Browse Source

fix: solium errors - function-order only

Matt Condon 7 years ago
parent
commit
bd2f1773cd

+ 6 - 6
contracts/Bounty.sol

@@ -34,12 +34,6 @@ contract Bounty is PullPayment, Destructible {
     return target;
   }
 
-  /**
-   * @dev Internal function to deploy the target contract.
-   * @return A target contract address
-   */
-  function deployContract() internal returns(address);
-
   /**
    * @dev Sends the contract funds to the researcher that proved the contract is broken.
    * @param target contract
@@ -53,6 +47,12 @@ contract Bounty is PullPayment, Destructible {
     claimed = true;
   }
 
+  /**
+   * @dev Internal function to deploy the target contract.
+   * @return A target contract address
+   */
+  function deployContract() internal returns(address);
+
 }
 
 

+ 7 - 7
contracts/crowdsale/CappedCrowdsale.sol

@@ -18,13 +18,6 @@ contract CappedCrowdsale is Crowdsale {
     cap = _cap;
   }
 
-  // overriding Crowdsale#validPurchase to add extra cap logic
-  // @return true if investors can buy at the moment
-  function validPurchase() internal view returns (bool) {
-    bool withinCap = weiRaised.add(msg.value) <= cap;
-    return super.validPurchase() && withinCap;
-  }
-
   // overriding Crowdsale#hasEnded to add cap logic
   // @return true if crowdsale event has ended
   function hasEnded() public view returns (bool) {
@@ -32,4 +25,11 @@ contract CappedCrowdsale is Crowdsale {
     return super.hasEnded() || capReached;
   }
 
+  // overriding Crowdsale#validPurchase to add extra cap logic
+  // @return true if investors can buy at the moment
+  function validPurchase() internal view returns (bool) {
+    bool withinCap = weiRaised.add(msg.value) <= cap;
+    return super.validPurchase() && withinCap;
+  }
+
 }

+ 16 - 17
contracts/crowdsale/Crowdsale.sol

@@ -54,22 +54,11 @@ contract Crowdsale {
     wallet = _wallet;
   }
 
-  // creates the token to be sold.
-  // override this method to have crowdsale of a specific mintable token.
-  function createTokenContract() internal returns (MintableToken) {
-    return new MintableToken();
-  }
-
   // fallback function can be used to buy tokens
   function () external payable {
     buyTokens(msg.sender);
   }
 
