Browse Source

make Bounty inheritance explicit

Manuel Araoz 9 years ago
parent
commit
726840b8de

+ 4 - 3
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.
   }
 }
 ```

+ 11 - 7
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);
+}
+

+ 4 - 2
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;
   }

+ 5 - 3
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;
   }
 }