Bounty.sol 1022 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. pragma solidity ^0.4.0;
  2. import './PullPayment.sol';
  3. import './token/SimpleToken.sol';
  4. /*
  5. * Bounty
  6. * This bounty will pay out if you can cause a SimpleToken'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 PullPayment {
  11. bool public claimed;
  12. mapping(address => address) public researchers;
  13. function() {
  14. if (claimed) throw;
  15. }
  16. function createTarget() returns(SimpleToken) {
  17. SimpleToken target = new SimpleToken();
  18. researchers[target] = msg.sender;
  19. return target;
  20. }
  21. function checkInvarient() returns(bool){
  22. return true;
  23. }
  24. function claim(SimpleToken target) {
  25. address researcher = researchers[target];
  26. if (researcher == 0) throw;
  27. // Check SimpleToken contract invariants
  28. // Customize this to the specifics of your contract
  29. if (target.totalSupply() == target.balance) {
  30. throw;
  31. }
  32. asyncSend(researcher, this.balance);
  33. claimed = true;
  34. }
  35. }