SimpleTokenBounty.sol 971 B

1234567891011121314151617181920212223242526272829303132333435363738
  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 SimpleTokenBounty 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 claim(SimpleToken target) {
  22. address researcher = researchers[target];
  23. if (researcher == 0) throw;
  24. // Check SimpleToken contract invariants
  25. // Customize this to the specifics of your contract
  26. if (target.totalSupply() == target.balance) {
  27. throw;
  28. }
  29. asyncSend(researcher, this.balance);
  30. claimed = true;
  31. }
  32. }