Skip to content

Instantly share code, notes, and snippets.

@critesjosh
Last active May 12, 2018 13:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save critesjosh/4a2899de078cc45296ca3fb168079ca9 to your computer and use it in GitHub Desktop.
Save critesjosh/4a2899de078cc45296ca3fb168079ca9 to your computer and use it in GitHub Desktop.
A simple storage contract
// 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