-  // Override this method to have a way to add business logic to your crowdsale when buying
-  function getTokenAmount(uint256 weiAmount) internal view returns(uint256) {
-    return weiAmount.mul(rate);
-  }
-
   // low level token purchase function
   function buyTokens(address beneficiary) public payable {
     require(beneficiary != address(0));
@@ -89,6 +78,22 @@ contract Crowdsale {
     forwardFunds();
   }
 
+  // @return true if crowdsale event has ended
+  function hasEnded() public view returns (bool) {
+    return now > endTime;
+  }
+
+  // creates the token to be sold.
+  // override this method to have crowdsale of a specific mintable token.
+  function createTokenContract() internal returns (MintableToken) {
+    return new MintableToken();
+  }
+
+  // Override this method to have a way to add business logic to your crowdsale when buying
+  function getTokenAmount(uint256 weiAmount) internal view returns(uint256) {
+    return weiAmount.mul(rate);
+  }
+
   // send ether to the fund collection wallet
   // override to create custom fund forwarding mechanisms
   function forwardFunds() internal {
@@ -102,10 +107,4 @@ contract Crowdsale {
     return withinPeriod && nonZeroPurchase;
   }
 
-  // @return true if crowdsale event has ended
-  function hasEnded() public view returns (bool) {
-    return now > endTime;
-  }
-
-
 }

+ 9 - 9
contracts/crowdsale/RefundableCrowdsale.sol

@@ -27,13 +27,6 @@ contract RefundableCrowdsale is FinalizableCrowdsale {
     goal = _goal;
   }
 
-  // We're overriding the fund forwarding from Crowdsale.
-  // In addition to sending the funds, we want to call
-  // the RefundVault deposit function
-  function forwardFunds() internal {
-    vault.deposit.value(msg.value)(msg.sender);
-  }
-
   // if crowdsale is unsuccessful, investors can claim refunds here
   function claimRefund() public {
     require(isFinalized);
@@ -42,6 +35,10 @@ contract RefundableCrowdsale is FinalizableCrowdsale {
     vault.refund(msg.sender);
   }
 
+  function goalReached() public view returns (bool) {
+    return weiRaised >= goal;
+  }
+
   // vault finalization task, called when owner calls finalize()
   function finalization() internal {
     if (goalReached()) {
@@ -53,8 +50,11 @@ contract RefundableCrowdsale is FinalizableCrowdsale {
     super.finalization();
   }
 
-  function goalReached() public view returns (bool) {
-    return weiRaised >= goal;
+  // We're overriding the fund forwarding from Crowdsale.
+  // In addition to sending the funds, we want to call
+  // the RefundVault deposit function
+  function forwardFunds() internal {
+    vault.deposit.value(msg.value)(msg.sender);
   }
 
 }

+ 4 - 4
contracts/mocks/ReentrancyMock.sol

@@ -12,8 +12,8 @@ contract ReentrancyMock is ReentrancyGuard {
     counter = 0;
   }
 
-  function count() private {
-    counter += 1;
+  function callback() external nonReentrant {
+    count();
   }
 
   function countLocalRecursive(uint256 n) public nonReentrant {
@@ -38,8 +38,8 @@ contract ReentrancyMock is ReentrancyGuard {
     attacker.callSender(func);
   }
 
-  function callback() external nonReentrant {
-    count();
+  function count() private {
+    counter += 1;
   }
 
 }

+ 24 - 24
contracts/ownership/rbac/RBAC.sol

@@ -36,30 +36,6 @@ contract RBAC {
     addRole(msg.sender, ROLE_ADMIN);
   }
 
-  /**
-   * @dev add a role to an address
-   * @param addr address
-   * @param roleName the name of the role
-   */
-  function addRole(address addr, string roleName)
-    internal
-  {
-    roles[roleName].add(addr);
-    RoleAdded(addr, roleName);
-  }
-
-  /**
-   * @dev remove a role from an address
-   * @param addr address
-   * @param roleName the name of the role
-   */
-  function removeRole(address addr, string roleName)
-    internal
-  {
-    roles[roleName].remove(addr);
-    RoleRemoved(addr, roleName);
-  }
-
   /**
    * @dev reverts if addr does not have role
    * @param addr address
@@ -111,6 +87,30 @@ contract RBAC {
     removeRole(addr, roleName);
   }
 
+  /**
+   * @dev add a role to an address
+   * @param addr address
+   * @param roleName the name of the role
+   */
+  function addRole(address addr, string roleName)
+    internal
+  {
+    roles[roleName].add(addr);
+    RoleAdded(addr, roleName);
+  }
+
+  /**
+   * @dev remove a role from an address
+   * @param addr address
+   * @param roleName the name of the role
+   */
+  function removeRole(address addr, string roleName)
+    internal
+  {
+    roles[roleName].remove(addr);
+    RoleRemoved(addr, roleName);
+  }
+
   /**
    * @dev modifier to scope access to a single role (uses msg.sender as addr)
    * @param roleName the name of the role

+ 10 - 10
contracts/payment/PullPayment.sol

@@ -15,16 +15,6 @@ contract PullPayment {
   mapping(address => uint256) public payments;
   uint256 public totalPayments;
 
-  /**
-  * @dev Called by the payer to store the sent amount as credit to be pulled.
-  * @param dest The destination address of the funds.
-  * @param amount The amount to transfer.
-  */
-  function asyncSend(address dest, uint256 amount) internal {
-    payments[dest] = payments[dest].add(amount);
-    totalPayments = totalPayments.add(amount);
-  }
-
   /**
   * @dev withdraw accumulated balance, called by payee.
   */
@@ -40,4 +30,14 @@ contract PullPayment {
 
     assert(payee.send(payment));
   }
+
+  /**
+  * @dev Called by the payer to store the sent amount as credit to be pulled.
+  * @param dest The destination address of the funds.
+  * @param amount The amount to transfer.
+  */
+  function asyncSend(address dest, uint256 amount) internal {
+    payments[dest] = payments[dest].add(amount);
+    totalPayments = totalPayments.add(amount);
+  }
 }

+ 14 - 14
contracts/payment/SplitPayment.sol

@@ -30,19 +30,9 @@ contract SplitPayment {
   }
 
   /**
-   * @dev Add a new payee to the contract.
-   * @param _payee The address of the payee to add.
-   * @param _shares The number of shares owned by the payee.
+   * @dev payable fallback
    */
-  function addPayee(address _payee, uint256 _shares) internal {
-    require(_payee != address(0));
-    require(_shares > 0);
-    require(shares[_payee] == 0);
-
-    payees.push(_payee);
-    shares[_payee] = _shares;
-    totalShares = totalShares.add(_shares);
-  }
+  function () public payable {}
 
   /**
    * @dev Claim your share of the balance.
@@ -65,7 +55,17 @@ contract SplitPayment {
   }
 
   /**
-   * @dev payable fallback
+   * @dev Add a new payee to the contract.
+   * @param _payee The address of the payee to add.
+   * @param _shares The number of shares owned by the payee.
    */
-  function () public payable {}
+  function addPayee(address _payee, uint256 _shares) internal {
+    require(_payee != address(0));
+    require(_shares > 0);
+    require(shares[_payee] == 0);
+
+    payees.push(_payee);
+    shares[_payee] = _shares;
+    totalShares = totalShares.add(_shares);
+  }
 }