Skip to content
This repository has been archived by the owner on Jan 16, 2023. It is now read-only.

Commit

Permalink
Upgrade Pragma Header in order to allow solidity latest solidity comp…
Browse files Browse the repository at this point in the history
…ilers (#261)

* Upgrade Pragma Header in order to allow solidity latest solidity compilers

* Upgrade minimum version of contracts to 0.7.0
Pragma header mandatory added
Some minor changes on SC according the upgrade of Solidity

* Fix Lint Problems

* Downgrade Truffle because latest version does not generate the test reports

* Downgrade the smartcontract compatibility to 0.6.0

* Restore accidentally deleted files

Co-authored-by: Alberto Hernandez <albherna@gmail.com>
  • Loading branch information
albert0-hernandez and alberto-hernandez authored Dec 21, 2021
1 parent 5f1c076 commit 45702dd
Show file tree
Hide file tree
Showing 22 changed files with 20,221 additions and 13,732 deletions.
2 changes: 1 addition & 1 deletion .mythx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ analyze:
mode: quick
async: false
create-group: true
solc: 0.5.9
solc: 0.7.0
remappings:
- "@openzeppelin=node_modules/@openzeppelin"
targets:
Expand Down
16 changes: 15 additions & 1 deletion contracts/AccountIngress.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,18 @@
pragma solidity 0.5.9;
/*
* Copyright ConsenSys AG.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*
* SPDX-License-Identifier: Apache-2.0
*/
pragma solidity >=0.6.0 <0.9.0;

import "./AccountRulesProxy.sol";
import "./Ingress.sol";
Expand Down
18 changes: 16 additions & 2 deletions contracts/AccountRules.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,18 @@
pragma solidity 0.5.9;
/*
* Copyright ConsenSys AG.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*
* SPDX-License-Identifier: Apache-2.0
*/
pragma solidity >=0.6.0 <0.9.0;

import "./AccountRulesProxy.sol";
import "./AccountRulesList.sol";
Expand Down Expand Up @@ -61,7 +75,7 @@ contract AccountRules is AccountRulesProxy, AccountRulesList {
uint256, // gasPrice
uint256, // gasLimit
bytes calldata // payload
) external view returns (bool) {
) external override view returns (bool) {
if (accountPermitted(sender)) {
return true;
}
Expand Down
16 changes: 15 additions & 1 deletion contracts/AccountRulesList.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,18 @@
pragma solidity 0.5.9;
/*
* Copyright ConsenSys AG.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*
* SPDX-License-Identifier: Apache-2.0
*/
pragma solidity >=0.6.0 <0.9.0;

import "./AccountStorage.sol";

Expand Down
16 changes: 15 additions & 1 deletion contracts/AccountRulesProxy.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,18 @@
pragma solidity 0.5.9;
/*
* Copyright ConsenSys AG.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*
* SPDX-License-Identifier: Apache-2.0
*/
pragma solidity >=0.6.0 <0.9.0;

interface AccountRulesProxy {
function transactionAllowed(
Expand Down
23 changes: 19 additions & 4 deletions contracts/AccountStorage.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,18 @@
pragma solidity 0.5.9;
/*
* Copyright ConsenSys AG.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*
* SPDX-License-Identifier: Apache-2.0
*/
pragma solidity >=0.6.0 <0.9.0;

import "./Admin.sol";
import "./AccountIngress.sol";
Expand Down Expand Up @@ -55,7 +69,8 @@ contract AccountStorage {

function add(address _account) public onlyLatestVersion returns (bool) {
if (indexOf[_account] == 0) {
indexOf[_account] = allowlist.push(_account);
allowlist.push(_account);
indexOf[_account] = allowlist.length;
return true;
}
return false;
Expand All @@ -72,7 +87,7 @@ contract AccountStorage {
}

//shrink array
allowlist.length -= 1; // mythx-disable-line SWC-101
allowlist.pop();
indexOf[_account] = 0;
return true;
}
Expand All @@ -86,4 +101,4 @@ contract AccountStorage {
function getAccounts() public view returns (address[] memory){
return allowlist;
}
}
}
18 changes: 16 additions & 2 deletions contracts/Admin.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,18 @@
pragma solidity 0.5.9;
/*
* Copyright ConsenSys AG.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*
* SPDX-License-Identifier: Apache-2.0
*/
pragma solidity >=0.6.0 <0.9.0;

import "./AdminProxy.sol";
import "./AdminList.sol";
Expand All @@ -19,7 +33,7 @@ contract Admin is AdminProxy, AdminList {
add(msg.sender);
}

function isAuthorized(address _address) public view returns (bool) {
function isAuthorized(address _address) public override view returns (bool) {
return exists(_address);
}

Expand Down
22 changes: 18 additions & 4 deletions contracts/AdminList.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
pragma solidity 0.5.9;

/*
* Copyright ConsenSys AG.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*
* SPDX-License-Identifier: Apache-2.0
*/
pragma solidity >=0.6.0 <0.9.0;


contract AdminList {
Expand Down Expand Up @@ -27,7 +40,8 @@ contract AdminList {

function add(address _account) internal returns (bool) {
if (indexOf[_account] == 0) {
indexOf[_account] = allowlist.push(_account);
allowlist.push(_account);
indexOf[_account] = allowlist.length;
return true;
}
return false;
Expand Down Expand Up @@ -64,7 +78,7 @@ contract AdminList {
}

//shrink array
allowlist.length -= 1; // mythx-disable-line SWC-101
allowlist.pop();
indexOf[_account] = 0;
return true;
}
Expand Down
16 changes: 15 additions & 1 deletion contracts/AdminProxy.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,18 @@
pragma solidity 0.5.9;
/*
* Copyright ConsenSys AG.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*
* SPDX-License-Identifier: Apache-2.0
*/
pragma solidity >=0.6.0 <0.9.0;

interface AdminProxy {
function isAuthorized(address source) external view returns (bool);
Expand Down
16 changes: 15 additions & 1 deletion contracts/ExposedAccountRulesList.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,18 @@
pragma solidity 0.5.9;
/*
* Copyright ConsenSys AG.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*
* SPDX-License-Identifier: Apache-2.0
*/
pragma solidity >=0.6.0 <0.9.0;

import "./AccountRulesList.sol";
import "./AccountStorage.sol";
Expand Down
16 changes: 15 additions & 1 deletion contracts/ExposedAdminList.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,18 @@
pragma solidity 0.5.9;
/*
* Copyright ConsenSys AG.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*
* SPDX-License-Identifier: Apache-2.0
*/
pragma solidity >=0.6.0 <0.9.0;

import "./AdminList.sol";

Expand Down
16 changes: 15 additions & 1 deletion contracts/ExposedNodeRulesList.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,18 @@
pragma solidity 0.5.9;
/*
* Copyright ConsenSys AG.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*
* SPDX-License-Identifier: Apache-2.0
*/
pragma solidity >=0.6.0 <0.9.0;

import "./NodeRulesList.sol";
import "./NodeStorage.sol";
Expand Down
19 changes: 17 additions & 2 deletions contracts/Ingress.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,18 @@
pragma solidity 0.5.9;
/*
* Copyright ConsenSys AG.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*
* SPDX-License-Identifier: Apache-2.0
*/
pragma solidity >=0.6.0 <0.9.0;

import "./AdminProxy.sol";

Expand Down Expand Up @@ -42,7 +56,8 @@ contract Ingress {
require(isAuthorized(msg.sender), "Not authorized to update contract registry.");

if (indexOf[name] == 0) {
indexOf[name] = contractKeys.push(name);
contractKeys.push(name);
indexOf[name] = contractKeys.length;
}

registry[name] = addr;
Expand Down
16 changes: 15 additions & 1 deletion contracts/Migrations.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,18 @@
pragma solidity 0.5.9;
/*
* Copyright ConsenSys AG.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*
* SPDX-License-Identifier: Apache-2.0
*/
pragma solidity >=0.6.0 <0.9.0;


contract Migrations {
Expand Down
16 changes: 15 additions & 1 deletion contracts/NodeIngress.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,18 @@
pragma solidity 0.5.9;
/*
* Copyright ConsenSys AG.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*
* SPDX-License-Identifier: Apache-2.0
*/
pragma solidity >=0.6.0 <0.9.0;

import "./NodeRulesProxy.sol";
import "./Ingress.sol";
Expand Down
18 changes: 16 additions & 2 deletions contracts/NodeRules.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,18 @@
pragma solidity 0.5.9;
/*
* Copyright ConsenSys AG.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*
* SPDX-License-Identifier: Apache-2.0
*/
pragma solidity >=0.6.0 <0.9.0;

import "./NodeRulesProxy.sol";
import "./NodeRulesList.sol";
Expand Down Expand Up @@ -74,7 +88,7 @@ contract NodeRules is NodeRulesProxy, NodeRulesList {
string calldata enodeId,
string calldata enodeHost,
uint16 enodePort
) external view returns (bool) {
) external override view returns (bool) {
return
enodePermitted (
enodeId,
Expand Down
Loading

0 comments on commit 45702dd

Please sign in to comment.