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

Commit 45702dd

Browse files
Upgrade Pragma Header in order to allow solidity latest solidity compilers (#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>
1 parent 5f1c076 commit 45702dd

22 files changed

+20221
-13732
lines changed

.mythx.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ analyze:
66
mode: quick
77
async: false
88
create-group: true
9-
solc: 0.5.9
9+
solc: 0.7.0
1010
remappings:
1111
- "@openzeppelin=node_modules/@openzeppelin"
1212
targets:

contracts/AccountIngress.sol

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,18 @@
1-
pragma solidity 0.5.9;
1+
/*
2+
* Copyright ConsenSys AG.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
5+
* the License. You may obtain a copy of the License at
6+
*
7+
* http://www.apache.org/licenses/LICENSE-2.0
8+
*
9+
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
10+
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
11+
* specific language governing permissions and limitations under the License.
12+
*
13+
* SPDX-License-Identifier: Apache-2.0
14+
*/
15+
pragma solidity >=0.6.0 <0.9.0;
216

317
import "./AccountRulesProxy.sol";
418
import "./Ingress.sol";

contracts/AccountRules.sol

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,18 @@
1-
pragma solidity 0.5.9;
1+
/*
2+
* Copyright ConsenSys AG.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
5+
* the License. You may obtain a copy of the License at
6+
*
7+
* http://www.apache.org/licenses/LICENSE-2.0
8+
*
9+
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
10+
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
11+
* specific language governing permissions and limitations under the License.
12+
*
13+
* SPDX-License-Identifier: Apache-2.0
14+
*/
15+
pragma solidity >=0.6.0 <0.9.0;
216

317
import "./AccountRulesProxy.sol";
418
import "./AccountRulesList.sol";
@@ -61,7 +75,7 @@ contract AccountRules is AccountRulesProxy, AccountRulesList {
6175
uint256, // gasPrice
6276
uint256, // gasLimit
6377
bytes calldata // payload
64-
) external view returns (bool) {
78+
) external override view returns (bool) {
6579
if (accountPermitted(sender)) {
6680
return true;
6781
}

contracts/AccountRulesList.sol

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,18 @@
1-
pragma solidity 0.5.9;
1+
/*
2+
* Copyright ConsenSys AG.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
5+
* the License. You may obtain a copy of the License at
6+
*
7+
* http://www.apache.org/licenses/LICENSE-2.0
8+
*
9+
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
10+
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
11+
* specific language governing permissions and limitations under the License.
12+
*
13+
* SPDX-License-Identifier: Apache-2.0
14+
*/
15+
pragma solidity >=0.6.0 <0.9.0;
216

317
import "./AccountStorage.sol";
418

contracts/AccountRulesProxy.sol

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,18 @@
1-
pragma solidity 0.5.9;
1+
/*
2+
* Copyright ConsenSys AG.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
5+
* the License. You may obtain a copy of the License at
6+
*
7+
* http://www.apache.org/licenses/LICENSE-2.0
8+
*
9+
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
10+
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
11+
* specific language governing permissions and limitations under the License.
12+
*
13+
* SPDX-License-Identifier: Apache-2.0
14+
*/
15+
pragma solidity >=0.6.0 <0.9.0;
216

317
interface AccountRulesProxy {
418
function transactionAllowed(

contracts/AccountStorage.sol

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,18 @@
1-
pragma solidity 0.5.9;
1+
/*
2+
* Copyright ConsenSys AG.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
5+
* the License. You may obtain a copy of the License at
6+
*
7+
* http://www.apache.org/licenses/LICENSE-2.0
8+
*
9+
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
10+
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
11+
* specific language governing permissions and limitations under the License.
12+
*
13+
* SPDX-License-Identifier: Apache-2.0
14+
*/
15+
pragma solidity >=0.6.0 <0.9.0;
216

317
import "./Admin.sol";
418
import "./AccountIngress.sol";
@@ -55,7 +69,8 @@ contract AccountStorage {
5569

5670
function add(address _account) public onlyLatestVersion returns (bool) {
5771
if (indexOf[_account] == 0) {
58-
indexOf[_account] = allowlist.push(_account);
72+
allowlist.push(_account);
73+
indexOf[_account] = allowlist.length;
5974
return true;
6075
}
6176
return false;
@@ -72,7 +87,7 @@ contract AccountStorage {
7287
}
7388

7489
//shrink array
75-
allowlist.length -= 1; // mythx-disable-line SWC-101
90+
allowlist.pop();
7691
indexOf[_account] = 0;
7792
return true;
7893
}
@@ -86,4 +101,4 @@ contract AccountStorage {
86101
function getAccounts() public view returns (address[] memory){
87102
return allowlist;
88103
}
89-
}
104+
}

contracts/Admin.sol

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,18 @@
1-
pragma solidity 0.5.9;
1+
/*
2+
* Copyright ConsenSys AG.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
5+
* the License. You may obtain a copy of the License at
6+
*
7+
* http://www.apache.org/licenses/LICENSE-2.0
8+
*
9+
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
10+
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
11+
* specific language governing permissions and limitations under the License.
12+
*
13+
* SPDX-License-Identifier: Apache-2.0
14+
*/
15+
pragma solidity >=0.6.0 <0.9.0;
216

317
import "./AdminProxy.sol";
418
import "./AdminList.sol";
@@ -19,7 +33,7 @@ contract Admin is AdminProxy, AdminList {
1933
add(msg.sender);
2034
}
2135

22-
function isAuthorized(address _address) public view returns (bool) {
36+
function isAuthorized(address _address) public override view returns (bool) {
2337
return exists(_address);
2438
}
2539

contracts/AdminList.sol

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,18 @@
1-
pragma solidity 0.5.9;
2-
1+
/*
2+
* Copyright ConsenSys AG.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
5+
* the License. You may obtain a copy of the License at
6+
*
7+
* http://www.apache.org/licenses/LICENSE-2.0
8+
*
9+
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
10+
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
11+
* specific language governing permissions and limitations under the License.
12+
*
13+
* SPDX-License-Identifier: Apache-2.0
14+
*/
15+
pragma solidity >=0.6.0 <0.9.0;
316

417

518
contract AdminList {
@@ -27,7 +40,8 @@ contract AdminList {
2740

2841
function add(address _account) internal returns (bool) {
2942
if (indexOf[_account] == 0) {
30-
indexOf[_account] = allowlist.push(_account);
43+
allowlist.push(_account);
44+
indexOf[_account] = allowlist.length;
3145
return true;
3246
}
3347
return false;
@@ -64,7 +78,7 @@ contract AdminList {
6478
}
6579

6680
//shrink array
67-
allowlist.length -= 1; // mythx-disable-line SWC-101
81+
allowlist.pop();
6882
indexOf[_account] = 0;
6983
return true;
7084
}

contracts/AdminProxy.sol

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,18 @@
1-
pragma solidity 0.5.9;
1+
/*
2+
* Copyright ConsenSys AG.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
5+
* the License. You may obtain a copy of the License at
6+
*
7+
* http://www.apache.org/licenses/LICENSE-2.0
8+
*
9+
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
10+
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
11+
* specific language governing permissions and limitations under the License.
12+
*
13+
* SPDX-License-Identifier: Apache-2.0
14+
*/
15+
pragma solidity >=0.6.0 <0.9.0;
216

317
interface AdminProxy {
418
function isAuthorized(address source) external view returns (bool);

contracts/ExposedAccountRulesList.sol

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,18 @@
1-
pragma solidity 0.5.9;
1+
/*
2+
* Copyright ConsenSys AG.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
5+
* the License. You may obtain a copy of the License at
6+
*
7+
* http://www.apache.org/licenses/LICENSE-2.0
8+
*
9+
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
10+
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
11+
* specific language governing permissions and limitations under the License.
12+
*
13+
* SPDX-License-Identifier: Apache-2.0
14+
*/
15+
pragma solidity >=0.6.0 <0.9.0;
216

317
import "./AccountRulesList.sol";
418
import "./AccountStorage.sol";

0 commit comments

Comments
 (0)