Skip to content

Instantly share code, notes, and snippets.

@DaveAppleton
Last active March 4, 2018 23:30
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 DaveAppleton/a6d5df89db55d5492aaa00c9bf4bd542 to your computer and use it in GitHub Desktop.
Save DaveAppleton/a6d5df89db55d5492aaa00c9bf4bd542 to your computer and use it in GitHub Desktop.
Contracts for Gophercon.in : 0x1f3aa7b716c9537262dd7450404e28ae7923e715 on Rinkeby Network / 0x7F3A19eDC1fFBd3fC2b4fc978b0d8f8C19316186
[
{
"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"
}
]
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