Created
May 27, 2018 04:52
-
-
Save kejace/e4e6f665ca0d85dc30b6879e275fd84c to your computer and use it in GitHub Desktop.
This file contains 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
contract Owned { | |
address owner; | |
modifier onlyOwner () { | |
if(msg.sender == owner) { | |
_; | |
} else { | |
throw; | |
} | |
} | |
} | |
contract GreedyStorage is Owned { | |
function GreedyStorage(){ | |
owner = msg.sender; | |
} | |
uint public m; // automatically generate "getter" m() | |
event Overidden(address overrider); | |
function increase (uint n) onlyOwner returns (uint) { | |
m = m + n; | |
return m; | |
} | |
function override (uint n) payable { | |
require(msg.value > 100000); // this is the price | |
m = n; | |
Overidden(msg.sender); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment