From bb966f51fb95f1f12b319e3647adbda0c9d43ace Mon Sep 17 00:00:00 2001 From: Martin Lundfall Date: Wed, 25 Mar 2020 12:41:06 +0100 Subject: [PATCH 1/2] solc 0.6.x version --- src/proxy.sol | 9 ++++----- src/proxy.t.sol | 16 ++++++++-------- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/src/proxy.sol b/src/proxy.sol index 4f475bc..8046878 100644 --- a/src/proxy.sol +++ b/src/proxy.sol @@ -15,7 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -pragma solidity >=0.5.0 <0.6.0; +pragma solidity >=0.6.0; import "ds-auth/auth.sol"; import "ds-note/note.sol"; @@ -32,9 +32,8 @@ contract DSProxy is DSAuth, DSNote { setCache(_cacheAddr); } - function() external payable { + fallback() external payable { } - // use the proxy to execute calldata _data on contract _code function execute(bytes memory _code, bytes memory _data) public @@ -61,8 +60,8 @@ contract DSProxy is DSAuth, DSNote { // call contract in current context assembly { - let succeeded := delegatecall(sub(gas, 5000), _target, add(_data, 0x20), mload(_data), 0, 0) - let size := returndatasize + let succeeded := delegatecall(sub(gas(), 5000), _target, add(_data, 0x20), mload(_data), 0, 0) + let size := returndatasize() response := mload(0x40) mstore(0x40, add(response, and(add(add(size, 0x20), 0x1f), not(0x1f)))) diff --git a/src/proxy.t.sol b/src/proxy.t.sol index ddf6cbf..370824b 100644 --- a/src/proxy.t.sol +++ b/src/proxy.t.sol @@ -15,7 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -pragma solidity >=0.5.0 <0.6.0; +pragma solidity >=0.6.0; import "ds-test/test.sol"; import "./proxy.sol"; @@ -49,7 +49,7 @@ contract TestContract { } contract TestFullAssemblyContract { - function() external { + fallback() payable external { assembly { let message := mload(0x40) mstore(message, "Fail test case") @@ -79,7 +79,7 @@ contract DSProxyTest is DSTest { ///test1 - check that DSProxyFactory creates a cache function test_DSProxyFactoryCheckCache() public { - assertTrue(address(factory.cache) != address(0)); + assertTrue(address(factory.cache()) != address(0)); } ///test 2 - build a proxy from DSProxyFactory and verify logging @@ -249,9 +249,9 @@ contract DSProxyTest is DSTest { bytes memory message; assembly { - succeeded := call(sub(gas, 5000), target, 0, add(data, 0x20), mload(data), 0, 0) + succeeded := call(sub(gas(), 5000), target, 0, add(data, 0x20), mload(data), 0, 0) - let size := returndatasize + let size := returndatasize() let response := mload(0x40) mstore(0x40, add(response, and(add(add(size, 0x20), 0x1f), not(0x1f)))) @@ -285,9 +285,9 @@ contract DSProxyTest is DSTest { bytes memory response; assembly { - succeeded := call(sub(gas, 5000), target, 0, add(data, 0x20), mload(data), 0, 0) + succeeded := call(sub(gas(), 5000), target, 0, add(data, 0x20), mload(data), 0, 0) - let size := returndatasize + let size := returndatasize() response := mload(0x40) mstore(0x40, add(response, and(add(add(size, 0x20), 0x1f), not(0x1f)))) @@ -319,6 +319,6 @@ contract DSProxyTest is DSTest { assertEq(address(this).balance, myBalance + 5); } - function() external payable { + fallback() external payable { } } From a8ae95bb548745e1b14ad38564e6047d6fac88ff Mon Sep 17 00:00:00 2001 From: Gonzalo Balabasquer Date: Wed, 9 Jun 2021 17:35:56 -0300 Subject: [PATCH 2/2] Solc0.6 (#30) * Upgrade dependencies (#29) * dapp upgrade ds-test * dapp upgrade ds-auth * dapp upgrade ds-note * Remove warnings --- lib/ds-auth | 2 +- lib/ds-note | 2 +- lib/ds-test | 2 +- src/proxy.sol | 2 +- src/proxy.t.sol | 6 +++--- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/ds-auth b/lib/ds-auth index 434bf46..bd00871 160000 --- a/lib/ds-auth +++ b/lib/ds-auth @@ -1 +1 @@ -Subproject commit 434bf463b255ecc2157b9c671139f6c617795ebf +Subproject commit bd00871dff1f9e6aea76b8c56a7bc28ab9c602b4 diff --git a/lib/ds-note b/lib/ds-note index c673c9d..4f2ad38 160000 --- a/lib/ds-note +++ b/lib/ds-note @@ -1 +1 @@ -Subproject commit c673c9d1a1464e973db4489221e22dc5b9b02319 +Subproject commit 4f2ad380e41e664802c4cb3a34f139ac08700bd8 diff --git a/lib/ds-test b/lib/ds-test index eb7148d..c0b770c 160000 --- a/lib/ds-test +++ b/lib/ds-test @@ -1 +1 @@ -Subproject commit eb7148d43c1ca6f9890361e2e2378364af2430ba +Subproject commit c0b770c04474db28d43ab4b2fdb891bd21887e9e diff --git a/src/proxy.sol b/src/proxy.sol index 8046878..12d9edd 100644 --- a/src/proxy.sol +++ b/src/proxy.sol @@ -32,7 +32,7 @@ contract DSProxy is DSAuth, DSNote { setCache(_cacheAddr); } - fallback() external payable { + receive() external payable { } // use the proxy to execute calldata _data on contract _code function execute(bytes memory _code, bytes memory _data) diff --git a/src/proxy.t.sol b/src/proxy.t.sol index 370824b..eccd11d 100644 --- a/src/proxy.t.sol +++ b/src/proxy.t.sol @@ -301,14 +301,14 @@ contract DSProxyTest is DSTest { ///test 12 - deposit ETH to Proxy function test_DSProxyDepositETH() public { assertEq(address(proxy).balance, 0); - (bool success,) = address(proxy).call.value(10)(""); + (bool success,) = address(proxy).call{value: 10}(""); assertTrue(success); assertEq(address(proxy).balance, 10); } ///test 13 - withdraw ETH from Proxy function test_DSProxyWithdrawETH() public { - (bool success,) = address(proxy).call.value(10)(""); + (bool success,) = address(proxy).call{value: 10}(""); assertTrue(success); assertEq(address(proxy).balance, 10); uint256 myBalance = address(this).balance; @@ -319,6 +319,6 @@ contract DSProxyTest is DSTest { assertEq(address(this).balance, myBalance + 5); } - fallback() external payable { + receive() external payable { } }