Skip to content

Instantly share code, notes, and snippets.

@mcdee
Created July 10, 2017 11:17
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 mcdee/63e01e5d6f96f6cf8ca5980452ba9fee to your computer and use it in GitHub Desktop.
Save mcdee/63e01e5d6f96f6cf8ca5980452ba9fee to your computer and use it in GitHub Desktop.
contract BadSplitter {
uint256 funds;
address sender;
address recipient;
// Deposit some funds in to the contract
function deposit(address other) payable {
funds = msg.value;
sender = msg.sender;
recipient = other;
}
// Split an amount of funds between the sender and the recipient
function split() {
// Can only be called by the recipient
require(msg.sender == recipient);
// Split the funds
sender.transfer(funds / 2);
recipient.transfer(funds / 2);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment