From 961a26ad4068abc2d9e688f477d1dd5d22adf84e Mon Sep 17 00:00:00 2001 From: Bill Gleim Date: Fri, 21 Oct 2016 15:42:43 -0700 Subject: [PATCH] Create SimpleTokenBounty --- contracts/bounties/SimpleTokenBounty.sol | 38 ++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 contracts/bounties/SimpleTokenBounty.sol diff --git a/contracts/bounties/SimpleTokenBounty.sol b/contracts/bounties/SimpleTokenBounty.sol new file mode 100644 index 000000000..3f8bf8d4a --- /dev/null +++ b/contracts/bounties/SimpleTokenBounty.sol @@ -0,0 +1,38 @@ +pragma solidity ^0.4.0; +import './PullPayment.sol'; +import './token/SimpleToken.sol'; + +/* + * Bounty + * This bounty will pay out if you can cause a SimpleToken's balance + * to be lower than its totalSupply, which would mean that it doesn't + * have sufficient ether for everyone to withdraw. + */ +contract Bounty is PullPayment { + + bool public claimed; + mapping(address => address) public researchers; + + function() { + if (claimed) throw; + } + + function createTarget() returns(SimpleToken) { + SimpleToken target = new SimpleToken(); + researchers[target] = msg.sender; + return target; + } + + function claim(SimpleToken target) { + address researcher = researchers[target]; + if (researcher == 0) throw; + // Check SimpleToken contract invariants + // Customize this to the specifics of your contract + if (target.totalSupply() == target.balance) { + throw; + } + asyncSend(researcher, this.balance); + claimed = true; + } + +}