Created
August 8, 2018 15:03
-
-
Save yhuag/188fabfbb698dc35be7cbe0e2313161c to your computer and use it in GitHub Desktop.
This file contains hidden or 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 Math { | |
uint public ans; | |
function add(uint a,uint b) public { | |
ans = a + b; | |
} | |
} | |
contract Delegate { | |
uint public ans; | |
address public target; | |
function setTarget(address _tar) public { | |
target = _tar; | |
} | |
function callAdd(uint c,uint d) public { | |
target.delegatecall(bytes4(keccak256("add(uint256,uint256)")), c,d); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment