SimpleTokenBounty.sol 1016 B

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