Created
March 20, 2018 00:48
-
-
Save devonwesley/3f459760d178a2824773b1d69bd5a2d9 to your computer and use it in GitHub Desktop.
Simplified WalletLibrary contract.
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.6; | |
contract WalletLibrary { | |
address public owner; | |
modifier onlyOwner() { | |
require(msg.sender == owner); | |
_; | |
} | |
function initWallet(address _owner) { | |
owner = _owner; | |
} | |
function changeOwner(address _newOwner) external { | |
if (msg.sender == owner) { | |
owner = _newOwner; | |
} | |
} | |
function withdraw(uint amount) external returns (bool success) { | |
if (msg.sender == owner) { | |
return owner.send(amount); | |
} else { | |
return false; | |
} | |
} | |
function kill() onlyOwner() { | |
selfdestruct(owner); | |
} | |
function () payable {} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment