Skip to content

Instantly share code, notes, and snippets.

@devonwesley
Created March 20, 2018 00:48
Show Gist options
  • Save devonwesley/3f459760d178a2824773b1d69bd5a2d9 to your computer and use it in GitHub Desktop.
Save devonwesley/3f459760d178a2824773b1d69bd5a2d9 to your computer and use it in GitHub Desktop.
Simplified WalletLibrary contract.
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