Created
March 8, 2018 19:26
-
-
Save daithi-coombes/1f911162bb6626d61473648d4d809018 to your computer and use it in GitHub Desktop.
This file contains hidden or 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.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