Skip to content

Instantly share code, notes, and snippets.

@boxfox619
Last active June 15, 2018 15:17
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 boxfox619/d89e27054c9c10e1ebf955ed7eb9128c to your computer and use it in GitHub Desktop.
Save boxfox619/d89e27054c9c10e1ebf955ed7eb9128c to your computer and use it in GitHub Desktop.
Solidity Example
contract Sample
{
uint data;
address owner;
event logData(uint256 dataToLog);
modifier onlyOwner() {
if (msg.sender != owner) throw;
_;
}
function Sample(uint256 initData, address initOwner){
data = initData;
owner = initOwner;
}
function getData() returns (uint256 returnedData){
return data;
}
function setData(uint256 newData) onlyOwner{
logData(newData);
data = newData;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment