Skip to content

Commit

Permalink
upgrade contracts to solc-7 and bump version in package.json
Browse files Browse the repository at this point in the history
  • Loading branch information
bh2smith committed Dec 7, 2020
1 parent 1aafd8c commit bc195b6
Show file tree
Hide file tree
Showing 12 changed files with 44 additions and 42 deletions.
2 changes: 1 addition & 1 deletion contracts/EtherToken.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: LGPL-3.0-only
pragma solidity ^0.6.0;
pragma solidity ^0.7.0;
import "./GnosisStandardToken.sol";

/// @title Token contract - Token exchanging Ether 1:1
Expand Down
2 changes: 1 addition & 1 deletion contracts/GnosisStandardToken.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: LGPL-3.0-only
pragma solidity ^0.6.0;
pragma solidity ^0.7.0;
import "./Token.sol";
import "./Math.sol";
import "./Proxy.sol";
Expand Down
2 changes: 1 addition & 1 deletion contracts/HumanFriendlyToken.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

/// Implements ERC 20 Token standard including extra accessors for human readability.
/// See: https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md
pragma solidity ^0.6.0;
pragma solidity ^0.7.0;
import "./Token.sol";

/// @title Abstract human-friendly token contract - Functions to be implemented by token contracts
Expand Down
8 changes: 4 additions & 4 deletions contracts/Math.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: LGPL-3.0-only
pragma solidity ^0.6.0;
pragma solidity ^0.7.0;

/// @title Math library - Allows calculation of logarithmic and exponential functions
/// @author Alan Lu - <[email protected]>
Expand Down Expand Up @@ -87,9 +87,9 @@ library GnosisMath {
zpow = zpow * z / ONE;
result += 0x9c7 * zpow / ONE;
if (shift >= 0) {
if (result >> (256 - shift) > 0) return (2 ** 256 - 1);
return result << shift;
} else return result >> (-shift);
if (result >> (uint(256) - uint(shift)) > 0) return (2 ** 256 - 1);
return result << uint(shift);
} else return result >> uint(-shift);
}

/// @dev Returns natural logarithm value of given x
Expand Down
4 changes: 2 additions & 2 deletions contracts/Migrations.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: LGPL-3.0-only
pragma solidity ^0.6.0;
pragma solidity ^0.7.0;

contract Migrations {
address public owner;
Expand All @@ -9,7 +9,7 @@ contract Migrations {
if (msg.sender == owner) _;
}

constructor() public {
constructor() {
owner = msg.sender;
}

Expand Down
4 changes: 2 additions & 2 deletions contracts/Proxy.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: LGPL-3.0-only
pragma solidity ^0.6.0;
pragma solidity ^0.7.0;

/// @title Proxied - indicates that a contract will be proxied. Also defines storage requirements for Proxy.
/// @author Alan Lu - <[email protected]>
Expand All @@ -12,7 +12,7 @@ contract Proxied {
contract Proxy is Proxied {
/// @dev Constructor function sets address of master copy contract.
/// @param _masterCopy Master copy address.
constructor(address _masterCopy) public {
constructor(address _masterCopy) {
require(_masterCopy != address(0), "The master copy is required");
masterCopy = _masterCopy;
}
Expand Down
15 changes: 8 additions & 7 deletions contracts/StorageAccessible.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: LGPL-3.0-only
pragma solidity ^0.6.0;
pragma solidity ^0.7.0;

/// @title StorageAccessible - generic base contract that allows callers to access all internal storage.
contract StorageAccessible {
Expand Down Expand Up @@ -37,13 +37,13 @@ contract StorageAccessible {
function simulateDelegatecall(
address targetContract,
bytes memory calldataPayload
) public returns (bytes memory) {
) public returns (bytes memory response) {
bytes memory innerCall = abi.encodeWithSelector(
SIMULATE_DELEGATECALL_INTERNAL_SELECTOR,
targetContract,
calldataPayload
);
(, bytes memory response) = address(this).call(innerCall);
(, response) = address(this).call(innerCall);
bool innerSuccess = response[response.length - 1] == 0x01;
setLength(response, response.length - 1);
if (innerSuccess) {
Expand All @@ -61,13 +61,13 @@ contract StorageAccessible {
function simulateStaticDelegatecall(
address targetContract,
bytes memory calldataPayload
) public view returns (bytes memory) {
) public view returns (bytes memory response) {
bytes memory innerCall = abi.encodeWithSelector(
SIMULATE_DELEGATECALL_INTERNAL_SELECTOR,
targetContract,
calldataPayload
);
(, bytes memory response) = address(this).staticcall(innerCall);
(, response) = address(this).staticcall(innerCall);
bool innerSuccess = response[response.length - 1] == 0x01;
setLength(response, response.length - 1);
if (innerSuccess) {
Expand All @@ -87,8 +87,9 @@ contract StorageAccessible {
function simulateDelegatecallInternal(
address targetContract,
bytes memory calldataPayload
) public returns (bytes memory) {
(bool success, bytes memory response) = targetContract.delegatecall(
) public returns (bytes memory response) {
bool success;
(success, response) = targetContract.delegatecall(
calldataPayload
);
revertWith(abi.encodePacked(response, success));
Expand Down
2 changes: 1 addition & 1 deletion contracts/Token.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: LGPL-3.0-only
/// Implements ERC 20 Token standard: https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md
pragma solidity ^0.6.0;
pragma solidity ^0.7.0;

/// @title Abstract token contract - Functions to be implemented by token contracts
abstract contract Token {
Expand Down
4 changes: 2 additions & 2 deletions contracts/test/StorageAccessibleWrapper.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: LGPL-3.0-only
pragma solidity ^0.6.0;
pragma solidity ^0.7.0;
import "../StorageAccessible.sol";

contract StorageAccessibleWrapper is StorageAccessible {
Expand All @@ -22,7 +22,7 @@ contract StorageAccessibleWrapper is StorageAccessible {
mapping(uint256 => uint256) qux;
FooBar foobar;

constructor() public {}
constructor() {}

function setFoo(uint256 foo_) public {
foo = foo_;
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@gnosis.pm/util-contracts",
"version": "3.0.0",
"version": "3.0.0-solc-7",
"description": "Utility contracts for Gnosis",
"main": "index.js",
"scripts": {
Expand Down Expand Up @@ -46,7 +46,7 @@
"eslint-plugin-standard": "^4.0.0",
"prettier": "^1.15.3",
"prettier-plugin-solidity-refactor": "^1.0.0-alpha.12",
"solc": "0.6.12",
"solc": "0.7.5",
"truffle": "^5.1.50",
"truffle-assertions": "^0.9.2"
},
Expand Down
2 changes: 1 addition & 1 deletion truffle.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ if (!privateKey && !mnemonic) {

// Solc
const solcUseDocker = process.env.SOLC_USE_DOCKER === 'true' || false
const solcVersion = '0.6.12'
const solcVersion = '0.7.5'

// Gas price
const gasPriceGWei = process.env.GAS_PRICE_GWEI || DEFAULT_GAS_PRICE_GWEI
Expand Down
37 changes: 19 additions & 18 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -628,30 +628,25 @@ array-includes@^3.1.1:
get-intrinsic "^1.0.1"
is-string "^1.0.5"

array-uniq@^1.0.3:
array-uniq@^1.0.3, array.prototype.map@^1.0.1:
version "1.0.3"
resolved "https://registry.yarnpkg.com/array-uniq/-/array-uniq-1.0.3.tgz#af6ac877a25cc7f74e058894753858dfdb24fdb6"
integrity sha1-r2rId6Jcx/dOBYiUdThY39sk/bY=

array.prototype.flat@^1.2.3:
version "1.2.4"
resolved "https://registry.yarnpkg.com/array.prototype.flat/-/array.prototype.flat-1.2.4.tgz#6ef638b43312bd401b4c6199fdec7e2dc9e9a123"
integrity sha512-4470Xi3GAPAjZqFcljX2xzckv1qeKPizoNkiS0+O4IoPR2ZNpcjE0pkhdihlDouK+x6QOast26B4Q/O9DJnwSg==
resolved "https://registry.yarnpkg.com/array.prototype.map/-/array.prototype.map-1.0.3.tgz#1609623618d3d84134a37d4a220030c2bd18420b"
integrity sha512-nNcb30v0wfDyIe26Yif3PcV1JXQp4zEeEfupG7L4SRjnD6HLbO5b2a7eVSba53bOx4YCHYMBHt+Fp4vYstneRA==
dependencies:
call-bind "^1.0.0"
define-properties "^1.1.3"
es-abstract "^1.18.0-next.1"
es-array-method-boxes-properly "^1.0.0"
is-string "^1.0.5"

array.prototype.map@^1.0.1:
version "1.0.3"
resolved "https://registry.yarnpkg.com/array.prototype.map/-/array.prototype.map-1.0.3.tgz#1609623618d3d84134a37d4a220030c2bd18420b"
integrity sha512-nNcb30v0wfDyIe26Yif3PcV1JXQp4zEeEfupG7L4SRjnD6HLbO5b2a7eVSba53bOx4YCHYMBHt+Fp4vYstneRA==
array.prototype.flat@^1.2.3:
version "1.2.4"
resolved "https://registry.yarnpkg.com/array.prototype.flat/-/array.prototype.flat-1.2.4.tgz#6ef638b43312bd401b4c6199fdec7e2dc9e9a123"
integrity sha512-4470Xi3GAPAjZqFcljX2xzckv1qeKPizoNkiS0+O4IoPR2ZNpcjE0pkhdihlDouK+x6QOast26B4Q/O9DJnwSg==
dependencies:
call-bind "^1.0.0"
define-properties "^1.1.3"
es-abstract "^1.18.0-next.1"
es-array-method-boxes-properly "^1.0.0"
is-string "^1.0.5"

asn1.js@^5.2.0:
version "5.4.1"
Expand Down Expand Up @@ -2407,6 +2402,11 @@ flatted@^2.0.0:
resolved "https://registry.yarnpkg.com/flatted/-/flatted-2.0.2.tgz#4575b21e2bcee7434aa9be662f4b7b5f9c2b5138"
integrity sha512-r5wGx7YeOwNWNlCA0wQ86zKyDLMQr+/RB8xy74M4hTphfmjlijTSSXGuH8rnvKZnfT9i+75zmd8jcKdMR4O6jA==

follow-redirects@^1.12.1:
version "1.13.0"
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.13.0.tgz#b42e8d93a2a7eea5ed88633676d6597bc8e384db"
integrity sha512-aq6gF1BEKje4a9i9+5jimNFIpq4Q1WiwBToeRK5NvZBd/TRsmW8BsJfOEGkr76TbOyPVD3OVDN910EcUNtRYEA==

forever-agent@~0.6.1:
version "0.6.1"
resolved "https://registry.yarnpkg.com/forever-agent/-/forever-agent-0.6.1.tgz#fbc71f0c41adeb37f96c577ad1ed42d8fdacca91"
Expand Down Expand Up @@ -4533,13 +4533,14 @@ slice-ansi@^2.1.0:
astral-regex "^1.0.0"
is-fullwidth-code-point "^2.0.0"

solc@0.6.12:
version "0.6.12"
resolved "https://registry.yarnpkg.com/solc/-/solc-0.6.12.tgz#48ac854e0c729361b22a7483645077f58cba080e"
integrity sha512-Lm0Ql2G9Qc7yPP2Ba+WNmzw2jwsrd3u4PobHYlSOxaut3TtUbj9+5ZrT6f4DUpNPEoBaFUOEg9Op9C0mk7ge9g==
solc@0.7.5:
version "0.7.5"
resolved "https://registry.yarnpkg.com/solc/-/solc-0.7.5.tgz#8dad9536075a113adcbcb2ace80d486b389f273c"
integrity sha512-RdcYGj2qjg+maWYRZPW65QvOOYbwexDT9xaOEQJtRI0TIYfzTJmslJ4f9S56VNjJsIR1zHdUIiPyuhF7wGIylw==
dependencies:
command-exists "^1.2.8"
commander "3.0.2"
follow-redirects "^1.12.1"
fs-extra "^0.30.0"
js-sha3 "0.8.0"
memorystream "^0.3.1"
Expand Down

0 comments on commit bc195b6

Please sign in to comment.