Created
December 11, 2018 15:08
-
-
Save shingonu/c737b52e3242dc56e971afd3073cba36 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity ^0.4.24; | |
contract D { | |
function callSetN(address _e, uint _n) public { | |
_e.call.value(10).gas(6712353)(bytes4(keccak256("setN(uint256)")), _n); | |
// E's storage is set, D is not modified | |
} | |
function callcodeSetN(address _e, uint _n) public { | |
_e.callcode.value(10).gas(6712353)(bytes4(keccak256("setN(uint256)")), _n); | |
// D's storage is set, E is not modified | |
} | |
function delegatecallSetN(address _e, uint _n) public { | |
_e.delegatecall.gas(6712353)(bytes4(keccak256("setN(uint256)")), _n); | |
// D's storage is set, E is not modified | |
} | |
} | |
contract E { | |
uint public n; | |
address public sender; | |
uint256 public amount; | |
function setN(uint _n) { | |
n = _n; | |
sender = msg.sender; | |
amount = msg.value; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment