Manuel Araoz il y a 8 ans
Parent
commit
60b48b0235
5 fichiers modifiés avec 40 ajouts et 48 suppressions
  1. 1 0
      .soliumignore
  2. 22 0
      .soliumrc.json
  3. 8 8
      contracts/Bounty.sol
  4. 9 19
      contracts/DayLimit.sol
  5. 0 21
      contracts/MultisigWallet.sol

+ 1 - 0
.soliumignore

@@ -0,0 +1 @@
+node_modules

+ 22 - 0
.soliumrc.json

@@ -0,0 +1,22 @@
+{
+  "custom-rules-filename": null,
+  "rules": {
+    "imports-on-top": true,
+    "variable-declarations": true,
+    "array-declarations": true,
+    "operator-whitespace": true,
+    "lbrace": true,
+    "mixedcase": false,
+    "camelcase": true,
+    "uppercase": true,
+    "no-with": true,
+    "no-empty-blocks": true,
+    "no-unused-vars": true,
+    "double-quotes": true,
+    "blank-lines": true,
+    "indentation": true,
+    "whitespace": true,
+    "deprecated-suicide": true,
+    "pragma-on-top": true
+  }
+}

+ 8 - 8
contracts/Bounty.sol

@@ -11,18 +11,19 @@ import './lifecycle/Killable.sol';
  * This bounty will pay out to a researcher if they break invariant logic of the contract.
  */
 contract Bounty is PullPayment, Killable {
-  Target target;
   bool public claimed;
   mapping(address => address) public researchers;
 
   event TargetCreated(address createdAddress);
 
   function() payable {
-    if (claimed) throw;
+    if (claimed) {
+      throw;
+    }
   }
 
   function createTarget() returns(Target) {
-    target = Target(deployContract());
+    Target target = Target(deployContract());
     researchers[target] = msg.sender;
     TargetCreated(target);
     return target;
@@ -30,13 +31,11 @@ contract Bounty is PullPayment, Killable {
 
   function deployContract() internal returns(address);
 
-  function checkInvariant() returns(bool){
-    return target.checkInvariant();
-  }
-
   function claim(Target target) {
     address researcher = researchers[target];
-    if (researcher == 0) throw;
+    if (researcher == 0) {
+      throw;
+    }
     // Check Target contract invariants
     if (target.checkInvariant()) {
       throw;
@@ -47,6 +46,7 @@ contract Bounty is PullPayment, Killable {
 
 }
 
+
 /*
  * Target
  * 

+ 9 - 19
contracts/DayLimit.sol

@@ -12,33 +12,18 @@ import './ownership/Shareable.sol';
  * uses is specified in the modifier.
  */
 contract DayLimit {
-  // FIELDS
 
   uint public dailyLimit;
   uint public spentToday;
   uint public lastDay;
 
 
-  // MODIFIERS
-
-  // simple modifier for daily limit.
-  modifier limitedDaily(uint _value) {
-    if (underLimit(_value))
-      _;
-  }
-
-
-  // CONSTRUCTOR
-  // stores initial daily limit and records the present day's index.
   function DayLimit(uint _limit) {
     dailyLimit = _limit;
     lastDay = today();
   }
 
-
-  // METHODS
-
-  // (re)sets the daily limit. doesn't alter the amount already spent today.
+  // sets the daily limit. doesn't alter the amount already spent today
   function _setDailyLimit(uint _newLimit) internal {
     dailyLimit = _newLimit;
   }
@@ -48,9 +33,6 @@ contract DayLimit {
     spentToday = 0;
   }
 
-
-  // INTERNAL METHODS
-
   // checks to see if there is at least `_value` left from the daily limit today. if there is, subtracts it and
   // returns true. otherwise just returns false.
   function underLimit(uint _value) internal returns (bool) {
@@ -72,4 +54,12 @@ contract DayLimit {
   function today() private constant returns (uint) {
     return now / 1 days;
   }
+
+
+  // simple modifier for daily limit.
+  modifier limitedDaily(uint _value) {
+    if (underLimit(_value)) {
+      _;
+    }
+  }
 }

+ 0 - 21
contracts/MultisigWallet.sol

@@ -13,27 +13,6 @@ import "./DayLimit.sol";
  * Wallet(w).from(anotherOwner).confirm(h);
  */
 contract MultisigWallet is Multisig, Shareable, DayLimit {
-  // TYPES
-
-  // Transaction structure to remember details of transaction lest it need be saved for a later call.
-  struct Transaction {
-    address to;
-    uint value;
-    bytes data;
-  }
-
-
-  // CONSTRUCTOR
-
-  // just pass on the owner array to the multiowned and
-  // the limit to daylimit
-  function MultisigWallet(address[] _owners, uint _required, uint _daylimit)
-    Shareable(_owners, _required)
-    DayLimit(_daylimit) { }
-
-
-  // METHODS
-
   // kills the contract sending everything to `_to`.
   function kill(address _to) onlymanyowners(sha3(msg.data)) external {
     suicide(_to);