Consolidate TokenBounties into Bounty

This commit is contained in:
Makoto Inoue
2016-10-27 22:35:08 +01:00
parent caca41f855
commit 99f288bfb5
4 changed files with 15 additions and 53 deletions

View File

@ -1,11 +1,11 @@
pragma solidity ^0.4.0;
import '../PullPayment.sol';
import '../Killable.sol';
import './PullPayment.sol';
import './Killable.sol';
/*
* Bounty
* 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
* have sufficient ether for everyone to withdraw.
* This bounty will pay out to a researcher if he/she breaks invariant logic of
* the contract you bet reward against.
*/
contract Factory {
@ -16,7 +16,7 @@ contract Target {
function checkInvariant() returns(bool);
}
contract SimpleTokenBounty is PullPayment, Killable {
contract Bounty is PullPayment, Killable {
Target target;
bool public claimed;
address public factoryAddress;
@ -28,7 +28,7 @@ contract SimpleTokenBounty is PullPayment, Killable {
if (claimed) throw;
}
function SimpleTokenBounty(address _factoryAddress){
function Bounty(address _factoryAddress){
factoryAddress = _factoryAddress;
}

View File

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