Skip to content

Instantly share code, notes, and snippets.

@mesirendon
Created August 10, 2019 15:40
Show Gist options
  • Save mesirendon/f8be999465dfb0674df6d8e16a18e4e0 to your computer and use it in GitHub Desktop.
Save mesirendon/f8be999465dfb0674df6d8e16a18e4e0 to your computer and use it in GitHub Desktop.
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