diff --git a/README.md b/README.md index 8f88e721d..daf458776 100644 --- a/README.md +++ b/README.md @@ -206,7 +206,7 @@ ___ To create a bounty for your contract, inherit from the base `Bounty` contract and provide an implementation for `deployContract()` returning the new contract address. ``` -import "./zeppelin/Bounty.sol"; +import {Bounty, Target} from "./zeppelin/Bounty.sol"; import "./YourContract.sol"; contract YourBounty is Bounty { @@ -221,9 +221,10 @@ Next, implement invariant logic into your smart contract At contracts/YourContract.sol ``` -contract YourContract { +import {Bounty, Target} from "./zeppelin/Bounty.sol"; +contract YourContract is Target { function checkInvariant() returns(bool) { - // Implement your logic to make sure that none of the state is broken. + // Implement your logic to make sure that none of the invariants are broken. } } ``` diff --git a/contracts/Bounty.sol b/contracts/Bounty.sol index 0f2ab6c2b..faaafad8c 100644 --- a/contracts/Bounty.sol +++ b/contracts/Bounty.sol @@ -1,17 +1,15 @@ pragma solidity ^0.4.4; + + import './PullPayment.sol'; import './Killable.sol'; + /* * Bounty - * This bounty will pay out to a researcher if he/she breaks invariant logic of - * the contract you bet reward against. + * + * This bounty will pay out to a researcher if they break invariant logic of the contract. */ - -contract Target { - function checkInvariant() returns(bool); -} - contract Bounty is PullPayment, Killable { Target target; bool public claimed; @@ -48,3 +46,9 @@ contract Bounty is PullPayment, Killable { } } + + +contract Target { + function checkInvariant() returns(bool); +} + diff --git a/contracts/test-helpers/InsecureTargetBounty.sol b/contracts/test-helpers/InsecureTargetBounty.sol index 5087cb6a6..83db61b92 100644 --- a/contracts/test-helpers/InsecureTargetBounty.sol +++ b/contracts/test-helpers/InsecureTargetBounty.sol @@ -1,8 +1,10 @@ pragma solidity ^0.4.4; -import "../Bounty.sol"; -contract InsecureTargetMock { +import {Bounty, Target} from "../Bounty.sol"; + + +contract InsecureTargetMock is Target { function checkInvariant() returns(bool){ return false; } diff --git a/contracts/test-helpers/SecureTargetBounty.sol b/contracts/test-helpers/SecureTargetBounty.sol index f83daf407..022edcc6f 100644 --- a/contracts/test-helpers/SecureTargetBounty.sol +++ b/contracts/test-helpers/SecureTargetBounty.sol @@ -1,9 +1,11 @@ pragma solidity ^0.4.4; -import "../Bounty.sol"; -contract SecureTargetMock { - function checkInvariant() returns(bool){ +import {Bounty, Target} from "../Bounty.sol"; + + +contract SecureTargetMock is Target { + function checkInvariant() returns(bool) { return true; } }