Bounty.sol 844 B

123456789101112131415161718192021222324252627282930313233343536
  1. import './PullPaymentCapable.sol';
  2. import './Token.sol';
  3. /*
  4. * Bounty
  5. * This bounty will pay out if you can cause a Token's balance
  6. * to be lower than its totalSupply, which would mean that it doesn't
  7. * have sufficient ether for everyone to withdraw.
  8. */
  9. contract Bounty is PullPaymentCapable {
  10. bool public claimed;
  11. mapping(address => address) public researchers;
  12. function() {
  13. if (claimed) throw;
  14. }
  15. function createTarget() returns(Token) {
  16. Token target = new Token(0);
  17. researchers[target] = msg.sender;
  18. return target;
  19. }
  20. function claim(Token target) {
  21. address researcher = researchers[target];
  22. if (researcher == 0) throw;
  23. // check Token contract invariants
  24. if (target.totalSupply() == target.balance) {
  25. throw;
  26. }
  27. asyncSend(researcher, this.balance);
  28. claimed = true;
  29. }
  30. }