Last active
March 14, 2018 17:51
-
-
Save devonwesley/c3c68fbb7e620107ca8b78ae4b2aba64 to your computer and use it in GitHub Desktop.
A mock WalletLibrary that has flaws DO NOT use for you real contract flow.
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 owner; | |
function initWallet(address _owner) { | |
owner = _owner; | |
} | |
function changeOwner(address _newOwner) external { | |
if (msg.sender == owner) { | |
owner = _newOwner; | |
} | |
} | |
function () payable {} | |
function withdraw(uint amount) external returns (bool success) { | |
if (msg.sender == owner) { | |
return owner.send(amount); | |
} else { | |
return false; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment