Created
June 22, 2016 05:33
-
-
Save PeterBorah/50bc2d8006674921f7016833420be154 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
import "BrokenToken.sol"; | |
contract Bounty { | |
// This bounty will pay out if you can cause BrokenToken's balance | |
// to be lower than its totalSupply, which would mean that it doesn't | |
// have sufficient ether for everyone to withdraw. | |
uint public totalBounty; | |
bool public claimed; | |
mapping(address => address) public owners; | |
event TargetCreation(address createdAddress); | |
function contribute() { | |
totalBounty += msg.value; | |
} | |
function createTarget() returns(BrokenToken) { | |
BrokenToken target = new BrokenToken(); | |
TargetCreation(target); | |
owners[address(target)] = msg.sender; | |
return target; | |
} | |
function claimBounty(BrokenToken target) { | |
if (owners[target] != 0 && target.totalSupply() > target.balance) { | |
totalBounty = 0; | |
claimed = true; | |
if(!owners[target].send(totalBounty)) throw; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment