Swap SimpleToken with Target

pull/35/head
Makoto Inoue 8 years ago
parent b5469310a1
commit 8df9925d1a
  1. 24
      contracts/bounties/SimpleTokenBounty.sol

@ -1,15 +1,21 @@
pragma solidity ^0.4.0; pragma solidity ^0.4.0;
import '../PullPayment.sol'; import '../PullPayment.sol';
import '../token/SimpleToken.sol';
/* /*
* Bounty * Bounty
* This bounty will pay out if you can cause a SimpleToken's balance * This bounty will pay out if you can cause a SimpleToken's balance
* to be lower than its totalSupply, which would mean that it doesn't * to be lower than its totalSupply, which would mean that it doesn't
* have sufficient ether for everyone to withdraw. * have sufficient ether for everyone to withdraw.
*/ */
contract SimpleTokenBounty is PullPayment {
contract Target {
function checkInvarient() returns(bool){
return true;
}
}
contract Bounty is PullPayment {
Target target;
bool public claimed; bool public claimed;
mapping(address => address) public researchers; mapping(address => address) public researchers;
@ -17,22 +23,22 @@ contract SimpleTokenBounty is PullPayment {
if (claimed) throw; if (claimed) throw;
} }
function createTarget() returns(SimpleToken) { function createTarget() returns(Target) {
SimpleToken target = new SimpleToken(); target = new Target();
researchers[target] = msg.sender; researchers[target] = msg.sender;
return target; return target;
} }
function checkInvarient() returns(bool){ function checkInvarient() returns(bool){
return true; return target.checkInvarient();
} }
function claim(SimpleToken target) { function claim(Target target) {
address researcher = researchers[target]; address researcher = researchers[target];
if (researcher == 0) throw; if (researcher == 0) throw;
// Check SimpleToken contract invariants // Check Target contract invariants
// Customize this to the specifics of your contract // Customize this to the specifics of your contract
if (target.totalSupply() == target.balance) { if (!target.checkInvarient()) {
throw; throw;
} }
asyncSend(researcher, this.balance); asyncSend(researcher, this.balance);

Loading…
Cancel
Save