Created
July 10, 2017 11:17
-
-
Save mcdee/63e01e5d6f96f6cf8ca5980452ba9fee to your computer and use it in GitHub Desktop.
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
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