From 61c8735317cf16f58a8cf8e476aada7d5e30edbd Mon Sep 17 00:00:00 2001 From: Leo Arias Date: Fri, 1 Jun 2018 07:39:03 +0000 Subject: [PATCH] tests: add and follow the solium rules --- .soliumignore | 1 + .soliumrc.json | 15 ++ .travis.yml | 28 ++- contracts/Kernel.sol | 46 +++- contracts/Migrations.sol | 14 +- contracts/Release.sol | 5 +- contracts/Vouching.sol | 40 +++- contracts/ZepToken.sol | 19 +- contracts/test/MockKernelV2.sol | 14 +- contracts/test/PickACard.sol | 7 +- contracts/test/stdlib/ERC721Basic.sol | 30 ++- contracts/test/stdlib/ERC721BasicToken.sol | 65 +++++- contracts/test/stdlib/ERC721Receiver.sol | 13 +- contracts/test/stdlib/ERC721Token.sol | 1 + package-lock.json | 235 +++++++++++++++++++++ package.json | 5 +- 16 files changed, 481 insertions(+), 57 deletions(-) create mode 100644 .soliumignore create mode 100644 .soliumrc.json diff --git a/.soliumignore b/.soliumignore new file mode 100644 index 0000000..3c3629e --- /dev/null +++ b/.soliumignore @@ -0,0 +1 @@ +node_modules diff --git a/.soliumrc.json b/.soliumrc.json new file mode 100644 index 0000000..2acda55 --- /dev/null +++ b/.soliumrc.json @@ -0,0 +1,15 @@ +{ + "extends": "solium:all", + "plugins": ["security"], + "rules": { + "quotes": ["error", "double"], + "no-empty-blocks": "off", + "indentation": ["error", 2], + "max-len": ["error", 79], + "no-constant": ["error"], + "security/enforce-explicit-visibility": ["error"], + "security/no-block-members": ["warning"], + "security/no-inline-assembly": ["warning"], + "arg-overflow": ["off"] + } +} diff --git a/.travis.yml b/.travis.yml index 9f987b9..579ffe2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,18 +1,32 @@ language: node_js + node_js: - '8' + cache: directories: - node_modules -env: - - - - SOLIDITY_COVERAGE=true -matrix: + +jobs: + # XXX fast_finish doesn't work with stages yet. See + # https://github.com/travis-ci/travis-ci/issues/8425 + # --elopio - 20180531 fast_finish: true allow_failures: - - env: SOLIDITY_COVERAGE=true -script: - - npm test + - env: SOLIDITY_COVERAGE=true + include: + # Run the unit test suite three times in parallel. + # The first one gets results faster and is the only one required to pass. + # The second one generates the coverage report. + - stage: unit + script: npm test + - stage: unit + script: npm run test + env: SOLIDITY_COVERAGE=true + # solidity style tests. + - stage: static + script: npm run lint:sol + notifications: slack: rooms: diff --git a/contracts/Kernel.sol b/contracts/Kernel.sol index 05be3d1..ed5191d 100644 --- a/contracts/Kernel.sol +++ b/contracts/Kernel.sol @@ -7,6 +7,7 @@ import "zeppelin-solidity/contracts/math/SafeMath.sol"; import "zos-lib/contracts/migrations/Migratable.sol"; import "zos-lib/contracts/upgradeability/UpgradeabilityProxyFactory.sol"; + /** * @title Kernel * @dev Controls the standard library releases for ZeppelinOS @@ -55,7 +56,10 @@ contract Kernel is Migratable { uint256 _developerFraction, ZepToken _token, Vouching _vouches - ) public isInitializer("Kernel", "0") { + ) + public + isInitializer("Kernel", "0") + { vouches = _vouches; token = _token; developerFraction = _developerFraction; @@ -71,7 +75,7 @@ contract Kernel is Migratable { require(release.frozen()); releases[release] = true; emit ReleaseRegistered(release); - + require(token.transferFrom(msg.sender, this, newVersionCost)); token.burn(newVersionCost); } @@ -90,7 +94,14 @@ contract Kernel is Migratable { * @param amount the amount being vouched * @param data additional information for complex vouching models */ - function vouch(Release release, uint256 amount, bytes data) public whenRegistered(release) { + function vouch( + Release release, + uint256 amount, + bytes data + ) + public + whenRegistered(release) + { require(token.transferFrom(msg.sender, this, amount)); _payoutAndVouch(msg.sender, release, amount, data); } @@ -101,7 +112,14 @@ contract Kernel is Migratable { * @param amount the amount being unvouched * @param data additional information for complex vouching models */ - function unvouch(Release release, uint256 amount, bytes data) public whenRegistered(release) { + function unvouch( + Release release, + uint256 amount, + bytes data + ) + public + whenRegistered(release) + { vouches.unvouch(msg.sender, release, amount, data); require(token.transfer(msg.sender, amount)); } @@ -113,7 +131,16 @@ contract Kernel is Migratable { * @param amount the amount of vouches being transferred * @param data additional information for complex vouching models */ - function transferVouch(Release from, Release to, uint256 amount, bytes data) public whenRegistered(from) whenRegistered(to) { + function transferVouch( + Release from, + Release to, + uint256 amount, + bytes data + ) + public + whenRegistered(from) + whenRegistered(to) + { vouches.unvouch(msg.sender, from, amount, data); _payoutAndVouch(msg.sender, to, amount, data); } @@ -125,7 +152,14 @@ contract Kernel is Migratable { * @param amount the amount being vouched * @param data additional information for complex vouching models */ - function _payoutAndVouch(address voucher, Release release, uint256 amount, bytes data) internal { + function _payoutAndVouch( + address voucher, + Release release, + uint256 amount, + bytes data + ) + internal + { uint256 developerPayout = amount.div(developerFraction); require(developerPayout > 0); diff --git a/contracts/Migrations.sol b/contracts/Migrations.sol index 27598ad..218efd6 100644 --- a/contracts/Migrations.sol +++ b/contracts/Migrations.sol @@ -1,11 +1,13 @@ pragma solidity ^0.4.21; + contract Migrations { address public owner; - uint public last_completed_migration; + uint public lastCompletedMigration; modifier restricted() { - if (msg.sender == owner) _; + if (msg.sender == owner) + _; } function Migrations() public { @@ -13,11 +15,11 @@ contract Migrations { } function setCompleted(uint completed) public restricted { - last_completed_migration = completed; + lastCompletedMigration = completed; } - function upgrade(address new_address) public restricted { - Migrations upgraded = Migrations(new_address); - upgraded.setCompleted(last_completed_migration); + function upgrade(address newAddress) public restricted { + Migrations upgraded = Migrations(newAddress); + upgraded.setCompleted(lastCompletedMigration); } } diff --git a/contracts/Release.sol b/contracts/Release.sol index 0a21218..4451ba5 100644 --- a/contracts/Release.sol +++ b/contracts/Release.sol @@ -1,7 +1,8 @@ pragma solidity ^0.4.21; - +// solium-disable-next-line max-len import "zos-lib/contracts/application/versioning/FreezableContractDirectory.sol"; + /** * @title Release * @dev This contract represents a particular stdlib version from a developer @@ -11,7 +12,7 @@ contract Release is FreezableContractDirectory { // Developer address to which staking payouts will be sent, owner of the contract directory address public developer; - + /** * @dev Constructor function that sets the developer of this release */ diff --git a/contracts/Vouching.sol b/contracts/Vouching.sol index 8ec43cf..a8419e8 100644 --- a/contracts/Vouching.sol +++ b/contracts/Vouching.sol @@ -20,7 +20,13 @@ contract Vouching is Migratable, Ownable { * @param total the new total amount vouched * @param data additional information for complex vouching models */ - event Vouched(address indexed voucher, address release, uint256 amount, uint256 total, bytes data); + event Vouched( + address indexed voucher, + address release, + uint256 amount, + uint256 total, + bytes data + ); /** * @dev Event signaling an unvouching @@ -30,7 +36,13 @@ contract Vouching is Migratable, Ownable { * @param total the new total amount vouched * @param data additional information for complex vouching models */ - event Unvouched(address indexed voucher, address release, uint256 amount, uint256 total, bytes data); + event Unvouched( + address indexed voucher, + address release, + uint256 amount, + uint256 total, + bytes data + ); // Total amount of vouched tokens uint256 private _totalVouched; @@ -72,7 +84,9 @@ contract Vouching is Migratable, Ownable { * @param release the stdlib release * @return the total vouched amount by the voucher for the given release */ - function vouchedFor(address voucher, address release) public view returns (uint256) { + function vouchedFor(address voucher, address release) + public view returns (uint256) + { return _vouches[voucher][release]; } @@ -83,7 +97,15 @@ contract Vouching is Migratable, Ownable { * @param amount the amount being vouched * @param data additional information for complex vouching models */ - function vouch(address voucher, address release, uint256 amount, bytes data) public onlyOwner { + function vouch( + address voucher, + address release, + uint256 amount, + bytes data + ) + public + onlyOwner + { _totalVouched = _totalVouched.add(amount); _releaseVouches[release] = _releaseVouches[release].add(amount); _vouches[voucher][release] = _vouches[voucher][release].add(amount); @@ -98,7 +120,15 @@ contract Vouching is Migratable, Ownable { * @param amount the amount being unvouched * @param data additional information for complex vouching models */ - function unvouch(address voucher, address release, uint256 amount, bytes data) public onlyOwner { + function unvouch( + address voucher, + address release, + uint256 amount, + bytes data + ) + public + onlyOwner + { uint256 currentVouch = _vouches[voucher][release]; require(currentVouch >= amount); diff --git a/contracts/ZepToken.sol b/contracts/ZepToken.sol index 9554253..d6fe4c1 100644 --- a/contracts/ZepToken.sol +++ b/contracts/ZepToken.sol @@ -1,19 +1,28 @@ pragma solidity ^0.4.21; -import 'zos-lib/contracts/migrations/Migratable.sol'; -import 'zeppelin-solidity/contracts/token/ERC20/PausableToken.sol'; -import 'zeppelin-solidity/contracts/token/ERC20/MintableToken.sol'; -import 'zeppelin-solidity/contracts/token/ERC20/BurnableToken.sol'; -import 'zeppelin-solidity/contracts/token/ERC20/StandardToken.sol'; +import "zos-lib/contracts/migrations/Migratable.sol"; +import "zeppelin-solidity/contracts/token/ERC20/PausableToken.sol"; +import "zeppelin-solidity/contracts/token/ERC20/MintableToken.sol"; +import "zeppelin-solidity/contracts/token/ERC20/BurnableToken.sol"; +import "zeppelin-solidity/contracts/token/ERC20/StandardToken.sol"; + /** * @title ZepToken * @dev ZEP token contract including mintable, pausable and burnable functionalities */ +// XXX There doesn't seem to be a way to split this line that keeps solium +// happy. See: +// https://github.com/duaraghav8/Solium/issues/205 +// --elopio - 2018-05-31 +// solium-disable-next-line max-len contract ZepToken is Migratable, StandardToken, MintableToken, PausableToken, BurnableToken { + // solium-disable-next-line uppercase string public constant name = "Zep Token"; + // solium-disable-next-line uppercase string public constant symbol = "ZEP"; + // solium-disable-next-line uppercase uint8 public constant decimals = 18; /** diff --git a/contracts/test/MockKernelV2.sol b/contracts/test/MockKernelV2.sol index 295dee5..564dfc1 100644 --- a/contracts/test/MockKernelV2.sol +++ b/contracts/test/MockKernelV2.sol @@ -2,17 +2,25 @@ pragma solidity ^0.4.18; import "../Kernel.sol"; + contract MockKernelV2 is Kernel { function testV2() public pure returns (string) { return "v2"; } - + // Duplicate developer payout, because reasons - function _payoutAndVouch(address voucher, Release release, uint256 amount, bytes data) internal { + function _payoutAndVouch( + address voucher, + Release release, + uint256 amount, + bytes data + ) + internal + { uint256 developerPayout = amount.mul(2).div(developerFraction); require(developerPayout > 0); - + uint256 vouchedAmount = amount.sub(developerPayout); vouches.vouch(voucher, release, vouchedAmount, data); require(token.transfer(release.developer(), developerPayout)); diff --git a/contracts/test/PickACard.sol b/contracts/test/PickACard.sol index ea1c2f2..6389b7a 100644 --- a/contracts/test/PickACard.sol +++ b/contracts/test/PickACard.sol @@ -3,15 +3,18 @@ pragma solidity ^0.4.21; import "./stdlib/ERC721Token.sol"; import "zos-lib/contracts/migrations/Migratable.sol"; + contract PickACard is Migratable { uint256 public constant MAX_CARD = 10; ERC721Token public erc721; - function initialize(ERC721Token _erc721) public isInitializer("PickACard", "0") { + function initialize(ERC721Token _erc721) + public isInitializer("PickACard", "0") + { erc721 = _erc721; erc721.initialize(); - for(uint256 i = 0; i <= MAX_CARD; i++) { + for (uint256 i = 0; i <= MAX_CARD; i++) { erc721.mint(this, i); } } diff --git a/contracts/test/stdlib/ERC721Basic.sol b/contracts/test/stdlib/ERC721Basic.sol index ee5b765..1bd050a 100644 --- a/contracts/test/stdlib/ERC721Basic.sol +++ b/contracts/test/stdlib/ERC721Basic.sol @@ -1,25 +1,39 @@ pragma solidity ^0.4.21; + /** * @title ERC721 Non-Fungible Token Standard basic interface * @dev see https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md */ contract ERC721Basic { - event Transfer(address indexed _from, address indexed _to, uint256 _tokenId); - event Approval(address indexed _owner, address indexed _approved, uint256 _tokenId); - event ApprovalForAll(address indexed _owner, address indexed _operator, bool _approved); + event Transfer( + address indexed _from, address indexed _to, uint256 _tokenId + ); + event Approval( + address indexed _owner, address indexed _approved, uint256 _tokenId + ); + event ApprovalForAll( + address indexed _owner, address indexed _operator, bool _approved + ); function balanceOf(address _owner) public view returns (uint256 _balance); function ownerOf(uint256 _tokenId) public view returns (address _owner); function exists(uint256 _tokenId) public view returns (bool _exists); function approve(address _to, uint256 _tokenId) public; - function getApproved(uint256 _tokenId) public view returns (address _operator); - + function getApproved(uint256 _tokenId) + public view returns (address _operator); + function setApprovalForAll(address _operator, bool _approved) public; - function isApprovedForAll(address _owner, address _operator) public view returns (bool); + function isApprovedForAll(address _owner, address _operator) + public view returns (bool); function transferFrom(address _from, address _to, uint256 _tokenId) public; - function safeTransferFrom(address _from, address _to, uint256 _tokenId) public; - function safeTransferFrom(address _from, address _to, uint256 _tokenId, bytes _data) public; + function safeTransferFrom(address _from, address _to, uint256 _tokenId) + public; + + function safeTransferFrom( + address _from, address _to, uint256 _tokenId, bytes _data + ) + public; } diff --git a/contracts/test/stdlib/ERC721BasicToken.sol b/contracts/test/stdlib/ERC721BasicToken.sol index cb66dd3..45ed212 100644 --- a/contracts/test/stdlib/ERC721BasicToken.sol +++ b/contracts/test/stdlib/ERC721BasicToken.sol @@ -5,6 +5,7 @@ import "./ERC721Receiver.sol"; import "zeppelin-solidity/contracts/math/SafeMath.sol"; import "zeppelin-solidity/contracts/AddressUtils.sol"; + /** * @title ERC721 Non-Fungible Token Standard basic implementation * @dev see https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md @@ -106,7 +107,6 @@ contract ERC721BasicToken is ERC721Basic { return tokenApprovals[_tokenId]; } - /** * @dev Sets or unsets the approval of a given operator * @dev An operator is allowed to transfer all tokens of the sender on their behalf @@ -125,7 +125,9 @@ contract ERC721BasicToken is ERC721Basic { * @param _operator operator address which you want to query the approval of * @return bool whether the given operator is approved by the given owner */ - function isApprovedForAll(address _owner, address _operator) public view returns (bool) { + function isApprovedForAll(address _owner, address _operator) + public view returns (bool) + { return operatorApprovals[_owner][_operator]; } @@ -137,7 +139,14 @@ contract ERC721BasicToken is ERC721Basic { * @param _to address to receive the ownership of the given token ID * @param _tokenId uint256 ID of the token to be transferred */ - function transferFrom(address _from, address _to, uint256 _tokenId) public canTransfer(_tokenId) { + function transferFrom( + address _from, + address _to, + uint256 _tokenId + ) + public + canTransfer(_tokenId) + { require(_from != address(0)); require(_to != address(0)); @@ -159,7 +168,14 @@ contract ERC721BasicToken is ERC721Basic { * @param _to address to receive the ownership of the given token ID * @param _tokenId uint256 ID of the token to be transferred */ - function safeTransferFrom(address _from, address _to, uint256 _tokenId) public canTransfer(_tokenId) { + function safeTransferFrom( + address _from, + address _to, + uint256 _tokenId + ) + public + canTransfer(_tokenId) + { safeTransferFrom(_from, _to, _tokenId, ""); } @@ -175,7 +191,15 @@ contract ERC721BasicToken is ERC721Basic { * @param _tokenId uint256 ID of the token to be transferred * @param _data bytes data to send along with a safe transfer check */ - function safeTransferFrom(address _from, address _to, uint256 _tokenId, bytes _data) public canTransfer(_tokenId) { + function safeTransferFrom( + address _from, + address _to, + uint256 _tokenId, + bytes _data + ) + public + canTransfer(_tokenId) + { transferFrom(_from, _to, _tokenId); require(checkAndCallSafeTransfer(_from, _to, _tokenId, _data)); } @@ -187,9 +211,23 @@ contract ERC721BasicToken is ERC721Basic { * @return bool whether the msg.sender is approved for the given token ID, * is an operator of the owner, or is the owner of the token */ - function isApprovedOrOwner(address _spender, uint256 _tokenId) internal view returns (bool) { + function isApprovedOrOwner( + address _spender, + uint256 _tokenId + ) + internal + view + returns (bool) + { address owner = ownerOf(_tokenId); - return _spender == owner || getApproved(_tokenId) == _spender || isApprovedForAll(owner, _spender); + // Disable solium check because of + // https://github.com/duaraghav8/Solium/issues/175 + // solium-disable-next-line operator-whitespace + return ( + _spender == owner || + getApproved(_tokenId) == _spender || + isApprovedForAll(owner, _spender) + ); } /** @@ -260,11 +298,20 @@ contract ERC721BasicToken is ERC721Basic { * @param _data bytes optional data to send along with the call * @return whether the call correctly returned the expected magic value */ - function checkAndCallSafeTransfer(address _from, address _to, uint256 _tokenId, bytes _data) internal returns (bool) { + function checkAndCallSafeTransfer( + address _from, + address _to, + uint256 _tokenId, + bytes _data + ) + internal + returns (bool) + { if (!_to.isContract()) { return true; } - bytes4 retval = ERC721Receiver(_to).onERC721Received(_from, _tokenId, _data); + bytes4 retval = ERC721Receiver(_to).onERC721Received( + _from, _tokenId, _data); return (retval == ERC721_RECEIVED); } } diff --git a/contracts/test/stdlib/ERC721Receiver.sol b/contracts/test/stdlib/ERC721Receiver.sol index 892ee7e..163ab49 100644 --- a/contracts/test/stdlib/ERC721Receiver.sol +++ b/contracts/test/stdlib/ERC721Receiver.sol @@ -1,5 +1,6 @@ pragma solidity ^0.4.21; + /** * @title ERC721 token receiver interface * @dev Interface for any contract that wants to support safeTransfers @@ -11,7 +12,7 @@ contract ERC721Receiver { * Equals to `bytes4(keccak256("onERC721Received(address,uint256,bytes)"))`, * which can be also obtained as `ERC721Receiver(0).onERC721Received.selector` */ - bytes4 constant ERC721_RECEIVED = 0xf0b9e5ba; + bytes4 constant ERC721_RECEIVED = 0xf0b9e5ba; /** * @notice Handle the receipt of an NFT @@ -20,10 +21,16 @@ contract ERC721Receiver { * transfer. This function MUST use 50,000 gas or less. Return of other * than the magic value MUST result in the transaction being reverted. * Note: the contract address is always the message sender. - * @param _from The sending address + * @param _from The sending address * @param _tokenId The NFT identifier which is being transfered * @param _data Additional data with no specified format * @return `bytes4(keccak256("onERC721Received(address,uint256,bytes)"))` */ - function onERC721Received(address _from, uint256 _tokenId, bytes _data) public returns(bytes4); + function onERC721Received( + address _from, + uint256 _tokenId, + bytes _data + ) + public + returns(bytes4); } diff --git a/contracts/test/stdlib/ERC721Token.sol b/contracts/test/stdlib/ERC721Token.sol index d9fb8f9..2770f0b 100644 --- a/contracts/test/stdlib/ERC721Token.sol +++ b/contracts/test/stdlib/ERC721Token.sol @@ -3,6 +3,7 @@ pragma solidity ^0.4.21; import "./ERC721BasicToken.sol"; import "zeppelin-solidity/contracts/ownership/Ownable.sol"; + contract ERC721Token is ERC721BasicToken, Ownable { bool private _initialized = false; diff --git a/package-lock.json b/package-lock.json index 8ba4cd5..9b078c4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4776,6 +4776,12 @@ "resolved": "https://registry.npmjs.org/js-sha3/-/js-sha3-0.5.5.tgz", "integrity": "sha1-uvDA6MVK1ZA0R9+Wreekobynmko=" }, + "js-string-escape": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/js-string-escape/-/js-string-escape-1.0.1.tgz", + "integrity": "sha1-4mJbrbwNZ8dTPp7cEGjFh65BN+8=", + "dev": true + }, "js-tokens": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.2.tgz", @@ -7356,6 +7362,12 @@ } } }, + "sol-digger": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/sol-digger/-/sol-digger-0.0.2.tgz", + "integrity": "sha1-QGxKnTHiaef4jrHC6hATGOXgkCU=", + "dev": true + }, "sol-explore": { "version": "1.6.2", "resolved": "https://registry.npmjs.org/sol-explore/-/sol-explore-1.6.2.tgz", @@ -7519,6 +7531,229 @@ } } }, + "solium": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/solium/-/solium-1.1.7.tgz", + "integrity": "sha512-yYbalsrzJCU+QJ0HZvxAT4IQIqI1e6KPW2vop0NaHwdijqhQC9fJkVioCrL18NbO2Z8rdcnx8Y0JpvYJWrIjRg==", + "dev": true, + "requires": { + "ajv": "5.5.2", + "chokidar": "1.7.0", + "colors": "1.2.1", + "commander": "2.9.0", + "js-string-escape": "1.0.1", + "lodash": "4.17.5", + "sol-digger": "0.0.2", + "sol-explore": "1.6.1", + "solium-plugin-security": "0.1.1", + "solparse": "2.2.5", + "text-table": "0.2.0" + }, + "dependencies": { + "ansi-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", + "dev": true + }, + "camelcase": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-4.1.0.tgz", + "integrity": "sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0=", + "dev": true + }, + "cliui": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-4.1.0.tgz", + "integrity": "sha512-4FG+RSG9DL7uEwRUZXZn3SS34DiDPfzP0VOiEwtUWlE+AR2EIg+hSyvrIgUUfhdgR/UkAeW2QHgeP+hWrXs7jQ==", + "dev": true, + "requires": { + "string-width": "2.1.1", + "strip-ansi": "4.0.0", + "wrap-ansi": "2.1.0" + } + }, + "debug": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", + "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + }, + "diff": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/diff/-/diff-3.3.1.tgz", + "integrity": "sha512-MKPHZDMB0o6yHyDryUOScqZibp914ksXwAMYMTHj6KO8UeKsRYNJD3oNCKjTqZon+V488P7N/HzXF8t7ZR95ww==", + "dev": true + }, + "find-up": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", + "integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=", + "dev": true, + "requires": { + "locate-path": "2.0.0" + } + }, + "glob": { + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", + "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==", + "dev": true, + "requires": { + "fs.realpath": "1.0.0", + "inflight": "1.0.6", + "inherits": "2.0.3", + "minimatch": "3.0.4", + "once": "1.4.0", + "path-is-absolute": "1.0.1" + } + }, + "growl": { + "version": "1.10.3", + "resolved": "https://registry.npmjs.org/growl/-/growl-1.10.3.tgz", + "integrity": "sha512-hKlsbA5Vu3xsh1Cg3J7jSmX/WaW6A5oBeqzM88oNbCRQFz+zUaXm6yxS4RVytp1scBoJzSYl4YAEOQIt6O8V1Q==", + "dev": true + }, + "has-flag": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-2.0.0.tgz", + "integrity": "sha1-6CB68cx7MNRGzHC3NLXovhj4jVE=", + "dev": true + }, + "is-fullwidth-code-point": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", + "dev": true + }, + "mocha": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-4.1.0.tgz", + "integrity": "sha512-0RVnjg1HJsXY2YFDoTNzcc1NKhYuXKRrBAG2gDygmJJA136Cs2QlRliZG1mA0ap7cuaT30mw16luAeln+4RiNA==", + "dev": true, + "requires": { + "browser-stdout": "1.3.0", + "commander": "2.11.0", + "debug": "3.1.0", + "diff": "3.3.1", + "escape-string-regexp": "1.0.5", + "glob": "7.1.2", + "growl": "1.10.3", + "he": "1.1.1", + "mkdirp": "0.5.1", + "supports-color": "4.4.0" + }, + "dependencies": { + "commander": { + "version": "2.11.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.11.0.tgz", + "integrity": "sha512-b0553uYA5YAEGgyYIGYROzKQ7X5RAqedkfjiZxwi0kL1g3bOaBNNZfYkzt/CL0umgD5wc9Jec2FbB98CjkMRvQ==", + "dev": true + } + } + }, + "os-locale": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-2.1.0.tgz", + "integrity": "sha512-3sslG3zJbEYcaC4YVAvDorjGxc7tv6KVATnLPZONiljsUncvihe9BQoVCEs0RZ1kmf4Hk9OBqlZfJZWI4GanKA==", + "dev": true, + "requires": { + "execa": "0.7.0", + "lcid": "1.0.0", + "mem": "1.1.0" + } + }, + "sol-explore": { + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/sol-explore/-/sol-explore-1.6.1.tgz", + "integrity": "sha1-tZ8HPGn+MyVg1aEMMrqMp/KYbPs=", + "dev": true + }, + "solparse": { + "version": "2.2.5", + "resolved": "https://registry.npmjs.org/solparse/-/solparse-2.2.5.tgz", + "integrity": "sha512-t7tvtR6KU6QfPYLMv1nlCh9DA8HYIu5tbjHpKu0fhGFZ1NuSp0KKDHfFHv07g6v1xgcuUY3rVqNFjZt5b9+5qA==", + "dev": true, + "requires": { + "mocha": "4.1.0", + "pegjs": "0.10.0", + "yargs": "10.1.2" + } + }, + "string-width": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", + "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", + "dev": true, + "requires": { + "is-fullwidth-code-point": "2.0.0", + "strip-ansi": "4.0.0" + } + }, + "strip-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "dev": true, + "requires": { + "ansi-regex": "3.0.0" + } + }, + "supports-color": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.4.0.tgz", + "integrity": "sha512-rKC3+DyXWgK0ZLKwmRsrkyHVZAjNkfzeehuFWdGGcqGDTZFH73+RH6S/RDAAxl9GusSjZSUWYLmT9N5pzXFOXQ==", + "dev": true, + "requires": { + "has-flag": "2.0.0" + } + }, + "which-module": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz", + "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=", + "dev": true + }, + "yargs": { + "version": "10.1.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-10.1.2.tgz", + "integrity": "sha512-ivSoxqBGYOqQVruxD35+EyCFDYNEFL/Uo6FcOnz+9xZdZzK0Zzw4r4KhbrME1Oo2gOggwJod2MnsdamSG7H9ig==", + "dev": true, + "requires": { + "cliui": "4.1.0", + "decamelize": "1.2.0", + "find-up": "2.1.0", + "get-caller-file": "1.0.2", + "os-locale": "2.1.0", + "require-directory": "2.1.1", + "require-main-filename": "1.0.1", + "set-blocking": "2.0.0", + "string-width": "2.1.1", + "which-module": "2.0.0", + "y18n": "3.2.1", + "yargs-parser": "8.1.0" + } + }, + "yargs-parser": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-8.1.0.tgz", + "integrity": "sha512-yP+6QqN8BmrgW2ggLtTbdrOyBNSI7zBa4IykmiV5R1wl1JWNxQvWhMfMdmzIYtKU7oP3OOInY/tl2ov3BDjnJQ==", + "dev": true, + "requires": { + "camelcase": "4.1.0" + } + } + } + }, + "solium-plugin-security": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/solium-plugin-security/-/solium-plugin-security-0.1.1.tgz", + "integrity": "sha512-kpLirBwIq4mhxk0Y/nn5cQ6qdJTI+U1LO3gpoNIcqNaW+sI058moXBe2UiHs+9wvF9IzYD49jcKhFTxcR9u9SQ==", + "dev": true + }, "sort-keys": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/sort-keys/-/sort-keys-2.0.0.tgz", diff --git a/package.json b/package.json index fbee288..eccf81a 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,9 @@ "test": "scripts/test.sh", "prepack": "truffle compile && babel src --out-dir lib", "deploy-local": "truffle exec scripts/deploy.js --network local", - "createapp-local": "truffle exec scripts/createapp.js --network local" + "createapp-local": "truffle exec scripts/createapp.js --network local", + "lint:sol": "solium -d .", + "lint:sol:fix": "solium -d . --fix" }, "devDependencies": { "babel-cli": "^6.26.0", @@ -36,6 +38,7 @@ "coveralls": "^3.0.0", "ethereumjs-abi": "^0.6.5", "solidity-coverage": "^0.4.15", + "solium": "^1.1.7", "truffle": "^4.1.6", "zos": "^0.3.16" },