Last active
May 12, 2018 13:53
-
-
Save critesjosh/4a2899de078cc45296ca3fb168079ca9 to your computer and use it in GitHub Desktop.
A simple storage contract
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
// deployed to the Rinkeby network @ 0x4103e048515a5ebdf34b32ed7692254a16c6d184 | |
pragma solidity ^0.4.0; | |
contract SimpleStorage { | |
uint256 storedData; | |
uint256 public timesSet; | |
address public lastCaller; | |
event Updated(uint newValue); | |
function set(uint x) public { | |
storedData = x; | |
lastCaller = msg.sender; | |
timesSet += 1; | |
emit Updated(x); | |
} | |
function get() public view returns (uint) { | |
return storedData; | |
} | |
} | |
// ABI | |
[ | |
{ | |
"constant": true, | |
"inputs": [], | |
"name": "lastCaller", | |
"outputs": [ | |
{ | |
"name": "", | |
"type": "address" | |
} | |
], | |
"payable": false, | |
"stateMutability": "view", | |
"type": "function" | |
}, | |
{ | |
"constant": false, | |
"inputs": [ | |
{ | |
"name": "x", | |
"type": "uint256" | |
} | |
], | |
"name": "set", | |
"outputs": [], | |
"payable": false, | |
"stateMutability": "nonpayable", | |
"type": "function" | |
}, | |
{ | |
"constant": true, | |
"inputs": [], | |
"name": "get", | |
"outputs": [ | |
{ | |
"name": "", | |
"type": "uint256" | |
} | |
], | |
"payable": false, | |
"stateMutability": "view", | |
"type": "function" | |
}, | |
{ | |
"constant": true, | |
"inputs": [], | |
"name": "timesSet", | |
"outputs": [ | |
{ | |
"name": "", | |
"type": "uint256" | |
} | |
], | |
"payable": false, | |
"stateMutability": "view", | |
"type": "function" | |
}, | |
{ | |
"anonymous": false, | |
"inputs": [ | |
{ | |
"indexed": false, | |
"name": "newValue", | |
"type": "uint256" | |
} | |
], | |
"name": "Updated", | |
"type": "event" | |
} | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment