|
|
@ -6,9 +6,8 @@ import './lifecycle/Destructible.sol'; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* |
|
|
|
/* |
|
|
|
* Bounty |
|
|
|
* @title Bounty |
|
|
|
* |
|
|
|
* @dev This bounty will pay out to a researcher if they break invariant logic of the contract. |
|
|
|
* This bounty will pay out to a researcher if they break invariant logic of the contract. |
|
|
|
|
|
|
|
*/ |
|
|
|
*/ |
|
|
|
contract Bounty is PullPayment, Destructible { |
|
|
|
contract Bounty is PullPayment, Destructible { |
|
|
|
bool public claimed; |
|
|
|
bool public claimed; |
|
|
@ -16,12 +15,19 @@ contract Bounty is PullPayment, Destructible { |
|
|
|
|
|
|
|
|
|
|
|
event TargetCreated(address createdAddress); |
|
|
|
event TargetCreated(address createdAddress); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* |
|
|
|
|
|
|
|
* @dev Function that allows the contract to recieve funds, if it hasn't been claimed. |
|
|
|
|
|
|
|
*/ |
|
|
|
function() payable { |
|
|
|
function() payable { |
|
|
|
if (claimed) { |
|
|
|
if (claimed) { |
|
|
|
throw; |
|
|
|
throw; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* |
|
|
|
|
|
|
|
* @dev Create and deploy the target contract(extension of Target contract), and sets the msg.sender as a researcher |
|
|
|
|
|
|
|
* @return A target contract |
|
|
|
|
|
|
|
*/ |
|
|
|
function createTarget() returns(Target) { |
|
|
|
function createTarget() returns(Target) { |
|
|
|
Target target = Target(deployContract()); |
|
|
|
Target target = Target(deployContract()); |
|
|
|
researchers[target] = msg.sender; |
|
|
|
researchers[target] = msg.sender; |
|
|
@ -29,8 +35,16 @@ contract Bounty is PullPayment, Destructible { |
|
|
|
return target; |
|
|
|
return target; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* |
|
|
|
|
|
|
|
* @dev Internal function to deploy the target contract. |
|
|
|
|
|
|
|
* @return A target contract address |
|
|
|
|
|
|
|
*/ |
|
|
|
function deployContract() internal returns(address); |
|
|
|
function deployContract() internal returns(address); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* |
|
|
|
|
|
|
|
* @dev Sends the contract funds to the researcher that proved the contract is broken. |
|
|
|
|
|
|
|
* @param Target contract |
|
|
|
|
|
|
|
*/ |
|
|
|
function claim(Target target) { |
|
|
|
function claim(Target target) { |
|
|
|
address researcher = researchers[target]; |
|
|
|
address researcher = researchers[target]; |
|
|
|
if (researcher == 0) { |
|
|
|
if (researcher == 0) { |
|
|
@ -48,11 +62,15 @@ contract Bounty is PullPayment, Destructible { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* |
|
|
|
/* |
|
|
|
* Target |
|
|
|
* @title Target |
|
|
|
* |
|
|
|
* |
|
|
|
* Your main contract should inherit from this class and implement the checkInvariant method. This is a function that should check everything your contract assumes to be true all the time. If this function returns false, it means your contract was broken in some way and is in an inconsistent state. This is what security researchers will try to acomplish when trying to get the bounty. |
|
|
|
* @dev Your main contract should inherit from this class and implement the checkInvariant method. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
contract Target { |
|
|
|
contract Target { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* |
|
|
|
|
|
|
|
* @dev Funtion tha should check everything your contract assumes to be true all the time. If this function returns false, it means your contract was broken in some way and is in an inconsistent state. This is what security researchers will try to acomplish when trying to get the bounty. |
|
|
|
|
|
|
|
* @return A boolean that indicates if the contract is broken or not. |
|
|
|
|
|
|
|
*/ |
|
|
|
function checkInvariant() returns(bool); |
|
|
|
function checkInvariant() returns(bool); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|