Skip to content

Instantly share code, notes, and snippets.

@rezamt
Created June 28, 2018 12:54
Show Gist options
  • Save rezamt/b04b965a29be46bc58ddbabf9cebaf93 to your computer and use it in GitHub Desktop.
Save rezamt/b04b965a29be46bc58ddbabf9cebaf93 to your computer and use it in GitHub Desktop.
Incrementer Smart Contract
pragma solidity ^0.4.24;
contract Incrementer {
address creator;
uint iteration;
function Incrementer() public
{
creator = msg.sender;
iteration = 0;
}
function Increment() public
{
iteration = iteration + 1;
}
function getIteration() public view returns (uint)
{
return iteration;
}
function kill() public
{
if (msg.sender == creator)
selfdestruct(creator); // kills this contract and sends remaining funds back to creator
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment