Bounty.sol 868 B

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