Swap SimpleToken with Target

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

@ -1,6 +1,5 @@
pragma solidity ^0.4.0;
import '../PullPayment.sol';
import '../token/SimpleToken.sol';
/*
* Bounty
@ -8,8 +7,15 @@ import '../token/SimpleToken.sol';
* to be lower than its totalSupply, which would mean that it doesn't
* 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;
mapping(address => address) public researchers;
@ -17,22 +23,22 @@ contract SimpleTokenBounty is PullPayment {
if (claimed) throw;
}
function createTarget() returns(SimpleToken) {
SimpleToken target = new SimpleToken();
function createTarget() returns(Target) {
target = new Target();
researchers[target] = msg.sender;
return target;
}
function checkInvarient() returns(bool){
return true;
return target.checkInvarient();
}
function claim(SimpleToken target) {
function claim(Target target) {
address researcher = researchers[target];
if (researcher == 0) throw;
// Check SimpleToken contract invariants
// Check Target contract invariants
// Customize this to the specifics of your contract
if (target.totalSupply() == target.balance) {
if (!target.checkInvarient()) {
throw;
}
asyncSend(researcher, this.balance);

Loading…
Cancel
Save