Forráskód Böngészése

Merge remote-tracking branch 'upstream/master' into add-smart-token

AugustoL 7 éve
szülő
commit
d060d29912
100 módosított fájl, 1491 hozzáadás és 506 törlés
  1. 1 0
      .gitattributes
  2. 0 1
      .github/ISSUE_TEMPLATE.md
  3. 1 1
      .github/PULL_REQUEST_TEMPLATE.md
  4. 8 18
      .soliumrc.json
  5. 1 0
      .travis.yml
  6. 8 8
      contracts/Bounty.sol
  7. 1 0
      contracts/DayLimit.sol
  8. 4 1
      contracts/MerkleProof.sol
  9. 1 0
      contracts/ReentrancyGuard.sol
  10. 10 9
      contracts/crowdsale/CappedCrowdsale.sol
  11. 20 16
      contracts/crowdsale/Crowdsale.sol
  12. 4 3
      contracts/crowdsale/FinalizableCrowdsale.sol
  13. 3 2
      contracts/crowdsale/RefundVault.sol
  14. 12 12
      contracts/crowdsale/RefundableCrowdsale.sol
  15. 5 3
      contracts/examples/SampleCrowdsale.sol
  16. 3 3
      contracts/examples/SimpleToken.sol
  17. 1 1
      contracts/lifecycle/Migrations.sol
  18. 2 2
      contracts/lifecycle/TokenDestructible.sol
  19. 1 1
      contracts/math/Math.sol
  20. 13 0
      contracts/math/SafeMath.sol
  21. 1 1
      contracts/mocks/BasicTokenMock.sol
  22. 2 1
      contracts/mocks/BurnableTokenMock.sol
  23. 1 1
      contracts/mocks/CappedCrowdsaleImpl.sol
  24. 2 0
      contracts/mocks/DayLimitMock.sol
  25. 3 2
      contracts/mocks/DetailedERC20Mock.sol
  26. 1 1
      contracts/mocks/ECRecoveryMock.sol
  27. 3 2
      contracts/mocks/ERC23TokenMock.sol
  28. 1 1
      contracts/mocks/FinalizableCrowdsaleImpl.sol
  29. 2 1
      contracts/mocks/ForceEther.sol
  30. 1 0
      contracts/mocks/HasNoEtherTest.sol
  31. 2 2
      contracts/mocks/InsecureTargetBounty.sol
  32. 1 1
      contracts/mocks/LimitBalanceMock.sol
  33. 1 1
      contracts/mocks/PausableMock.sol
  34. 2 1
      contracts/mocks/PausableTokenMock.sol
  35. 1 1
      contracts/mocks/PullPaymentMock.sol
  36. 52 52
      contracts/mocks/RBACMock.sol
  37. 1 0
      contracts/mocks/ReentrancyAttack.sol
  38. 9 8
      contracts/mocks/ReentrancyMock.sol
  39. 1 1
      contracts/mocks/RefundableCrowdsaleImpl.sol
  40. 5 2
      contracts/mocks/SafeERC20Helper.sol
  41. 1 1
      contracts/mocks/SafeMathMock.sol
  42. 1 1
      contracts/mocks/SecureTargetBounty.sol
  43. 1 1
      contracts/mocks/StandardTokenMock.sol
  44. 1 0
      contracts/ownership/CanReclaimToken.sol
  45. 1 1
      contracts/ownership/Claimable.sol
  46. 11 10
      contracts/ownership/Contactable.sol
  47. 1 3
      contracts/ownership/DelayedClaimable.sol
  48. 1 0
      contracts/ownership/HasNoContracts.sol
  49. 1 0
      contracts/ownership/HasNoEther.sol
  50. 1 0
      contracts/ownership/HasNoTokens.sol
  51. 1 0
      contracts/ownership/NoOwner.sol
  52. 0 2
      contracts/ownership/Ownable.sol
  53. 139 140
      contracts/ownership/rbac/RBAC.sol
  54. 40 40
      contracts/ownership/rbac/Roles.sol
  55. 11 11
      contracts/payment/PullPayment.sol
  56. 16 15
      contracts/payment/SplitPayment.sol
  57. 2 2
      contracts/token/BasicToken.sol
  58. 16 15
      contracts/token/BurnableToken.sol
  59. 2 1
      contracts/token/CappedToken.sol
  60. 2 1
      contracts/token/DetailedERC20.sol
  61. 1 1
      contracts/token/ERC20.sol
  62. 2 2
      contracts/token/MintableToken.sol
  63. 3 3
      contracts/token/PausableToken.sol
  64. 3 2
      contracts/token/SafeERC20.sol
  65. 2 2
      contracts/token/StandardToken.sol
  66. 2 2
      contracts/token/TokenTimelock.sol
  67. 5 4
      contracts/token/TokenVesting.sol
  68. 926 15
      package-lock.json
  69. 5 0
      package.json
  70. 2 2
      test/Bounty.test.js
  71. 25 0
      test/Math.test.js
  72. 5 5
      test/crowdsale/CappedCrowdsale.test.js
  73. 5 5
      test/crowdsale/Crowdsale.test.js
  74. 4 4
      test/crowdsale/FinalizableCrowdsale.test.js
  75. 2 2
      test/crowdsale/RefundVault.test.js
  76. 5 5
      test/crowdsale/RefundableCrowdsale.test.js
  77. 5 5
      test/examples/SampleCrowdsale.test.js
  78. 1 1
      test/lifecycle/Destructible.test.js
  79. 1 1
      test/lifecycle/Pausable.test.js
  80. 1 1
      test/lifecycle/TokenDestructible.test.js
  81. 2 2
      test/math/SafeMath.test.js
  82. 17 0
      test/mocks/MathMock.sol
  83. 1 1
      test/ownership/CanReclaimToken.test.js
  84. 1 1
      test/ownership/Claimable.test.js
  85. 0 0
      test/ownership/Contactable.test.js
  86. 3 14
      test/ownership/DelayedClaimble.test.js
  87. 1 1
      test/ownership/HasNoContracts.test.js
  88. 2 2
      test/ownership/HasNoEther.test.js
  89. 1 1
      test/ownership/HasNoTokens.test.js
  90. 1 1
      test/ownership/Ownable.test.js
  91. 9 9
      test/ownership/rbac/RBAC.test.js
  92. 0 0
      test/payment/PullPayment.test.js
  93. 1 1
      test/payment/SplitPayment.test.js
  94. 1 1
      test/token/BasicToken.test.js
  95. 1 1
      test/token/BurnableToken.test.js
  96. 2 2
      test/token/CappedToken.test.js
  97. 0 0
      test/token/DetailedERC20.test.js
  98. 1 1
      test/token/MintableToken.test.js
  99. 1 1
      test/token/PausableToken.test.js
  100. 1 1
      test/token/SafeERC20.test.js

+ 1 - 0
.gitattributes

@@ -0,0 +1 @@
+*.sol linguist-language=Solidity

+ 0 - 1
.github/ISSUE_TEMPLATE.md

@@ -1,4 +1,3 @@
-## The Problem
 
 - [ ] 🐛 This is a bug report.
 - [ ] 📈 This is a feature request.

+ 1 - 1
.github/PULL_REQUEST_TEMPLATE.md

@@ -3,7 +3,7 @@
 - [ ] 📘 I've reviewed the [OpenZeppelin Contributor Guidelines](/docs/CONTRIBUTING.md)
 - [ ] ✅ I've added tests where applicable to test my new functionality.
 - [ ] 📖 I've made sure that my contracts are well-documented.
-- [ ] 🎨 I've run the JavaScript linter (`npm run lint:fix`) and fixed all issues.
+- [ ] 🎨 I've run the JS/Solidity linters (`npm run lint:all:fix`) and fixed any issues.
 
 <!-- **Does this close any open issues?** If so, list them here. -->
 

+ 8 - 18
.soliumrc.json

@@ -1,22 +1,12 @@
 {
-  "custom-rules-filename": null,
+  "extends": "solium:all",
+  "plugins": ["security"],
   "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
+    "quotes": ["error", "double"],
+    "indentation": ["error", 2],
+    "arg-overflow": ["warning", 3],
+    "security/enforce-explicit-visibility": ["error"],
+    "security/no-block-members": ["warning"],
+    "security/no-inline-assembly": ["warning"]
   }
 }

+ 1 - 0
.travis.yml

@@ -18,6 +18,7 @@ before_script:
   - truffle version
 script:
   - npm run lint
+  - npm run lint:sol
   - npm run test
 notifications:
   slack:

+ 8 - 8
contracts/Bounty.sol

@@ -1,8 +1,8 @@
 pragma solidity ^0.4.18;
 
 
-import './payment/PullPayment.sol';
-import './lifecycle/Destructible.sol';
+import "./payment/PullPayment.sol";
+import "./lifecycle/Destructible.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);
+
 }
 
 

+ 1 - 0
contracts/DayLimit.sol

@@ -1,5 +1,6 @@
 pragma solidity ^0.4.18;
 
+
 /**
  * @title DayLimit
  * @dev Base contract that enables methods to be protected by placing a linear limit (specifiable)

+ 4 - 1
contracts/MerkleProof.sol

@@ -1,5 +1,6 @@
 pragma solidity ^0.4.18;
 
+
 /*
  * @title MerkleProof
  * @dev Merkle proof verification
@@ -15,7 +16,9 @@ library MerkleProof {
    */
   function verifyProof(bytes _proof, bytes32 _root, bytes32 _leaf) public pure returns (bool) {
     // Check if proof length is a multiple of 32
-    if (_proof.length % 32 != 0) return false;
+    if (_proof.length % 32 != 0) {
+      return false;
+    }
 
     bytes32 proofElement;
     bytes32 computedHash = _leaf;

+ 1 - 0
contracts/ReentrancyGuard.sol

@@ -1,5 +1,6 @@
 pragma solidity ^0.4.18;
 
+
 /**
  * @title Helps contracts guard agains reentrancy attacks.
  * @author Remco Bloemen <remco@2π.com>

+ 10 - 9
contracts/crowdsale/CappedCrowdsale.sol

@@ -1,7 +1,8 @@
 pragma solidity ^0.4.18;
 
-import '../math/SafeMath.sol';
-import './Crowdsale.sol';
+import "../math/SafeMath.sol";
+import "./Crowdsale.sol";
+
 
 /**
  * @title CappedCrowdsale
@@ -17,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) {
@@ -31,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;
+  }
+
 }

+ 20 - 16
contracts/crowdsale/Crowdsale.sol

@@ -1,7 +1,8 @@
 pragma solidity ^0.4.18;
 
-import '../token/MintableToken.sol';
-import '../math/SafeMath.sol';
+import "../token/MintableToken.sol";
+import "../math/SafeMath.sol";
+
 
 /**
  * @title Crowdsale
@@ -53,13 +54,6 @@ 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);
@@ -73,7 +67,7 @@ contract Crowdsale {
     uint256 weiAmount = msg.value;
 
     // calculate token amount to be created
-    uint256 tokens = weiAmount.mul(rate);
+    uint256 tokens = getTokenAmount(weiAmount);
 
     // update state
     weiRaised = weiRaised.add(weiAmount);
@@ -84,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 {
@@ -97,10 +107,4 @@ contract Crowdsale {
     return withinPeriod && nonZeroPurchase;
   }
 
-  // @return true if crowdsale event has ended
-  function hasEnded() public view returns (bool) {
-    return now > endTime;
-  }
-
-
 }

+ 4 - 3
contracts/crowdsale/FinalizableCrowdsale.sol

@@ -1,8 +1,9 @@
 pragma solidity ^0.4.18;
 
-import '../math/SafeMath.sol';
-import '../ownership/Ownable.sol';
-import './Crowdsale.sol';
+import "../math/SafeMath.sol";
+import "../ownership/Ownable.sol";
+import "./Crowdsale.sol";
+
 
 /**
  * @title FinalizableCrowdsale

+ 3 - 2
contracts/crowdsale/RefundVault.sol

@@ -1,7 +1,8 @@
 pragma solidity ^0.4.18;
 
-import '../math/SafeMath.sol';
-import '../ownership/Ownable.sol';
+import "../math/SafeMath.sol";
+import "../ownership/Ownable.sol";
+
 
 /**
  * @title RefundVault

+ 12 - 12
contracts/crowdsale/RefundableCrowdsale.sol

@@ -1,9 +1,9 @@
 pragma solidity ^0.4.18;
 
 
-import '../math/SafeMath.sol';
-import './FinalizableCrowdsale.sol';
-import './RefundVault.sol';
+import "../math/SafeMath.sol";
+import "./FinalizableCrowdsale.sol";
+import "./RefundVault.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);
   }
 
 }

+ 5 - 3
contracts/examples/SampleCrowdsale.sol

@@ -4,6 +4,7 @@ import "../crowdsale/CappedCrowdsale.sol";
 import "../crowdsale/RefundableCrowdsale.sol";
 import "../token/MintableToken.sol";
 
+
 /**
  * @title SampleCrowdsaleToken
  * @dev Very simple ERC20 Token that can be minted.
@@ -11,12 +12,13 @@ import "../token/MintableToken.sol";
  */
 contract SampleCrowdsaleToken is MintableToken {
 
-  string public constant name = "Sample Crowdsale Token";
-  string public constant symbol = "SCT";
-  uint8 public constant decimals = 18;
+  string public constant name = "Sample Crowdsale Token"; // solium-disable-line uppercase
+  string public constant symbol = "SCT"; // solium-disable-line uppercase
+  uint8 public constant decimals = 18; // solium-disable-line uppercase
 
 }
 
+
 /**
  * @title SampleCrowdsale
  * @dev This is an example of a fully fledged crowdsale.

+ 3 - 3
contracts/examples/SimpleToken.sol

@@ -12,9 +12,9 @@ import "../token/StandardToken.sol";
  */
 contract SimpleToken is StandardToken {
 
-  string public constant name = "SimpleToken";
-  string public constant symbol = "SIM";
-  uint8 public constant decimals = 18;
+  string public constant name = "SimpleToken"; // solium-disable-line uppercase
+  string public constant symbol = "SIM"; // solium-disable-line uppercase
+  uint8 public constant decimals = 18; // solium-disable-line uppercase
 
   uint256 public constant INITIAL_SUPPLY = 10000 * (10 ** uint256(decimals));
 

+ 1 - 1
contracts/lifecycle/Migrations.sol

@@ -1,7 +1,7 @@
 pragma solidity ^0.4.18;
 
+import "../ownership/Ownable.sol";
 
-import '../ownership/Ownable.sol';
 
 /**
  * @title Migrations

+ 2 - 2
contracts/lifecycle/TokenDestructible.sol

@@ -1,9 +1,9 @@
 pragma solidity ^0.4.18;
 
-
 import "../ownership/Ownable.sol";
 import "../token/ERC20Basic.sol";
 
+
 /**
  * @title TokenDestructible:
  * @author Remco Bloemen <remco@2π.com>
@@ -24,7 +24,7 @@ contract TokenDestructible is Ownable {
   function destroy(address[] tokens) onlyOwner public {
 
     // Transfer tokens to owner
-    for(uint256 i = 0; i < tokens.length; i++) {
+    for (uint256 i = 0; i < tokens.length; i++) {
       ERC20Basic token = ERC20Basic(tokens[i]);
       uint256 balance = token.balanceOf(this);
       token.transfer(owner, balance);

+ 1 - 1
contracts/math/Math.sol

@@ -1,10 +1,10 @@
 pragma solidity ^0.4.18;
 
+
 /**
  * @title Math
  * @dev Assorted math operations
  */
-
 library Math {
   function max64(uint64 a, uint64 b) internal pure returns (uint64) {
     return a >= b ? a : b;

+ 13 - 0
contracts/math/SafeMath.sol

@@ -6,6 +6,10 @@ pragma solidity ^0.4.18;
  * @dev Math operations with safety checks that throw on error
  */
 library SafeMath {
+
+  /**
+  * @dev Multiplies two numbers, throws on overflow.
+  */
   function mul(uint256 a, uint256 b) internal pure returns (uint256) {
     if (a == 0) {
       return 0;
@@ -15,6 +19,9 @@ library SafeMath {
     return c;
   }
 
+  /**
+  * @dev Integer division of two numbers, truncating the quotient.
+  */
   function div(uint256 a, uint256 b) internal pure returns (uint256) {
     // assert(b > 0); // Solidity automatically throws when dividing by 0
     uint256 c = a / b;
@@ -22,11 +29,17 @@ library SafeMath {
     return c;
   }
 
+  /**
+  * @dev Substracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
+  */
   function sub(uint256 a, uint256 b) internal pure returns (uint256) {
     assert(b <= a);
     return a - b;
   }
 
+  /**
+  * @dev Adds two numbers, throws on overflow.
+  */
   function add(uint256 a, uint256 b) internal pure returns (uint256) {
     uint256 c = a + b;
     assert(c >= a);

+ 1 - 1
contracts/mocks/BasicTokenMock.sol

@@ -1,7 +1,7 @@
 pragma solidity ^0.4.18;
 
 
-import '../token/BasicToken.sol';
+import "../token/BasicToken.sol";
 
 
 // mock class using BasicToken

+ 2 - 1
contracts/mocks/BurnableTokenMock.sol

@@ -1,6 +1,7 @@
 pragma solidity ^0.4.18;
 
-import '../token/BurnableToken.sol';
+import "../token/BurnableToken.sol";
+
 
 contract BurnableTokenMock is BurnableToken {
 

+ 1 - 1
contracts/mocks/CappedCrowdsaleImpl.sol

@@ -1,7 +1,7 @@
 pragma solidity ^0.4.18;
 
 
-import '../crowdsale/CappedCrowdsale.sol';
+import "../crowdsale/CappedCrowdsale.sol";
 
 
 contract CappedCrowdsaleImpl is CappedCrowdsale {

+ 2 - 0
contracts/mocks/DayLimitMock.sol

@@ -1,6 +1,8 @@
 pragma solidity ^0.4.18;
+
 import "../../contracts/DayLimit.sol";
 
+
 contract DayLimitMock is DayLimit {
   uint256 public totalSpending;
 

+ 3 - 2
contracts/mocks/DetailedERC20Mock.sol

@@ -1,7 +1,8 @@
 pragma solidity ^0.4.18;
 
-import '../token/StandardToken.sol';
-import '../token/DetailedERC20.sol';
+import "../token/StandardToken.sol";
+import "../token/DetailedERC20.sol";
+
 
 contract DetailedERC20Mock is StandardToken, DetailedERC20 {
   function DetailedERC20Mock(string _name, string _symbol, uint8 _decimals) DetailedERC20(_name, _symbol, _decimals) public {}

+ 1 - 1
contracts/mocks/ECRecoveryMock.sol

@@ -1,7 +1,7 @@
 pragma solidity ^0.4.18;
 
 
-import '../ECRecovery.sol';
+import "../ECRecovery.sol";
 
 
 contract ECRecoveryMock {

+ 3 - 2
contracts/mocks/ERC23TokenMock.sol

@@ -1,13 +1,14 @@
 pragma solidity ^0.4.18;
 
 
-import '../token/BasicToken.sol';
+import "../token/BasicToken.sol";
 
 
 contract ERC23ContractInterface {
   function tokenFallback(address _from, uint256 _value, bytes _data) external;
 }
 
+
 contract ERC23TokenMock is BasicToken {
 
   function ERC23TokenMock(address initialAccount, uint256 initialBalance) public {
@@ -24,7 +25,7 @@ contract ERC23TokenMock is BasicToken {
     assembly {
       is_contract := not(iszero(extcodesize(_to)))
     }
-    if(is_contract) {
+    if (is_contract) {
       ERC23ContractInterface receiver = ERC23ContractInterface(_to);
       receiver.tokenFallback(msg.sender, _value, _data);
     }

+ 1 - 1
contracts/mocks/FinalizableCrowdsaleImpl.sol

@@ -1,7 +1,7 @@
 pragma solidity ^0.4.18;
 
 
-import '../crowdsale/FinalizableCrowdsale.sol';
+import "../crowdsale/FinalizableCrowdsale.sol";
 
 
 contract FinalizableCrowdsaleImpl is FinalizableCrowdsale {

+ 2 - 1
contracts/mocks/ForceEther.sol

@@ -1,11 +1,12 @@
 pragma solidity ^0.4.18;
 
+
 // @title Force Ether into a contract.
 // @notice  even
 // if the contract is not payable.
 // @notice To use, construct the contract with the target as argument.
 // @author Remco Bloemen <remco@neufund.org>
-contract ForceEther  {
+contract ForceEther {
 
   function ForceEther() public payable { }
 

+ 1 - 0
contracts/mocks/HasNoEtherTest.sol

@@ -2,6 +2,7 @@ pragma solidity ^0.4.18;
 
 import "../../contracts/ownership/HasNoEther.sol";
 
+
 contract HasNoEtherTest is HasNoEther {
 
   // Constructor with explicit payable — should still fail

+ 2 - 2
contracts/mocks/InsecureTargetBounty.sol

@@ -1,15 +1,15 @@
 pragma solidity ^0.4.18;
 
-
 import {Bounty, Target} from "../../contracts/Bounty.sol";
 
 
 contract InsecureTargetMock is Target {
-  function checkInvariant() public returns(bool){
+  function checkInvariant() public returns(bool) {
     return false;
   }
 }
 
+
 contract InsecureTargetBounty is Bounty {
   function deployContract() internal returns (address) {
     return new InsecureTargetMock();

+ 1 - 1
contracts/mocks/LimitBalanceMock.sol

@@ -1,7 +1,7 @@
 pragma solidity ^0.4.18;
 
 
-import '../LimitBalance.sol';
+import "../LimitBalance.sol";
 
 
 // mock class using LimitBalance

+ 1 - 1
contracts/mocks/PausableMock.sol

@@ -1,7 +1,7 @@
 pragma solidity ^0.4.18;
 
 
-import '../lifecycle/Pausable.sol';
+import "../lifecycle/Pausable.sol";
 
 
 // mock class using Pausable

+ 2 - 1
contracts/mocks/PausableTokenMock.sol

@@ -1,6 +1,7 @@
 pragma solidity ^0.4.18;
 
-import '../token/PausableToken.sol';
+import "../token/PausableToken.sol";
+
 
 // mock class using PausableToken
 contract PausableTokenMock is PausableToken {

+ 1 - 1
contracts/mocks/PullPaymentMock.sol

@@ -1,7 +1,7 @@
 pragma solidity ^0.4.18;
 
 
-import '../payment/PullPayment.sol';
+import "../payment/PullPayment.sol";
 
 
 // mock class using PullPayment

+ 52 - 52
contracts/mocks/RBACMock.sol

@@ -1,69 +1,69 @@
 pragma solidity ^0.4.8;
 
-import '../ownership/rbac/RBAC.sol';
+import "../ownership/rbac/RBAC.sol";
 
 
 contract RBACMock is RBAC {
 
-    string constant ROLE_ADVISOR = "advisor";
+  string constant ROLE_ADVISOR = "advisor";
 
-    modifier onlyAdminOrAdvisor()
-    {
-        require(
-            hasRole(msg.sender, ROLE_ADMIN) ||
-            hasRole(msg.sender, ROLE_ADVISOR)
-        );
-        _;
-    }
+  modifier onlyAdminOrAdvisor()
+  {
+    require(
+      hasRole(msg.sender, ROLE_ADMIN) ||
+      hasRole(msg.sender, ROLE_ADVISOR)
+    );
+    _;
+  }
 
-    function RBACMock(address[] _advisors)
-        public
-    {
-        addRole(msg.sender, ROLE_ADVISOR);
+  function RBACMock(address[] _advisors)
+    public
+  {
+    addRole(msg.sender, ROLE_ADVISOR);
 
-        for (uint256 i = 0; i < _advisors.length; i++) {
-            addRole(_advisors[i], ROLE_ADVISOR);
-        }
+    for (uint256 i = 0; i < _advisors.length; i++) {
+      addRole(_advisors[i], ROLE_ADVISOR);
     }
+  }
 
-    function onlyAdminsCanDoThis()
-        onlyAdmin
-        view
-        external
-    {
-    }
+  function onlyAdminsCanDoThis()
+    onlyAdmin
+    view
+    external
+  {
+  }
 
-    function onlyAdvisorsCanDoThis()
-        onlyRole(ROLE_ADVISOR)
-        view
-        external
-    {
-    }
+  function onlyAdvisorsCanDoThis()
+    onlyRole(ROLE_ADVISOR)
+    view
+    external
+  {
+  }
 
-    function eitherAdminOrAdvisorCanDoThis()
-        onlyAdminOrAdvisor
-        view
-        external
-    {
-    }
+  function eitherAdminOrAdvisorCanDoThis()
+    onlyAdminOrAdvisor
+    view
+    external
+  {
+  }
 
-    function nobodyCanDoThis()
-        onlyRole("unknown")
-        view
-        external
-    {
-    }
+  function nobodyCanDoThis()
+    onlyRole("unknown")
+    view
+    external
+  {
+  }
 
-    // admins can remove advisor's role
-    function removeAdvisor(address _addr)
-        onlyAdmin
-        public
-    {
-        // revert if the user isn't an advisor
-        //  (perhaps you want to soft-fail here instead?)
-        checkRole(_addr, ROLE_ADVISOR);
+  // admins can remove advisor's role
+  function removeAdvisor(address _addr)
+    onlyAdmin
+    public
+  {
+    // revert if the user isn't an advisor
+    //  (perhaps you want to soft-fail here instead?)
+    checkRole(_addr, ROLE_ADVISOR);
 
-        // remove the advisor's role
-        removeRole(_addr, ROLE_ADVISOR);
-    }
+    // remove the advisor's role
+    removeRole(_addr, ROLE_ADVISOR);
+  }
 }

+ 1 - 0
contracts/mocks/ReentrancyAttack.sol

@@ -1,5 +1,6 @@
 pragma solidity ^0.4.18;
 
+
 contract ReentrancyAttack {
 
   function callSender(bytes4 data) public {

+ 9 - 8
contracts/mocks/ReentrancyMock.sol

@@ -1,7 +1,8 @@
 pragma solidity ^0.4.18;
 
-import '../ReentrancyGuard.sol';
-import './ReentrancyAttack.sol';
+import "../ReentrancyGuard.sol";
+import "./ReentrancyAttack.sol";
+
 
 contract ReentrancyMock is ReentrancyGuard {
 
@@ -11,12 +12,12 @@ contract ReentrancyMock is ReentrancyGuard {
     counter = 0;
   }
 
-  function count() private {
-    counter += 1;
+  function callback() external nonReentrant {
+    count();
   }
 
   function countLocalRecursive(uint256 n) public nonReentrant {
-    if(n > 0) {
+    if (n > 0) {
       count();
       countLocalRecursive(n - 1);
     }
@@ -24,7 +25,7 @@ contract ReentrancyMock is ReentrancyGuard {
 
   function countThisRecursive(uint256 n) public nonReentrant {
     bytes4 func = bytes4(keccak256("countThisRecursive(uint256)"));
-    if(n > 0) {
+    if (n > 0) {
       count();
       bool result = this.call(func, n - 1);
       require(result == true);
@@ -37,8 +38,8 @@ contract ReentrancyMock is ReentrancyGuard {
     attacker.callSender(func);
   }
 
-  function callback() external nonReentrant {
-    count();
+  function count() private {
+    counter += 1;
   }
 
 }

+ 1 - 1
contracts/mocks/RefundableCrowdsaleImpl.sol

@@ -1,7 +1,7 @@
 pragma solidity ^0.4.18;
 
 
-import '../crowdsale/RefundableCrowdsale.sol';
+import "../crowdsale/RefundableCrowdsale.sol";
 
 
 contract RefundableCrowdsaleImpl is RefundableCrowdsale {

+ 5 - 2
contracts/mocks/SafeERC20Helper.sol

@@ -1,7 +1,8 @@
 pragma solidity ^0.4.18;
 
-import '../token/ERC20.sol';
-import '../token/SafeERC20.sol';
+import "../token/ERC20.sol";
+import "../token/SafeERC20.sol";
+
 
 contract ERC20FailingMock is ERC20 {
   function transfer(address, uint256) public returns (bool) {
@@ -25,6 +26,7 @@ contract ERC20FailingMock is ERC20 {
   }
 }
 
+
 contract ERC20SucceedingMock is ERC20 {
   function transfer(address, uint256) public returns (bool) {
     return true;
@@ -47,6 +49,7 @@ contract ERC20SucceedingMock is ERC20 {
   }
 }
 
+
 contract SafeERC20Helper {
   using SafeERC20 for ERC20;
 

+ 1 - 1
contracts/mocks/SafeMathMock.sol

@@ -1,7 +1,7 @@
 pragma solidity ^0.4.18;
 
 
-import '../math/SafeMath.sol';
+import "../math/SafeMath.sol";
 
 
 contract SafeMathMock {

+ 1 - 1
contracts/mocks/SecureTargetBounty.sol

@@ -1,6 +1,5 @@
 pragma solidity ^0.4.18;
 
-
 import {Bounty, Target} from "../../contracts/Bounty.sol";
 
 
@@ -10,6 +9,7 @@ contract SecureTargetMock is Target {
   }
 }
 
+
 contract SecureTargetBounty is Bounty {
   function deployContract() internal returns (address) {
     return new SecureTargetMock();

+ 1 - 1
contracts/mocks/StandardTokenMock.sol

@@ -1,7 +1,7 @@
 pragma solidity ^0.4.18;
 
 
-import '../token/StandardToken.sol';
+import "../token/StandardToken.sol";
 
 
 // mock class using StandardToken

+ 1 - 0
contracts/ownership/CanReclaimToken.sol

@@ -4,6 +4,7 @@ import "./Ownable.sol";
 import "../token/ERC20Basic.sol";
 import "../token/SafeERC20.sol";
 
+
 /**
  * @title Contracts that should be able to recover tokens
  * @author SylTi

+ 1 - 1
contracts/ownership/Claimable.sol

@@ -1,7 +1,7 @@
 pragma solidity ^0.4.18;
 
 
-import './Ownable.sol';
+import "./Ownable.sol";
 
 
 /**

+ 11 - 10
contracts/ownership/Contactable.sol

@@ -1,21 +1,22 @@
 pragma solidity ^0.4.18;
 
-import './Ownable.sol';
+import "./Ownable.sol";
+
 
 /**
  * @title Contactable token
  * @dev Basic version of a contactable contract, allowing the owner to provide a string with their
  * contact information.
  */
-contract Contactable is Ownable{
+contract Contactable is Ownable {
 
-    string public contactInformation;
+  string public contactInformation;
 
-    /**
-     * @dev Allows the owner to set a string with their contact information.
-     * @param info The contact information to attach to the contract.
-     */
-    function setContactInformation(string info) onlyOwner public {
-         contactInformation = info;
-     }
+  /**
+    * @dev Allows the owner to set a string with their contact information.
+    * @param info The contact information to attach to the contract.
+    */
+  function setContactInformation(string info) onlyOwner public {
+    contactInformation = info;
+  }
 }

+ 1 - 3
contracts/ownership/DelayedClaimable.sol

@@ -1,7 +1,6 @@
 pragma solidity ^0.4.18;
 
-
-import './Claimable.sol';
+import "./Claimable.sol";
 
 
 /**
@@ -26,7 +25,6 @@ contract DelayedClaimable is Claimable {
     start = _start;
   }
 
-
   /**
    * @dev Allows the pendingOwner address to finalize the transfer, as long as it is called within
    * the specified start and end time.

+ 1 - 0
contracts/ownership/HasNoContracts.sol

@@ -2,6 +2,7 @@ pragma solidity ^0.4.18;
 
 import "./Ownable.sol";
 
+
 /**
  * @title Contracts that should not own Contracts
  * @author Remco Bloemen <remco@2π.com>

+ 1 - 0
contracts/ownership/HasNoEther.sol

@@ -2,6 +2,7 @@ pragma solidity ^0.4.18;
 
 import "./Ownable.sol";
 
+
 /**
  * @title Contracts that should not own Ether
  * @author Remco Bloemen <remco@2π.com>

+ 1 - 0
contracts/ownership/HasNoTokens.sol

@@ -2,6 +2,7 @@ pragma solidity ^0.4.18;
 
 import "./CanReclaimToken.sol";
 
+
 /**
  * @title Contracts that should not own Tokens
  * @author Remco Bloemen <remco@2π.com>

+ 1 - 0
contracts/ownership/NoOwner.sol

@@ -4,6 +4,7 @@ import "./HasNoEther.sol";
 import "./HasNoTokens.sol";
 import "./HasNoContracts.sol";
 
+
 /**
  * @title Base contract for contracts that should not own things.
  * @author Remco Bloemen <remco@2π.com>

+ 0 - 2
contracts/ownership/Ownable.sol

@@ -21,7 +21,6 @@ contract Ownable {
     owner = msg.sender;
   }
 
-
   /**
    * @dev Throws if called by any account other than the owner.
    */
@@ -30,7 +29,6 @@ contract Ownable {
     _;
   }
 
-
   /**
    * @dev Allows the current owner to transfer control of the contract to a newOwner.
    * @param newOwner The address to transfer ownership to.

+ 139 - 140
contracts/ownership/rbac/RBAC.sol

@@ -1,6 +1,6 @@
 pragma solidity ^0.4.18;
 
-import './Roles.sol';
+import "./Roles.sol";
 
 
 /**
@@ -15,143 +15,142 @@ import './Roles.sol';
  *  to avoid typos.
  */
 contract RBAC {
-    using Roles for Roles.Role;
-
-    mapping (string => Roles.Role) private roles;
-
-    event RoleAdded(address addr, string roleName);
-    event RoleRemoved(address addr, string roleName);
-
-    /**
-     * A constant role name for indicating admins.
-     */
-    string public constant ROLE_ADMIN = "admin";
-
-    /**
-     * @dev constructor. Sets msg.sender as admin by default
-     */
-    function RBAC()
-        public
-    {
-        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
-     * @param roleName the name of the role
-     * // reverts
-     */
-    function checkRole(address addr, string roleName)
-        view
-        public
-    {
-        roles[roleName].check(addr);
-    }
-
-    /**
-     * @dev determine if addr has role
-     * @param addr address
-     * @param roleName the name of the role
-     * @return bool
-     */
-    function hasRole(address addr, string roleName)
-        view
-        public
-        returns (bool)
-    {
-        return roles[roleName].has(addr);
-    }
-
-    /**
-     * @dev add a role to an address
-     * @param addr address
-     * @param roleName the name of the role
-     */
-    function adminAddRole(address addr, string roleName)
-        onlyAdmin
-        public
-    {
-        addRole(addr, roleName);
-    }
-
-    /**
-     * @dev remove a role from an address
-     * @param addr address
-     * @param roleName the name of the role
-     */
-    function adminRemoveRole(address addr, string roleName)
-        onlyAdmin
-        public
-    {
-        removeRole(addr, roleName);
-    }
-
-
-    /**
-     * @dev modifier to scope access to a single role (uses msg.sender as addr)
-     * @param roleName the name of the role
-     * // reverts
-     */
-    modifier onlyRole(string roleName)
-    {
-        checkRole(msg.sender, roleName);
-        _;
-    }
-
-    /**
-     * @dev modifier to scope access to admins
-     * // reverts
-     */
-    modifier onlyAdmin()
-    {
-        checkRole(msg.sender, ROLE_ADMIN);
-        _;
-    }
-
-    /**
-     * @dev modifier to scope access to a set of roles (uses msg.sender as addr)
-     * @param roleNames the names of the roles to scope access to
-     * // reverts
-     *
-     * @TODO - when solidity supports dynamic arrays as arguments to modifiers, provide this
-     *  see: https://github.com/ethereum/solidity/issues/2467
-     */
-    // modifier onlyRoles(string[] roleNames) {
-    //     bool hasAnyRole = false;
-    //     for (uint8 i = 0; i < roleNames.length; i++) {
-    //         if (hasRole(msg.sender, roleNames[i])) {
-    //             hasAnyRole = true;
-    //             break;
-    //         }
-    //     }
-
-    //     require(hasAnyRole);
-
-    //     _;
-    // }
+  using Roles for Roles.Role;
+
+  mapping (string => Roles.Role) private roles;
+
+  event RoleAdded(address addr, string roleName);
+  event RoleRemoved(address addr, string roleName);
+
+  /**
+   * A constant role name for indicating admins.
+   */
+  string public constant ROLE_ADMIN = "admin";
+
+  /**
+   * @dev constructor. Sets msg.sender as admin by default
+   */
+  function RBAC()
+    public
+  {
+    addRole(msg.sender, ROLE_ADMIN);
+  }
+
+  /**
+   * @dev reverts if addr does not have role
+   * @param addr address
+   * @param roleName the name of the role
+   * // reverts
+   */
+  function checkRole(address addr, string roleName)
+    view
+    public
+  {
+    roles[roleName].check(addr);
+  }
+
+  /**
+   * @dev determine if addr has role
+   * @param addr address
+   * @param roleName the name of the role
+   * @return bool
+   */
+  function hasRole(address addr, string roleName)
+    view
+    public
+    returns (bool)
+  {
+    return roles[roleName].has(addr);
+  }
+
+  /**
+   * @dev add a role to an address
+   * @param addr address
+   * @param roleName the name of the role
+   */
+  function adminAddRole(address addr, string roleName)
+    onlyAdmin
+    public
+  {
+    addRole(addr, roleName);
+  }
+
+  /**
+   * @dev remove a role from an address
+   * @param addr address
+   * @param roleName the name of the role
+   */
+  function adminRemoveRole(address addr, string roleName)
+    onlyAdmin
+    public
+  {
+    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
+   * // reverts
+   */
+  modifier onlyRole(string roleName)
+  {
+    checkRole(msg.sender, roleName);
+    _;
+  }
+
+  /**
+   * @dev modifier to scope access to admins
+   * // reverts
+   */
+  modifier onlyAdmin()
+  {
+    checkRole(msg.sender, ROLE_ADMIN);
+    _;
+  }
+
+  /**
+   * @dev modifier to scope access to a set of roles (uses msg.sender as addr)
+   * @param roleNames the names of the roles to scope access to
+   * // reverts
+   *
+   * @TODO - when solidity supports dynamic arrays as arguments to modifiers, provide this
+   *  see: https://github.com/ethereum/solidity/issues/2467
+   */
+  // modifier onlyRoles(string[] roleNames) {
+  //     bool hasAnyRole = false;
+  //     for (uint8 i = 0; i < roleNames.length; i++) {
+  //         if (hasRole(msg.sender, roleNames[i])) {
+  //             hasAnyRole = true;
+  //             break;
+  //         }
+  //     }
+
+  //     require(hasAnyRole);
+
+  //     _;
+  // }
 }

+ 40 - 40
contracts/ownership/rbac/Roles.sol

@@ -8,48 +8,48 @@ pragma solidity ^0.4.18;
  *      See RBAC.sol for example usage.
  */
 library Roles {
-    struct Role {
-        mapping (address => bool) bearer;
-    }
+  struct Role {
+    mapping (address => bool) bearer;
+  }
 
-    /**
-     * @dev give an address access to this role
-     */
-    function add(Role storage role, address addr)
-        internal
-    {
-        role.bearer[addr] = true;
-    }
+  /**
+   * @dev give an address access to this role
+   */
+  function add(Role storage role, address addr)
+    internal
+  {
+    role.bearer[addr] = true;
+  }
 
-    /**
-     * @dev remove an address' access to this role
-     */
-    function remove(Role storage role, address addr)
-        internal
-    {
-        role.bearer[addr] = false;
-    }
+  /**
+   * @dev remove an address' access to this role
+   */
+  function remove(Role storage role, address addr)
+    internal
+  {
+    role.bearer[addr] = false;
+  }
 
-    /**
-     * @dev check if an address has this role
-     * // reverts
-     */
-    function check(Role storage role, address addr)
-        view
-        internal
-    {
-        require(has(role, addr));
-    }
+  /**
+   * @dev check if an address has this role
+   * // reverts
+   */
+  function check(Role storage role, address addr)
+    view
+    internal
+  {
+    require(has(role, addr));
+  }
 
-    /**
-     * @dev check if an address has this role
-     * @return bool
-     */
-    function has(Role storage role, address addr)
-        view
-        internal
-        returns (bool)
-    {
-        return role.bearer[addr];
-    }
+  /**
+   * @dev check if an address has this role
+   * @return bool
+   */
+  function has(Role storage role, address addr)
+    view
+    internal
+    returns (bool)
+  {
+    return role.bearer[addr];
+  }
 }

+ 11 - 11
contracts/payment/PullPayment.sol

@@ -1,7 +1,7 @@
 pragma solidity ^0.4.18;
 
 
-import '../math/SafeMath.sol';
+import "../math/SafeMath.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);
+  }
 }

+ 16 - 15
contracts/payment/SplitPayment.sol

@@ -1,6 +1,7 @@
 pragma solidity ^0.4.18;
 
-import '../math/SafeMath.sol';
+import "../math/SafeMath.sol";
+
 
 /**
  * @title SplitPayment
@@ -29,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.
@@ -64,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);
+  }
 }

+ 2 - 2
contracts/token/BasicToken.sol

@@ -1,8 +1,8 @@
 pragma solidity ^0.4.18;
 
 
-import './ERC20Basic.sol';
-import '../math/SafeMath.sol';
+import "./ERC20Basic.sol";
+import "../math/SafeMath.sol";
 
 
 /**

+ 16 - 15
contracts/token/BurnableToken.sol

@@ -1,6 +1,7 @@
 pragma solidity ^0.4.18;
 
-import './BasicToken.sol';
+import "./BasicToken.sol";
+
 
 /**
  * @title Burnable Token
@@ -8,20 +9,20 @@ import './BasicToken.sol';
  */
 contract BurnableToken is BasicToken {
 
-    event Burn(address indexed burner, uint256 value);
+  event Burn(address indexed burner, uint256 value);
 
-    /**
-     * @dev Burns a specific amount of tokens.
-     * @param _value The amount of token to be burned.
-     */
-    function burn(uint256 _value) public {
-        require(_value <= balances[msg.sender]);
-        // no need to require value <= totalSupply, since that would imply the
-        // sender's balance is greater than the totalSupply, which *should* be an assertion failure
+  /**
+   * @dev Burns a specific amount of tokens.
+   * @param _value The amount of token to be burned.
+   */
+  function burn(uint256 _value) public {
+    require(_value <= balances[msg.sender]);
+    // no need to require value <= totalSupply, since that would imply the
+    // sender's balance is greater than the totalSupply, which *should* be an assertion failure
 
-        address burner = msg.sender;
-        balances[burner] = balances[burner].sub(_value);
-        totalSupply = totalSupply.sub(_value);
-        Burn(burner, _value);
-    }
+    address burner = msg.sender;
+    balances[burner] = balances[burner].sub(_value);
+    totalSupply = totalSupply.sub(_value);
+    Burn(burner, _value);
+  }
 }

+ 2 - 1
contracts/token/CappedToken.sol

@@ -1,6 +1,7 @@
 pragma solidity ^0.4.11;
 
-import './MintableToken.sol';
+import "./MintableToken.sol";
+
 
 /**
  * @title Capped token

+ 2 - 1
contracts/token/DetailedERC20.sol

@@ -1,6 +1,7 @@
 pragma solidity ^0.4.18;
 
-import './ERC20.sol';
+import "./ERC20.sol";
+
 
 contract DetailedERC20 is ERC20 {
   string public name;

+ 1 - 1
contracts/token/ERC20.sol

@@ -1,7 +1,7 @@
 pragma solidity ^0.4.18;
 
 
-import './ERC20Basic.sol';
+import "./ERC20Basic.sol";
 
 
 /**

+ 2 - 2
contracts/token/MintableToken.sol

@@ -1,8 +1,8 @@
 pragma solidity ^0.4.18;
 
 
-import './StandardToken.sol';
-import '../ownership/Ownable.sol';
+import "./StandardToken.sol";
+import "../ownership/Ownable.sol";
 
 
 

+ 3 - 3
contracts/token/PausableToken.sol

@@ -1,14 +1,14 @@
 pragma solidity ^0.4.18;
 
-import './StandardToken.sol';
-import '../lifecycle/Pausable.sol';
+import "./StandardToken.sol";
+import "../lifecycle/Pausable.sol";
+
 
 /**
  * @title Pausable token
  *
  * @dev StandardToken modified with pausable transfers.
  **/
-
 contract PausableToken is StandardToken, Pausable {
 
   function transfer(address _to, uint256 _value) public whenNotPaused returns (bool) {

+ 3 - 2
contracts/token/SafeERC20.sol

@@ -1,7 +1,8 @@
 pragma solidity ^0.4.18;
 
-import './ERC20Basic.sol';
-import './ERC20.sol';
+import "./ERC20Basic.sol";
+import "./ERC20.sol";
+
 
 /**
  * @title SafeERC20

+ 2 - 2
contracts/token/StandardToken.sol

@@ -1,8 +1,8 @@
 pragma solidity ^0.4.18;
 
 
-import './BasicToken.sol';
-import './ERC20.sol';
+import "./BasicToken.sol";
+import "./ERC20.sol";
 
 
 /**

+ 2 - 2
contracts/token/TokenTimelock.sol

@@ -1,9 +1,9 @@
 pragma solidity ^0.4.18;
 
-
-import './ERC20Basic.sol';
+import "./ERC20Basic.sol";
 import "../token/SafeERC20.sol";
 
+
 /**
  * @title TokenTimelock
  * @dev TokenTimelock is a token holder contract that will allow a

+ 5 - 4
contracts/token/TokenVesting.sol

@@ -1,9 +1,10 @@
 pragma solidity ^0.4.18;
 
-import './ERC20Basic.sol';
-import './SafeERC20.sol';
-import '../ownership/Ownable.sol';
-import '../math/SafeMath.sol';
+import "./ERC20Basic.sol";
+import "./SafeERC20.sol";
+import "../ownership/Ownable.sol";
+import "../math/SafeMath.sol";
+
 
 /**
  * @title TokenVesting

A különbségek nem kerülnek megjelenítésre, a fájl túl nagy
+ 926 - 15
package-lock.json


+ 5 - 0
package.json

@@ -6,6 +6,10 @@
     "test": "scripts/test.sh",
     "lint": "eslint .",
     "lint:fix": "eslint . --fix",
+    "lint:sol": "solium -d .",
+    "lint:sol:fix": "solium -d . --fix",
+    "lint:all": "npm run lint && npm run lint:sol",
+    "lint:all:fix": "npm run lint:fix && npm run lint:sol:fix",
     "console": "truffle console",
     "coverage": "scripts/coverage.sh"
   },
@@ -47,6 +51,7 @@
     "ethereumjs-util": "^5.1.2",
     "mocha-lcov-reporter": "^1.3.0",
     "solidity-coverage": "^0.4.3",
+    "solium": "^1.1.2",
     "truffle": "^4.0.0",
     "truffle-hdwallet-provider": "0.0.3"
   },

+ 2 - 2
test/Bounty.test.js

@@ -74,7 +74,7 @@ contract('Bounty', function (accounts) {
             web3.eth.getBalance(bounty.address).toNumber());
         }
       };
-      bounty.createTarget({ from: researcher });
+      await bounty.createTarget({ from: researcher });
       await awaitEvent(event, watcher);
     });
   });
@@ -104,7 +104,7 @@ contract('Bounty', function (accounts) {
 
         assert.equal(0, web3.eth.getBalance(bounty.address).toNumber());
       };
-      bounty.createTarget({ from: researcher });
+      await bounty.createTarget({ from: researcher });
       await awaitEvent(event, watcher);
     });
   });

+ 25 - 0
test/Math.test.js

@@ -0,0 +1,25 @@
+var MathMock = artifacts.require('./mocks/MathMock.sol');
+
+contract('Math', function (accounts) {
+  let math;
+
+  before(async function () {
+    math = await MathMock.new();
+  });
+
+  it('returns max correctly', async function () {
+    let a = 5678;
+    let b = 1234;
+    await math.max64(a, b);
+    let result = await math.result();
+    assert.equal(result, a);
+  });
+
+  it('returns min correctly', async function () {
+    let a = 5678;
+    let b = 1234;
+    await math.min64(a, b);
+    let result = await math.result();
+    assert.equal(result, b);
+  });
+});

+ 5 - 5
test/CappedCrowdsale.test.js → test/crowdsale/CappedCrowdsale.test.js

@@ -1,8 +1,8 @@
-import ether from './helpers/ether';
-import { advanceBlock } from './helpers/advanceToBlock';
-import { increaseTimeTo, duration } from './helpers/increaseTime';
-import latestTime from './helpers/latestTime';
-import EVMRevert from './helpers/EVMRevert';
+import ether from '../helpers/ether';
+import { advanceBlock } from '../helpers/advanceToBlock';
+import { increaseTimeTo, duration } from '../helpers/increaseTime';
+import latestTime from '../helpers/latestTime';
+import EVMRevert from '../helpers/EVMRevert';
 
 const BigNumber = web3.BigNumber;
 

+ 5 - 5
test/Crowdsale.test.js → test/crowdsale/Crowdsale.test.js

@@ -1,8 +1,8 @@
-import ether from './helpers/ether';
-import { advanceBlock } from './helpers/advanceToBlock';
-import { increaseTimeTo, duration } from './helpers/increaseTime';
-import latestTime from './helpers/latestTime';
-import EVMRevert from './helpers/EVMRevert';
+import ether from '../helpers/ether';
+import { advanceBlock } from '../helpers/advanceToBlock';
+import { increaseTimeTo, duration } from '../helpers/increaseTime';
+import latestTime from '../helpers/latestTime';
+import EVMRevert from '../helpers/EVMRevert';
 
 const BigNumber = web3.BigNumber;
 

+ 4 - 4
test/FinalizableCrowdsale.test.js → test/crowdsale/FinalizableCrowdsale.test.js

@@ -1,7 +1,7 @@
-import { advanceBlock } from './helpers/advanceToBlock';
-import { increaseTimeTo, duration } from './helpers/increaseTime';
-import latestTime from './helpers/latestTime';
-import EVMRevert from './helpers/EVMRevert';
+import { advanceBlock } from '../helpers/advanceToBlock';
+import { increaseTimeTo, duration } from '../helpers/increaseTime';
+import latestTime from '../helpers/latestTime';
+import EVMRevert from '../helpers/EVMRevert';
 
 const BigNumber = web3.BigNumber;
 

+ 2 - 2
test/RefundVault.test.js → test/crowdsale/RefundVault.test.js

@@ -1,5 +1,5 @@
-import ether from './helpers/ether';
-import EVMRevert from './helpers/EVMRevert';
+import ether from '../helpers/ether';
+import EVMRevert from '../helpers/EVMRevert';
 
 const BigNumber = web3.BigNumber;
 

+ 5 - 5
test/RefundableCrowdsale.test.js → test/crowdsale/RefundableCrowdsale.test.js

@@ -1,8 +1,8 @@
-import ether from './helpers/ether';
-import { advanceBlock } from './helpers/advanceToBlock';
-import { increaseTimeTo, duration } from './helpers/increaseTime';
-import latestTime from './helpers/latestTime';
-import EVMRevert from './helpers/EVMRevert';
+import ether from '../helpers/ether';
+import { advanceBlock } from '../helpers/advanceToBlock';
+import { increaseTimeTo, duration } from '../helpers/increaseTime';
+import latestTime from '../helpers/latestTime';
+import EVMRevert from '../helpers/EVMRevert';
 
 const BigNumber = web3.BigNumber;
 

+ 5 - 5
test/SampleCrowdsale.test.js → test/examples/SampleCrowdsale.test.js

@@ -1,8 +1,8 @@
-import ether from './helpers/ether';
-import { advanceBlock } from './helpers/advanceToBlock';
-import { increaseTimeTo, duration } from './helpers/increaseTime';
-import latestTime from './helpers/latestTime';
-import EVMRevert from './helpers/EVMRevert';
+import ether from '../helpers/ether';
+import { advanceBlock } from '../helpers/advanceToBlock';
+import { increaseTimeTo, duration } from '../helpers/increaseTime';
+import latestTime from '../helpers/latestTime';
+import EVMRevert from '../helpers/EVMRevert';
 
 const BigNumber = web3.BigNumber;
 

+ 1 - 1
test/Destructible.test.js → test/lifecycle/Destructible.test.js

@@ -1,6 +1,6 @@
 
 var Destructible = artifacts.require('../contracts/lifecycle/Destructible.sol');
-require('./helpers/transactionMined.js');
+require('../helpers/transactionMined.js');
 
 contract('Destructible', function (accounts) {
   it('should send balance to owner after destruction', async function () {

+ 1 - 1
test/Pausable.test.js → test/lifecycle/Pausable.test.js

@@ -1,5 +1,5 @@
 
-import assertRevert from './helpers/assertRevert';
+import assertRevert from '../helpers/assertRevert';
 const PausableMock = artifacts.require('mocks/PausableMock.sol');
 
 contract('Pausable', function (accounts) {

+ 1 - 1
test/TokenDestructible.test.js → test/lifecycle/TokenDestructible.test.js

@@ -1,7 +1,7 @@
 
 var TokenDestructible = artifacts.require('../contracts/lifecycle/TokenDestructible.sol');
 var StandardTokenMock = artifacts.require('mocks/StandardTokenMock.sol');
-require('./helpers/transactionMined.js');
+require('../helpers/transactionMined.js');
 
 contract('TokenDestructible', function (accounts) {
   let destructible;

+ 2 - 2
test/SafeMath.test.js → test/math/SafeMath.test.js

@@ -1,5 +1,5 @@
-import assertRevert from './helpers/assertRevert';
-const assertJump = require('./helpers/assertJump');
+import assertRevert from '../helpers/assertRevert';
+const assertJump = require('../helpers/assertJump');
 var SafeMathMock = artifacts.require('mocks/SafeMathMock.sol');
 
 contract('SafeMath', function (accounts) {

+ 17 - 0
test/mocks/MathMock.sol

@@ -0,0 +1,17 @@
+pragma solidity ^0.4.18;
+
+
+import "../../contracts/math/Math.sol";
+
+
+contract MathMock {
+  uint64 public result;
+
+  function max64(uint64 a, uint64 b) public {
+    result = Math.max64(a, b);
+  }
+
+  function min64(uint64 a, uint64 b) public {
+    result = Math.min64(a, b);
+  }
+}

+ 1 - 1
test/CanReclaimToken.test.js → test/ownership/CanReclaimToken.test.js

@@ -1,5 +1,5 @@
 
-import expectThrow from './helpers/expectThrow';
+import expectThrow from '../helpers/expectThrow';
 
 const CanReclaimToken = artifacts.require('../contracts/ownership/CanReclaimToken.sol');
 const BasicTokenMock = artifacts.require('mocks/BasicTokenMock.sol');

+ 1 - 1
test/Claimable.test.js → test/ownership/Claimable.test.js

@@ -1,5 +1,5 @@
 
-import assertRevert from './helpers/assertRevert';
+import assertRevert from '../helpers/assertRevert';
 
 var Claimable = artifacts.require('../contracts/ownership/Claimable.sol');
 

+ 0 - 0
test/Contactable.test.js → test/ownership/Contactable.test.js


+ 3 - 14
test/DelayedClaimble.test.js → test/ownership/DelayedClaimble.test.js

@@ -1,3 +1,4 @@
+import assertRevert from '../helpers/assertRevert';
 
 var DelayedClaimable = artifacts.require('../contracts/ownership/DelayedClaimable.sol');
 
@@ -42,25 +43,13 @@ contract('DelayedClaimable', function (accounts) {
     assert.equal(start, 100);
     let pendingOwner = await delayedClaimable.pendingOwner();
     assert.equal(pendingOwner, accounts[1]);
-    var err = null;
-    try {
-      await delayedClaimable.claimOwnership({ from: accounts[1] });
-    } catch (error) {
-      err = error;
-    }
-    assert.isFalse(err.message.search('revert') === -1);
+    await assertRevert(delayedClaimable.claimOwnership({ from: accounts[1] }));
     let owner = await delayedClaimable.owner();
     assert.isTrue(owner !== accounts[1]);
   });
 
   it('set end and start invalid values fail', async function () {
     await delayedClaimable.transferOwnership(accounts[1]);
-    var err = null;
-    try {
-      await delayedClaimable.setLimits(1001, 1000);
-    } catch (error) {
-      err = error;
-    }
-    assert.isFalse(err.message.search('revert') === -1);
+    await assertRevert(delayedClaimable.setLimits(1001, 1000));
   });
 });

+ 1 - 1
test/HasNoContracts.test.js → test/ownership/HasNoContracts.test.js

@@ -1,5 +1,5 @@
 
-import expectThrow from './helpers/expectThrow';
+import expectThrow from '../helpers/expectThrow';
 
 const Ownable = artifacts.require('../contracts/ownership/Ownable.sol');
 const HasNoContracts = artifacts.require(

+ 2 - 2
test/HasNoEther.test.js → test/ownership/HasNoEther.test.js

@@ -1,6 +1,6 @@
 
-import expectThrow from './helpers/expectThrow';
-import toPromise from './helpers/toPromise';
+import expectThrow from '../helpers/expectThrow';
+import toPromise from '../helpers/toPromise';
 const HasNoEtherTest = artifacts.require('../mocks/HasNoEtherTest.sol');
 const ForceEther = artifacts.require('../mocks/ForceEther.sol');
 

+ 1 - 1
test/HasNoTokens.test.js → test/ownership/HasNoTokens.test.js

@@ -1,5 +1,5 @@
 
-import expectThrow from './helpers/expectThrow';
+import expectThrow from '../helpers/expectThrow';
 
 const HasNoTokens = artifacts.require('../contracts/lifecycle/HasNoTokens.sol');
 const ERC23TokenMock = artifacts.require('mocks/ERC23TokenMock.sol');

+ 1 - 1
test/Ownable.test.js → test/ownership/Ownable.test.js

@@ -1,5 +1,5 @@
 
-import assertRevert from './helpers/assertRevert';
+import assertRevert from '../helpers/assertRevert';
 
 var Ownable = artifacts.require('../contracts/ownership/Ownable.sol');
 

+ 9 - 9
test/RBAC.test.js → test/ownership/rbac/RBAC.test.js

@@ -1,5 +1,5 @@
-import expectThrow from './helpers/expectThrow';
-import expectEvent from './helpers/expectEvent';
+import expectThrow from '../../helpers/expectThrow';
+import expectEvent from '../../helpers/expectEvent';
 
 const RBACMock = artifacts.require('mocks/RBACMock.sol');
 
@@ -45,17 +45,17 @@ contract('RBAC', function (accounts) {
         .should.be.fulfilled;
     });
     it('does not allow admins to call #nobodyCanDoThis', async () => {
-      expectThrow(
+      await expectThrow(
         mock.nobodyCanDoThis({ from: admin })
       );
     });
     it('does not allow advisors to call #nobodyCanDoThis', async () => {
-      expectThrow(
+      await expectThrow(
         mock.nobodyCanDoThis({ from: advisors[0] })
       );
     });
     it('does not allow anyone to call #nobodyCanDoThis', async () => {
-      expectThrow(
+      await expectThrow(
         mock.nobodyCanDoThis({ from: anyone })
       );
     });
@@ -69,14 +69,14 @@ contract('RBAC', function (accounts) {
     });
 
     it('announces a RoleAdded event on addRole', async () => {
-      expectEvent.inTransaction(
+      await expectEvent.inTransaction(
         mock.adminAddRole(futureAdvisor, ROLE_ADVISOR, { from: admin }),
         'RoleAdded'
       );
     });
 
     it('announces a RoleRemoved event on removeRole', async () => {
-      expectEvent.inTransaction(
+      await expectEvent.inTransaction(
         mock.adminRemoveRole(futureAdvisor, ROLE_ADVISOR, { from: admin }),
         'RoleRemoved'
       );
@@ -85,12 +85,12 @@ contract('RBAC', function (accounts) {
 
   context('in adversarial conditions', () => {
     it('does not allow an advisor to remove another advisor', async () => {
-      expectThrow(
+      await expectThrow(
         mock.removeAdvisor(advisors[1], { from: advisors[0] })
       );
     });
     it('does not allow "anyone" to remove an advisor', async () => {
-      expectThrow(
+      await expectThrow(
         mock.removeAdvisor(advisors[0], { from: anyone })
       );
     });

+ 0 - 0
test/PullPayment.test.js → test/payment/PullPayment.test.js


+ 1 - 1
test/SplitPayment.test.js → test/payment/SplitPayment.test.js

@@ -5,7 +5,7 @@ require('chai')
   .use(require('chai-bignumber')(BigNumber))
   .should();
 
-const EVMThrow = require('./helpers/EVMThrow.js');
+const EVMThrow = require('../helpers/EVMThrow.js');
 const SplitPayment = artifacts.require('../contracts/payment/SplitPayment.sol');
 
 contract('SplitPayment', function ([owner, payee1, payee2, payee3, nonpayee1, payer1]) {

+ 1 - 1
test/BasicToken.test.js → test/token/BasicToken.test.js

@@ -1,4 +1,4 @@
-import assertRevert from './helpers/assertRevert';
+import assertRevert from '../helpers/assertRevert';
 
 var BasicTokenMock = artifacts.require('mocks/BasicTokenMock.sol');
 

+ 1 - 1
test/BurnableToken.test.js → test/token/BurnableToken.test.js

@@ -1,5 +1,5 @@
 
-const EVMRevert = require('./helpers/EVMRevert.js');
+const EVMRevert = require('../helpers/EVMRevert.js');
 const BurnableTokenMock = artifacts.require('mocks/BurnableTokenMock.sol');
 const BigNumber = web3.BigNumber;
 

+ 2 - 2
test/CappedToken.test.js → test/token/CappedToken.test.js

@@ -1,6 +1,6 @@
 
-import expectThrow from './helpers/expectThrow';
-import ether from './helpers/ether';
+import expectThrow from '../helpers/expectThrow';
+import ether from '../helpers/ether';
 
 var CappedToken = artifacts.require('../contracts/Tokens/CappedToken.sol');
 

+ 0 - 0
test/DetailedERC20.test.js → test/token/DetailedERC20.test.js


+ 1 - 1
test/MintableToken.test.js → test/token/MintableToken.test.js

@@ -1,5 +1,5 @@
 
-import expectThrow from './helpers/expectThrow';
+import expectThrow from '../helpers/expectThrow';
 var MintableToken = artifacts.require('../contracts/Tokens/MintableToken.sol');
 
 contract('Mintable', function (accounts) {

+ 1 - 1
test/PausableToken.test.js → test/token/PausableToken.test.js

@@ -1,6 +1,6 @@
 'user strict';
 
-import assertRevert from './helpers/assertRevert';
+import assertRevert from '../helpers/assertRevert';
 var PausableTokenMock = artifacts.require('./mocks/PausableTokenMock.sol');
 
 contract('PausableToken', function (accounts) {

+ 1 - 1
test/SafeERC20.test.js → test/token/SafeERC20.test.js

@@ -1,4 +1,4 @@
-import EVMThrow from './helpers/EVMThrow';
+import EVMThrow from '../helpers/EVMThrow';
 
 require('chai')
   .use(require('chai-as-promised'))

Nem az összes módosított fájl került megjelenítésre, mert túl sok fájl változott