Created
March 1, 2017 15:48
-
-
Save ikumasa/2984efb664b07ec0f271dd0bf676b12e 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
| contract simplestorage { | |
| uint public storedData; | |
| event Set(address indexed sender, uint data); | |
| function simplestorage(uint initVal) { | |
| storedData = initVal; | |
| } | |
| function set(uint x) { | |
| storedData += x; | |
| Set(msg.sender, storedData); | |
| } | |
| function set2(uint x) payable { | |
| storedData += x; | |
| } | |
| function get() constant returns (uint) { | |
| return storedData; | |
| } | |
| } | |
| contract simplestorage2 { | |
| uint public storedData; | |
| function set(uint x) { | |
| storedData += x; | |
| } | |
| function set2(uint x) payable { | |
| storedData += x; | |
| } | |
| function set3(address simpleAddr, uint x) { | |
| simplestorage(simpleAddr).set(x); | |
| } | |
| function set4(address simpleAddr, uint x) { | |
| simplestorage(simpleAddr).call.value(1)(bytes4(sha3("set2(uint256)")), x); | |
| } | |
| function get() constant returns (uint) { | |
| return storedData; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment