Skip to content

Instantly share code, notes, and snippets.

@daithi-coombes
Created March 8, 2018 19:26
Show Gist options
  • Save daithi-coombes/1f911162bb6626d61473648d4d809018 to your computer and use it in GitHub Desktop.
Save daithi-coombes/1f911162bb6626d61473648d4d809018 to your computer and use it in GitHub Desktop.
pragma solidity ^0.4.21;
contract SampleModifiers{
address public owner;
uint public foobar = 22;
modifier isOwner(){
require(owner==msg.sender);
_;
}
// constructor
function SampleModifiers() public {
owner = msg.sender; // msg.sender = address of sender.
}
function changeOwner(address newOwner) public {
owner = newOwner;
}
function getCurrentCosts() public isOwner view returns(string){
return "this is taken from webApi... I swear";
}
function getPure() public pure returns(uint){
uint foo = 9;
uint bar = 10;
uint baz = foo + bar;
return baz;
}
function getView() public view returns(uint){
uint baz = foobar + 22;
return baz;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment