Skip to content

Instantly share code, notes, and snippets.

@devonwesley
Last active March 14, 2018 17:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save devonwesley/c3c68fbb7e620107ca8b78ae4b2aba64 to your computer and use it in GitHub Desktop.
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.
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