Bounty.sol 873 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  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) {
  14. throw;
  15. }
  16. }
  17. function createTarget() returns(Token) {
  18. Token target = new Token(0);
  19. researchers[target] = msg.sender;
  20. return target;
  21. }
  22. function claim(Token target) {
  23. address researcher = researchers[target];
  24. if (researcher == 0) {
  25. throw;
  26. }
  27. // check Token contract invariants
  28. if (target.totalSupply() == target.balance) {
  29. throw;
  30. }
  31. asyncSend(researcher, this.balance);
  32. claimed = true;
  33. }
  34. }