Created
August 10, 2019 15:40
-
-
Save mesirendon/f8be999465dfb0674df6d8e16a18e4e0 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
pragma solidity >=0.4.22 <0.6.0; | |
contract Marranito { | |
address owner; | |
constructor() public { | |
owner = msg.sender; | |
} | |
modifier onlyOwner() { | |
require(msg.sender == owner, "This is not the account I was expecting"); | |
_; | |
} | |
function transfer(address _to) public onlyOwner { | |
owner = _to; | |
} | |
function withdraw() private onlyOwner { | |
msg.sender.transfer(address(this).balance); | |
} | |
function() external payable { | |
if(msg.value == 0) { | |
withdraw(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment