Bounty.sol 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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. return true;
  12. }
  13. }
  14. contract Bounty is PullPayment {
  15. Target target;
  16. bool public claimed;
  17. mapping(address => address) public researchers;
  18. function() {
  19. if (claimed) throw;
  20. }
  21. function createTarget() returns(Target) {
  22. target = new Target();
  23. researchers[target] = msg.sender;
  24. return target;
  25. }
  26. function checkInvarient() returns(bool){
  27. return target.checkInvarient();
  28. }
  29. function claim(Target target) {
  30. address researcher = researchers[target];
  31. if (researcher == 0) throw;
  32. // Check Target contract invariants
  33. // Customize this to the specifics of your contract
  34. if (!target.checkInvarient()) {
  35. throw;
  36. }
  37. asyncSend(researcher, this.balance);
  38. claimed = true;
  39. }
  40. }