Skip to content

Instantly share code, notes, and snippets.

@PeterBorah
Created June 22, 2016 05:33
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 PeterBorah/50bc2d8006674921f7016833420be154 to your computer and use it in GitHub Desktop.
Save PeterBorah/50bc2d8006674921f7016833420be154 to your computer and use it in GitHub Desktop.
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