Last active
March 4, 2018 23:30
-
-
Save DaveAppleton/a6d5df89db55d5492aaa00c9bf4bd542 to your computer and use it in GitHub Desktop.
Contracts for Gophercon.in : 0x1f3aa7b716c9537262dd7450404e28ae7923e715 on Rinkeby Network / 0x7F3A19eDC1fFBd3fC2b4fc978b0d8f8C19316186
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
[ | |
{ | |
"constant": true, | |
"inputs": [], | |
"name": "numTargets", | |
"outputs": [ | |
{ | |
"name": "", | |
"type": "uint256" | |
} | |
], | |
"payable": false, | |
"stateMutability": "view", | |
"type": "function" | |
}, | |
{ | |
"constant": true, | |
"inputs": [ | |
{ | |
"name": "", | |
"type": "address" | |
} | |
], | |
"name": "hits", | |
"outputs": [ | |
{ | |
"name": "", | |
"type": "uint256" | |
} | |
], | |
"payable": false, | |
"stateMutability": "view", | |
"type": "function" | |
}, | |
{ | |
"constant": true, | |
"inputs": [ | |
{ | |
"name": "", | |
"type": "uint256" | |
} | |
], | |
"name": "hitList", | |
"outputs": [ | |
{ | |
"name": "", | |
"type": "address" | |
} | |
], | |
"payable": false, | |
"stateMutability": "view", | |
"type": "function" | |
}, | |
{ | |
"anonymous": false, | |
"inputs": [ | |
{ | |
"indexed": false, | |
"name": "who", | |
"type": "address" | |
}, | |
{ | |
"indexed": false, | |
"name": "count", | |
"type": "uint256" | |
} | |
], | |
"name": "Thump", | |
"type": "event" | |
}, | |
{ | |
"constant": false, | |
"inputs": [], | |
"name": "hitMe", | |
"outputs": [], | |
"payable": false, | |
"stateMutability": "nonpayable", | |
"type": "function" | |
} | |
] |
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.18; | |
contract GopherCon{ | |
mapping(address => uint) public hits; | |
address[] public hitList; | |
function hitMe() public { | |
if (hits[msg.sender] == 0) { | |
hitList.push(msg.sender); | |
} | |
hits[msg.sender]++; | |
Thump(msg.sender,hits[msg.sender]); | |
} | |
function numTargets() public view returns (uint) { | |
return hitList.length; | |
} | |
event Thump(address who, uint count); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment