Swap SimpleToken with Target
This commit is contained in:
@ -1,6 +1,5 @@
|
|||||||
pragma solidity ^0.4.0;
|
pragma solidity ^0.4.0;
|
||||||
import '../PullPayment.sol';
|
import '../PullPayment.sol';
|
||||||
import '../token/SimpleToken.sol';
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Bounty
|
* Bounty
|
||||||
@ -8,8 +7,15 @@ import '../token/SimpleToken.sol';
|
|||||||
* 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);
|
||||||
|
|||||||
Reference in New Issue
Block a user