make Bounty inheritance explicit
This commit is contained in:
@ -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.
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
@ -1,8 +1,10 @@
|
||||
pragma solidity ^0.4.4;
|
||||
|
||||
import "../Bounty.sol";
|
||||
|
||||
contract SecureTargetMock {
|
||||
import {Bounty, Target} from "../Bounty.sol";
|
||||
|
||||
|
||||
contract SecureTargetMock is Target {
|
||||
function checkInvariant() returns(bool) {
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user