Skip to content

solc 0.6.x version #26

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/ds-auth
Submodule ds-auth updated 3 files
+1 −1 lib/ds-test
+2 −1 src/auth.sol
+1 −7 src/auth.t.sol
2 changes: 1 addition & 1 deletion lib/ds-note
Submodule ds-note updated 1 files
+1 −1 lib/ds-test
2 changes: 1 addition & 1 deletion lib/ds-test
Submodule ds-test updated 3 files
+11 −1 Makefile
+223 −0 aux/demo.sol
+337 −47 src/test.sol
9 changes: 4 additions & 5 deletions src/proxy.sol
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.

pragma solidity >=0.5.0 <0.6.0;
pragma solidity >=0.6.0;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you should set a higher bound, since the contract doesn't compile with solidity 0.8 for example (due to the cast in line 113)


import "ds-auth/auth.sol";
import "ds-note/note.sol";
Expand All @@ -32,9 +32,8 @@ contract DSProxy is DSAuth, DSNote {
setCache(_cacheAddr);
}

function() external payable {
receive() external payable {
}

// use the proxy to execute calldata _data on contract _code
function execute(bytes memory _code, bytes memory _data)
public
Expand All @@ -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))))
Expand Down
20 changes: 10 additions & 10 deletions src/proxy.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.

pragma solidity >=0.5.0 <0.6.0;
pragma solidity >=0.6.0;

import "ds-test/test.sol";
import "./proxy.sol";
Expand Down Expand Up @@ -49,7 +49,7 @@ contract TestContract {
}

contract TestFullAssemblyContract {
function() external {
fallback() payable external {
assembly {
let message := mload(0x40)
mstore(message, "Fail test case")
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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))))
Expand Down Expand Up @@ -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))))
Expand All @@ -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;
Expand All @@ -319,6 +319,6 @@ contract DSProxyTest is DSTest {
assertEq(address(this).balance, myBalance + 5);
}

function() external payable {
receive() external payable {
}
}