From cd4a7f9451cf127d501be7b68ecf33e3cf94f023 Mon Sep 17 00:00:00 2001 From: Mudit Gupta Date: Wed, 9 Jan 2019 18:35:25 +0530 Subject: [PATCH] Solidity 0.5.0 (#478) * Added truffle next * Added refactor plugin * Capped STO refactor * constant to view * Updated refactor * added storage location to return params * pm fixes * Oraclize fixes * Custom datatype fixes * Updated refactor * PM fixes * Updated Oraclize * wip * It's compiling! * Updated CI config * Updated CI config * Updated circleCI config * Updated circleCI * Updated CircleCI config * Payable address changes * reduced contract size for test * Updated truffle * Deployment fixed * merge refactor * Revert oraclize changes * WIP * Migrations refactoring complete * Prettier * refactor js * wip * Create insctance fixed * Create instance changes * await at * log watch refactor * Getsig fixed * cappedsto init fn fixed * Block number and timestamp fixed * Await at * toWei to BN * Time travel fixed * Time travel changed * wip * Minor fixes * WIP * bug fix * WIP * capped stro tests fixed * Investor details fixed * ST instance name fixed * Checkpoint tests fixed * CTM tests fixed * empty bytes to 0x0 * wip * toNumber to toString * Whitelist changes * ERC20 tests fixed * WIP * Ether dividend tests fixed * Added fixed address * Permissions to hex * GPM tests fixed * gtm tests fixed * Coverage fixed * updated oz * Updated circleCI docker image * updated coverage script * Updated circleci config * Updated travis script * Updated ci scripts * Issuance tests fixed * MATM tests fixed * Module registry tests fixed * percentage tm tests fixed * Presale tests fixed * STR tests fixed * ST tests fixed * fixed z_general_permission_manager_fuzzer.js * fixed y_scheduled_checkpoints.js * fixed v_tracked_redemptions.js * fixed u_module_registry_proxy.js * fixed t_security_token_registry_proxy.js * Updated usd tiered sto tests * fixed r_concurrent_STO.js * simulation WIP * USDTSTO sim fixed * minor cleanup * added tolerance * Tolerance fixed * update version to 0.5.0 * fixed compilation errors * Coverage script fixed * Tests updated * fixed 2_deploy_contracts.js * Tests fixed * time travel updated * STR test fixed * suggested changes * Merge compilation fix * test fixed * STR proxy tests fixed * reformatting * fixed typo * non payable owner * triggering travis * ST optimization * uncommented tests --- .circleci/config.yml | 12 +- .solcover.js | 2 +- .travis.yml | 8 +- contracts/FeatureRegistry.sol | 9 +- contracts/Migrations.sol | 8 +- contracts/ModuleRegistry.sol | 71 +- contracts/Pausable.sol | 5 +- contracts/PolymathRegistry.sol | 10 +- contracts/ReclaimTokens.sol | 3 +- contracts/RegistryUpdater.sol | 5 +- contracts/STRGetter.sol | 27 +- contracts/SecurityTokenRegistry.sol | 112 +- contracts/external/IMedianizer.sol | 9 +- contracts/external/oraclizeAPI.sol | 1638 +++++++------ contracts/helpers/PolyToken.sol | 31 +- contracts/interfaces/IBoot.sol | 5 +- contracts/interfaces/IFeatureRegistry.sol | 5 +- contracts/interfaces/IModule.sol | 7 +- contracts/interfaces/IModuleFactory.sol | 23 +- contracts/interfaces/IModuleRegistry.sol | 13 +- contracts/interfaces/IOracle.sol | 3 +- contracts/interfaces/IOwnable.sol | 5 +- contracts/interfaces/IPoly.sol | 20 +- contracts/interfaces/IPolymathRegistry.sol | 7 +- contracts/interfaces/ISTFactory.sol | 15 +- contracts/interfaces/ISTO.sol | 7 +- contracts/interfaces/ISecurityToken.sol | 97 +- .../interfaces/ISecurityTokenRegistry.sol | 57 +- contracts/interfaces/ITransferManager.sol | 9 +- contracts/interfaces/IUSDTieredSTOProxy.sol | 15 +- contracts/interfaces/TransferManagerEnums.sol | 5 +- .../libraries/BokkyPooBahsDateTimeLibrary.sol | 113 +- contracts/libraries/DecimalMath.sol | 11 +- contracts/libraries/Encoder.sol | 15 +- contracts/libraries/KindMath.sol | 11 +- contracts/libraries/TokenLib.sol | 110 +- contracts/libraries/Util.sol | 27 +- contracts/libraries/VersionUtils.sol | 89 +- contracts/mocks/MockBurnFactory.sol | 20 +- contracts/mocks/MockFactory.sol | 18 +- contracts/mocks/MockModuleRegistry.sol | 6 +- contracts/mocks/MockOracle.sol | 3 +- contracts/mocks/MockPolyOracle.sol | 7 +- contracts/mocks/MockRedemptionManager.sol | 10 +- contracts/mocks/MockWrongTypeFactory.sol | 15 +- contracts/mocks/PolyTokenFaucet.sol | 40 +- contracts/mocks/SecurityTokenRegistryMock.sol | 11 +- contracts/mocks/TestSTOFactory.sol | 17 +- contracts/modules/Burn/IBurn.sol | 2 +- .../modules/Checkpoint/DividendCheckpoint.sol | 56 +- .../Checkpoint/DividendCheckpointStorage.sol | 17 +- .../Checkpoint/ERC20DividendCheckpoint.sol | 111 +- .../ERC20DividendCheckpointFactory.sol | 28 +- .../ERC20DividendCheckpointStorage.sol | 5 +- .../Checkpoint/EtherDividendCheckpoint.sol | 75 +- .../EtherDividendCheckpointFactory.sol | 28 +- contracts/modules/Checkpoint/ICheckpoint.sol | 2 +- .../Experimental/Burn/TrackedRedemption.sol | 13 +- .../Burn/TrackedRedemptionFactory.sol | 27 +- .../Mixed/ScheduledCheckpoint.sol | 47 +- .../Mixed/ScheduledCheckpointFactory.sol | 35 +- .../LockupVolumeRestrictionTM.sol | 103 +- .../LockupVolumeRestrictionTMFactory.sol | 28 +- .../SingleTradeVolumeRestrictionTM.sol | 58 +- .../SingleTradeVolumeRestrictionTMFactory.sol | 25 +- contracts/modules/Module.sol | 21 +- contracts/modules/ModuleFactory.sol | 35 +- contracts/modules/ModuleStorage.sol | 5 +- .../GeneralPermissionManager.sol | 78 +- .../GeneralPermissionManagerFactory.sol | 27 +- .../GeneralPermissionManagerStorage.sol | 2 +- .../PermissionManager/IPermissionManager.sol | 33 +- contracts/modules/STO/CappedSTO.sol | 57 +- contracts/modules/STO/CappedSTOFactory.sol | 33 +- contracts/modules/STO/CappedSTOStorage.sol | 2 +- contracts/modules/STO/DummySTO.sol | 19 +- contracts/modules/STO/DummySTOFactory.sol | 31 +- contracts/modules/STO/DummySTOStorage.sol | 2 +- contracts/modules/STO/PreSaleSTO.sol | 35 +- contracts/modules/STO/PreSaleSTOFactory.sol | 30 +- contracts/modules/STO/PreSaleSTOStorage.sol | 2 +- contracts/modules/STO/STO.sol | 10 +- contracts/modules/STO/STOStorage.sol | 9 +- contracts/modules/STO/USDTieredSTO.sol | 325 ++- contracts/modules/STO/USDTieredSTOFactory.sol | 29 +- contracts/modules/STO/USDTieredSTOStorage.sol | 23 +- .../TransferManager/CountTransferManager.sol | 20 +- .../CountTransferManagerFactory.sol | 29 +- .../CountTransferManagerStorage.sol | 2 +- .../GeneralTransferManager.sol | 82 +- .../GeneralTransferManagerFactory.sol | 35 +- .../GeneralTransferManagerStorage.sol | 5 +- .../ManualApprovalTransferManager.sol | 23 +- .../ManualApprovalTransferManagerFactory.sol | 30 +- .../ManualApprovalTransferManagerStorage.sol | 2 +- .../PercentageTransferManager.sol | 34 +- .../PercentageTransferManagerFactory.sol | 30 +- .../PercentageTransferManagerStorage.sol | 2 +- .../TransferManager/TransferManager.sol | 3 +- contracts/oracles/MakerDAOOracle.sol | 5 +- contracts/oracles/PolyOracle.sol | 28 +- contracts/proxy/CappedSTOProxy.sol | 12 +- contracts/proxy/CountTransferManagerProxy.sol | 12 +- contracts/proxy/DummySTOProxy.sol | 12 +- .../proxy/ERC20DividendCheckpointProxy.sol | 18 +- .../proxy/EtherDividendCheckpointProxy.sol | 18 +- .../proxy/GeneralPermissionManagerProxy.sol | 12 +- .../proxy/GeneralTransferManagerProxy.sol | 18 +- .../ManualApprovalTransferManagerProxy.sol | 12 +- contracts/proxy/ModuleRegistryProxy.sol | 5 +- contracts/proxy/OwnedProxy.sol | 11 +- contracts/proxy/OwnedUpgradeabilityProxy.sol | 21 +- .../proxy/PercentageTransferManagerProxy.sol | 2 +- contracts/proxy/PreSaleSTOProxy.sol | 2 +- contracts/proxy/Proxy.sol | 12 +- .../proxy/SecurityTokenRegistryProxy.sol | 5 +- contracts/proxy/USDTieredSTOProxy.sol | 13 +- contracts/proxy/UpgradeabilityProxy.sol | 7 +- contracts/storage/EternalStorage.sol | 55 +- contracts/tokens/STFactory.sol | 26 +- contracts/tokens/SecurityToken.sol | 199 +- migrations/1_deploy_token.js | 15 +- migrations/2_deploy_contracts.js | 790 +++--- package.json | 11 +- scripts/calculateSize.js | 20 +- scripts/compareStorageLayout.js | 211 +- scripts/encoders/encode_CappedSTO.js | 75 +- scripts/patch.js | 43 +- scripts/test.sh | 3 +- scripts/tokenInfo-v1.js | 72 +- scripts/tokenInfo-v2.js | 74 +- test/a_poly_oracle.js | 87 +- test/b_capped_sto.js | 449 ++-- test/c_checkpoints.js | 113 +- test/d_count_transfer_manager.js | 247 +- test/e_erc20_dividends.js | 622 +++-- test/f_ether_dividends.js | 603 +++-- test/g_general_permission_manager.js | 256 +- test/h_general_transfer_manager.js | 373 ++- test/helpers/contracts/PolyToken.sol | 6 +- test/helpers/createInstances.js | 145 +- test/helpers/latestTime.js | 9 +- test/helpers/signData.js | 4 +- test/helpers/time.js | 89 +- test/helpers/utils.js | 24 +- test/i_Issuance.js | 94 +- test/j_manual_approval_transfer_manager.js | 181 +- test/k_module_registry.js | 204 +- test/l_percentage_transfer_manager.js | 189 +- test/m_presale_sto.js | 131 +- test/n_security_token_registry.js | 280 +-- test/o_security_token.js | 405 ++- test/p_usd_tiered_sto.js | 2183 +++++++++-------- test/q_usd_tiered_sto_sim.js | 522 ++-- test/r_concurrent_STO.js | 57 +- test/s_v130_to_v140_upgrade.js | 94 +- test/t_security_token_registry_proxy.js | 50 +- test/u_module_registry_proxy.js | 41 +- test/v_tracked_redemptions.js | 76 +- ...kup_volume_restriction_transfer_manager.js | 627 +++-- test/y_scheduled_checkpoints.js | 267 +- test/z_general_permission_manager_fuzzer.js | 573 +++-- truffle-ci.js | 15 +- truffle-config.js | 17 +- upgrade.js | 19 + yarn.lock | 1702 ++++++++++--- 166 files changed, 9308 insertions(+), 7796 deletions(-) create mode 100644 upgrade.js diff --git a/.circleci/config.yml b/.circleci/config.yml index a39d287a0..8bd70f869 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -2,13 +2,12 @@ version: 2 jobs: build: docker: - - image: circleci/node:8 + - image: maxsam4/solidity-kit steps: - checkout - restore_cache: key: dependency-cache-{{ checksum "package.json" }} - run: yarn install - - run: sudo npm i truffle -g - run: node --version - run: truffle version - run: truffle compile @@ -18,14 +17,13 @@ jobs: - node_modules test: docker: - - image: circleci/node:8 + - image: maxsam4/solidity-kit parallelism: 2 steps: - checkout - restore_cache: key: dependency-cache-{{ checksum "package.json" }} - run: yarn install - - run: sudo npm i truffle -g - run: node --version - run: truffle version - run: npm run test @@ -39,13 +37,12 @@ jobs: path: ./test-results/mocha/results.xml coverage: docker: - - image: circleci/node:8 + - image: maxsam4/solidity-kit steps: - checkout - restore_cache: key: dependency-cache-{{ checksum "package.json" }} - run: yarn install - - run: sudo npm i truffle -g - run: node --version - run: truffle version - run: @@ -59,13 +56,12 @@ jobs: path: ./coverage/lcov.info docs: docker: - - image: circleci/node:8 + - image: maxsam4/solidity-kit steps: - checkout - restore_cache: key: dependency-cache-{{ checksum "package.json" }} - run: yarn install - - run: sudo npm i truffle -g - run: node --version - run: truffle version - run: npm run docs diff --git a/.solcover.js b/.solcover.js index dac86d6e3..2e5750f8d 100644 --- a/.solcover.js +++ b/.solcover.js @@ -5,5 +5,5 @@ module.exports = { testCommand: 'node ../node_modules/.bin/truffle test `find test/*.js ! -name a_poly_oracle.js -and ! -name s_v130_to_v140_upgrade.js -and ! -name q_usd_tiered_sto_sim.js -and ! -name z_general_permission_manager_fuzzer.js` --network coverage', deepSkip: true, skipFiles: ['external', 'flat', 'helpers', 'mocks', 'oracles', 'libraries/KindMath.sol', 'libraries/BokkyPooBahsDateTimeLibrary.sol', 'storage', 'modules/Experimental'], - forceParse: ['mocks', 'oracles', 'modules/Experimental'] + forceParse: ['mocks', 'oracles', 'helpers', 'modules/Experimental'] }; diff --git a/.travis.yml b/.travis.yml index b676c5840..f5f910f50 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,7 +6,13 @@ cache: - node_modules jobs: include: - - stage: test + - stage: Test + install: + - echo -ne '\n' | sudo add-apt-repository ppa:ethereum/ethereum + - sudo apt-get update + - sudo apt-get install -y dpkg + - sudo apt-get install -y solc + - yarn install before_script: truffle version script: npm run test notifications: diff --git a/contracts/FeatureRegistry.sol b/contracts/FeatureRegistry.sol index 936a19976..1fbbb2134 100644 --- a/contracts/FeatureRegistry.sol +++ b/contracts/FeatureRegistry.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.24; +pragma solidity ^0.5.0; import "./ReclaimTokens.sol"; import "./interfaces/IFeatureRegistry.sol"; @@ -7,8 +7,7 @@ import "./interfaces/IFeatureRegistry.sol"; * @title Registry for managing polymath feature switches */ contract FeatureRegistry is IFeatureRegistry, ReclaimTokens { - - mapping (bytes32 => bool) public featureStatus; + mapping(bytes32 => bool) public featureStatus; event ChangeFeatureStatus(string _nameKey, bool _newStatus); @@ -17,7 +16,7 @@ contract FeatureRegistry is IFeatureRegistry, ReclaimTokens { * @param _nameKey is the key for the feature status mapping * @return bool */ - function getFeatureStatus(string _nameKey) external view returns(bool) { + function getFeatureStatus(string calldata _nameKey) external view returns(bool) { bytes32 key = keccak256(bytes(_nameKey)); return featureStatus[key]; } @@ -28,7 +27,7 @@ contract FeatureRegistry is IFeatureRegistry, ReclaimTokens { * @param _nameKey is the key for the feature status mapping * @param _newStatus is the new feature status */ - function setFeatureStatus(string _nameKey, bool _newStatus) public onlyOwner { + function setFeatureStatus(string calldata _nameKey, bool _newStatus) external onlyOwner { bytes32 key = keccak256(bytes(_nameKey)); require(featureStatus[key] != _newStatus, "Status unchanged"); emit ChangeFeatureStatus(_nameKey, _newStatus); diff --git a/contracts/Migrations.sol b/contracts/Migrations.sol index 9f2b50b60..a15e3c71b 100644 --- a/contracts/Migrations.sol +++ b/contracts/Migrations.sol @@ -1,8 +1,6 @@ -pragma solidity ^0.4.24; - +pragma solidity ^0.5.0; contract Migrations { - address public owner; uint public lastCompletedMigration; @@ -16,11 +14,11 @@ contract Migrations { owner = msg.sender; } - function setCompleted(uint _completed)public restricted { + function setCompleted(uint _completed) public restricted { lastCompletedMigration = _completed; } - function upgrade(address _newAddress)public restricted { + function upgrade(address _newAddress) public restricted { Migrations upgraded = Migrations(_newAddress); upgraded.setCompleted(lastCompletedMigration); } diff --git a/contracts/ModuleRegistry.sol b/contracts/ModuleRegistry.sol index f03a360a9..5c538d583 100644 --- a/contracts/ModuleRegistry.sol +++ b/contracts/ModuleRegistry.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.24; +pragma solidity ^0.5.0; import "openzeppelin-solidity/contracts/token/ERC20/IERC20.sol"; import "./interfaces/IModuleRegistry.sol"; @@ -41,7 +41,7 @@ contract ModuleRegistry is IModuleRegistry, EternalStorage { // Emit when network becomes paused event Pause(uint256 _timestammp); - // Emit when network becomes unpaused + // Emit when network becomes unpaused event Unpause(uint256 _timestamp); // Emit when Module is used by the SecurityToken event ModuleUsed(address indexed _moduleFactory, address indexed _securityToken); @@ -62,7 +62,7 @@ contract ModuleRegistry is IModuleRegistry, EternalStorage { * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { - require(msg.sender == owner(),"sender must be owner"); + require(msg.sender == owner(), "sender must be owner"); _; } @@ -70,8 +70,7 @@ contract ModuleRegistry is IModuleRegistry, EternalStorage { * @notice Modifier to make a function callable only when the contract is not paused. */ modifier whenNotPausedOrOwner() { - if (msg.sender == owner()) - _; + if (msg.sender == owner()) _; else { require(!isPaused(), "Already paused"); _; @@ -99,13 +98,12 @@ contract ModuleRegistry is IModuleRegistry, EternalStorage { ///////////////////////////// // Constructor - constructor () public - { + constructor() public { } function initialize(address _polymathRegistry, address _owner) external payable { - require(!getBool(Encoder.getKey("initialised")),"already initialized"); + require(!getBool(Encoder.getKey("initialised")), "already initialized"); require(_owner != address(0) && _polymathRegistry != address(0), "0x address is invalid"); set(Encoder.getKey("polymathRegistry"), _polymathRegistry); set(Encoder.getKey("owner"), _owner); @@ -124,7 +122,10 @@ contract ModuleRegistry is IModuleRegistry, EternalStorage { // This if statement is required to be able to add modules from the token proxy contract during deployment if (ISecurityTokenRegistry(getAddress(Encoder.getKey("securityTokenRegistry"))).isSecurityToken(msg.sender)) { if (IFeatureRegistry(getAddress(Encoder.getKey("featureRegistry"))).getFeatureStatus("customModulesAllowed")) { - require(getBool(Encoder.getKey("verified", _moduleFactory)) || IOwnable(_moduleFactory).owner() == IOwnable(msg.sender).owner(),"ModuleFactory must be verified or SecurityToken owner must be ModuleFactory owner"); + require( + getBool(Encoder.getKey("verified", _moduleFactory)) || IOwnable(_moduleFactory).owner() == IOwnable(msg.sender).owner(), + "ModuleFactory must be verified or SecurityToken owner must be ModuleFactory owner" + ); } else { require(getBool(Encoder.getKey("verified", _moduleFactory)), "ModuleFactory must be verified"); } @@ -149,7 +150,10 @@ contract ModuleRegistry is IModuleRegistry, EternalStorage { */ function registerModule(address _moduleFactory) external whenNotPausedOrOwner { if (IFeatureRegistry(getAddress(Encoder.getKey("featureRegistry"))).getFeatureStatus("customModulesAllowed")) { - require(msg.sender == IOwnable(_moduleFactory).owner() || msg.sender == owner(),"msg.sender must be the Module Factory owner or registry curator"); + require( + msg.sender == IOwnable(_moduleFactory).owner() || msg.sender == owner(), + "msg.sender must be the Module Factory owner or registry curator" + ); } else { require(msg.sender == owner(), "Only owner allowed to register modules"); } @@ -173,7 +177,7 @@ contract ModuleRegistry is IModuleRegistry, EternalStorage { uint256(getArrayAddress(Encoder.getKey("moduleList", uint256(moduleType))).length) ); pushArray(Encoder.getKey("moduleList", uint256(moduleType)), _moduleFactory); - emit ModuleRegistered (_moduleFactory, IOwnable(_moduleFactory).owner()); + emit ModuleRegistered(_moduleFactory, IOwnable(_moduleFactory).owner()); } /** @@ -232,7 +236,7 @@ contract ModuleRegistry is IModuleRegistry, EternalStorage { * @return list of tags * @return corresponding list of module factories */ - function getTagsByTypeAndToken(uint8 _moduleType, address _securityToken) external view returns(bytes32[], address[]) { + function getTagsByTypeAndToken(uint8 _moduleType, address _securityToken) external view returns(bytes32[] memory, address[] memory) { address[] memory modules = getModulesByTypeAndToken(_moduleType, _securityToken); return _tagsByModules(modules); } @@ -243,7 +247,7 @@ contract ModuleRegistry is IModuleRegistry, EternalStorage { * @return list of tags * @return corresponding list of module factories */ - function getTagsByType(uint8 _moduleType) external view returns(bytes32[], address[]) { + function getTagsByType(uint8 _moduleType) external view returns(bytes32[] memory, address[] memory) { address[] memory modules = getModulesByType(_moduleType); return _tagsByModules(modules); } @@ -254,7 +258,7 @@ contract ModuleRegistry is IModuleRegistry, EternalStorage { * @return list of tags * @return corresponding list of module factories */ - function _tagsByModules(address[] _modules) internal view returns(bytes32[], address[]) { + function _tagsByModules(address[] memory _modules) internal view returns(bytes32[] memory, address[] memory) { uint256 counter = 0; uint256 i; uint256 j; @@ -281,7 +285,7 @@ contract ModuleRegistry is IModuleRegistry, EternalStorage { * @param _factoryAddress is the address of the module factory * @return address array which contains the list of securityTokens that use that module factory */ - function getReputationByFactory(address _factoryAddress) external view returns(address[]) { + function getReputationByFactory(address _factoryAddress) external view returns(address[] memory) { return getArrayAddress(Encoder.getKey("reputation", _factoryAddress)); } @@ -290,7 +294,7 @@ contract ModuleRegistry is IModuleRegistry, EternalStorage { * @param _moduleType Type of Module * @return address array that contains the list of addresses of module factory contracts. */ - function getModulesByType(uint8 _moduleType) public view returns(address[]) { + function getModulesByType(uint8 _moduleType) public view returns(address[] memory) { return getArrayAddress(Encoder.getKey("moduleList", uint256(_moduleType))); } @@ -300,37 +304,38 @@ contract ModuleRegistry is IModuleRegistry, EternalStorage { * @param _securityToken is the address of SecurityToken * @return address array that contains the list of available addresses of module factory contracts. */ - function getModulesByTypeAndToken(uint8 _moduleType, address _securityToken) public view returns (address[]) { + function getModulesByTypeAndToken(uint8 _moduleType, address _securityToken) public view returns(address[] memory) { uint256 _len = getArrayAddress(Encoder.getKey("moduleList", uint256(_moduleType))).length; address[] memory _addressList = getArrayAddress(Encoder.getKey("moduleList", uint256(_moduleType))); - bool _isCustomModuleAllowed = IFeatureRegistry(getAddress(Encoder.getKey("featureRegistry"))).getFeatureStatus("customModulesAllowed"); + bool _isCustomModuleAllowed = IFeatureRegistry(getAddress(Encoder.getKey("featureRegistry"))).getFeatureStatus( + "customModulesAllowed" + ); uint256 counter = 0; for (uint256 i = 0; i < _len; i++) { if (_isCustomModuleAllowed) { - if (IOwnable(_addressList[i]).owner() == IOwnable(_securityToken).owner() || getBool(Encoder.getKey("verified", _addressList[i]))) - if(_isCompatibleModule(_addressList[i], _securityToken)) - counter++; - } - else if (getBool(Encoder.getKey("verified", _addressList[i]))) { - if(_isCompatibleModule(_addressList[i], _securityToken)) - counter++; + if (IOwnable(_addressList[i]).owner() == IOwnable(_securityToken).owner() || getBool( + Encoder.getKey("verified", _addressList[i]) + )) if (_isCompatibleModule(_addressList[i], _securityToken)) counter++; + } else if (getBool(Encoder.getKey("verified", _addressList[i]))) { + if (_isCompatibleModule(_addressList[i], _securityToken)) counter++; } } address[] memory _tempArray = new address[](counter); counter = 0; for (uint256 j = 0; j < _len; j++) { if (_isCustomModuleAllowed) { - if (IOwnable(_addressList[j]).owner() == IOwnable(_securityToken).owner() || getBool(Encoder.getKey("verified", _addressList[j]))) { - if(_isCompatibleModule(_addressList[j], _securityToken)) { + if (IOwnable(_addressList[j]).owner() == IOwnable(_securityToken).owner() || getBool( + Encoder.getKey("verified", _addressList[j]) + )) { + if (_isCompatibleModule(_addressList[j], _securityToken)) { _tempArray[counter] = _addressList[j]; - counter ++; + counter++; } } - } - else if (getBool(Encoder.getKey("verified", _addressList[j]))) { - if(_isCompatibleModule(_addressList[j], _securityToken)) { + } else if (getBool(Encoder.getKey("verified", _addressList[j]))) { + if (_isCompatibleModule(_addressList[j], _securityToken)) { _tempArray[counter] = _addressList[j]; - counter ++; + counter++; } } } @@ -345,7 +350,7 @@ contract ModuleRegistry is IModuleRegistry, EternalStorage { require(_tokenContract != address(0), "0x address is invalid"); IERC20 token = IERC20(_tokenContract); uint256 balance = token.balanceOf(address(this)); - require(token.transfer(owner(), balance),"token transfer failed"); + require(token.transfer(owner(), balance), "token transfer failed"); } /** diff --git a/contracts/Pausable.sol b/contracts/Pausable.sol index fe4a3ca28..996275e5c 100644 --- a/contracts/Pausable.sol +++ b/contracts/Pausable.sol @@ -1,10 +1,9 @@ -pragma solidity ^0.4.24; +pragma solidity ^0.5.0; /** * @title Utility contract to allow pausing and unpausing of certain functions */ contract Pausable { - event Pause(uint256 _timestammp); event Unpause(uint256 _timestamp); @@ -26,7 +25,7 @@ contract Pausable { _; } - /** + /** * @notice Called by the owner to pause, triggers stopped state */ function _pause() internal whenNotPaused { diff --git a/contracts/PolymathRegistry.sol b/contracts/PolymathRegistry.sol index 0d6a6ac92..15e34ff6f 100644 --- a/contracts/PolymathRegistry.sol +++ b/contracts/PolymathRegistry.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.24; +pragma solidity ^0.5.0; import "./ReclaimTokens.sol"; @@ -6,8 +6,7 @@ import "./ReclaimTokens.sol"; * @title Core functionality for registry upgradability */ contract PolymathRegistry is ReclaimTokens { - - mapping (bytes32 => address) public storedAddresses; + mapping(bytes32 => address) public storedAddresses; event ChangeAddress(string _nameKey, address indexed _oldAddress, address indexed _newAddress); @@ -16,7 +15,7 @@ contract PolymathRegistry is ReclaimTokens { * @param _nameKey is the key for the contract address mapping * @return address */ - function getAddress(string _nameKey) external view returns(address) { + function getAddress(string calldata _nameKey) external view returns(address) { bytes32 key = keccak256(bytes(_nameKey)); require(storedAddresses[key] != address(0), "Invalid address key"); return storedAddresses[key]; @@ -27,11 +26,10 @@ contract PolymathRegistry is ReclaimTokens { * @param _nameKey is the key for the contract address mapping * @param _newAddress is the new contract address */ - function changeAddress(string _nameKey, address _newAddress) external onlyOwner { + function changeAddress(string calldata _nameKey, address _newAddress) external onlyOwner { bytes32 key = keccak256(bytes(_nameKey)); emit ChangeAddress(_nameKey, storedAddresses[key], _newAddress); storedAddresses[key] = _newAddress; } - } diff --git a/contracts/ReclaimTokens.sol b/contracts/ReclaimTokens.sol index d1c4516f5..75b8cb192 100644 --- a/contracts/ReclaimTokens.sol +++ b/contracts/ReclaimTokens.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.24; +pragma solidity ^0.5.0; import "openzeppelin-solidity/contracts/ownership/Ownable.sol"; import "openzeppelin-solidity/contracts/token/ERC20/IERC20.sol"; @@ -7,7 +7,6 @@ import "openzeppelin-solidity/contracts/token/ERC20/IERC20.sol"; * @title Utility contract to allow owner to retreive any ERC20 sent to the contract */ contract ReclaimTokens is Ownable { - /** * @notice Reclaim all ERC20Basic compatible tokens * @param _tokenContract The address of the token contract diff --git a/contracts/RegistryUpdater.sol b/contracts/RegistryUpdater.sol index ee325b1cf..70e6c6849 100644 --- a/contracts/RegistryUpdater.sol +++ b/contracts/RegistryUpdater.sol @@ -1,17 +1,16 @@ -pragma solidity ^0.4.24; +pragma solidity ^0.5.0; import "openzeppelin-solidity/contracts/ownership/Ownable.sol"; import "./PolymathRegistry.sol"; contract RegistryUpdater is Ownable { - address public polymathRegistry; address public moduleRegistry; address public securityTokenRegistry; address public featureRegistry; address public polyToken; - constructor (address _polymathRegistry) public { + constructor(address _polymathRegistry) public { require(_polymathRegistry != address(0), "Invalid address"); polymathRegistry = _polymathRegistry; } diff --git a/contracts/STRGetter.sol b/contracts/STRGetter.sol index c48a0ce8c..31df84bdb 100644 --- a/contracts/STRGetter.sol +++ b/contracts/STRGetter.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.24; +pragma solidity ^0.5.0; import "./storage/EternalStorage.sol"; import "./libraries/Util.sol"; @@ -16,11 +16,12 @@ contract STRGetter is EternalStorage { * @notice Returns the list of tickers owned by the selected address * @param _owner is the address which owns the list of tickers */ - function getTickersByOwner(address _owner) external view returns(bytes32[]) { + function getTickersByOwner(address _owner) external view returns(bytes32[] memory) { uint counter = 0; // accessing the data structure userTotickers[_owner].length bytes32[] memory tickers = getArrayBytes32(Encoder.getKey("userToTickers", _owner)); - for (uint i = 0; i < tickers.length; i++) { + uint i; + for (i = 0; i < tickers.length; i++) { string memory ticker = Util.bytes32ToString(tickers[i]); /*solium-disable-next-line security/no-block-members*/ if (getUint(Encoder.getKey("registeredTickers_expiryDate", ticker)) >= now || getTickerStatus(ticker)) { @@ -30,7 +31,7 @@ contract STRGetter is EternalStorage { bytes32[] memory tempList = new bytes32[](counter); counter = 0; for (i = 0; i < tickers.length; i++) { - ticker = Util.bytes32ToString(tickers[i]); + string memory ticker = Util.bytes32ToString(tickers[i]); /*solium-disable-next-line security/no-block-members*/ if (getUint(Encoder.getKey("registeredTickers_expiryDate", ticker)) >= now || getTickerStatus(ticker)) { tempList[counter] = tickers[i]; @@ -45,7 +46,7 @@ contract STRGetter is EternalStorage { * @param _owner is the address which owns the list of tickers * @dev Intention is that this is called off-chain so block gas limit is not relevant */ - function getTokensByOwner(address _owner) external view returns(address[]) { + function getTokensByOwner(address _owner) external view returns(address[] memory) { return _getTokens(false, _owner); } @@ -53,7 +54,7 @@ contract STRGetter is EternalStorage { * @notice Returns the list of all tokens * @dev Intention is that this is called off-chain so block gas limit is not relevant */ - function getTokens() external view returns(address[]) { + function getTokens() external view returns(address[] memory) { return _getTokens(true, address(0)); } /** @@ -61,7 +62,7 @@ contract STRGetter is EternalStorage { * @param _allTokens if _allTokens is true returns all tokens despite on the second parameter * @param _owner is the address which owns the list of tickers */ - function _getTokens(bool _allTokens, address _owner) internal view returns(address[]) { + function _getTokens(bool _allTokens, address _owner) internal view returns(address[] memory) { // Loop over all active users, then all associated tickers of those users // This ensures we find tokens, even if their owner has been modified address[] memory activeUsers = getArrayAddress(Encoder.getKey("activeUsers")); @@ -107,7 +108,7 @@ contract STRGetter is EternalStorage { * @return string * @return bool */ - function getTickerDetails(string _ticker) external view returns (address, uint256, uint256, string, bool) { + function getTickerDetails(string calldata _ticker) external view returns (address, uint256, uint256, string memory, bool) { string memory ticker = Util.upper(_ticker); bool tickerStatus = getTickerStatus(ticker); uint256 expiryDate = getUint(Encoder.getKey("registeredTickers_expiryDate", ticker)); @@ -131,7 +132,7 @@ contract STRGetter is EternalStorage { * @param _ticker is the ticker of the security token * @return address */ - function getSecurityTokenAddress(string _ticker) external view returns (address) { + function getSecurityTokenAddress(string calldata _ticker) external view returns (address) { string memory ticker = Util.upper(_ticker); return getAddress(Encoder.getKey("tickerToSecurityToken", ticker)); } @@ -144,7 +145,7 @@ contract STRGetter is EternalStorage { * @return string is the details of the security token. * @return uint256 is the timestamp at which security Token was deployed. */ - function getSecurityTokenData(address _securityToken) external view returns (string, address, string, uint256) { + function getSecurityTokenData(address _securityToken) external view returns (string memory, address, string memory, uint256) { return ( getString(Encoder.getKey("securityTokens_ticker", _securityToken)), IOwnable(_securityToken).owner(), @@ -163,7 +164,7 @@ contract STRGetter is EternalStorage { /** * @notice Gets Protocol version */ - function getProtocolVersion() public view returns(uint8[]) { + function getProtocolVersion() public view returns(uint8[] memory) { return VersionUtils.unpack(uint24(getUint(Encoder.getKey("latestVersion")))); } @@ -196,7 +197,7 @@ contract STRGetter is EternalStorage { * @param _ticker Ticker whose status need to determine * @return bool */ - function getTickerStatus(string _ticker) public view returns(bool) { + function getTickerStatus(string memory _ticker) public view returns(bool) { return getBool(Encoder.getKey("registeredTickers_status", _ticker)); } @@ -205,7 +206,7 @@ contract STRGetter is EternalStorage { * @param _ticker Ticker whose owner need to determine * @return address Address of the owner */ - function getTickerOwner(string _ticker) public view returns(address) { + function getTickerOwner(string memory _ticker) public view returns(address) { return getAddress(Encoder.getKey("registeredTickers_owner", _ticker)); } diff --git a/contracts/SecurityTokenRegistry.sol b/contracts/SecurityTokenRegistry.sol index b3a023a78..f8f6e010b 100644 --- a/contracts/SecurityTokenRegistry.sol +++ b/contracts/SecurityTokenRegistry.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.24; +pragma solidity ^0.5.0; import "openzeppelin-solidity/contracts/math/SafeMath.sol"; import "openzeppelin-solidity/contracts/token/ERC20/IERC20.sol"; @@ -76,13 +76,13 @@ contract SecurityTokenRegistry is EternalStorage, Proxy { // Emit when network becomes paused event Pause(uint256 _timestammp); - // Emit when network becomes unpaused + // Emit when network becomes unpaused event Unpause(uint256 _timestamp); // Emit when the ticker is removed from the registry event TickerRemoved(string _ticker, uint256 _removedAt, address _removedBy); // Emit when the token ticker expiry is changed event ChangeExpiryLimit(uint256 _oldExpiry, uint256 _newExpiry); - // Emit when changeSecurityLaunchFee is called + // Emit when changeSecurityLaunchFee is called event ChangeSecurityLaunchFee(uint256 _oldFee, uint256 _newFee); // Emit when changeTickerRegistrationFee is called event ChangeTickerRegistrationFee(uint256 _oldFee, uint256 _newFee); @@ -120,7 +120,7 @@ contract SecurityTokenRegistry is EternalStorage, Proxy { * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { - require(msg.sender == owner(),"sender must be owner"); + require(msg.sender == owner(), "sender must be owner"); _; } @@ -128,8 +128,7 @@ contract SecurityTokenRegistry is EternalStorage, Proxy { * @notice Modifier to make a function callable only when the contract is not paused. */ modifier whenNotPausedOrOwner() { - if (msg.sender == owner()) - _; + if (msg.sender == owner()) _; else { require(!isPaused(), "Already paused"); _; @@ -144,7 +143,6 @@ contract SecurityTokenRegistry is EternalStorage, Proxy { _; } - /** * @notice Modifier to make a function callable only when the contract is paused. */ @@ -153,7 +151,6 @@ contract SecurityTokenRegistry is EternalStorage, Proxy { _; } - ///////////////////////////// // Initialization ///////////////////////////// @@ -233,7 +230,7 @@ contract SecurityTokenRegistry is EternalStorage, Proxy { * @param _ticker is unique token ticker * @param _tokenName is the name of the token */ - function registerTicker(address _owner, string _ticker, string _tokenName) external whenNotPausedOrOwner { + function registerTicker(address _owner, string calldata _ticker, string calldata _tokenName) external whenNotPausedOrOwner { require(_owner != address(0), "Owner should not be 0x"); require(bytes(_ticker).length > 0 && bytes(_ticker).length <= 10, "Ticker length range (0,10]"); // Attempt to charge the reg fee if it is > 0 POLY @@ -255,13 +252,13 @@ contract SecurityTokenRegistry is EternalStorage, Proxy { * @notice Internal - Sets the details of the ticker */ function _addTicker( - address _owner, - string _ticker, - string _tokenName, - uint256 _registrationDate, - uint256 _expiryDate, - bool _status, - bool _fromAdmin, + address _owner, + string memory _ticker, + string memory _tokenName, + uint256 _registrationDate, + uint256 _expiryDate, + bool _status, + bool _fromAdmin, uint256 _fee ) internal @@ -283,8 +280,8 @@ contract SecurityTokenRegistry is EternalStorage, Proxy { */ function modifyTicker( address _owner, - string _ticker, - string _tokenName, + string calldata _ticker, + string calldata _tokenName, uint256 _registrationDate, uint256 _expiryDate, bool _status @@ -305,8 +302,8 @@ contract SecurityTokenRegistry is EternalStorage, Proxy { */ function _modifyTicker( address _owner, - string _ticker, - string _tokenName, + string memory _ticker, + string memory _tokenName, uint256 _registrationDate, uint256 _expiryDate, bool _status @@ -327,7 +324,7 @@ contract SecurityTokenRegistry is EternalStorage, Proxy { _addTicker(_owner, _ticker, _tokenName, _registrationDate, _expiryDate, _status, true, uint256(0)); } - function _tickerOwner(string _ticker) internal view returns(address) { + function _tickerOwner(string memory _ticker) internal view returns(address) { return getAddress(Encoder.getKey("registeredTickers_owner", _ticker)); } @@ -335,7 +332,7 @@ contract SecurityTokenRegistry is EternalStorage, Proxy { * @notice Removes the ticker details, associated ownership & security token mapping * @param _ticker is the token ticker */ - function removeTicker(string _ticker) external onlyOwner { + function removeTicker(string calldata _ticker) external onlyOwner { string memory ticker = Util.upper(_ticker); address owner = _tickerOwner(ticker); require(owner != address(0), "Ticker doesn't exist"); @@ -351,18 +348,17 @@ contract SecurityTokenRegistry is EternalStorage, Proxy { * @param _ticker is the token ticker * @return bool */ - function _tickerAvailable(string _ticker) internal view returns(bool) { + function _tickerAvailable(string memory _ticker) internal view returns(bool) { if (_tickerOwner(_ticker) != address(0)) { /*solium-disable-next-line security/no-block-members*/ if ((now > getUint(Encoder.getKey("registeredTickers_expiryDate", _ticker))) && !_tickerStatus(_ticker)) { return true; - } else - return false; + } else return false; } return true; } - function _tickerStatus(string _ticker) internal view returns(bool) { + function _tickerStatus(string memory _ticker) internal view returns(bool) { return getBool(Encoder.getKey("registeredTickers_status", _ticker)); } @@ -371,7 +367,7 @@ contract SecurityTokenRegistry is EternalStorage, Proxy { * @param _owner is the address of the owner of the ticker * @param _ticker is the ticker symbol */ - function _setTickerOwnership(address _owner, string _ticker) internal { + function _setTickerOwnership(address _owner, string memory _ticker) internal { bytes32 _ownerKey = Encoder.getKey("userToTickers", _owner); uint256 length = uint256(getArrayBytes32(_ownerKey).length); pushArray(_ownerKey, Util.stringToBytes32(_ticker)); @@ -387,30 +383,25 @@ contract SecurityTokenRegistry is EternalStorage, Proxy { * @notice Internal - Stores the ticker details */ function _storeTickerDetails( - string _ticker, + string memory _ticker, address _owner, uint256 _registrationDate, uint256 _expiryDate, - string _tokenName, + string memory _tokenName, bool _status ) internal { bytes32 key = Encoder.getKey("registeredTickers_owner", _ticker); - if (getAddress(key) != _owner) - set(key, _owner); + if (getAddress(key) != _owner) set(key, _owner); key = Encoder.getKey("registeredTickers_registrationDate", _ticker); - if (getUint(key) != _registrationDate) - set(key, _registrationDate); + if (getUint(key) != _registrationDate) set(key, _registrationDate); key = Encoder.getKey("registeredTickers_expiryDate", _ticker); - if (getUint(key) != _expiryDate) - set(key, _expiryDate); + if (getUint(key) != _expiryDate) set(key, _expiryDate); key = Encoder.getKey("registeredTickers_tokenName", _ticker); - if (Encoder.getKey(getString(key)) != Encoder.getKey(_tokenName)) - set(key, _tokenName); + if (Encoder.getKey(getString(key)) != Encoder.getKey(_tokenName)) set(key, _tokenName); key = Encoder.getKey("registeredTickers_status", _ticker); - if (getBool(key) != _status) - set(key, _status); + if (getBool(key) != _status) set(key, _status); } /** @@ -418,13 +409,15 @@ contract SecurityTokenRegistry is EternalStorage, Proxy { * @param _newOwner is the address of the new owner of the ticker * @param _ticker is the ticker symbol */ - function transferTickerOwnership(address _newOwner, string _ticker) external whenNotPausedOrOwner { + function transferTickerOwnership(address _newOwner, string calldata _ticker) external whenNotPausedOrOwner { string memory ticker = Util.upper(_ticker); require(_newOwner != address(0), "Invalid address"); bytes32 ownerKey = Encoder.getKey("registeredTickers_owner", ticker); require(getAddress(ownerKey) == msg.sender, "Not authorised"); - if (_tickerStatus(ticker)) - require(IOwnable(getAddress(Encoder.getKey("tickerToSecurityToken", ticker))).owner() == _newOwner, "New owner does not match token owner"); + if (_tickerStatus(ticker)) require( + IOwnable(getAddress(Encoder.getKey("tickerToSecurityToken", ticker))).owner() == _newOwner, + "New owner does not match token owner" + ); _deleteTickerOwnership(msg.sender, ticker); _setTickerOwnership(_newOwner, ticker); set(ownerKey, _newOwner); @@ -434,7 +427,7 @@ contract SecurityTokenRegistry is EternalStorage, Proxy { /** * @notice Internal - Removes the owner of a ticker */ - function _deleteTickerOwnership(address _owner, string _ticker) internal { + function _deleteTickerOwnership(address _owner, string memory _ticker) internal { uint256 index = uint256(getUint(Encoder.getKey("tickerIndex", _ticker))); bytes32 ownerKey = Encoder.getKey("userToTickers", _owner); bytes32[] memory tickers = getArrayBytes32(ownerKey); @@ -468,7 +461,15 @@ contract SecurityTokenRegistry is EternalStorage, Proxy { * @param _tokenDetails is the off-chain details of the token * @param _divisible is whether or not the token is divisible */ - function generateSecurityToken(string _name, string _ticker, string _tokenDetails, bool _divisible) external whenNotPausedOrOwner { + function generateSecurityToken( + string calldata _name, + string calldata _ticker, + string calldata _tokenDetails, + bool _divisible + ) + external + whenNotPausedOrOwner + { require(bytes(_name).length > 0 && bytes(_ticker).length > 0, "Ticker length > 0"); string memory ticker = Util.upper(_ticker); bytes32 statusKey = Encoder.getKey("registeredTickers_status", ticker); @@ -509,15 +510,15 @@ contract SecurityTokenRegistry is EternalStorage, Proxy { * @param _deployedAt is the timestamp at which the security token is deployed */ function modifySecurityToken( - string _name, - string _ticker, + string calldata _name, + string calldata _ticker, address _owner, address _securityToken, - string _tokenDetails, + string calldata _tokenDetails, uint256 _deployedAt - ) - external - onlyOwner + ) + external + onlyOwner { require(bytes(_name).length > 0 && bytes(_ticker).length > 0, "String length > 0"); require(bytes(_ticker).length <= 10, "Ticker length range (0,10]"); @@ -540,7 +541,12 @@ contract SecurityTokenRegistry is EternalStorage, Proxy { /** * @notice Internal - Stores the security token details */ - function _storeSecurityTokenData(address _securityToken, string _ticker, string _tokenDetails, uint256 _deployedAt) internal { + function _storeSecurityTokenData( + address _securityToken, + string memory _ticker, + string memory _tokenDetails, + uint256 _deployedAt + ) internal { set(Encoder.getKey("securityTokens_ticker", _securityToken), _ticker); set(Encoder.getKey("securityTokens_tokenDetails", _securityToken), _tokenDetails); set(Encoder.getKey("securityTokens_deployedAt", _securityToken), _deployedAt); @@ -551,7 +557,7 @@ contract SecurityTokenRegistry is EternalStorage, Proxy { * @param _securityToken is the address of the security token * @return bool */ - function isSecurityToken(address _securityToken) external view returns (bool) { + function isSecurityToken(address _securityToken) external view returns(bool) { return (keccak256(bytes(getString(Encoder.getKey("securityTokens_ticker", _securityToken)))) != keccak256("")); } @@ -598,7 +604,7 @@ contract SecurityTokenRegistry is EternalStorage, Proxy { set(TICKERREGFEE, _tickerRegFee); } - /** + /** * @notice Sets the ticker registration fee in POLY tokens. Only Polymath. * @param _stLaunchFee is the registration fee in POLY tokens (base 18 decimals) */ diff --git a/contracts/external/IMedianizer.sol b/contracts/external/IMedianizer.sol index 755d54a0f..aebe8f77a 100644 --- a/contracts/external/IMedianizer.sol +++ b/contracts/external/IMedianizer.sol @@ -1,15 +1,14 @@ /* solium-disable */ -pragma solidity ^0.4.24; +pragma solidity ^0.5.0; /** * @title Interface to MakerDAO Medianizer contract */ interface IMedianizer { + function peek() external view returns(bytes32, bool); - function peek() constant external returns (bytes32, bool); - - function read() constant external returns (bytes32); + function read() external view returns(bytes32); function set(address wat) external; @@ -27,7 +26,7 @@ interface IMedianizer { function poke(bytes32) external; - function compute() constant external returns (bytes32, bool); + function compute() external view returns(bytes32, bool); function void() external; diff --git a/contracts/external/oraclizeAPI.sol b/contracts/external/oraclizeAPI.sol index bc8045879..9989144c7 100644 --- a/contracts/external/oraclizeAPI.sol +++ b/contracts/external/oraclizeAPI.sol @@ -1,10 +1,9 @@ -// -// Release targetted at solc 0.4.25 to silence compiler warning/error messages, compatible down to 0.4.22 /* -Copyright (c) 2015-2016 Oraclize SRL -Copyright (c) 2016 Oraclize LTD +ORACLIZE_API +Copyright (c) 2015-2016 Oraclize SRL +Copyright (c) 2016 Oraclize LTD Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal @@ -13,13 +12,9 @@ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -27,32 +22,37 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +pragma solidity >= 0.5.0; // Incompatible compiler version - please select a compiler within the stated pragma range, or use a different version of the oraclizeAPI! -// This api is currently targeted at 0.4.22 to 0.4.25 (stable builds), please import oraclizeAPI_pre0.4.sol or oraclizeAPI_0.4 where necessary -/* solium-disable */ -pragma solidity >=0.4.22;// Incompatible compiler version... please select one stated within pragma solidity or use different oraclizeAPI version +// Dummy contract only used to emit to end-user they are using wrong solc +contract solcChecker { +/* INCOMPATIBLE SOLC: import the following instead: "github.com/oraclize/ethereum-api/oraclizeAPI_0.4.sol" */ function f(bytes calldata x) external; +} contract OraclizeI { + address public cbAddress; - function query(uint _timestamp, string _datasource, string _arg) external payable returns (bytes32 _id); - function query_withGasLimit(uint _timestamp, string _datasource, string _arg, uint _gaslimit) external payable returns (bytes32 _id); - function query2(uint _timestamp, string _datasource, string _arg1, string _arg2) public payable returns (bytes32 _id); - function query2_withGasLimit(uint _timestamp, string _datasource, string _arg1, string _arg2, uint _gaslimit) external payable returns (bytes32 _id); - function queryN(uint _timestamp, string _datasource, bytes _argN) public payable returns (bytes32 _id); - function queryN_withGasLimit(uint _timestamp, string _datasource, bytes _argN, uint _gaslimit) external payable returns (bytes32 _id); - function getPrice(string _datasource) public returns (uint _dsprice); - function getPrice(string _datasource, uint gaslimit) public returns (uint _dsprice); + function setProofType(byte _proofType) external; function setCustomGasPrice(uint _gasPrice) external; - function randomDS_getSessionPubKeyHash() external constant returns(bytes32); + function getPrice(string memory _datasource) public returns (uint _dsprice); + function randomDS_getSessionPubKeyHash() external view returns (bytes32 _sessionKeyHash); + function getPrice(string memory _datasource, uint _gasLimit) public returns (uint _dsprice); + function queryN(uint _timestamp, string memory _datasource, bytes memory _argN) public payable returns (bytes32 _id); + function query(uint _timestamp, string calldata _datasource, string calldata _arg) external payable returns (bytes32 _id); + function query2(uint _timestamp, string memory _datasource, string memory _arg1, string memory _arg2) public payable returns (bytes32 _id); + function query_withGasLimit(uint _timestamp, string calldata _datasource, string calldata _arg, uint _gasLimit) external payable returns (bytes32 _id); + function queryN_withGasLimit(uint _timestamp, string calldata _datasource, bytes calldata _argN, uint _gasLimit) external payable returns (bytes32 _id); + function query2_withGasLimit(uint _timestamp, string calldata _datasource, string calldata _arg1, string calldata _arg2, uint _gasLimit) external payable returns (bytes32 _id); } contract OraclizeAddrResolverI { - function getAddress() public returns (address _addr); + function getAddress() public returns (address _address); } - /* + Begin solidity-cborutils https://github.com/smartcontractkit/solidity-cborutils @@ -78,764 +78,876 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ +*/ library Buffer { + struct buffer { bytes buf; uint capacity; } - function init(buffer memory buf, uint _capacity) internal pure { + function init(buffer memory _buf, uint _capacity) internal pure { uint capacity = _capacity; - if(capacity % 32 != 0) capacity += 32 - (capacity % 32); - // Allocate space for the buffer data - buf.capacity = capacity; + if (capacity % 32 != 0) { + capacity += 32 - (capacity % 32); + } + _buf.capacity = capacity; // Allocate space for the buffer data assembly { let ptr := mload(0x40) - mstore(buf, ptr) + mstore(_buf, ptr) mstore(ptr, 0) mstore(0x40, add(ptr, capacity)) } } - function resize(buffer memory buf, uint capacity) private pure { - bytes memory oldbuf = buf.buf; - init(buf, capacity); - append(buf, oldbuf); + function resize(buffer memory _buf, uint _capacity) private pure { + bytes memory oldbuf = _buf.buf; + init(_buf, _capacity); + append(_buf, oldbuf); } - function max(uint a, uint b) private pure returns(uint) { - if(a > b) { - return a; + function max(uint _a, uint _b) private pure returns (uint _max) { + if (_a > _b) { + return _a; } - return b; + return _b; } - /** - * @dev Appends a byte array to the end of the buffer. Resizes if doing so - * would exceed the capacity of the buffer. - * @param buf The buffer to append to. - * @param data The data to append. - * @return The original buffer. - */ - function append(buffer memory buf, bytes data) internal pure returns(buffer memory) { - if(data.length + buf.buf.length > buf.capacity) { - resize(buf, max(buf.capacity, data.length) * 2); + * @dev Appends a byte array to the end of the buffer. Resizes if doing so + * would exceed the capacity of the buffer. + * @param _buf The buffer to append to. + * @param _data The data to append. + * @return The original buffer. + * + */ + function append(buffer memory _buf, bytes memory _data) internal pure returns (buffer memory _buffer) { + if (_data.length + _buf.buf.length > _buf.capacity) { + resize(_buf, max(_buf.capacity, _data.length) * 2); } - uint dest; uint src; - uint len = data.length; + uint len = _data.length; assembly { - // Memory address of the buffer data - let bufptr := mload(buf) - // Length of existing buffer data - let buflen := mload(bufptr) - // Start address = buffer address + buffer length + sizeof(buffer length) - dest := add(add(bufptr, buflen), 32) - // Update buffer length - mstore(bufptr, add(buflen, mload(data))) - src := add(data, 32) - } - - // Copy word-length chunks while possible - for(; len >= 32; len -= 32) { + let bufptr := mload(_buf) // Memory address of the buffer data + let buflen := mload(bufptr) // Length of existing buffer data + dest := add(add(bufptr, buflen), 32) // Start address = buffer address + buffer length + sizeof(buffer length) + mstore(bufptr, add(buflen, mload(_data))) // Update buffer length + src := add(_data, 32) + } + for(; len >= 32; len -= 32) { // Copy word-length chunks while possible assembly { mstore(dest, mload(src)) } dest += 32; src += 32; } - - // Copy remaining bytes - uint mask = 256 ** (32 - len) - 1; + uint mask = 256 ** (32 - len) - 1; // Copy remaining bytes assembly { let srcpart := and(mload(src), not(mask)) let destpart := and(mload(dest), mask) mstore(dest, or(destpart, srcpart)) } - - return buf; + return _buf; } - /** - * @dev Appends a byte to the end of the buffer. Resizes if doing so would - * exceed the capacity of the buffer. - * @param buf The buffer to append to. - * @param data The data to append. - * @return The original buffer. - */ - function append(buffer memory buf, uint8 data) internal pure { - if(buf.buf.length + 1 > buf.capacity) { - resize(buf, buf.capacity * 2); + * + * @dev Appends a byte to the end of the buffer. Resizes if doing so would + * exceed the capacity of the buffer. + * @param _buf The buffer to append to. + * @param _data The data to append. + * @return The original buffer. + * + */ + function append(buffer memory _buf, uint8 _data) internal pure { + if (_buf.buf.length + 1 > _buf.capacity) { + resize(_buf, _buf.capacity * 2); } - assembly { - // Memory address of the buffer data - let bufptr := mload(buf) - // Length of existing buffer data - let buflen := mload(bufptr) - // Address = buffer address + buffer length + sizeof(buffer length) - let dest := add(add(bufptr, buflen), 32) - mstore8(dest, data) - // Update buffer length - mstore(bufptr, add(buflen, 1)) + let bufptr := mload(_buf) // Memory address of the buffer data + let buflen := mload(bufptr) // Length of existing buffer data + let dest := add(add(bufptr, buflen), 32) // Address = buffer address + buffer length + sizeof(buffer length) + mstore8(dest, _data) + mstore(bufptr, add(buflen, 1)) // Update buffer length } } - /** - * @dev Appends a byte to the end of the buffer. Resizes if doing so would - * exceed the capacity of the buffer. - * @param buf The buffer to append to. - * @param data The data to append. - * @return The original buffer. - */ - function appendInt(buffer memory buf, uint data, uint len) internal pure returns(buffer memory) { - if(len + buf.buf.length > buf.capacity) { - resize(buf, max(buf.capacity, len) * 2); - } - - uint mask = 256 ** len - 1; + * + * @dev Appends a byte to the end of the buffer. Resizes if doing so would + * exceed the capacity of the buffer. + * @param _buf The buffer to append to. + * @param _data The data to append. + * @return The original buffer. + * + */ + function appendInt(buffer memory _buf, uint _data, uint _len) internal pure returns (buffer memory _buffer) { + if (_len + _buf.buf.length > _buf.capacity) { + resize(_buf, max(_buf.capacity, _len) * 2); + } + uint mask = 256 ** _len - 1; assembly { - // Memory address of the buffer data - let bufptr := mload(buf) - // Length of existing buffer data - let buflen := mload(bufptr) - // Address = buffer address + buffer length + sizeof(buffer length) + len - let dest := add(add(bufptr, buflen), len) - mstore(dest, or(and(mload(dest), not(mask)), data)) - // Update buffer length - mstore(bufptr, add(buflen, len)) - } - return buf; + let bufptr := mload(_buf) // Memory address of the buffer data + let buflen := mload(bufptr) // Length of existing buffer data + let dest := add(add(bufptr, buflen), _len) // Address = buffer address + buffer length + sizeof(buffer length) + len + mstore(dest, or(and(mload(dest), not(mask)), _data)) + mstore(bufptr, add(buflen, _len)) // Update buffer length + } + return _buf; } } library CBOR { + using Buffer for Buffer.buffer; uint8 private constant MAJOR_TYPE_INT = 0; - uint8 private constant MAJOR_TYPE_NEGATIVE_INT = 1; + uint8 private constant MAJOR_TYPE_MAP = 5; uint8 private constant MAJOR_TYPE_BYTES = 2; - uint8 private constant MAJOR_TYPE_STRING = 3; uint8 private constant MAJOR_TYPE_ARRAY = 4; - uint8 private constant MAJOR_TYPE_MAP = 5; + uint8 private constant MAJOR_TYPE_STRING = 3; + uint8 private constant MAJOR_TYPE_NEGATIVE_INT = 1; uint8 private constant MAJOR_TYPE_CONTENT_FREE = 7; - function encodeType(Buffer.buffer memory buf, uint8 major, uint value) private pure { - if(value <= 23) { - buf.append(uint8((major << 5) | value)); - } else if(value <= 0xFF) { - buf.append(uint8((major << 5) | 24)); - buf.appendInt(value, 1); - } else if(value <= 0xFFFF) { - buf.append(uint8((major << 5) | 25)); - buf.appendInt(value, 2); - } else if(value <= 0xFFFFFFFF) { - buf.append(uint8((major << 5) | 26)); - buf.appendInt(value, 4); - } else if(value <= 0xFFFFFFFFFFFFFFFF) { - buf.append(uint8((major << 5) | 27)); - buf.appendInt(value, 8); + function encodeType(Buffer.buffer memory _buf, uint8 _major, uint _value) private pure { + if (_value <= 23) { + _buf.append(uint8((_major << 5) | _value)); + } else if (_value <= 0xFF) { + _buf.append(uint8((_major << 5) | 24)); + _buf.appendInt(_value, 1); + } else if (_value <= 0xFFFF) { + _buf.append(uint8((_major << 5) | 25)); + _buf.appendInt(_value, 2); + } else if (_value <= 0xFFFFFFFF) { + _buf.append(uint8((_major << 5) | 26)); + _buf.appendInt(_value, 4); + } else if (_value <= 0xFFFFFFFFFFFFFFFF) { + _buf.append(uint8((_major << 5) | 27)); + _buf.appendInt(_value, 8); } } - function encodeIndefiniteLengthType(Buffer.buffer memory buf, uint8 major) private pure { - buf.append(uint8((major << 5) | 31)); + function encodeIndefiniteLengthType(Buffer.buffer memory _buf, uint8 _major) private pure { + _buf.append(uint8((_major << 5) | 31)); } - function encodeUInt(Buffer.buffer memory buf, uint value) internal pure { - encodeType(buf, MAJOR_TYPE_INT, value); + function encodeUInt(Buffer.buffer memory _buf, uint _value) internal pure { + encodeType(_buf, MAJOR_TYPE_INT, _value); } - function encodeInt(Buffer.buffer memory buf, int value) internal pure { - if(value >= 0) { - encodeType(buf, MAJOR_TYPE_INT, uint(value)); + function encodeInt(Buffer.buffer memory _buf, int _value) internal pure { + if (_value >= 0) { + encodeType(_buf, MAJOR_TYPE_INT, uint(_value)); } else { - encodeType(buf, MAJOR_TYPE_NEGATIVE_INT, uint(-1 - value)); + encodeType(_buf, MAJOR_TYPE_NEGATIVE_INT, uint(-1 - _value)); } } - function encodeBytes(Buffer.buffer memory buf, bytes value) internal pure { - encodeType(buf, MAJOR_TYPE_BYTES, value.length); - buf.append(value); + function encodeBytes(Buffer.buffer memory _buf, bytes memory _value) internal pure { + encodeType(_buf, MAJOR_TYPE_BYTES, _value.length); + _buf.append(_value); } - function encodeString(Buffer.buffer memory buf, string value) internal pure { - encodeType(buf, MAJOR_TYPE_STRING, bytes(value).length); - buf.append(bytes(value)); + function encodeString(Buffer.buffer memory _buf, string memory _value) internal pure { + encodeType(_buf, MAJOR_TYPE_STRING, bytes(_value).length); + _buf.append(bytes(_value)); } - function startArray(Buffer.buffer memory buf) internal pure { - encodeIndefiniteLengthType(buf, MAJOR_TYPE_ARRAY); + function startArray(Buffer.buffer memory _buf) internal pure { + encodeIndefiniteLengthType(_buf, MAJOR_TYPE_ARRAY); } - function startMap(Buffer.buffer memory buf) internal pure { - encodeIndefiniteLengthType(buf, MAJOR_TYPE_MAP); + function startMap(Buffer.buffer memory _buf) internal pure { + encodeIndefiniteLengthType(_buf, MAJOR_TYPE_MAP); } - function endSequence(Buffer.buffer memory buf) internal pure { - encodeIndefiniteLengthType(buf, MAJOR_TYPE_CONTENT_FREE); + function endSequence(Buffer.buffer memory _buf) internal pure { + encodeIndefiniteLengthType(_buf, MAJOR_TYPE_CONTENT_FREE); } } - /* + End solidity-cborutils - */ +*/ contract usingOraclize { - uint constant day = 60*60*24; - uint constant week = 60*60*24*7; - uint constant month = 60*60*24*30; + + using CBOR for Buffer.buffer; + + OraclizeI oraclize; + OraclizeAddrResolverI OAR; + + uint constant day = 60 * 60 * 24; + uint constant week = 60 * 60 * 24 * 7; + uint constant month = 60 * 60 * 24 * 30; + byte constant proofType_NONE = 0x00; - byte constant proofType_TLSNotary = 0x10; byte constant proofType_Ledger = 0x30; - byte constant proofType_Android = 0x40; byte constant proofType_Native = 0xF0; byte constant proofStorage_IPFS = 0x01; + byte constant proofType_Android = 0x40; + byte constant proofType_TLSNotary = 0x10; + + string oraclize_network_name; uint8 constant networkID_auto = 0; + uint8 constant networkID_morden = 2; uint8 constant networkID_mainnet = 1; uint8 constant networkID_testnet = 2; - uint8 constant networkID_morden = 2; uint8 constant networkID_consensys = 161; - OraclizeAddrResolverI OAR; + mapping(bytes32 => bytes32) oraclize_randomDS_args; + mapping(bytes32 => bool) oraclize_randomDS_sessionKeysHashVerified; - OraclizeI oraclize; modifier oraclizeAPI { - if((address(OAR)==0)||(getCodeSize(address(OAR))==0)) + if ((address(OAR) == address(0)) || (getCodeSize(address(OAR)) == 0)) { oraclize_setNetwork(networkID_auto); - - if(address(oraclize) != OAR.getAddress()) + } + if (address(oraclize) != OAR.getAddress()) { oraclize = OraclizeI(OAR.getAddress()); - + } _; } - modifier coupon(string code){ - oraclize = OraclizeI(OAR.getAddress()); + + modifier oraclize_randomDS_proofVerify(bytes32 _queryId, string memory _result, bytes memory _proof) { + // RandomDS Proof Step 1: The prefix has to match 'LP\x01' (Ledger Proof version 1) + require((_proof[0] == "L") && (_proof[1] == "P") && (uint8(_proof[2]) == uint8(1))); + bool proofVerified = oraclize_randomDS_proofVerify__main(_proof, _queryId, bytes(_result), oraclize_getNetworkName()); + require(proofVerified); _; } - function oraclize_setNetwork(uint8 networkID) internal returns(bool){ + function oraclize_setNetwork(uint8 _networkID) internal returns (bool _networkSet) { return oraclize_setNetwork(); - networkID; // silence the warning and remain backwards compatible + _networkID; // silence the warning and remain backwards compatible + } + + function oraclize_setNetworkName(string memory _network_name) internal { + oraclize_network_name = _network_name; } - function oraclize_setNetwork() internal returns(bool){ - if (getCodeSize(0x1d3B2638a7cC9f2CB3D298A3DA7a90B67E5506ed)>0){ //mainnet + + function oraclize_getNetworkName() internal view returns (string memory _networkName) { + return oraclize_network_name; + } + + function oraclize_setNetwork() internal returns (bool _networkSet) { + if (getCodeSize(0x1d3B2638a7cC9f2CB3D298A3DA7a90B67E5506ed) > 0) { //mainnet OAR = OraclizeAddrResolverI(0x1d3B2638a7cC9f2CB3D298A3DA7a90B67E5506ed); oraclize_setNetworkName("eth_mainnet"); return true; } - if (getCodeSize(0xc03A2615D5efaf5F49F60B7BB6583eaec212fdf1)>0){ //ropsten testnet + if (getCodeSize(0xc03A2615D5efaf5F49F60B7BB6583eaec212fdf1) > 0) { //ropsten testnet OAR = OraclizeAddrResolverI(0xc03A2615D5efaf5F49F60B7BB6583eaec212fdf1); oraclize_setNetworkName("eth_ropsten3"); return true; } - if (getCodeSize(0xB7A07BcF2Ba2f2703b24C0691b5278999C59AC7e)>0){ //kovan testnet + if (getCodeSize(0xB7A07BcF2Ba2f2703b24C0691b5278999C59AC7e) > 0) { //kovan testnet OAR = OraclizeAddrResolverI(0xB7A07BcF2Ba2f2703b24C0691b5278999C59AC7e); oraclize_setNetworkName("eth_kovan"); return true; } - if (getCodeSize(0x146500cfd35B22E4A392Fe0aDc06De1a1368Ed48)>0){ //rinkeby testnet + if (getCodeSize(0x146500cfd35B22E4A392Fe0aDc06De1a1368Ed48) > 0) { //rinkeby testnet OAR = OraclizeAddrResolverI(0x146500cfd35B22E4A392Fe0aDc06De1a1368Ed48); oraclize_setNetworkName("eth_rinkeby"); return true; } - if (getCodeSize(0x6f485C8BF6fc43eA212E93BBF8ce046C7f1cb475)>0){ //ethereum-bridge + if (getCodeSize(0x6f485C8BF6fc43eA212E93BBF8ce046C7f1cb475) > 0) { //ethereum-bridge OAR = OraclizeAddrResolverI(0x6f485C8BF6fc43eA212E93BBF8ce046C7f1cb475); return true; } - if (getCodeSize(0x20e12A1F859B3FeaE5Fb2A0A32C18F5a65555bBF)>0){ //ether.camp ide + if (getCodeSize(0x20e12A1F859B3FeaE5Fb2A0A32C18F5a65555bBF) > 0) { //ether.camp ide OAR = OraclizeAddrResolverI(0x20e12A1F859B3FeaE5Fb2A0A32C18F5a65555bBF); return true; } - if (getCodeSize(0x51efaF4c8B3C9AfBD5aB9F4bbC82784Ab6ef8fAA)>0){ //browser-solidity + if (getCodeSize(0x51efaF4c8B3C9AfBD5aB9F4bbC82784Ab6ef8fAA) > 0) { //browser-solidity OAR = OraclizeAddrResolverI(0x51efaF4c8B3C9AfBD5aB9F4bbC82784Ab6ef8fAA); return true; } return false; } - function __callback(bytes32 myid, string result) public { - __callback(myid, result, new bytes(0)); + function __callback(bytes32 _myid, string memory _result) public { + __callback(_myid, _result, new bytes(0)); } - function __callback(bytes32 myid, string result, bytes proof) public { + + function __callback(bytes32 _myid, string memory _result, bytes memory _proof) public { return; - // Following should never be reached with a preceding return, however - // this is just a placeholder function, ideally meant to be defined in - // child contract when proofs are used - myid; result; proof; // Silence compiler warnings - oraclize = OraclizeI(0); // Additional compiler silence about making function pure/view. - } - - function oraclize_getPrice(string datasource) oraclizeAPI internal returns (uint){ - return oraclize.getPrice(datasource); - } - - function oraclize_getPrice(string datasource, uint gaslimit) oraclizeAPI internal returns (uint){ - return oraclize.getPrice(datasource, gaslimit); - } - - function oraclize_query(string datasource, string arg) oraclizeAPI internal returns (bytes32 id){ - uint price = oraclize.getPrice(datasource); - if (price > 1 ether + tx.gasprice*200000) return 0; // unexpectedly high price - return oraclize.query.value(price)(0, datasource, arg); - } - function oraclize_query(uint timestamp, string datasource, string arg) oraclizeAPI internal returns (bytes32 id){ - uint price = oraclize.getPrice(datasource); - if (price > 1 ether + tx.gasprice*200000) return 0; // unexpectedly high price - return oraclize.query.value(price)(timestamp, datasource, arg); - } - function oraclize_query(uint timestamp, string datasource, string arg, uint gaslimit) oraclizeAPI internal returns (bytes32 id){ - uint price = oraclize.getPrice(datasource, gaslimit); - if (price > 1 ether + tx.gasprice*gaslimit) return 0; // unexpectedly high price - return oraclize.query_withGasLimit.value(price)(timestamp, datasource, arg, gaslimit); - } - function oraclize_query(string datasource, string arg, uint gaslimit) oraclizeAPI internal returns (bytes32 id){ - uint price = oraclize.getPrice(datasource, gaslimit); - if (price > 1 ether + tx.gasprice*gaslimit) return 0; // unexpectedly high price - return oraclize.query_withGasLimit.value(price)(0, datasource, arg, gaslimit); - } - function oraclize_query(string datasource, string arg1, string arg2) oraclizeAPI internal returns (bytes32 id){ - uint price = oraclize.getPrice(datasource); - if (price > 1 ether + tx.gasprice*200000) return 0; // unexpectedly high price - return oraclize.query2.value(price)(0, datasource, arg1, arg2); - } - function oraclize_query(uint timestamp, string datasource, string arg1, string arg2) oraclizeAPI internal returns (bytes32 id){ - uint price = oraclize.getPrice(datasource); - if (price > 1 ether + tx.gasprice*200000) return 0; // unexpectedly high price - return oraclize.query2.value(price)(timestamp, datasource, arg1, arg2); - } - function oraclize_query(uint timestamp, string datasource, string arg1, string arg2, uint gaslimit) oraclizeAPI internal returns (bytes32 id){ - uint price = oraclize.getPrice(datasource, gaslimit); - if (price > 1 ether + tx.gasprice*gaslimit) return 0; // unexpectedly high price - return oraclize.query2_withGasLimit.value(price)(timestamp, datasource, arg1, arg2, gaslimit); - } - function oraclize_query(string datasource, string arg1, string arg2, uint gaslimit) oraclizeAPI internal returns (bytes32 id){ - uint price = oraclize.getPrice(datasource, gaslimit); - if (price > 1 ether + tx.gasprice*gaslimit) return 0; // unexpectedly high price - return oraclize.query2_withGasLimit.value(price)(0, datasource, arg1, arg2, gaslimit); - } - function oraclize_query(string datasource, string[] argN) oraclizeAPI internal returns (bytes32 id){ - uint price = oraclize.getPrice(datasource); - if (price > 1 ether + tx.gasprice*200000) return 0; // unexpectedly high price - bytes memory args = stra2cbor(argN); - return oraclize.queryN.value(price)(0, datasource, args); - } - function oraclize_query(uint timestamp, string datasource, string[] argN) oraclizeAPI internal returns (bytes32 id){ - uint price = oraclize.getPrice(datasource); - if (price > 1 ether + tx.gasprice*200000) return 0; // unexpectedly high price - bytes memory args = stra2cbor(argN); - return oraclize.queryN.value(price)(timestamp, datasource, args); - } - function oraclize_query(uint timestamp, string datasource, string[] argN, uint gaslimit) oraclizeAPI internal returns (bytes32 id){ - uint price = oraclize.getPrice(datasource, gaslimit); - if (price > 1 ether + tx.gasprice*gaslimit) return 0; // unexpectedly high price - bytes memory args = stra2cbor(argN); - return oraclize.queryN_withGasLimit.value(price)(timestamp, datasource, args, gaslimit); - } - function oraclize_query(string datasource, string[] argN, uint gaslimit) oraclizeAPI internal returns (bytes32 id){ - uint price = oraclize.getPrice(datasource, gaslimit); - if (price > 1 ether + tx.gasprice*gaslimit) return 0; // unexpectedly high price - bytes memory args = stra2cbor(argN); - return oraclize.queryN_withGasLimit.value(price)(0, datasource, args, gaslimit); - } - function oraclize_query(string datasource, string[1] args) oraclizeAPI internal returns (bytes32 id) { + _myid; _result; _proof; // Silence compiler warnings + } + + function oraclize_getPrice(string memory _datasource) oraclizeAPI internal returns (uint _queryPrice) { + return oraclize.getPrice(_datasource); + } + + function oraclize_getPrice(string memory _datasource, uint _gasLimit) oraclizeAPI internal returns (uint _queryPrice) { + return oraclize.getPrice(_datasource, _gasLimit); + } + + function oraclize_query(string memory _datasource, string memory _arg) oraclizeAPI internal returns (bytes32 _id) { + uint price = oraclize.getPrice(_datasource); + if (price > 1 ether + tx.gasprice * 200000) { + return 0; // Unexpectedly high price + } + return oraclize.query.value(price)(0, _datasource, _arg); + } + + function oraclize_query(uint _timestamp, string memory _datasource, string memory _arg) oraclizeAPI internal returns (bytes32 _id) { + uint price = oraclize.getPrice(_datasource); + if (price > 1 ether + tx.gasprice * 200000) { + return 0; // Unexpectedly high price + } + return oraclize.query.value(price)(_timestamp, _datasource, _arg); + } + + function oraclize_query(uint _timestamp, string memory _datasource, string memory _arg, uint _gasLimit) oraclizeAPI internal returns (bytes32 _id) { + uint price = oraclize.getPrice(_datasource,_gasLimit); + if (price > 1 ether + tx.gasprice * _gasLimit) { + return 0; // Unexpectedly high price + } + return oraclize.query_withGasLimit.value(price)(_timestamp, _datasource, _arg, _gasLimit); + } + + function oraclize_query(string memory _datasource, string memory _arg, uint _gasLimit) oraclizeAPI internal returns (bytes32 _id) { + uint price = oraclize.getPrice(_datasource, _gasLimit); + if (price > 1 ether + tx.gasprice * _gasLimit) { + return 0; // Unexpectedly high price + } + return oraclize.query_withGasLimit.value(price)(0, _datasource, _arg, _gasLimit); + } + + function oraclize_query(string memory _datasource, string memory _arg1, string memory _arg2) oraclizeAPI internal returns (bytes32 _id) { + uint price = oraclize.getPrice(_datasource); + if (price > 1 ether + tx.gasprice * 200000) { + return 0; // Unexpectedly high price + } + return oraclize.query2.value(price)(0, _datasource, _arg1, _arg2); + } + + function oraclize_query(uint _timestamp, string memory _datasource, string memory _arg1, string memory _arg2) oraclizeAPI internal returns (bytes32 _id) { + uint price = oraclize.getPrice(_datasource); + if (price > 1 ether + tx.gasprice * 200000) { + return 0; // Unexpectedly high price + } + return oraclize.query2.value(price)(_timestamp, _datasource, _arg1, _arg2); + } + + function oraclize_query(uint _timestamp, string memory _datasource, string memory _arg1, string memory _arg2, uint _gasLimit) oraclizeAPI internal returns (bytes32 _id) { + uint price = oraclize.getPrice(_datasource, _gasLimit); + if (price > 1 ether + tx.gasprice * _gasLimit) { + return 0; // Unexpectedly high price + } + return oraclize.query2_withGasLimit.value(price)(_timestamp, _datasource, _arg1, _arg2, _gasLimit); + } + + function oraclize_query(string memory _datasource, string memory _arg1, string memory _arg2, uint _gasLimit) oraclizeAPI internal returns (bytes32 _id) { + uint price = oraclize.getPrice(_datasource, _gasLimit); + if (price > 1 ether + tx.gasprice * _gasLimit) { + return 0; // Unexpectedly high price + } + return oraclize.query2_withGasLimit.value(price)(0, _datasource, _arg1, _arg2, _gasLimit); + } + + function oraclize_query(string memory _datasource, string[] memory _argN) oraclizeAPI internal returns (bytes32 _id) { + uint price = oraclize.getPrice(_datasource); + if (price > 1 ether + tx.gasprice * 200000) { + return 0; // Unexpectedly high price + } + bytes memory args = stra2cbor(_argN); + return oraclize.queryN.value(price)(0, _datasource, args); + } + + function oraclize_query(uint _timestamp, string memory _datasource, string[] memory _argN) oraclizeAPI internal returns (bytes32 _id) { + uint price = oraclize.getPrice(_datasource); + if (price > 1 ether + tx.gasprice * 200000) { + return 0; // Unexpectedly high price + } + bytes memory args = stra2cbor(_argN); + return oraclize.queryN.value(price)(_timestamp, _datasource, args); + } + + function oraclize_query(uint _timestamp, string memory _datasource, string[] memory _argN, uint _gasLimit) oraclizeAPI internal returns (bytes32 _id) { + uint price = oraclize.getPrice(_datasource, _gasLimit); + if (price > 1 ether + tx.gasprice * _gasLimit) { + return 0; // Unexpectedly high price + } + bytes memory args = stra2cbor(_argN); + return oraclize.queryN_withGasLimit.value(price)(_timestamp, _datasource, args, _gasLimit); + } + + function oraclize_query(string memory _datasource, string[] memory _argN, uint _gasLimit) oraclizeAPI internal returns (bytes32 _id) { + uint price = oraclize.getPrice(_datasource, _gasLimit); + if (price > 1 ether + tx.gasprice * _gasLimit) { + return 0; // Unexpectedly high price + } + bytes memory args = stra2cbor(_argN); + return oraclize.queryN_withGasLimit.value(price)(0, _datasource, args, _gasLimit); + } + + function oraclize_query(string memory _datasource, string[1] memory _args) oraclizeAPI internal returns (bytes32 _id) { string[] memory dynargs = new string[](1); - dynargs[0] = args[0]; - return oraclize_query(datasource, dynargs); + dynargs[0] = _args[0]; + return oraclize_query(_datasource, dynargs); } - function oraclize_query(uint timestamp, string datasource, string[1] args) oraclizeAPI internal returns (bytes32 id) { + + function oraclize_query(uint _timestamp, string memory _datasource, string[1] memory _args) oraclizeAPI internal returns (bytes32 _id) { string[] memory dynargs = new string[](1); - dynargs[0] = args[0]; - return oraclize_query(timestamp, datasource, dynargs); + dynargs[0] = _args[0]; + return oraclize_query(_timestamp, _datasource, dynargs); } - function oraclize_query(uint timestamp, string datasource, string[1] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) { + + function oraclize_query(uint _timestamp, string memory _datasource, string[1] memory _args, uint _gasLimit) oraclizeAPI internal returns (bytes32 _id) { string[] memory dynargs = new string[](1); - dynargs[0] = args[0]; - return oraclize_query(timestamp, datasource, dynargs, gaslimit); + dynargs[0] = _args[0]; + return oraclize_query(_timestamp, _datasource, dynargs, _gasLimit); } - function oraclize_query(string datasource, string[1] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) { + + function oraclize_query(string memory _datasource, string[1] memory _args, uint _gasLimit) oraclizeAPI internal returns (bytes32 _id) { string[] memory dynargs = new string[](1); - dynargs[0] = args[0]; - return oraclize_query(datasource, dynargs, gaslimit); + dynargs[0] = _args[0]; + return oraclize_query(_datasource, dynargs, _gasLimit); } - function oraclize_query(string datasource, string[2] args) oraclizeAPI internal returns (bytes32 id) { + function oraclize_query(string memory _datasource, string[2] memory _args) oraclizeAPI internal returns (bytes32 _id) { string[] memory dynargs = new string[](2); - dynargs[0] = args[0]; - dynargs[1] = args[1]; - return oraclize_query(datasource, dynargs); + dynargs[0] = _args[0]; + dynargs[1] = _args[1]; + return oraclize_query(_datasource, dynargs); } - function oraclize_query(uint timestamp, string datasource, string[2] args) oraclizeAPI internal returns (bytes32 id) { + + function oraclize_query(uint _timestamp, string memory _datasource, string[2] memory _args) oraclizeAPI internal returns (bytes32 _id) { string[] memory dynargs = new string[](2); - dynargs[0] = args[0]; - dynargs[1] = args[1]; - return oraclize_query(timestamp, datasource, dynargs); + dynargs[0] = _args[0]; + dynargs[1] = _args[1]; + return oraclize_query(_timestamp, _datasource, dynargs); } - function oraclize_query(uint timestamp, string datasource, string[2] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) { + + function oraclize_query(uint _timestamp, string memory _datasource, string[2] memory _args, uint _gasLimit) oraclizeAPI internal returns (bytes32 _id) { string[] memory dynargs = new string[](2); - dynargs[0] = args[0]; - dynargs[1] = args[1]; - return oraclize_query(timestamp, datasource, dynargs, gaslimit); + dynargs[0] = _args[0]; + dynargs[1] = _args[1]; + return oraclize_query(_timestamp, _datasource, dynargs, _gasLimit); } - function oraclize_query(string datasource, string[2] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) { + + function oraclize_query(string memory _datasource, string[2] memory _args, uint _gasLimit) oraclizeAPI internal returns (bytes32 _id) { string[] memory dynargs = new string[](2); - dynargs[0] = args[0]; - dynargs[1] = args[1]; - return oraclize_query(datasource, dynargs, gaslimit); + dynargs[0] = _args[0]; + dynargs[1] = _args[1]; + return oraclize_query(_datasource, dynargs, _gasLimit); } - function oraclize_query(string datasource, string[3] args) oraclizeAPI internal returns (bytes32 id) { + + function oraclize_query(string memory _datasource, string[3] memory _args) oraclizeAPI internal returns (bytes32 _id) { string[] memory dynargs = new string[](3); - dynargs[0] = args[0]; - dynargs[1] = args[1]; - dynargs[2] = args[2]; - return oraclize_query(datasource, dynargs); + dynargs[0] = _args[0]; + dynargs[1] = _args[1]; + dynargs[2] = _args[2]; + return oraclize_query(_datasource, dynargs); } - function oraclize_query(uint timestamp, string datasource, string[3] args) oraclizeAPI internal returns (bytes32 id) { + + function oraclize_query(uint _timestamp, string memory _datasource, string[3] memory _args) oraclizeAPI internal returns (bytes32 _id) { string[] memory dynargs = new string[](3); - dynargs[0] = args[0]; - dynargs[1] = args[1]; - dynargs[2] = args[2]; - return oraclize_query(timestamp, datasource, dynargs); + dynargs[0] = _args[0]; + dynargs[1] = _args[1]; + dynargs[2] = _args[2]; + return oraclize_query(_timestamp, _datasource, dynargs); } - function oraclize_query(uint timestamp, string datasource, string[3] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) { + + function oraclize_query(uint _timestamp, string memory _datasource, string[3] memory _args, uint _gasLimit) oraclizeAPI internal returns (bytes32 _id) { string[] memory dynargs = new string[](3); - dynargs[0] = args[0]; - dynargs[1] = args[1]; - dynargs[2] = args[2]; - return oraclize_query(timestamp, datasource, dynargs, gaslimit); + dynargs[0] = _args[0]; + dynargs[1] = _args[1]; + dynargs[2] = _args[2]; + return oraclize_query(_timestamp, _datasource, dynargs, _gasLimit); } - function oraclize_query(string datasource, string[3] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) { + + function oraclize_query(string memory _datasource, string[3] memory _args, uint _gasLimit) oraclizeAPI internal returns (bytes32 _id) { string[] memory dynargs = new string[](3); - dynargs[0] = args[0]; - dynargs[1] = args[1]; - dynargs[2] = args[2]; - return oraclize_query(datasource, dynargs, gaslimit); + dynargs[0] = _args[0]; + dynargs[1] = _args[1]; + dynargs[2] = _args[2]; + return oraclize_query(_datasource, dynargs, _gasLimit); } - function oraclize_query(string datasource, string[4] args) oraclizeAPI internal returns (bytes32 id) { + function oraclize_query(string memory _datasource, string[4] memory _args) oraclizeAPI internal returns (bytes32 _id) { string[] memory dynargs = new string[](4); - dynargs[0] = args[0]; - dynargs[1] = args[1]; - dynargs[2] = args[2]; - dynargs[3] = args[3]; - return oraclize_query(datasource, dynargs); + dynargs[0] = _args[0]; + dynargs[1] = _args[1]; + dynargs[2] = _args[2]; + dynargs[3] = _args[3]; + return oraclize_query(_datasource, dynargs); } - function oraclize_query(uint timestamp, string datasource, string[4] args) oraclizeAPI internal returns (bytes32 id) { + + function oraclize_query(uint _timestamp, string memory _datasource, string[4] memory _args) oraclizeAPI internal returns (bytes32 _id) { string[] memory dynargs = new string[](4); - dynargs[0] = args[0]; - dynargs[1] = args[1]; - dynargs[2] = args[2]; - dynargs[3] = args[3]; - return oraclize_query(timestamp, datasource, dynargs); + dynargs[0] = _args[0]; + dynargs[1] = _args[1]; + dynargs[2] = _args[2]; + dynargs[3] = _args[3]; + return oraclize_query(_timestamp, _datasource, dynargs); } - function oraclize_query(uint timestamp, string datasource, string[4] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) { + + function oraclize_query(uint _timestamp, string memory _datasource, string[4] memory _args, uint _gasLimit) oraclizeAPI internal returns (bytes32 _id) { string[] memory dynargs = new string[](4); - dynargs[0] = args[0]; - dynargs[1] = args[1]; - dynargs[2] = args[2]; - dynargs[3] = args[3]; - return oraclize_query(timestamp, datasource, dynargs, gaslimit); + dynargs[0] = _args[0]; + dynargs[1] = _args[1]; + dynargs[2] = _args[2]; + dynargs[3] = _args[3]; + return oraclize_query(_timestamp, _datasource, dynargs, _gasLimit); } - function oraclize_query(string datasource, string[4] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) { + + function oraclize_query(string memory _datasource, string[4] memory _args, uint _gasLimit) oraclizeAPI internal returns (bytes32 _id) { string[] memory dynargs = new string[](4); - dynargs[0] = args[0]; - dynargs[1] = args[1]; - dynargs[2] = args[2]; - dynargs[3] = args[3]; - return oraclize_query(datasource, dynargs, gaslimit); + dynargs[0] = _args[0]; + dynargs[1] = _args[1]; + dynargs[2] = _args[2]; + dynargs[3] = _args[3]; + return oraclize_query(_datasource, dynargs, _gasLimit); } - function oraclize_query(string datasource, string[5] args) oraclizeAPI internal returns (bytes32 id) { + + function oraclize_query(string memory _datasource, string[5] memory _args) oraclizeAPI internal returns (bytes32 _id) { string[] memory dynargs = new string[](5); - dynargs[0] = args[0]; - dynargs[1] = args[1]; - dynargs[2] = args[2]; - dynargs[3] = args[3]; - dynargs[4] = args[4]; - return oraclize_query(datasource, dynargs); - } - function oraclize_query(uint timestamp, string datasource, string[5] args) oraclizeAPI internal returns (bytes32 id) { + dynargs[0] = _args[0]; + dynargs[1] = _args[1]; + dynargs[2] = _args[2]; + dynargs[3] = _args[3]; + dynargs[4] = _args[4]; + return oraclize_query(_datasource, dynargs); + } + + function oraclize_query(uint _timestamp, string memory _datasource, string[5] memory _args) oraclizeAPI internal returns (bytes32 _id) { string[] memory dynargs = new string[](5); - dynargs[0] = args[0]; - dynargs[1] = args[1]; - dynargs[2] = args[2]; - dynargs[3] = args[3]; - dynargs[4] = args[4]; - return oraclize_query(timestamp, datasource, dynargs); - } - function oraclize_query(uint timestamp, string datasource, string[5] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) { + dynargs[0] = _args[0]; + dynargs[1] = _args[1]; + dynargs[2] = _args[2]; + dynargs[3] = _args[3]; + dynargs[4] = _args[4]; + return oraclize_query(_timestamp, _datasource, dynargs); + } + + function oraclize_query(uint _timestamp, string memory _datasource, string[5] memory _args, uint _gasLimit) oraclizeAPI internal returns (bytes32 _id) { string[] memory dynargs = new string[](5); - dynargs[0] = args[0]; - dynargs[1] = args[1]; - dynargs[2] = args[2]; - dynargs[3] = args[3]; - dynargs[4] = args[4]; - return oraclize_query(timestamp, datasource, dynargs, gaslimit); - } - function oraclize_query(string datasource, string[5] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) { + dynargs[0] = _args[0]; + dynargs[1] = _args[1]; + dynargs[2] = _args[2]; + dynargs[3] = _args[3]; + dynargs[4] = _args[4]; + return oraclize_query(_timestamp, _datasource, dynargs, _gasLimit); + } + + function oraclize_query(string memory _datasource, string[5] memory _args, uint _gasLimit) oraclizeAPI internal returns (bytes32 _id) { string[] memory dynargs = new string[](5); - dynargs[0] = args[0]; - dynargs[1] = args[1]; - dynargs[2] = args[2]; - dynargs[3] = args[3]; - dynargs[4] = args[4]; - return oraclize_query(datasource, dynargs, gaslimit); - } - function oraclize_query(string datasource, bytes[] argN) oraclizeAPI internal returns (bytes32 id){ - uint price = oraclize.getPrice(datasource); - if (price > 1 ether + tx.gasprice*200000) return 0; // unexpectedly high price - bytes memory args = ba2cbor(argN); - return oraclize.queryN.value(price)(0, datasource, args); - } - function oraclize_query(uint timestamp, string datasource, bytes[] argN) oraclizeAPI internal returns (bytes32 id){ - uint price = oraclize.getPrice(datasource); - if (price > 1 ether + tx.gasprice*200000) return 0; // unexpectedly high price - bytes memory args = ba2cbor(argN); - return oraclize.queryN.value(price)(timestamp, datasource, args); - } - function oraclize_query(uint timestamp, string datasource, bytes[] argN, uint gaslimit) oraclizeAPI internal returns (bytes32 id){ - uint price = oraclize.getPrice(datasource, gaslimit); - if (price > 1 ether + tx.gasprice*gaslimit) return 0; // unexpectedly high price - bytes memory args = ba2cbor(argN); - return oraclize.queryN_withGasLimit.value(price)(timestamp, datasource, args, gaslimit); - } - function oraclize_query(string datasource, bytes[] argN, uint gaslimit) oraclizeAPI internal returns (bytes32 id){ - uint price = oraclize.getPrice(datasource, gaslimit); - if (price > 1 ether + tx.gasprice*gaslimit) return 0; // unexpectedly high price - bytes memory args = ba2cbor(argN); - return oraclize.queryN_withGasLimit.value(price)(0, datasource, args, gaslimit); - } - function oraclize_query(string datasource, bytes[1] args) oraclizeAPI internal returns (bytes32 id) { + dynargs[0] = _args[0]; + dynargs[1] = _args[1]; + dynargs[2] = _args[2]; + dynargs[3] = _args[3]; + dynargs[4] = _args[4]; + return oraclize_query(_datasource, dynargs, _gasLimit); + } + + function oraclize_query(string memory _datasource, bytes[] memory _argN) oraclizeAPI internal returns (bytes32 _id) { + uint price = oraclize.getPrice(_datasource); + if (price > 1 ether + tx.gasprice * 200000) { + return 0; // Unexpectedly high price + } + bytes memory args = ba2cbor(_argN); + return oraclize.queryN.value(price)(0, _datasource, args); + } + + function oraclize_query(uint _timestamp, string memory _datasource, bytes[] memory _argN) oraclizeAPI internal returns (bytes32 _id) { + uint price = oraclize.getPrice(_datasource); + if (price > 1 ether + tx.gasprice * 200000) { + return 0; // Unexpectedly high price + } + bytes memory args = ba2cbor(_argN); + return oraclize.queryN.value(price)(_timestamp, _datasource, args); + } + + function oraclize_query(uint _timestamp, string memory _datasource, bytes[] memory _argN, uint _gasLimit) oraclizeAPI internal returns (bytes32 _id) { + uint price = oraclize.getPrice(_datasource, _gasLimit); + if (price > 1 ether + tx.gasprice * _gasLimit) { + return 0; // Unexpectedly high price + } + bytes memory args = ba2cbor(_argN); + return oraclize.queryN_withGasLimit.value(price)(_timestamp, _datasource, args, _gasLimit); + } + + function oraclize_query(string memory _datasource, bytes[] memory _argN, uint _gasLimit) oraclizeAPI internal returns (bytes32 _id) { + uint price = oraclize.getPrice(_datasource, _gasLimit); + if (price > 1 ether + tx.gasprice * _gasLimit) { + return 0; // Unexpectedly high price + } + bytes memory args = ba2cbor(_argN); + return oraclize.queryN_withGasLimit.value(price)(0, _datasource, args, _gasLimit); + } + + function oraclize_query(string memory _datasource, bytes[1] memory _args) oraclizeAPI internal returns (bytes32 _id) { bytes[] memory dynargs = new bytes[](1); - dynargs[0] = args[0]; - return oraclize_query(datasource, dynargs); + dynargs[0] = _args[0]; + return oraclize_query(_datasource, dynargs); } - function oraclize_query(uint timestamp, string datasource, bytes[1] args) oraclizeAPI internal returns (bytes32 id) { + + function oraclize_query(uint _timestamp, string memory _datasource, bytes[1] memory _args) oraclizeAPI internal returns (bytes32 _id) { bytes[] memory dynargs = new bytes[](1); - dynargs[0] = args[0]; - return oraclize_query(timestamp, datasource, dynargs); + dynargs[0] = _args[0]; + return oraclize_query(_timestamp, _datasource, dynargs); } - function oraclize_query(uint timestamp, string datasource, bytes[1] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) { + + function oraclize_query(uint _timestamp, string memory _datasource, bytes[1] memory _args, uint _gasLimit) oraclizeAPI internal returns (bytes32 _id) { bytes[] memory dynargs = new bytes[](1); - dynargs[0] = args[0]; - return oraclize_query(timestamp, datasource, dynargs, gaslimit); + dynargs[0] = _args[0]; + return oraclize_query(_timestamp, _datasource, dynargs, _gasLimit); } - function oraclize_query(string datasource, bytes[1] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) { + + function oraclize_query(string memory _datasource, bytes[1] memory _args, uint _gasLimit) oraclizeAPI internal returns (bytes32 _id) { bytes[] memory dynargs = new bytes[](1); - dynargs[0] = args[0]; - return oraclize_query(datasource, dynargs, gaslimit); + dynargs[0] = _args[0]; + return oraclize_query(_datasource, dynargs, _gasLimit); } - function oraclize_query(string datasource, bytes[2] args) oraclizeAPI internal returns (bytes32 id) { + function oraclize_query(string memory _datasource, bytes[2] memory _args) oraclizeAPI internal returns (bytes32 _id) { bytes[] memory dynargs = new bytes[](2); - dynargs[0] = args[0]; - dynargs[1] = args[1]; - return oraclize_query(datasource, dynargs); + dynargs[0] = _args[0]; + dynargs[1] = _args[1]; + return oraclize_query(_datasource, dynargs); } - function oraclize_query(uint timestamp, string datasource, bytes[2] args) oraclizeAPI internal returns (bytes32 id) { + + function oraclize_query(uint _timestamp, string memory _datasource, bytes[2] memory _args) oraclizeAPI internal returns (bytes32 _id) { bytes[] memory dynargs = new bytes[](2); - dynargs[0] = args[0]; - dynargs[1] = args[1]; - return oraclize_query(timestamp, datasource, dynargs); + dynargs[0] = _args[0]; + dynargs[1] = _args[1]; + return oraclize_query(_timestamp, _datasource, dynargs); } - function oraclize_query(uint timestamp, string datasource, bytes[2] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) { + + function oraclize_query(uint _timestamp, string memory _datasource, bytes[2] memory _args, uint _gasLimit) oraclizeAPI internal returns (bytes32 _id) { bytes[] memory dynargs = new bytes[](2); - dynargs[0] = args[0]; - dynargs[1] = args[1]; - return oraclize_query(timestamp, datasource, dynargs, gaslimit); + dynargs[0] = _args[0]; + dynargs[1] = _args[1]; + return oraclize_query(_timestamp, _datasource, dynargs, _gasLimit); } - function oraclize_query(string datasource, bytes[2] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) { + + function oraclize_query(string memory _datasource, bytes[2] memory _args, uint _gasLimit) oraclizeAPI internal returns (bytes32 _id) { bytes[] memory dynargs = new bytes[](2); - dynargs[0] = args[0]; - dynargs[1] = args[1]; - return oraclize_query(datasource, dynargs, gaslimit); + dynargs[0] = _args[0]; + dynargs[1] = _args[1]; + return oraclize_query(_datasource, dynargs, _gasLimit); } - function oraclize_query(string datasource, bytes[3] args) oraclizeAPI internal returns (bytes32 id) { + + function oraclize_query(string memory _datasource, bytes[3] memory _args) oraclizeAPI internal returns (bytes32 _id) { bytes[] memory dynargs = new bytes[](3); - dynargs[0] = args[0]; - dynargs[1] = args[1]; - dynargs[2] = args[2]; - return oraclize_query(datasource, dynargs); + dynargs[0] = _args[0]; + dynargs[1] = _args[1]; + dynargs[2] = _args[2]; + return oraclize_query(_datasource, dynargs); } - function oraclize_query(uint timestamp, string datasource, bytes[3] args) oraclizeAPI internal returns (bytes32 id) { + + function oraclize_query(uint _timestamp, string memory _datasource, bytes[3] memory _args) oraclizeAPI internal returns (bytes32 _id) { bytes[] memory dynargs = new bytes[](3); - dynargs[0] = args[0]; - dynargs[1] = args[1]; - dynargs[2] = args[2]; - return oraclize_query(timestamp, datasource, dynargs); + dynargs[0] = _args[0]; + dynargs[1] = _args[1]; + dynargs[2] = _args[2]; + return oraclize_query(_timestamp, _datasource, dynargs); } - function oraclize_query(uint timestamp, string datasource, bytes[3] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) { + + function oraclize_query(uint _timestamp, string memory _datasource, bytes[3] memory _args, uint _gasLimit) oraclizeAPI internal returns (bytes32 _id) { bytes[] memory dynargs = new bytes[](3); - dynargs[0] = args[0]; - dynargs[1] = args[1]; - dynargs[2] = args[2]; - return oraclize_query(timestamp, datasource, dynargs, gaslimit); + dynargs[0] = _args[0]; + dynargs[1] = _args[1]; + dynargs[2] = _args[2]; + return oraclize_query(_timestamp, _datasource, dynargs, _gasLimit); } - function oraclize_query(string datasource, bytes[3] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) { + + function oraclize_query(string memory _datasource, bytes[3] memory _args, uint _gasLimit) oraclizeAPI internal returns (bytes32 _id) { bytes[] memory dynargs = new bytes[](3); - dynargs[0] = args[0]; - dynargs[1] = args[1]; - dynargs[2] = args[2]; - return oraclize_query(datasource, dynargs, gaslimit); + dynargs[0] = _args[0]; + dynargs[1] = _args[1]; + dynargs[2] = _args[2]; + return oraclize_query(_datasource, dynargs, _gasLimit); } - function oraclize_query(string datasource, bytes[4] args) oraclizeAPI internal returns (bytes32 id) { + function oraclize_query(string memory _datasource, bytes[4] memory _args) oraclizeAPI internal returns (bytes32 _id) { bytes[] memory dynargs = new bytes[](4); - dynargs[0] = args[0]; - dynargs[1] = args[1]; - dynargs[2] = args[2]; - dynargs[3] = args[3]; - return oraclize_query(datasource, dynargs); + dynargs[0] = _args[0]; + dynargs[1] = _args[1]; + dynargs[2] = _args[2]; + dynargs[3] = _args[3]; + return oraclize_query(_datasource, dynargs); } - function oraclize_query(uint timestamp, string datasource, bytes[4] args) oraclizeAPI internal returns (bytes32 id) { + + function oraclize_query(uint _timestamp, string memory _datasource, bytes[4] memory _args) oraclizeAPI internal returns (bytes32 _id) { bytes[] memory dynargs = new bytes[](4); - dynargs[0] = args[0]; - dynargs[1] = args[1]; - dynargs[2] = args[2]; - dynargs[3] = args[3]; - return oraclize_query(timestamp, datasource, dynargs); + dynargs[0] = _args[0]; + dynargs[1] = _args[1]; + dynargs[2] = _args[2]; + dynargs[3] = _args[3]; + return oraclize_query(_timestamp, _datasource, dynargs); } - function oraclize_query(uint timestamp, string datasource, bytes[4] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) { + + function oraclize_query(uint _timestamp, string memory _datasource, bytes[4] memory _args, uint _gasLimit) oraclizeAPI internal returns (bytes32 _id) { bytes[] memory dynargs = new bytes[](4); - dynargs[0] = args[0]; - dynargs[1] = args[1]; - dynargs[2] = args[2]; - dynargs[3] = args[3]; - return oraclize_query(timestamp, datasource, dynargs, gaslimit); + dynargs[0] = _args[0]; + dynargs[1] = _args[1]; + dynargs[2] = _args[2]; + dynargs[3] = _args[3]; + return oraclize_query(_timestamp, _datasource, dynargs, _gasLimit); } - function oraclize_query(string datasource, bytes[4] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) { + + function oraclize_query(string memory _datasource, bytes[4] memory _args, uint _gasLimit) oraclizeAPI internal returns (bytes32 _id) { bytes[] memory dynargs = new bytes[](4); - dynargs[0] = args[0]; - dynargs[1] = args[1]; - dynargs[2] = args[2]; - dynargs[3] = args[3]; - return oraclize_query(datasource, dynargs, gaslimit); + dynargs[0] = _args[0]; + dynargs[1] = _args[1]; + dynargs[2] = _args[2]; + dynargs[3] = _args[3]; + return oraclize_query(_datasource, dynargs, _gasLimit); } - function oraclize_query(string datasource, bytes[5] args) oraclizeAPI internal returns (bytes32 id) { - bytes[] memory dynargs = new bytes[](5); - dynargs[0] = args[0]; - dynargs[1] = args[1]; - dynargs[2] = args[2]; - dynargs[3] = args[3]; - dynargs[4] = args[4]; - return oraclize_query(datasource, dynargs); - } - function oraclize_query(uint timestamp, string datasource, bytes[5] args) oraclizeAPI internal returns (bytes32 id) { - bytes[] memory dynargs = new bytes[](5); - dynargs[0] = args[0]; - dynargs[1] = args[1]; - dynargs[2] = args[2]; - dynargs[3] = args[3]; - dynargs[4] = args[4]; - return oraclize_query(timestamp, datasource, dynargs); - } - function oraclize_query(uint timestamp, string datasource, bytes[5] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) { + + function oraclize_query(string memory _datasource, bytes[5] memory _args) oraclizeAPI internal returns (bytes32 _id) { bytes[] memory dynargs = new bytes[](5); - dynargs[0] = args[0]; - dynargs[1] = args[1]; - dynargs[2] = args[2]; - dynargs[3] = args[3]; - dynargs[4] = args[4]; - return oraclize_query(timestamp, datasource, dynargs, gaslimit); - } - function oraclize_query(string datasource, bytes[5] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) { + dynargs[0] = _args[0]; + dynargs[1] = _args[1]; + dynargs[2] = _args[2]; + dynargs[3] = _args[3]; + dynargs[4] = _args[4]; + return oraclize_query(_datasource, dynargs); + } + + function oraclize_query(uint _timestamp, string memory _datasource, bytes[5] memory _args) oraclizeAPI internal returns (bytes32 _id) { bytes[] memory dynargs = new bytes[](5); - dynargs[0] = args[0]; - dynargs[1] = args[1]; - dynargs[2] = args[2]; - dynargs[3] = args[3]; - dynargs[4] = args[4]; - return oraclize_query(datasource, dynargs, gaslimit); + dynargs[0] = _args[0]; + dynargs[1] = _args[1]; + dynargs[2] = _args[2]; + dynargs[3] = _args[3]; + dynargs[4] = _args[4]; + return oraclize_query(_timestamp, _datasource, dynargs); } - function oraclize_cbAddress() oraclizeAPI internal returns (address){ - return oraclize.cbAddress(); + function oraclize_query(uint _timestamp, string memory _datasource, bytes[5] memory _args, uint _gasLimit) oraclizeAPI internal returns (bytes32 _id) { + bytes[] memory dynargs = new bytes[](5); + dynargs[0] = _args[0]; + dynargs[1] = _args[1]; + dynargs[2] = _args[2]; + dynargs[3] = _args[3]; + dynargs[4] = _args[4]; + return oraclize_query(_timestamp, _datasource, dynargs, _gasLimit); } - function oraclize_setProof(byte proofP) oraclizeAPI internal { - return oraclize.setProofType(proofP); + + function oraclize_query(string memory _datasource, bytes[5] memory _args, uint _gasLimit) oraclizeAPI internal returns (bytes32 _id) { + bytes[] memory dynargs = new bytes[](5); + dynargs[0] = _args[0]; + dynargs[1] = _args[1]; + dynargs[2] = _args[2]; + dynargs[3] = _args[3]; + dynargs[4] = _args[4]; + return oraclize_query(_datasource, dynargs, _gasLimit); } - function oraclize_setCustomGasPrice(uint gasPrice) oraclizeAPI internal { - return oraclize.setCustomGasPrice(gasPrice); + + function oraclize_setProof(byte _proofP) oraclizeAPI internal { + return oraclize.setProofType(_proofP); } - function oraclize_randomDS_getSessionPubKeyHash() oraclizeAPI internal returns (bytes32){ - return oraclize.randomDS_getSessionPubKeyHash(); + + function oraclize_cbAddress() oraclizeAPI internal returns (address _callbackAddress) { + return oraclize.cbAddress(); } - function getCodeSize(address _addr) view internal returns(uint _size) { + function getCodeSize(address _addr) view internal returns (uint _size) { assembly { _size := extcodesize(_addr) } } - function parseAddr(string _a) internal pure returns (address){ + function oraclize_setCustomGasPrice(uint _gasPrice) oraclizeAPI internal { + return oraclize.setCustomGasPrice(_gasPrice); + } + + function oraclize_randomDS_getSessionPubKeyHash() oraclizeAPI internal returns (bytes32 _sessionKeyHash) { + return oraclize.randomDS_getSessionPubKeyHash(); + } + + function parseAddr(string memory _a) internal pure returns (address _parsedAddress) { bytes memory tmp = bytes(_a); uint160 iaddr = 0; uint160 b1; uint160 b2; - for (uint i=2; i<2+2*20; i+=2){ + for (uint i = 2; i < 2 + 2 * 20; i += 2) { iaddr *= 256; - b1 = uint160(tmp[i]); - b2 = uint160(tmp[i+1]); - if ((b1 >= 97)&&(b1 <= 102)) b1 -= 87; - else if ((b1 >= 65)&&(b1 <= 70)) b1 -= 55; - else if ((b1 >= 48)&&(b1 <= 57)) b1 -= 48; - if ((b2 >= 97)&&(b2 <= 102)) b2 -= 87; - else if ((b2 >= 65)&&(b2 <= 70)) b2 -= 55; - else if ((b2 >= 48)&&(b2 <= 57)) b2 -= 48; - iaddr += (b1*16+b2); + b1 = uint160(uint8(tmp[i])); + b2 = uint160(uint8(tmp[i + 1])); + if ((b1 >= 97) && (b1 <= 102)) { + b1 -= 87; + } else if ((b1 >= 65) && (b1 <= 70)) { + b1 -= 55; + } else if ((b1 >= 48) && (b1 <= 57)) { + b1 -= 48; + } + if ((b2 >= 97) && (b2 <= 102)) { + b2 -= 87; + } else if ((b2 >= 65) && (b2 <= 70)) { + b2 -= 55; + } else if ((b2 >= 48) && (b2 <= 57)) { + b2 -= 48; + } + iaddr += (b1 * 16 + b2); } return address(iaddr); } - function strCompare(string _a, string _b) internal pure returns (int) { + function strCompare(string memory _a, string memory _b) internal pure returns (int _returnCode) { bytes memory a = bytes(_a); bytes memory b = bytes(_b); uint minLength = a.length; - if (b.length < minLength) minLength = b.length; - for (uint i = 0; i < minLength; i ++) - if (a[i] < b[i]) + if (b.length < minLength) { + minLength = b.length; + } + for (uint i = 0; i < minLength; i ++) { + if (a[i] < b[i]) { return -1; - else if (a[i] > b[i]) + } else if (a[i] > b[i]) { return 1; - if (a.length < b.length) + } + } + if (a.length < b.length) { return -1; - else if (a.length > b.length) + } else if (a.length > b.length) { return 1; - else + } else { return 0; + } } - function indexOf(string _haystack, string _needle) internal pure returns (int) { + function indexOf(string memory _haystack, string memory _needle) internal pure returns (int _returnCode) { bytes memory h = bytes(_haystack); bytes memory n = bytes(_needle); - if(h.length < 1 || n.length < 1 || (n.length > h.length)) + if (h.length < 1 || n.length < 1 || (n.length > h.length)) { return -1; - else if(h.length > (2**128 -1)) + } else if (h.length > (2 ** 128 - 1)) { return -1; - else - { + } else { uint subindex = 0; - for (uint i = 0; i < h.length; i ++) - { - if (h[i] == n[0]) - { + for (uint i = 0; i < h.length; i++) { + if (h[i] == n[0]) { subindex = 1; - while(subindex < n.length && (i + subindex) < h.length && h[i + subindex] == n[subindex]) - { + while(subindex < n.length && (i + subindex) < h.length && h[i + subindex] == n[subindex]) { subindex++; } - if(subindex == n.length) + if (subindex == n.length) { return int(i); + } } } return -1; } } - function strConcat(string _a, string _b, string _c, string _d, string _e) internal pure returns (string) { + function strConcat(string memory _a, string memory _b) internal pure returns (string memory _concatenatedString) { + return strConcat(_a, _b, "", "", ""); + } + + function strConcat(string memory _a, string memory _b, string memory _c) internal pure returns (string memory _concatenatedString) { + return strConcat(_a, _b, _c, "", ""); + } + + function strConcat(string memory _a, string memory _b, string memory _c, string memory _d) internal pure returns (string memory _concatenatedString) { + return strConcat(_a, _b, _c, _d, ""); + } + + function strConcat(string memory _a, string memory _b, string memory _c, string memory _d, string memory _e) internal pure returns (string memory _concatenatedString) { bytes memory _ba = bytes(_a); bytes memory _bb = bytes(_b); bytes memory _bc = bytes(_c); @@ -844,115 +956,141 @@ contract usingOraclize { string memory abcde = new string(_ba.length + _bb.length + _bc.length + _bd.length + _be.length); bytes memory babcde = bytes(abcde); uint k = 0; - for (uint i = 0; i < _ba.length; i++) babcde[k++] = _ba[i]; - for (i = 0; i < _bb.length; i++) babcde[k++] = _bb[i]; - for (i = 0; i < _bc.length; i++) babcde[k++] = _bc[i]; - for (i = 0; i < _bd.length; i++) babcde[k++] = _bd[i]; - for (i = 0; i < _be.length; i++) babcde[k++] = _be[i]; + uint i = 0; + for (i = 0; i < _ba.length; i++) { + babcde[k++] = _ba[i]; + } + for (i = 0; i < _bb.length; i++) { + babcde[k++] = _bb[i]; + } + for (i = 0; i < _bc.length; i++) { + babcde[k++] = _bc[i]; + } + for (i = 0; i < _bd.length; i++) { + babcde[k++] = _bd[i]; + } + for (i = 0; i < _be.length; i++) { + babcde[k++] = _be[i]; + } return string(babcde); } - function strConcat(string _a, string _b, string _c, string _d) internal pure returns (string) { - return strConcat(_a, _b, _c, _d, ""); - } - - function strConcat(string _a, string _b, string _c) internal pure returns (string) { - return strConcat(_a, _b, _c, "", ""); + function safeParseInt(string memory _a) internal pure returns (uint _parsedInt) { + return safeParseInt(_a, 0); } - function strConcat(string _a, string _b) internal pure returns (string) { - return strConcat(_a, _b, "", "", ""); + function safeParseInt(string memory _a, uint _b) internal pure returns (uint _parsedInt) { + bytes memory bresult = bytes(_a); + uint mint = 0; + bool decimals = false; + for (uint i = 0; i < bresult.length; i++) { + if ((uint(uint8(bresult[i])) >= 48) && (uint(uint8(bresult[i])) <= 57)) { + if (decimals) { + if (_b == 0) break; + else _b--; + } + mint *= 10; + mint += uint(uint8(bresult[i])) - 48; + } else if (uint(uint8(bresult[i])) == 46) { + require(!decimals, 'More than one decimal encountered in string!'); + decimals = true; + } else { + revert("Non-numeral character encountered in string!"); + } + } + if (_b > 0) { + mint *= 10 ** _b; + } + return mint; } - // parseInt - function parseInt(string _a) internal pure returns (uint) { + function parseInt(string memory _a) internal pure returns (uint _parsedInt) { return parseInt(_a, 0); } - // parseInt(parseFloat*10^_b) - function parseInt(string _a, uint _b) internal pure returns (uint) { + function parseInt(string memory _a, uint _b) internal pure returns (uint _parsedInt) { bytes memory bresult = bytes(_a); uint mint = 0; bool decimals = false; - for (uint i=0; i= 48)&&(bresult[i] <= 57)){ - if (decimals){ - if (_b == 0) break; - else _b--; + for (uint i = 0; i < bresult.length; i++) { + if ((uint(uint8(bresult[i])) >= 48) && (uint(uint8(bresult[i])) <= 57)) { + if (decimals) { + if (_b == 0) { + break; + } else { + _b--; + } } mint *= 10; - mint += uint(bresult[i]) - 48; - } else if (bresult[i] == 46) decimals = true; + mint += uint(uint8(bresult[i])) - 48; + } else if (uint(uint8(bresult[i])) == 46) { + decimals = true; + } + } + if (_b > 0) { + mint *= 10 ** _b; } - if (_b > 0) mint *= 10**_b; return mint; } - function uint2str(uint i) internal pure returns (string){ - if (i == 0) return "0"; - uint j = i; + function uint2str(uint _i) internal pure returns (string memory _uintAsString) { + if (_i == 0) { + return "0"; + } + uint j = _i; uint len; - while (j != 0){ + while (j != 0) { len++; j /= 10; } bytes memory bstr = new bytes(len); uint k = len - 1; - while (i != 0){ - bstr[k--] = byte(48 + i % 10); - i /= 10; + while (_i != 0) { + bstr[k--] = byte(uint8(48 + _i % 10)); + _i /= 10; } return string(bstr); } - using CBOR for Buffer.buffer; - function stra2cbor(string[] arr) internal pure returns (bytes) { + function stra2cbor(string[] memory _arr) internal pure returns (bytes memory _cborEncoding) { safeMemoryCleaner(); Buffer.buffer memory buf; Buffer.init(buf, 1024); buf.startArray(); - for (uint i = 0; i < arr.length; i++) { - buf.encodeString(arr[i]); + for (uint i = 0; i < _arr.length; i++) { + buf.encodeString(_arr[i]); } buf.endSequence(); return buf.buf; } - function ba2cbor(bytes[] arr) internal pure returns (bytes) { + function ba2cbor(bytes[] memory _arr) internal pure returns (bytes memory _cborEncoding) { safeMemoryCleaner(); Buffer.buffer memory buf; Buffer.init(buf, 1024); buf.startArray(); - for (uint i = 0; i < arr.length; i++) { - buf.encodeBytes(arr[i]); + for (uint i = 0; i < _arr.length; i++) { + buf.encodeBytes(_arr[i]); } buf.endSequence(); return buf.buf; } - string oraclize_network_name; - function oraclize_setNetworkName(string _network_name) internal { - oraclize_network_name = _network_name; - } - - function oraclize_getNetworkName() internal view returns (string) { - return oraclize_network_name; - } - - function oraclize_newRandomDSQuery(uint _delay, uint _nbytes, uint _customGasLimit) internal returns (bytes32){ + function oraclize_newRandomDSQuery(uint _delay, uint _nbytes, uint _customGasLimit) internal returns (bytes32 _queryId) { require((_nbytes > 0) && (_nbytes <= 32)); - // Convert from seconds to ledger timer ticks - _delay *= 10; + _delay *= 10; // Convert from seconds to ledger timer ticks bytes memory nbytes = new bytes(1); - nbytes[0] = byte(_nbytes); + nbytes[0] = byte(uint8(_nbytes)); bytes memory unonce = new bytes(32); bytes memory sessionKeyHash = new bytes(32); bytes32 sessionKeyHash_bytes32 = oraclize_randomDS_getSessionPubKeyHash(); assembly { mstore(unonce, 0x20) - // the following variables can be relaxed - // check relaxed random contract under ethereum-examples repo - // for an idea on how to override and replace comit hash vars + /* + The following variables can be relaxed. + Check the relaxed random contract at https://github.com/oraclize/ethereum-examples + for an idea on how to override and replace commit hash variables. + */ mstore(add(unonce, 0x20), xor(blockhash(sub(number, 1)), xor(coinbase, timestamp))) mstore(sessionKeyHash, 0x20) mstore(add(sessionKeyHash, 0x20), sessionKeyHash_bytes32) @@ -961,15 +1099,11 @@ contract usingOraclize { assembly { mstore(add(delay, 0x20), _delay) } - bytes memory delay_bytes8 = new bytes(8); copyBytes(delay, 24, 8, delay_bytes8, 0); - bytes[4] memory args = [unonce, nbytes, sessionKeyHash, delay]; bytes32 queryId = oraclize_query("random", args, _customGasLimit); - bytes memory delay_bytes8_left = new bytes(8); - assembly { let x := mload(add(delay_bytes8, 0x20)) mstore8(add(delay_bytes8_left, 0x27), div(x, 0x100000000000000000000000000000000000000000000000000000000000000)) @@ -980,248 +1114,214 @@ contract usingOraclize { mstore8(add(delay_bytes8_left, 0x22), div(x, 0x10000000000000000000000000000000000000000000000000000)) mstore8(add(delay_bytes8_left, 0x21), div(x, 0x100000000000000000000000000000000000000000000000000)) mstore8(add(delay_bytes8_left, 0x20), div(x, 0x1000000000000000000000000000000000000000000000000)) - } - oraclize_randomDS_setCommitment(queryId, keccak256(abi.encodePacked(delay_bytes8_left, args[1], sha256(args[0]), args[2]))); return queryId; } - function oraclize_randomDS_setCommitment(bytes32 queryId, bytes32 commitment) internal { - oraclize_randomDS_args[queryId] = commitment; + function oraclize_randomDS_setCommitment(bytes32 _queryId, bytes32 _commitment) internal { + oraclize_randomDS_args[_queryId] = _commitment; } - mapping(bytes32=>bytes32) oraclize_randomDS_args; - mapping(bytes32=>bool) oraclize_randomDS_sessionKeysHashVerified; - - function verifySig(bytes32 tosignh, bytes dersig, bytes pubkey) internal returns (bool){ + function verifySig(bytes32 _tosignh, bytes memory _dersig, bytes memory _pubkey) internal returns (bool _sigVerified) { bool sigok; address signer; - bytes32 sigr; bytes32 sigs; - bytes memory sigr_ = new bytes(32); - uint offset = 4+(uint(dersig[3]) - 0x20); - sigr_ = copyBytes(dersig, offset, 32, sigr_, 0); + uint offset = 4 + (uint(uint8(_dersig[3])) - 0x20); + sigr_ = copyBytes(_dersig, offset, 32, sigr_, 0); bytes memory sigs_ = new bytes(32); offset += 32 + 2; - sigs_ = copyBytes(dersig, offset+(uint(dersig[offset-1]) - 0x20), 32, sigs_, 0); - + sigs_ = copyBytes(_dersig, offset + (uint(uint8(_dersig[offset - 1])) - 0x20), 32, sigs_, 0); assembly { sigr := mload(add(sigr_, 32)) sigs := mload(add(sigs_, 32)) } - - - (sigok, signer) = safer_ecrecover(tosignh, 27, sigr, sigs); - if (address(keccak256(pubkey)) == signer) return true; - else { - (sigok, signer) = safer_ecrecover(tosignh, 28, sigr, sigs); - return (address(keccak256(pubkey)) == signer); + (sigok, signer) = safer_ecrecover(_tosignh, 27, sigr, sigs); + if (address(uint160(uint256(keccak256(_pubkey)))) == signer) { + return true; + } else { + (sigok, signer) = safer_ecrecover(_tosignh, 28, sigr, sigs); + return (address(uint160(uint256(keccak256(_pubkey)))) == signer); } } - function oraclize_randomDS_proofVerify__sessionKeyValidity(bytes proof, uint sig2offset) internal returns (bool) { + function oraclize_randomDS_proofVerify__sessionKeyValidity(bytes memory _proof, uint _sig2offset) internal returns (bool _proofVerified) { bool sigok; - - // Step 6: verify the attestation signature, APPKEY1 must sign the sessionKey from the correct ledger app (CODEHASH) - bytes memory sig2 = new bytes(uint(proof[sig2offset+1])+2); - copyBytes(proof, sig2offset, sig2.length, sig2, 0); - + // Random DS Proof Step 6: Verify the attestation signature, APPKEY1 must sign the sessionKey from the correct ledger app (CODEHASH) + bytes memory sig2 = new bytes(uint(uint8(_proof[_sig2offset + 1])) + 2); + copyBytes(_proof, _sig2offset, sig2.length, sig2, 0); bytes memory appkey1_pubkey = new bytes(64); - copyBytes(proof, 3+1, 64, appkey1_pubkey, 0); - - bytes memory tosign2 = new bytes(1+65+32); - tosign2[0] = byte(1); //role - copyBytes(proof, sig2offset-65, 65, tosign2, 1); + copyBytes(_proof, 3 + 1, 64, appkey1_pubkey, 0); + bytes memory tosign2 = new bytes(1 + 65 + 32); + tosign2[0] = byte(uint8(1)); //role + copyBytes(_proof, _sig2offset - 65, 65, tosign2, 1); bytes memory CODEHASH = hex"fd94fa71bc0ba10d39d464d0d8f465efeef0a2764e3887fcc9df41ded20f505c"; - copyBytes(CODEHASH, 0, 32, tosign2, 1+65); + copyBytes(CODEHASH, 0, 32, tosign2, 1 + 65); sigok = verifySig(sha256(tosign2), sig2, appkey1_pubkey); - - if (sigok == false) return false; - - - // Step 7: verify the APPKEY1 provenance (must be signed by Ledger) + if (!sigok) { + return false; + } + // Random DS Proof Step 7: Verify the APPKEY1 provenance (must be signed by Ledger) bytes memory LEDGERKEY = hex"7fb956469c5c9b89840d55b43537e66a98dd4811ea0a27224272c2e5622911e8537a2f8e86a46baec82864e98dd01e9ccc2f8bc5dfc9cbe5a91a290498dd96e4"; - - bytes memory tosign3 = new bytes(1+65); + bytes memory tosign3 = new bytes(1 + 65); tosign3[0] = 0xFE; - copyBytes(proof, 3, 65, tosign3, 1); - - bytes memory sig3 = new bytes(uint(proof[3+65+1])+2); - copyBytes(proof, 3+65, sig3.length, sig3, 0); - + copyBytes(_proof, 3, 65, tosign3, 1); + bytes memory sig3 = new bytes(uint(uint8(_proof[3 + 65 + 1])) + 2); + copyBytes(_proof, 3 + 65, sig3.length, sig3, 0); sigok = verifySig(sha256(tosign3), sig3, LEDGERKEY); - return sigok; } - modifier oraclize_randomDS_proofVerify(bytes32 _queryId, string _result, bytes _proof) { - // Step 1: the prefix has to match 'LP\x01' (Ledger Proof version 1) - require((_proof[0] == "L") && (_proof[1] == "P") && (_proof[2] == 1)); - - bool proofVerified = oraclize_randomDS_proofVerify__main(_proof, _queryId, bytes(_result), oraclize_getNetworkName()); - require(proofVerified); - - _; - } - - function oraclize_randomDS_proofVerify__returnCode(bytes32 _queryId, string _result, bytes _proof) internal returns (uint8){ - // Step 1: the prefix has to match 'LP\x01' (Ledger Proof version 1) - if ((_proof[0] != "L")||(_proof[1] != "P")||(_proof[2] != 1)) return 1; - + function oraclize_randomDS_proofVerify__returnCode(bytes32 _queryId, string memory _result, bytes memory _proof) internal returns (uint8 _returnCode) { + // Random DS Proof Step 1: The prefix has to match 'LP\x01' (Ledger Proof version 1) + if ((_proof[0] != "L") || (_proof[1] != "P") || (uint8(_proof[2]) != uint8(1))) { + return 1; + } bool proofVerified = oraclize_randomDS_proofVerify__main(_proof, _queryId, bytes(_result), oraclize_getNetworkName()); - if (proofVerified == false) return 2; - + if (!proofVerified) { + return 2; + } return 0; } - function matchBytes32Prefix(bytes32 content, bytes prefix, uint n_random_bytes) internal pure returns (bool){ + function matchBytes32Prefix(bytes32 _content, bytes memory _prefix, uint _nRandomBytes) internal pure returns (bool _matchesPrefix) { bool match_ = true; - - require(prefix.length == n_random_bytes); - - for (uint256 i=0; i< n_random_bytes; i++) { - if (content[i] != prefix[i]) match_ = false; + require(_prefix.length == _nRandomBytes); + for (uint256 i = 0; i< _nRandomBytes; i++) { + if (_content[i] != _prefix[i]) { + match_ = false; + } } - return match_; } - function oraclize_randomDS_proofVerify__main(bytes proof, bytes32 queryId, bytes result, string context_name) internal returns (bool){ - - // Step 2: the unique keyhash has to match with the sha256 of (context name + queryId) - uint ledgerProofLength = 3+65+(uint(proof[3+65+1])+2)+32; + function oraclize_randomDS_proofVerify__main(bytes memory _proof, bytes32 _queryId, bytes memory _result, string memory _contextName) internal returns (bool _proofVerified) { + // Random DS Proof Step 2: The unique keyhash has to match with the sha256 of (context name + _queryId) + uint ledgerProofLength = 3 + 65 + (uint(uint8(_proof[3 + 65 + 1])) + 2) + 32; bytes memory keyhash = new bytes(32); - copyBytes(proof, ledgerProofLength, 32, keyhash, 0); - if (!(keccak256(keyhash) == keccak256(abi.encodePacked(sha256(abi.encodePacked(context_name, queryId)))))) return false; - - bytes memory sig1 = new bytes(uint(proof[ledgerProofLength+(32+8+1+32)+1])+2); - copyBytes(proof, ledgerProofLength+(32+8+1+32), sig1.length, sig1, 0); - - // Step 3: we assume sig1 is valid (it will be verified during step 5) and we verify if 'result' is the prefix of sha256(sig1) - if (!matchBytes32Prefix(sha256(sig1), result, uint(proof[ledgerProofLength+32+8]))) return false; - - // Step 4: commitment match verification, keccak256(delay, nbytes, unonce, sessionKeyHash) == commitment in storage. + copyBytes(_proof, ledgerProofLength, 32, keyhash, 0); + if (!(keccak256(keyhash) == keccak256(abi.encodePacked(sha256(abi.encodePacked(_contextName, _queryId)))))) { + return false; + } + bytes memory sig1 = new bytes(uint(uint8(_proof[ledgerProofLength + (32 + 8 + 1 + 32) + 1])) + 2); + copyBytes(_proof, ledgerProofLength + (32 + 8 + 1 + 32), sig1.length, sig1, 0); + // Random DS Proof Step 3: We assume sig1 is valid (it will be verified during step 5) and we verify if '_result' is the _prefix of sha256(sig1) + if (!matchBytes32Prefix(sha256(sig1), _result, uint(uint8(_proof[ledgerProofLength + 32 + 8])))) { + return false; + } + // Random DS Proof Step 4: Commitment match verification, keccak256(delay, nbytes, unonce, sessionKeyHash) == commitment in storage. // This is to verify that the computed args match with the ones specified in the query. - bytes memory commitmentSlice1 = new bytes(8+1+32); - copyBytes(proof, ledgerProofLength+32, 8+1+32, commitmentSlice1, 0); - + bytes memory commitmentSlice1 = new bytes(8 + 1 + 32); + copyBytes(_proof, ledgerProofLength + 32, 8 + 1 + 32, commitmentSlice1, 0); bytes memory sessionPubkey = new bytes(64); - uint sig2offset = ledgerProofLength+32+(8+1+32)+sig1.length+65; - copyBytes(proof, sig2offset-64, 64, sessionPubkey, 0); - + uint sig2offset = ledgerProofLength + 32 + (8 + 1 + 32) + sig1.length + 65; + copyBytes(_proof, sig2offset - 64, 64, sessionPubkey, 0); bytes32 sessionPubkeyHash = sha256(sessionPubkey); - if (oraclize_randomDS_args[queryId] == keccak256(abi.encodePacked(commitmentSlice1, sessionPubkeyHash))){ //unonce, nbytes and sessionKeyHash match - delete oraclize_randomDS_args[queryId]; + if (oraclize_randomDS_args[_queryId] == keccak256(abi.encodePacked(commitmentSlice1, sessionPubkeyHash))) { //unonce, nbytes and sessionKeyHash match + delete oraclize_randomDS_args[_queryId]; } else return false; - - - // Step 5: validity verification for sig1 (keyhash and args signed with the sessionKey) - bytes memory tosign1 = new bytes(32+8+1+32); - copyBytes(proof, ledgerProofLength, 32+8+1+32, tosign1, 0); - if (!verifySig(sha256(tosign1), sig1, sessionPubkey)) return false; - - // verify if sessionPubkeyHash was verified already, if not.. let's do it! - if (oraclize_randomDS_sessionKeysHashVerified[sessionPubkeyHash] == false){ - oraclize_randomDS_sessionKeysHashVerified[sessionPubkeyHash] = oraclize_randomDS_proofVerify__sessionKeyValidity(proof, sig2offset); + // Random DS Proof Step 5: Validity verification for sig1 (keyhash and args signed with the sessionKey) + bytes memory tosign1 = new bytes(32 + 8 + 1 + 32); + copyBytes(_proof, ledgerProofLength, 32 + 8 + 1 + 32, tosign1, 0); + if (!verifySig(sha256(tosign1), sig1, sessionPubkey)) { + return false; + } + // Verify if sessionPubkeyHash was verified already, if not.. let's do it! + if (!oraclize_randomDS_sessionKeysHashVerified[sessionPubkeyHash]) { + oraclize_randomDS_sessionKeysHashVerified[sessionPubkeyHash] = oraclize_randomDS_proofVerify__sessionKeyValidity(_proof, sig2offset); } - return oraclize_randomDS_sessionKeysHashVerified[sessionPubkeyHash]; } - - // the following function has been written by Alex Beregszaszi (@axic), use it under the terms of the MIT license - function copyBytes(bytes from, uint fromOffset, uint length, bytes to, uint toOffset) internal pure returns (bytes) { - uint minLength = length + toOffset; - - // Buffer too small - require(to.length >= minLength); // Should be a better way? - - // NOTE: the offset 32 is added to skip the `size` field of both bytes variables - uint i = 32 + fromOffset; - uint j = 32 + toOffset; - - while (i < (32 + fromOffset + length)) { + /* + The following function has been written by Alex Beregszaszi (@axic), use it under the terms of the MIT license + */ + function copyBytes(bytes memory _from, uint _fromOffset, uint _length, bytes memory _to, uint _toOffset) internal pure returns (bytes memory _copiedBytes) { + uint minLength = _length + _toOffset; + require(_to.length >= minLength); // Buffer too small. Should be a better way? + uint i = 32 + _fromOffset; // NOTE: the offset 32 is added to skip the `size` field of both bytes variables + uint j = 32 + _toOffset; + while (i < (32 + _fromOffset + _length)) { assembly { - let tmp := mload(add(from, i)) - mstore(add(to, j), tmp) + let tmp := mload(add(_from, i)) + mstore(add(_to, j), tmp) } i += 32; j += 32; } - - return to; - } - - // the following function has been written by Alex Beregszaszi (@axic), use it under the terms of the MIT license - // Duplicate Solidity's ecrecover, but catching the CALL return value - function safer_ecrecover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal returns (bool, address) { - // We do our own memory management here. Solidity uses memory offset - // 0x40 to store the current end of memory. We write past it (as - // writes are memory extensions), but don't update the offset so - // Solidity will reuse it. The memory used here is only needed for - // this context. - - // FIXME: inline assembly can't access return values + return _to; + } + /* + The following function has been written by Alex Beregszaszi (@axic), use it under the terms of the MIT license + Duplicate Solidity's ecrecover, but catching the CALL return value + */ + function safer_ecrecover(bytes32 _hash, uint8 _v, bytes32 _r, bytes32 _s) internal returns (bool _success, address _recoveredAddress) { + /* + We do our own memory management here. Solidity uses memory offset + 0x40 to store the current end of memory. We write past it (as + writes are memory extensions), but don't update the offset so + Solidity will reuse it. The memory used here is only needed for + this context. + FIXME: inline assembly can't access return values + */ bool ret; address addr; - assembly { let size := mload(0x40) - mstore(size, hash) - mstore(add(size, 32), v) - mstore(add(size, 64), r) - mstore(add(size, 96), s) - - // NOTE: we can reuse the request memory because we deal with - // the return code - ret := call(3000, 1, 0, size, 128, size, 32) + mstore(size, _hash) + mstore(add(size, 32), _v) + mstore(add(size, 64), _r) + mstore(add(size, 96), _s) + ret := call(3000, 1, 0, size, 128, size, 32) // NOTE: we can reuse the request memory because we deal with the return code. addr := mload(size) } - return (ret, addr); } - - // the following function has been written by Alex Beregszaszi (@axic), use it under the terms of the MIT license - function ecrecovery(bytes32 hash, bytes sig) internal returns (bool, address) { + /* + The following function has been written by Alex Beregszaszi (@axic), use it under the terms of the MIT license + */ + function ecrecovery(bytes32 _hash, bytes memory _sig) internal returns (bool _success, address _recoveredAddress) { bytes32 r; bytes32 s; uint8 v; - - if (sig.length != 65) - return (false, 0); - - // The signature format is a compact form of: - // {bytes32 r}{bytes32 s}{uint8 v} - // Compact means, uint8 is not padded to 32 bytes. + if (_sig.length != 65) { + return (false, address(0)); + } + /* + The signature format is a compact form of: + {bytes32 r}{bytes32 s}{uint8 v} + Compact means, uint8 is not padded to 32 bytes. + */ assembly { - r := mload(add(sig, 32)) - s := mload(add(sig, 64)) - - // Here we are loading the last 32 bytes. We exploit the fact that - // 'mload' will pad with zeroes if we overread. - // There is no 'mload8' to do this, but that would be nicer. - v := byte(0, mload(add(sig, 96))) - - // Alternative solution: - // 'byte' is not working due to the Solidity parser, so lets - // use the second best option, 'and' - // v := and(mload(add(sig, 65)), 255) + r := mload(add(_sig, 32)) + s := mload(add(_sig, 64)) + /* + Here we are loading the last 32 bytes. We exploit the fact that + 'mload' will pad with zeroes if we overread. + There is no 'mload8' to do this, but that would be nicer. + */ + v := byte(0, mload(add(_sig, 96))) + /* + Alternative solution: + 'byte' is not working due to the Solidity parser, so lets + use the second best option, 'and' + v := and(mload(add(_sig, 65)), 255) + */ } - - // albeit non-transactional signatures are not specified by the YP, one would expect it - // to match the YP range of [27, 28] - // - // geth uses [0, 1] and some clients have followed. This might change, see: - // https://github.com/ethereum/go-ethereum/issues/2053 - if (v < 27) - v += 27; - - if (v != 27 && v != 28) - return (false, 0); - - return safer_ecrecover(hash, v, r, s); + /* + albeit non-transactional signatures are not specified by the YP, one would expect it + to match the YP range of [27, 28] + geth uses [0, 1] and some clients have followed. This might change, see: + https://github.com/ethereum/go-ethereum/issues/2053 + */ + if (v < 27) { + v += 27; + } + if (v != 27 && v != 28) { + return (false, address(0)); + } + return safer_ecrecover(_hash, v, r, s); } function safeMemoryCleaner() internal pure { @@ -1230,6 +1330,10 @@ contract usingOraclize { codecopy(fmem, codesize, sub(msize, fmem)) } } - } -// +/* + +END ORACLIZE_API + +*/ + diff --git a/contracts/helpers/PolyToken.sol b/contracts/helpers/PolyToken.sol index ab71ecfda..5230276e3 100644 --- a/contracts/helpers/PolyToken.sol +++ b/contracts/helpers/PolyToken.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.24; +pragma solidity ^0.5.0; import "../interfaces/IPoly.sol"; @@ -30,7 +30,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * @dev Math operations with safety checks that throw on error */ library SafeMath { - function mul(uint256 a, uint256 b) internal pure returns (uint256) { + function mul(uint256 a, uint256 b) internal pure returns(uint256) { if (a == 0) { return 0; } @@ -39,25 +39,26 @@ library SafeMath { return c; } - function div(uint256 a, uint256 b) internal pure returns (uint256) { + function div(uint256 a, uint256 b) internal pure returns(uint256) { // assert(b > 0); // Solidity automatically throws when dividing by 0 uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } - function sub(uint256 a, uint256 b) internal pure returns (uint256) { + function sub(uint256 a, uint256 b) internal pure returns(uint256) { assert(b <= a); return a - b; } - function add(uint256 a, uint256 b) internal pure returns (uint256) { + function add(uint256 a, uint256 b) internal pure returns(uint256) { uint256 c = a + b; assert(c >= a); return c; } } + /** * @title Standard ERC20 token * @@ -73,8 +74,8 @@ contract PolyToken is IPoly { uint8 public constant decimals = 18; uint256 public constant decimalFactor = 10 ** uint256(decimals); uint256 public constant totalSupply = 1000000000 * decimalFactor; - mapping (address => uint256) balances; - mapping (address => mapping (address => uint256)) internal allowed; + mapping(address => uint256) balances; + mapping(address => mapping(address => uint256)) internal allowed; event Transfer(address indexed from, address indexed to, uint256 value); event Approval(address indexed owner, address indexed spender, uint256 value); @@ -83,7 +84,7 @@ contract PolyToken is IPoly { * @dev Constructor for Poly creation * @dev Assigns the totalSupply to the PolyDistribution contract */ - constructor (address _polyDistributionContractAddress) public { + constructor(address _polyDistributionContractAddress) public { require(_polyDistributionContractAddress != address(0), "Invalid address"); balances[_polyDistributionContractAddress] = totalSupply; emit Transfer(address(0), _polyDistributionContractAddress, totalSupply); @@ -94,7 +95,7 @@ contract PolyToken is IPoly { * @param _owner The address to query the the balance of * @return An uint256 representing the amount owned by the passed address */ - function balanceOf(address _owner) public view returns (uint256 balance) { + function balanceOf(address _owner) public view returns(uint256 balance) { return balances[_owner]; } @@ -104,7 +105,7 @@ contract PolyToken is IPoly { * @param _spender address The address which will spend the tokens * @return A uint256 specifying the amount of tokens left available for the spender */ - function allowance(address _owner, address _spender) public view returns (uint256) { + function allowance(address _owner, address _spender) public view returns(uint256) { return allowed[_owner][_spender]; } @@ -113,7 +114,7 @@ contract PolyToken is IPoly { * @param _to The address to transfer tokens to * @param _value The amount to be transferred */ - function transfer(address _to, uint256 _value) public returns (bool) { + function transfer(address _to, uint256 _value) public returns(bool) { require(_to != address(0), "Invalid address"); require(_value <= balances[msg.sender], "Insufficient tokens transferable"); @@ -130,7 +131,7 @@ contract PolyToken is IPoly { * @param _to address The address to transfer tokens to * @param _value uint256 The amount of tokens to be transferred */ - function transferFrom(address _from, address _to, uint256 _value) public returns (bool) { + function transferFrom(address _from, address _to, uint256 _value) public returns(bool) { require(_to != address(0), "Invalid address"); require(_value <= balances[_from], "Insufficient tokens transferable"); require(_value <= allowed[_from][msg.sender], "Insufficient tokens allowable"); @@ -152,7 +153,7 @@ contract PolyToken is IPoly { * @param _spender The address which will spend the funds * @param _value The amount of tokens to be spent */ - function approve(address _spender, uint256 _value) public returns (bool) { + function approve(address _spender, uint256 _value) public returns(bool) { allowed[msg.sender][_spender] = _value; emit Approval(msg.sender, _spender, _value); return true; @@ -168,7 +169,7 @@ contract PolyToken is IPoly { * @param _spender The address which will spend the funds. * @param _addedValue The amount of tokens to increase the allowance by. */ - function increaseApproval(address _spender, uint _addedValue) public returns (bool) { + function increaseApproval(address _spender, uint _addedValue) public returns(bool) { allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue); emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; @@ -184,7 +185,7 @@ contract PolyToken is IPoly { * @param _spender The address which will spend the funds * @param _subtractedValue The amount of tokens to decrease the allowance by */ - function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) { + function decreaseApproval(address _spender, uint _subtractedValue) public returns(bool) { uint oldValue = allowed[msg.sender][_spender]; if (_subtractedValue > oldValue) { allowed[msg.sender][_spender] = 0; diff --git a/contracts/interfaces/IBoot.sol b/contracts/interfaces/IBoot.sol index db29dc319..ecade0f31 100644 --- a/contracts/interfaces/IBoot.sol +++ b/contracts/interfaces/IBoot.sol @@ -1,10 +1,9 @@ -pragma solidity ^0.4.24; +pragma solidity ^0.5.0; interface IBoot { - /** * @notice This function returns the signature of configure function * @return bytes4 Configure function signature */ function getInitFunction() external pure returns(bytes4); -} \ No newline at end of file +} diff --git a/contracts/interfaces/IFeatureRegistry.sol b/contracts/interfaces/IFeatureRegistry.sol index 574f412a5..563a1a9b8 100644 --- a/contracts/interfaces/IFeatureRegistry.sol +++ b/contracts/interfaces/IFeatureRegistry.sol @@ -1,15 +1,14 @@ -pragma solidity ^0.4.24; +pragma solidity ^0.5.0; /** * @title Interface for managing polymath feature switches */ interface IFeatureRegistry { - /** * @notice Get the status of a feature * @param _nameKey is the key for the feature status mapping * @return bool */ - function getFeatureStatus(string _nameKey) external view returns(bool); + function getFeatureStatus(string calldata _nameKey) external view returns(bool); } diff --git a/contracts/interfaces/IModule.sol b/contracts/interfaces/IModule.sol index bc5140ae2..781ae2a65 100644 --- a/contracts/interfaces/IModule.sol +++ b/contracts/interfaces/IModule.sol @@ -1,19 +1,18 @@ -pragma solidity ^0.4.24; +pragma solidity ^0.5.0; /** * @title Interface that every module contract should implement */ interface IModule { - /** * @notice This function returns the signature of configure function */ - function getInitFunction() external pure returns (bytes4); + function getInitFunction() external pure returns(bytes4); /** * @notice Return the permission flags that are associated with a module */ - function getPermissions() external view returns(bytes32[]); + function getPermissions() external view returns(bytes32[] memory); /** * @notice Used to withdraw the fee by the factory owner diff --git a/contracts/interfaces/IModuleFactory.sol b/contracts/interfaces/IModuleFactory.sol index 9c2ad6bf2..d0a35355d 100644 --- a/contracts/interfaces/IModuleFactory.sol +++ b/contracts/interfaces/IModuleFactory.sol @@ -1,10 +1,9 @@ -pragma solidity ^0.4.24; +pragma solidity ^0.5.0; /** * @title Interface that every module factory contract should implement */ interface IModuleFactory { - event ChangeFactorySetupFee(uint256 _oldSetupCost, uint256 _newSetupCost, address _moduleFactory); event ChangeFactoryUsageFee(uint256 _oldUsageCost, uint256 _newUsageCost, address _moduleFactory); event ChangeFactorySubscriptionFee(uint256 _oldSubscriptionCost, uint256 _newMonthlySubscriptionCost, address _moduleFactory); @@ -19,12 +18,12 @@ interface IModuleFactory { event ChangeSTVersionBound(string _boundType, uint8 _major, uint8 _minor, uint8 _patch); //Should create an instance of the Module, or throw - function deploy(bytes _data) external returns(address); + function deploy(bytes calldata _data) external returns(address); /** * @notice Type of the Module factory */ - function getTypes() external view returns(uint8[]); + function getTypes() external view returns(uint8[] memory); /** * @notice Get the name of the Module @@ -34,12 +33,12 @@ interface IModuleFactory { /** * @notice Returns the instructions associated with the module */ - function getInstructions() external view returns (string); + function getInstructions() external view returns(string memory); /** * @notice Get the tags related to the module factory */ - function getTags() external view returns (bytes32[]); + function getTags() external view returns(bytes32[] memory); /** * @notice Used to change the setup fee @@ -64,23 +63,23 @@ interface IModuleFactory { * @param _boundType Type of bound * @param _newVersion New version array */ - function changeSTVersionBounds(string _boundType, uint8[] _newVersion) external; + function changeSTVersionBounds(string calldata _boundType, uint8[] calldata _newVersion) external; - /** + /** * @notice Get the setup cost of the module */ - function getSetupCost() external view returns (uint256); + function getSetupCost() external view returns(uint256); /** * @notice Used to get the lower bound * @return Lower bound */ - function getLowerSTVersionBounds() external view returns(uint8[]); + function getLowerSTVersionBounds() external view returns(uint8[] memory); - /** + /** * @notice Used to get the upper bound * @return Upper bound */ - function getUpperSTVersionBounds() external view returns(uint8[]); + function getUpperSTVersionBounds() external view returns(uint8[] memory); } diff --git a/contracts/interfaces/IModuleRegistry.sol b/contracts/interfaces/IModuleRegistry.sol index 0ca6044e4..0d4af763e 100644 --- a/contracts/interfaces/IModuleRegistry.sol +++ b/contracts/interfaces/IModuleRegistry.sol @@ -1,10 +1,9 @@ -pragma solidity ^0.4.24; +pragma solidity ^0.5.0; /** * @title Interface for the Polymath Module Registry contract */ interface IModuleRegistry { - /** * @notice Called by a security token to notify the registry it is using a module * @param _moduleFactory is the address of the relevant module factory @@ -36,7 +35,7 @@ interface IModuleRegistry { * @param _factoryAddress address of the Module Factory * @return address array which has the list of securityToken's uses that module factory */ - function getReputationByFactory(address _factoryAddress) external view returns(address[]); + function getReputationByFactory(address _factoryAddress) external view returns(address[] memory); /** * @notice Returns all the tags related to the a module type which are valid for the given token @@ -45,7 +44,7 @@ interface IModuleRegistry { * @return list of tags * @return corresponding list of module factories */ - function getTagsByTypeAndToken(uint8 _moduleType, address _securityToken) external view returns(bytes32[], address[]); + function getTagsByTypeAndToken(uint8 _moduleType, address _securityToken) external view returns(bytes32[] memory, address[] memory); /** * @notice Returns all the tags related to the a module type which are valid for the given token @@ -53,14 +52,14 @@ interface IModuleRegistry { * @return list of tags * @return corresponding list of module factories */ - function getTagsByType(uint8 _moduleType) external view returns(bytes32[], address[]); + function getTagsByType(uint8 _moduleType) external view returns(bytes32[] memory, address[] memory); /** * @notice Returns the list of addresses of Module Factory of a particular type * @param _moduleType Type of Module * @return address array that contains the list of addresses of module factory contracts. */ - function getModulesByType(uint8 _moduleType) external view returns(address[]); + function getModulesByType(uint8 _moduleType) external view returns(address[] memory); /** * @notice Returns the list of available Module factory addresses of a particular type for a given token. @@ -68,7 +67,7 @@ interface IModuleRegistry { * @param _securityToken is the address of SecurityToken * @return address array that contains the list of available addresses of module factory contracts. */ - function getModulesByTypeAndToken(uint8 _moduleType, address _securityToken) external view returns (address[]); + function getModulesByTypeAndToken(uint8 _moduleType, address _securityToken) external view returns(address[] memory); /** * @notice Use to get the latest contract address of the regstries diff --git a/contracts/interfaces/IOracle.sol b/contracts/interfaces/IOracle.sol index 483a22cd0..dc8205a2b 100644 --- a/contracts/interfaces/IOracle.sol +++ b/contracts/interfaces/IOracle.sol @@ -1,7 +1,6 @@ -pragma solidity ^0.4.24; +pragma solidity ^0.5.0; interface IOracle { - /** * @notice Returns address of oracle currency (0x0 for ETH) */ diff --git a/contracts/interfaces/IOwnable.sol b/contracts/interfaces/IOwnable.sol index e4f427bd8..9f36abea6 100644 --- a/contracts/interfaces/IOwnable.sol +++ b/contracts/interfaces/IOwnable.sol @@ -1,5 +1,4 @@ -pragma solidity ^0.4.24; - +pragma solidity ^0.5.0; /** * @title Ownable @@ -10,7 +9,7 @@ interface IOwnable { /** * @dev Returns owner */ - function owner() external view returns (address); + function owner() external view returns(address); /** * @dev Allows the current owner to relinquish control of the contract. diff --git a/contracts/interfaces/IPoly.sol b/contracts/interfaces/IPoly.sol index 3d84a468b..0de0cc753 100644 --- a/contracts/interfaces/IPoly.sol +++ b/contracts/interfaces/IPoly.sol @@ -1,19 +1,19 @@ -pragma solidity ^0.4.24; +pragma solidity ^0.5.0; /** * @title ERC20 interface * @dev see https://github.com/ethereum/EIPs/issues/20 */ interface IPoly { - function decimals() external view returns (uint8); - function totalSupply() external view returns (uint256); - function balanceOf(address _owner) external view returns (uint256); - function allowance(address _owner, address _spender) external view returns (uint256); - function transfer(address _to, uint256 _value) external returns (bool); - function transferFrom(address _from, address _to, uint256 _value) external returns (bool); - function approve(address _spender, uint256 _value) external returns (bool); - function decreaseApproval(address _spender, uint _subtractedValue) external returns (bool); - function increaseApproval(address _spender, uint _addedValue) external returns (bool); + function decimals() external view returns(uint8); + function totalSupply() external view returns(uint256); + function balanceOf(address _owner) external view returns(uint256); + function allowance(address _owner, address _spender) external view returns(uint256); + function transfer(address _to, uint256 _value) external returns(bool); + function transferFrom(address _from, address _to, uint256 _value) external returns(bool); + function approve(address _spender, uint256 _value) external returns(bool); + function decreaseApproval(address _spender, uint _subtractedValue) external returns(bool); + function increaseApproval(address _spender, uint _addedValue) external returns(bool); event Transfer(address indexed from, address indexed to, uint256 value); event Approval(address indexed owner, address indexed spender, uint256 value); } diff --git a/contracts/interfaces/IPolymathRegistry.sol b/contracts/interfaces/IPolymathRegistry.sol index 4601253fa..91a057d54 100644 --- a/contracts/interfaces/IPolymathRegistry.sol +++ b/contracts/interfaces/IPolymathRegistry.sol @@ -1,14 +1,11 @@ -pragma solidity ^0.4.24; +pragma solidity ^0.5.0; - interface IPolymathRegistry { - /** * @notice Returns the contract address * @param _nameKey is the key for the contract address mapping * @return address */ - function getAddress(string _nameKey) external view returns(address); + function getAddress(string calldata _nameKey) external view returns(address); } - \ No newline at end of file diff --git a/contracts/interfaces/ISTFactory.sol b/contracts/interfaces/ISTFactory.sol index 7b7d6dd77..e4e2e4dc5 100644 --- a/contracts/interfaces/ISTFactory.sol +++ b/contracts/interfaces/ISTFactory.sol @@ -1,10 +1,9 @@ -pragma solidity ^0.4.24; +pragma solidity ^0.5.0; /** * @title Interface for security token proxy deployment */ interface ISTFactory { - /** * @notice Deploys the token and adds default modules like permission manager and transfer manager. * Future versions of the proxy can attach different modules or pass some other paramters. @@ -17,14 +16,14 @@ interface ISTFactory { * @param _polymathRegistry is the address of the Polymath Registry contract */ function deployToken( - string _name, - string _symbol, + string calldata _name, + string calldata _symbol, uint8 _decimals, - string _tokenDetails, + string calldata _tokenDetails, address _issuer, bool _divisible, address _polymathRegistry - ) - external - returns (address); + ) + external + returns(address); } diff --git a/contracts/interfaces/ISTO.sol b/contracts/interfaces/ISTO.sol index ab3d6b3ff..248274e39 100644 --- a/contracts/interfaces/ISTO.sol +++ b/contracts/interfaces/ISTO.sol @@ -1,13 +1,12 @@ -pragma solidity ^0.4.24; +pragma solidity ^0.5.0; /** * @title Interface to be implemented by all STO modules */ interface ISTO { - /** * @notice Returns the total no. of tokens sold */ - function getTokensSold() external view returns (uint256); + function getTokensSold() external view returns(uint256); -} \ No newline at end of file +} diff --git a/contracts/interfaces/ISecurityToken.sol b/contracts/interfaces/ISecurityToken.sol index c2b7ed76f..3228d8740 100644 --- a/contracts/interfaces/ISecurityToken.sol +++ b/contracts/interfaces/ISecurityToken.sol @@ -1,20 +1,19 @@ -pragma solidity ^0.4.24; +pragma solidity ^0.5.0; /** * @title Interface for all security tokens */ interface ISecurityToken { - // Standard ERC20 interface - function decimals() external view returns (uint8); - function totalSupply() external view returns (uint256); - function balanceOf(address _owner) external view returns (uint256); - function allowance(address _owner, address _spender) external view returns (uint256); - function transfer(address _to, uint256 _value) external returns (bool); - function transferFrom(address _from, address _to, uint256 _value) external returns (bool); - function approve(address _spender, uint256 _value) external returns (bool); - function decreaseApproval(address _spender, uint _subtractedValue) external returns (bool); - function increaseApproval(address _spender, uint _addedValue) external returns (bool); + function decimals() external view returns(uint8); + function totalSupply() external view returns(uint256); + function balanceOf(address _owner) external view returns(uint256); + function allowance(address _owner, address _spender) external view returns(uint256); + function transfer(address _to, uint256 _value) external returns(bool); + function transferFrom(address _from, address _to, uint256 _value) external returns(bool); + function approve(address _spender, uint256 _value) external returns(bool); + function decreaseApproval(address _spender, uint _subtractedValue) external returns(bool); + function increaseApproval(address _spender, uint _addedValue) external returns(bool); event Transfer(address indexed from, address indexed to, uint256 value); event Approval(address indexed owner, address indexed spender, uint256 value); @@ -24,10 +23,9 @@ interface ISecurityToken { * @param _from Sender of transfer * @param _to Receiver of transfer * @param _value Value of transfer - * @param _data Data to indicate validation * @return bool */ - function verifyTransfer(address _from, address _to, uint256 _value, bytes _data) external returns (bool); + function verifyTransfer(address _from, address _to, uint256 _value, bytes calldata _data) external returns(bool success); /** * @notice Mints new tokens and assigns them to the target _investor. @@ -36,7 +34,7 @@ interface ISecurityToken { * @param _value is the amount of tokens that will be minted to the investor * @return success */ - function mint(address _investor, uint256 _value) external returns (bool success); + function mint(address _investor, uint256 _value) external returns(bool success); /** * @notice Mints new tokens and assigns them to the target _investor. @@ -45,7 +43,7 @@ interface ISecurityToken { * @param _value is The amount of tokens that will be minted to the investor * @param _data Data to indicate validation */ - function mintWithData(address _investor, uint256 _value, bytes _data) external returns (bool success); + function mintWithData(address _investor, uint256 _value, bytes calldata _data) external returns(bool success); /** * @notice Used to burn the securityToken on behalf of someone else @@ -53,14 +51,14 @@ interface ISecurityToken { * @param _value No. of tokens to be burned * @param _data Data to indicate validation */ - function burnFromWithData(address _from, uint256 _value, bytes _data) external; + function burnFromWithData(address _from, uint256 _value, bytes calldata _data) external; /** * @notice Used to burn the securityToken * @param _value No. of tokens to be burned * @param _data Data to indicate validation */ - function burnWithData(uint256 _value, bytes _data) external; + function burnWithData(uint256 _value, bytes calldata _data) external; event Minted(address indexed _to, uint256 _value); event Burnt(address indexed _burner, uint256 _value); @@ -74,7 +72,7 @@ interface ISecurityToken { * @param _perm the permissions * @return success */ - function checkPermission(address _delegate, address _module, bytes32 _perm) external view returns (bool); + function checkPermission(address _delegate, address _module, bytes32 _perm) external view returns(bool); /** * @notice Returns module list for a module type @@ -86,52 +84,52 @@ interface ISecurityToken { * @return uint8 Array of module types * @return bytes32 Module label */ - function getModule(address _module) external view returns (bytes32, address, address, bool, uint8[], bytes32); + function getModule(address _module) external view returns (bytes32, address, address, bool, uint8[] memory, bytes32); /** * @notice Returns module list for a module name * @param _name Name of the module * @return address[] List of modules with this name */ - function getModulesByName(bytes32 _name) external view returns (address[]); + function getModulesByName(bytes32 _name) external view returns(address[] memory); /** * @notice Returns module list for a module type * @param _type Type of the module * @return address[] List of modules with this type */ - function getModulesByType(uint8 _type) external view returns (address[]); + function getModulesByType(uint8 _type) external view returns(address[] memory); /** * @notice Queries totalSupply at a specified checkpoint * @param _checkpointId Checkpoint ID to query as of */ - function totalSupplyAt(uint256 _checkpointId) external view returns (uint256); + function totalSupplyAt(uint256 _checkpointId) external view returns(uint256); /** * @notice Queries balance at a specified checkpoint * @param _investor Investor to query balance for * @param _checkpointId Checkpoint ID to query as of */ - function balanceOfAt(address _investor, uint256 _checkpointId) external view returns (uint256); + function balanceOfAt(address _investor, uint256 _checkpointId) external view returns(uint256); /** * @notice Creates a checkpoint that can be used to query historical balances / totalSuppy */ - function createCheckpoint() external returns (uint256); + function createCheckpoint() external returns(uint256); /** * @notice Gets list of times that checkpoints were created * @return List of checkpoint times */ - function getCheckpointTimes() external view returns(uint256[]); + function getCheckpointTimes() external view returns(uint256[] memory); /** * @notice Gets length of investors array * NB - this length may differ from investorCount if the list has not been pruned of zero-balance investors * @return Length */ - function getInvestors() external view returns (address[]); + function getInvestors() external view returns(address[] memory); /** * @notice returns an array of investors at a given checkpoint @@ -139,7 +137,7 @@ interface ISecurityToken { * @param _checkpointId Checkpoint id at which investor list is to be populated * @return list of investors */ - function getInvestorsAt(uint256 _checkpointId) external view returns(address[]); + function getInvestorsAt(uint256 _checkpointId) external view returns(address[] memory); /** * @notice generates subset of investors @@ -148,13 +146,13 @@ interface ISecurityToken { * @param _end Position of investor to stop iteration at * @return list of investors */ - function iterateInvestors(uint256 _start, uint256 _end) external view returns(address[]); - + function iterateInvestors(uint256 _start, uint256 _end) external view returns(address[] memory); + /** * @notice Gets current checkpoint ID * @return Id */ - function currentCheckpointId() external view returns (uint256); + function currentCheckpointId() external view returns(uint256); /** * @notice Allows the owner to withdraw unspent POLY stored by them on the ST or any ERC20 token. @@ -176,7 +174,7 @@ interface ISecurityToken { * @notice Changes the tokenDetails * @param _newTokenDetails New token details */ - function updateTokenDetails(string _newTokenDetails) external; + function updateTokenDetails(string calldata _newTokenDetails) external; /** * @notice Allows the owner to change token granularity @@ -206,7 +204,7 @@ interface ISecurityToken { * @param _values A list of the amount of tokens to mint to corresponding addresses from _investor[] list * @return Success */ - function mintMulti(address[] _investors, uint256[] _values) external returns (bool success); + function mintMulti(address[] calldata _investors, uint256[] calldata _values) external returns(bool success); /** * @notice Attachs a module to the SecurityToken @@ -220,7 +218,7 @@ interface ISecurityToken { */ function addModuleWithLabel( address _moduleFactory, - bytes _data, + bytes calldata _data, uint256 _maxCost, uint256 _budget, bytes32 _label @@ -238,12 +236,7 @@ interface ISecurityToken { * @param _maxCost max amount of POLY willing to pay to module. (WIP) * @param _budget max amount of ongoing POLY willing to assign to the module. */ - function addModule( - address _moduleFactory, - bytes _data, - uint256 _maxCost, - uint256 _budget - ) external; + function addModule(address _moduleFactory, bytes calldata _data, uint256 _maxCost, uint256 _budget) external; /** * @notice Archives a module attached to the SecurityToken @@ -277,7 +270,7 @@ interface ISecurityToken { * @param _data data to indicate validation * @param _log data attached to the transfer by controller to emit in event */ - function forceTransfer(address _from, address _to, uint256 _value, bytes _data, bytes _log) external; + function forceTransfer(address _from, address _to, uint256 _value, bytes calldata _data, bytes calldata _log) external; /** * @notice Used by a controller to execute a foced burn @@ -286,34 +279,34 @@ interface ISecurityToken { * @param _data data to indicate validation * @param _log data attached to the transfer by controller to emit in event */ - function forceBurn(address _from, uint256 _value, bytes _data, bytes _log) external; + function forceBurn(address _from, uint256 _value, bytes calldata _data, bytes calldata _log) external; /** * @notice Used by the issuer to permanently disable controller functionality * @dev enabled via feature switch "disableControllerAllowed" */ - function disableController() external; + function disableController() external; - /** + /** * @notice Used to get the version of the securityToken */ - function getVersion() external view returns(uint8[]); + function getVersion() external view returns(uint8[] memory); - /** + /** * @notice Gets the investor count */ - function getInvestorCount() external view returns(uint256); + function getInvestorCount() external view returns(uint256); - /** + /** * @notice Overloaded version of the transfer function * @param _to receiver of transfer * @param _value value of transfer * @param _data data to indicate validation * @return bool success */ - function transferWithData(address _to, uint256 _value, bytes _data) external returns (bool success); + function transferWithData(address _to, uint256 _value, bytes calldata _data) external returns(bool success); - /** + /** * @notice Overloaded version of the transferFrom function * @param _from sender of transfer * @param _to receiver of transfer @@ -321,11 +314,11 @@ interface ISecurityToken { * @param _data data to indicate validation * @return bool success */ - function transferFromWithData(address _from, address _to, uint256 _value, bytes _data) external returns(bool); + function transferFromWithData(address _from, address _to, uint256 _value, bytes calldata _data) external returns(bool); - /** + /** * @notice Provides the granularity of the token * @return uint256 */ - function granularity() external view returns(uint256); + function granularity() external view returns(uint256); } diff --git a/contracts/interfaces/ISecurityTokenRegistry.sol b/contracts/interfaces/ISecurityTokenRegistry.sol index 1e1c82b49..18e1e6951 100644 --- a/contracts/interfaces/ISecurityTokenRegistry.sol +++ b/contracts/interfaces/ISecurityTokenRegistry.sol @@ -1,18 +1,17 @@ -pragma solidity ^0.4.24; +pragma solidity ^0.5.0; /** * @title Interface for the Polymath Security Token Registry contract */ interface ISecurityTokenRegistry { - - /** + /** * @notice Creates a new Security Token and saves it to the registry * @param _name Name of the token * @param _ticker Ticker ticker of the security token * @param _tokenDetails Off-chain details of the token * @param _divisible Whether the token is divisible or not */ - function generateSecurityToken(string _name, string _ticker, string _tokenDetails, bool _divisible) external; + function generateSecurityToken(string calldata _name, string calldata _ticker, string calldata _tokenDetails, bool _divisible) external; /** * @notice Adds a new custom Security Token and saves it to the registry. (Token should follow the ISecurityToken interface) @@ -24,14 +23,14 @@ interface ISecurityTokenRegistry { * @param _deployedAt Timestamp at which security token comes deployed on the ethereum blockchain */ function modifySecurityToken( - string _name, - string _ticker, + string calldata _name, + string calldata _ticker, address _owner, address _securityToken, - string _tokenDetails, + string calldata _tokenDetails, uint256 _deployedAt - ) - external; + ) + external; /** * @notice Registers the token ticker for its particular owner @@ -41,7 +40,7 @@ interface ISecurityTokenRegistry { * @param _ticker Token ticker * @param _tokenName Name of the token */ - function registerTicker(address _owner, string _ticker, string _tokenName) external; + function registerTicker(address _owner, string calldata _ticker, string calldata _tokenName) external; /** * @notice Changes the protocol version and the SecurityToken contract @@ -59,7 +58,7 @@ interface ISecurityTokenRegistry { * @param _securityToken Address of the Scurity token * @return bool */ - function isSecurityToken(address _securityToken) external view returns (bool); + function isSecurityToken(address _securityToken) external view returns(bool); /** * @dev Allows the current owner to transfer control of the contract to a newOwner. @@ -72,9 +71,9 @@ interface ISecurityTokenRegistry { * @param _ticker Symbol of the Scurity token * @return address */ - function getSecurityTokenAddress(string _ticker) external view returns (address); + function getSecurityTokenAddress(string calldata _ticker) external view returns(address); - /** + /** * @notice Get security token data by its address * @param _securityToken Address of the Scurity token. * @return string Symbol of the Security Token. @@ -82,7 +81,7 @@ interface ISecurityTokenRegistry { * @return string Details of the Token. * @return uint256 Timestamp at which Security Token get launched on Polymath platform. */ - function getSecurityTokenData(address _securityToken) external view returns (string, address, string, uint256); + function getSecurityTokenData(address _securityToken) external view returns(string memory, address, string memory, uint256); /** * @notice Get the current STFactory Address @@ -92,26 +91,26 @@ interface ISecurityTokenRegistry { /** * @notice Get Protocol version */ - function getProtocolVersion() external view returns(uint8[]); + function getProtocolVersion() external view returns(uint8[] memory); /** * @notice Used to get the ticker list as per the owner * @param _owner Address which owns the list of tickers */ - function getTickersByOwner(address _owner) external view returns(bytes32[]); + function getTickersByOwner(address _owner) external view returns(bytes32[] memory); /** * @notice Returns the list of tokens owned by the selected address * @param _owner is the address which owns the list of tickers * @dev Intention is that this is called off-chain so block gas limit is not relevant */ - function getTokensByOwner(address _owner) external view returns(address[]); + function getTokensByOwner(address _owner) external view returns(address[] memory); /** * @notice Returns the list of all tokens * @dev Intention is that this is called off-chain so block gas limit is not relevant */ - function getTokens() external view returns(address[]); + function getTokens() external view returns(address[] memory); /** * @notice Returns the owner and timestamp for a given ticker @@ -122,7 +121,7 @@ interface ISecurityTokenRegistry { * @return string * @return bool */ - function getTickerDetails(string _ticker) external view returns (address, uint256, uint256, string, bool); + function getTickerDetails(string calldata _ticker) external view returns(address, uint256, uint256, string memory, bool); /** * @notice Modifies the ticker details. Only polymath account has the ability @@ -136,26 +135,26 @@ interface ISecurityTokenRegistry { */ function modifyTicker( address _owner, - string _ticker, - string _tokenName, + string calldata _ticker, + string calldata _tokenName, uint256 _registrationDate, uint256 _expiryDate, bool _status - ) - external; + ) + external; - /** + /** * @notice Removes the ticker details and associated ownership & security token mapping * @param _ticker Token ticker */ - function removeTicker(string _ticker) external; + function removeTicker(string calldata _ticker) external; /** * @notice Transfers the ownership of the ticker * @dev _newOwner Address whom ownership to transfer * @dev _ticker Ticker */ - function transferTickerOwnership(address _newOwner, string _ticker) external; + function transferTickerOwnership(address _newOwner, string calldata _ticker) external; /** * @notice Changes the expiry time for the token ticker @@ -167,13 +166,13 @@ interface ISecurityTokenRegistry { * @notice Sets the ticker registration fee in POLY tokens * @param _tickerRegFee Registration fee in POLY tokens (base 18 decimals) */ - function changeTickerRegistrationFee(uint256 _tickerRegFee) external; + function changeTickerRegistrationFee(uint256 _tickerRegFee) external; - /** + /** * @notice Sets the ticker registration fee in POLY tokens * @param _stLaunchFee Registration fee in POLY tokens (base 18 decimals) */ - function changeSecurityLaunchFee(uint256 _stLaunchFee) external; + function changeSecurityLaunchFee(uint256 _stLaunchFee) external; /** * @notice Gets the security token launch fee diff --git a/contracts/interfaces/ITransferManager.sol b/contracts/interfaces/ITransferManager.sol index b5819c63d..b248a98b3 100644 --- a/contracts/interfaces/ITransferManager.sol +++ b/contracts/interfaces/ITransferManager.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.24; +pragma solidity ^0.5.0; import "./TransferManagerEnums.sol"; @@ -6,10 +6,11 @@ import "./TransferManagerEnums.sol"; * @title Interface to be implemented by all Transfer Manager modules */ interface ITransferManager { - /** * @notice Determines if the transfer between these two accounts can happen */ - function verifyTransfer(address _from, address _to, uint256 _amount, bytes _data, bool _isTransfer) external returns(TransferManagerEnums.Result); + function verifyTransfer(address _from, address _to, uint256 _amount, bytes calldata _data, bool _isTransfer) external returns( + TransferManagerEnums.Result + ); -} \ No newline at end of file +} diff --git a/contracts/interfaces/IUSDTieredSTOProxy.sol b/contracts/interfaces/IUSDTieredSTOProxy.sol index 480cee059..bcbf2b2d9 100644 --- a/contracts/interfaces/IUSDTieredSTOProxy.sol +++ b/contracts/interfaces/IUSDTieredSTOProxy.sol @@ -1,23 +1,22 @@ -pragma solidity ^0.4.24; +pragma solidity ^0.5.0; /** * @title Interface for security token proxy deployment */ interface IUSDTieredSTOProxy { - - /** + /** * @notice Deploys the STO. * @param _securityToken Contract address of the securityToken * @param _factoryAddress Contract address of the factory * @return address Address of the deployed STO */ - function deploySTO(address _securityToken, address _factoryAddress) external returns (address); - - /** + function deploySTO(address _securityToken, address _factoryAddress) external returns(address); + + /** * @notice Used to get the init function signature * @param _contractAddress Address of the STO contract * @return bytes4 */ - function getInitFunction(address _contractAddress) external returns (bytes4); + function getInitFunction(address _contractAddress) external returns(bytes4); -} \ No newline at end of file +} diff --git a/contracts/interfaces/TransferManagerEnums.sol b/contracts/interfaces/TransferManagerEnums.sol index 2b7e85853..c097dddc7 100644 --- a/contracts/interfaces/TransferManagerEnums.sol +++ b/contracts/interfaces/TransferManagerEnums.sol @@ -1,10 +1,9 @@ -pragma solidity ^0.4.24; +pragma solidity ^0.5.0; /** * @title Container contract for transfer manager enums */ contract TransferManagerEnums { - //If verifyTransfer returns: // FORCE_VALID, the transaction will always be valid, regardless of other TM results // INVALID, then the transfer should not be allowed regardless of other TM results @@ -12,4 +11,4 @@ contract TransferManagerEnums { // NA, then the result from this TM is ignored enum Result {INVALID, NA, VALID, FORCE_VALID} -} \ No newline at end of file +} diff --git a/contracts/libraries/BokkyPooBahsDateTimeLibrary.sol b/contracts/libraries/BokkyPooBahsDateTimeLibrary.sol index 29de4d7cd..fdfd3df2e 100644 --- a/contracts/libraries/BokkyPooBahsDateTimeLibrary.sol +++ b/contracts/libraries/BokkyPooBahsDateTimeLibrary.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.24; +pragma solidity ^0.5.0; // ---------------------------------------------------------------------------- // BokkyPooBah's DateTime Library v1.00 @@ -29,7 +29,6 @@ pragma solidity ^0.4.24; // ---------------------------------------------------------------------------- library BokkyPooBahsDateTimeLibrary { - uint constant SECONDS_PER_DAY = 24 * 60 * 60; uint constant SECONDS_PER_HOUR = 60 * 60; uint constant SECONDS_PER_MINUTE = 60; @@ -56,18 +55,13 @@ library BokkyPooBahsDateTimeLibrary { // - 3 * ((year + 4900 + (month - 14) / 12) / 100) / 4 // - offset // ------------------------------------------------------------------------ - function _daysFromDate(uint year, uint month, uint day) internal pure returns (uint _days) { + function _daysFromDate(uint year, uint month, uint day) internal pure returns(uint _days) { require(year >= 1970); int _year = int(year); int _month = int(month); int _day = int(day); - int __days = _day - - 32075 - + 1461 * (_year + 4800 + (_month - 14) / 12) / 4 - + 367 * (_month - 2 - (_month - 14) / 12 * 12) / 12 - - 3 * ((_year + 4900 + (_month - 14) / 12) / 100) / 4 - - OFFSET19700101; + int __days = _day - 32075 + 1461 * (_year + 4800 + (_month - 14) / 12) / 4 + 367 * (_month - 2 - (_month - 14) / 12 * 12) / 12 - 3 * ((_year + 4900 + (_month - 14) / 12) / 100) / 4 - OFFSET19700101; _days = uint(__days); } @@ -89,7 +83,7 @@ library BokkyPooBahsDateTimeLibrary { // month = month + 2 - 12 * L // year = 100 * (N - 49) + year + L // ------------------------------------------------------------------------ - function _daysToDate(uint _days) internal pure returns (uint year, uint month, uint day) { + function _daysToDate(uint _days) internal pure returns(uint year, uint month, uint day) { int __days = int(_days); int L = __days + 68569 + OFFSET19700101; @@ -108,16 +102,26 @@ library BokkyPooBahsDateTimeLibrary { day = uint(_day); } - function timestampFromDate(uint year, uint month, uint day) internal pure returns (uint timestamp) { + function timestampFromDate(uint year, uint month, uint day) internal pure returns(uint timestamp) { timestamp = _daysFromDate(year, month, day) * SECONDS_PER_DAY; } - function timestampFromDateTime(uint year, uint month, uint day, uint hour, uint minute, uint second) internal pure returns (uint timestamp) { + function timestampFromDateTime(uint year, uint month, uint day, uint hour, uint minute, uint second) internal pure returns( + uint timestamp + ) { timestamp = _daysFromDate(year, month, day) * SECONDS_PER_DAY + hour * SECONDS_PER_HOUR + minute * SECONDS_PER_MINUTE + second; } - function timestampToDate(uint timestamp) internal pure returns (uint year, uint month, uint day) { + function timestampToDate(uint timestamp) internal pure returns(uint year, uint month, uint day) { (year, month, day) = _daysToDate(timestamp / SECONDS_PER_DAY); } - function timestampToDateTime(uint timestamp) internal pure returns (uint year, uint month, uint day, uint hour, uint minute, uint second) { + function timestampToDateTime(uint timestamp) internal pure returns( + uint year, + uint month, + uint day, + uint hour, + uint minute, + uint second + ) + { (year, month, day) = _daysToDate(timestamp / SECONDS_PER_DAY); uint secs = timestamp % SECONDS_PER_DAY; hour = secs / SECONDS_PER_HOUR; @@ -126,7 +130,7 @@ library BokkyPooBahsDateTimeLibrary { second = secs % SECONDS_PER_MINUTE; } - function isValidDate(uint year, uint month, uint day) internal pure returns (bool valid) { + function isValidDate(uint year, uint month, uint day) internal pure returns(bool valid) { if (year >= 1970 && month > 0 && month <= 12) { uint daysInMonth = _getDaysInMonth(year, month); if (day > 0 && day <= daysInMonth) { @@ -134,37 +138,37 @@ library BokkyPooBahsDateTimeLibrary { } } } - function isValidDateTime(uint year, uint month, uint day, uint hour, uint minute, uint second) internal pure returns (bool valid) { + function isValidDateTime(uint year, uint month, uint day, uint hour, uint minute, uint second) internal pure returns(bool valid) { if (isValidDate(year, month, day)) { if (hour < 24 && minute < 60 && second < 60) { valid = true; } } } - function isLeapYear(uint timestamp) internal pure returns (bool leapYear) { + function isLeapYear(uint timestamp) internal pure returns(bool leapYear) { uint year; uint month; uint day; (year, month, day) = _daysToDate(timestamp / SECONDS_PER_DAY); leapYear = _isLeapYear(year); } - function _isLeapYear(uint year) internal pure returns (bool leapYear) { + function _isLeapYear(uint year) internal pure returns(bool leapYear) { leapYear = ((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0); } - function isWeekDay(uint timestamp) internal pure returns (bool weekDay) { + function isWeekDay(uint timestamp) internal pure returns(bool weekDay) { weekDay = getDayOfWeek(timestamp) <= DOW_FRI; } - function isWeekEnd(uint timestamp) internal pure returns (bool weekEnd) { + function isWeekEnd(uint timestamp) internal pure returns(bool weekEnd) { weekEnd = getDayOfWeek(timestamp) >= DOW_SAT; } - function getDaysInMonth(uint timestamp) internal pure returns (uint daysInMonth) { + function getDaysInMonth(uint timestamp) internal pure returns(uint daysInMonth) { uint year; uint month; uint day; (year, month, day) = _daysToDate(timestamp / SECONDS_PER_DAY); daysInMonth = _getDaysInMonth(year, month); } - function _getDaysInMonth(uint year, uint month) internal pure returns (uint daysInMonth) { + function _getDaysInMonth(uint year, uint month) internal pure returns(uint daysInMonth) { if (month == 1 || month == 3 || month == 5 || month == 7 || month == 8 || month == 10 || month == 12) { daysInMonth = 31; } else if (month != 2) { @@ -174,39 +178,39 @@ library BokkyPooBahsDateTimeLibrary { } } // 1 = Monday, 7 = Sunday - function getDayOfWeek(uint timestamp) internal pure returns (uint dayOfWeek) { + function getDayOfWeek(uint timestamp) internal pure returns(uint dayOfWeek) { uint _days = timestamp / SECONDS_PER_DAY; dayOfWeek = (_days + 3) % 7 + 1; } - function getYear(uint timestamp) internal pure returns (uint year) { + function getYear(uint timestamp) internal pure returns(uint year) { uint month; uint day; (year, month, day) = _daysToDate(timestamp / SECONDS_PER_DAY); } - function getMonth(uint timestamp) internal pure returns (uint month) { + function getMonth(uint timestamp) internal pure returns(uint month) { uint year; uint day; (year, month, day) = _daysToDate(timestamp / SECONDS_PER_DAY); } - function getDay(uint timestamp) internal pure returns (uint day) { + function getDay(uint timestamp) internal pure returns(uint day) { uint year; uint month; (year, month, day) = _daysToDate(timestamp / SECONDS_PER_DAY); } - function getHour(uint timestamp) internal pure returns (uint hour) { + function getHour(uint timestamp) internal pure returns(uint hour) { uint secs = timestamp % SECONDS_PER_DAY; hour = secs / SECONDS_PER_HOUR; } - function getMinute(uint timestamp) internal pure returns (uint minute) { + function getMinute(uint timestamp) internal pure returns(uint minute) { uint secs = timestamp % SECONDS_PER_HOUR; minute = secs / SECONDS_PER_MINUTE; } - function getSecond(uint timestamp) internal pure returns (uint second) { + function getSecond(uint timestamp) internal pure returns(uint second) { second = timestamp % SECONDS_PER_MINUTE; } - function addYears(uint timestamp, uint _years) internal pure returns (uint newTimestamp) { + function addYears(uint timestamp, uint _years) internal pure returns(uint newTimestamp) { uint year; uint month; uint day; @@ -219,7 +223,8 @@ library BokkyPooBahsDateTimeLibrary { newTimestamp = _daysFromDate(year, month, day) * SECONDS_PER_DAY + timestamp % SECONDS_PER_DAY; require(newTimestamp >= timestamp); } - function addMonths(uint timestamp, uint _months) internal pure returns (uint newTimestamp) { + + function addMonths(uint timestamp, uint _months) internal pure returns(uint newTimestamp) { uint year; uint month; uint day; @@ -234,24 +239,28 @@ library BokkyPooBahsDateTimeLibrary { newTimestamp = _daysFromDate(year, month, day) * SECONDS_PER_DAY + timestamp % SECONDS_PER_DAY; require(newTimestamp >= timestamp); } - function addDays(uint timestamp, uint _days) internal pure returns (uint newTimestamp) { + + function addDays(uint timestamp, uint _days) internal pure returns(uint newTimestamp) { newTimestamp = timestamp + _days * SECONDS_PER_DAY; require(newTimestamp >= timestamp); } - function addHours(uint timestamp, uint _hours) internal pure returns (uint newTimestamp) { + + function addHours(uint timestamp, uint _hours) internal pure returns(uint newTimestamp) { newTimestamp = timestamp + _hours * SECONDS_PER_HOUR; require(newTimestamp >= timestamp); } - function addMinutes(uint timestamp, uint _minutes) internal pure returns (uint newTimestamp) { + + function addMinutes(uint timestamp, uint _minutes) internal pure returns(uint newTimestamp) { newTimestamp = timestamp + _minutes * SECONDS_PER_MINUTE; require(newTimestamp >= timestamp); } - function addSeconds(uint timestamp, uint _seconds) internal pure returns (uint newTimestamp) { + + function addSeconds(uint timestamp, uint _seconds) internal pure returns(uint newTimestamp) { newTimestamp = timestamp + _seconds; require(newTimestamp >= timestamp); } - function subYears(uint timestamp, uint _years) internal pure returns (uint newTimestamp) { + function subYears(uint timestamp, uint _years) internal pure returns(uint newTimestamp) { uint year; uint month; uint day; @@ -264,7 +273,8 @@ library BokkyPooBahsDateTimeLibrary { newTimestamp = _daysFromDate(year, month, day) * SECONDS_PER_DAY + timestamp % SECONDS_PER_DAY; require(newTimestamp <= timestamp); } - function subMonths(uint timestamp, uint _months) internal pure returns (uint newTimestamp) { + + function subMonths(uint timestamp, uint _months) internal pure returns(uint newTimestamp) { uint year; uint month; uint day; @@ -279,24 +289,28 @@ library BokkyPooBahsDateTimeLibrary { newTimestamp = _daysFromDate(year, month, day) * SECONDS_PER_DAY + timestamp % SECONDS_PER_DAY; require(newTimestamp <= timestamp); } - function subDays(uint timestamp, uint _days) internal pure returns (uint newTimestamp) { + + function subDays(uint timestamp, uint _days) internal pure returns(uint newTimestamp) { newTimestamp = timestamp - _days * SECONDS_PER_DAY; require(newTimestamp <= timestamp); } - function subHours(uint timestamp, uint _hours) internal pure returns (uint newTimestamp) { + + function subHours(uint timestamp, uint _hours) internal pure returns(uint newTimestamp) { newTimestamp = timestamp - _hours * SECONDS_PER_HOUR; require(newTimestamp <= timestamp); } - function subMinutes(uint timestamp, uint _minutes) internal pure returns (uint newTimestamp) { + + function subMinutes(uint timestamp, uint _minutes) internal pure returns(uint newTimestamp) { newTimestamp = timestamp - _minutes * SECONDS_PER_MINUTE; require(newTimestamp <= timestamp); } - function subSeconds(uint timestamp, uint _seconds) internal pure returns (uint newTimestamp) { + + function subSeconds(uint timestamp, uint _seconds) internal pure returns(uint newTimestamp) { newTimestamp = timestamp - _seconds; require(newTimestamp <= timestamp); } - function diffYears(uint fromTimestamp, uint toTimestamp) internal pure returns (uint _years) { + function diffYears(uint fromTimestamp, uint toTimestamp) internal pure returns(uint _years) { require(fromTimestamp <= toTimestamp); uint fromYear; uint fromMonth; @@ -308,7 +322,8 @@ library BokkyPooBahsDateTimeLibrary { (toYear, toMonth, toDay) = _daysToDate(toTimestamp / SECONDS_PER_DAY); _years = toYear - fromYear; } - function diffMonths(uint fromTimestamp, uint toTimestamp) internal pure returns (uint _months) { + + function diffMonths(uint fromTimestamp, uint toTimestamp) internal pure returns(uint _months) { require(fromTimestamp <= toTimestamp); uint fromYear; uint fromMonth; @@ -320,19 +335,23 @@ library BokkyPooBahsDateTimeLibrary { (toYear, toMonth, toDay) = _daysToDate(toTimestamp / SECONDS_PER_DAY); _months = toYear * 12 + toMonth - fromYear * 12 - fromMonth; } - function diffDays(uint fromTimestamp, uint toTimestamp) internal pure returns (uint _days) { + + function diffDays(uint fromTimestamp, uint toTimestamp) internal pure returns(uint _days) { require(fromTimestamp <= toTimestamp); _days = (toTimestamp - fromTimestamp) / SECONDS_PER_DAY; } - function diffHours(uint fromTimestamp, uint toTimestamp) internal pure returns (uint _hours) { + + function diffHours(uint fromTimestamp, uint toTimestamp) internal pure returns(uint _hours) { require(fromTimestamp <= toTimestamp); _hours = (toTimestamp - fromTimestamp) / SECONDS_PER_HOUR; } - function diffMinutes(uint fromTimestamp, uint toTimestamp) internal pure returns (uint _minutes) { + + function diffMinutes(uint fromTimestamp, uint toTimestamp) internal pure returns(uint _minutes) { require(fromTimestamp <= toTimestamp); _minutes = (toTimestamp - fromTimestamp) / SECONDS_PER_MINUTE; } - function diffSeconds(uint fromTimestamp, uint toTimestamp) internal pure returns (uint _seconds) { + + function diffSeconds(uint fromTimestamp, uint toTimestamp) internal pure returns(uint _seconds) { require(fromTimestamp <= toTimestamp); _seconds = toTimestamp - fromTimestamp; } diff --git a/contracts/libraries/DecimalMath.sol b/contracts/libraries/DecimalMath.sol index 242daffab..ab942bad2 100644 --- a/contracts/libraries/DecimalMath.sol +++ b/contracts/libraries/DecimalMath.sol @@ -1,16 +1,15 @@ -pragma solidity ^0.4.24; +pragma solidity ^0.5.0; import "openzeppelin-solidity/contracts/math/SafeMath.sol"; library DecimalMath { - using SafeMath for uint256; - /** + /** * @notice This function multiplies two decimals represented as (decimal * 10**DECIMALS) * @return uint256 Result of multiplication represented as (decimal * 10**DECIMALS) */ - function mul(uint256 x, uint256 y) internal pure returns (uint256 z) { + function mul(uint256 x, uint256 y) internal pure returns(uint256 z) { z = SafeMath.add(SafeMath.mul(x, y), (10 ** 18) / 2) / (10 ** 18); } @@ -18,8 +17,8 @@ library DecimalMath { * @notice This function divides two decimals represented as (decimal * 10**DECIMALS) * @return uint256 Result of division represented as (decimal * 10**DECIMALS) */ - function div(uint256 x, uint256 y) internal pure returns (uint256 z) { + function div(uint256 x, uint256 y) internal pure returns(uint256 z) { z = SafeMath.add(SafeMath.mul(x, (10 ** 18)), y / 2) / y; } -} \ No newline at end of file +} diff --git a/contracts/libraries/Encoder.sol b/contracts/libraries/Encoder.sol index 27d9a4ddf..b3cf9124d 100644 --- a/contracts/libraries/Encoder.sol +++ b/contracts/libraries/Encoder.sol @@ -1,28 +1,27 @@ -pragma solidity ^0.4.24; +pragma solidity ^0.5.0; library Encoder { - - function getKey(string _key) internal pure returns (bytes32) { + function getKey(string memory _key) internal pure returns(bytes32) { return bytes32(keccak256(abi.encodePacked(_key))); } - function getKey(string _key1, address _key2) internal pure returns (bytes32) { + function getKey(string memory _key1, address _key2) internal pure returns(bytes32) { return bytes32(keccak256(abi.encodePacked(_key1, _key2))); } - function getKey(string _key1, string _key2) internal pure returns (bytes32) { + function getKey(string memory _key1, string memory _key2) internal pure returns(bytes32) { return bytes32(keccak256(abi.encodePacked(_key1, _key2))); } - function getKey(string _key1, uint256 _key2) internal pure returns (bytes32) { + function getKey(string memory _key1, uint256 _key2) internal pure returns(bytes32) { return bytes32(keccak256(abi.encodePacked(_key1, _key2))); } - function getKey(string _key1, bytes32 _key2) internal pure returns (bytes32) { + function getKey(string memory _key1, bytes32 _key2) internal pure returns(bytes32) { return bytes32(keccak256(abi.encodePacked(_key1, _key2))); } - function getKey(string _key1, bool _key2) internal pure returns (bytes32) { + function getKey(string memory _key1, bool _key2) internal pure returns(bytes32) { return bytes32(keccak256(abi.encodePacked(_key1, _key2))); } diff --git a/contracts/libraries/KindMath.sol b/contracts/libraries/KindMath.sol index 850926088..00810abb1 100644 --- a/contracts/libraries/KindMath.sol +++ b/contracts/libraries/KindMath.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.24; +pragma solidity ^0.5.0; // Copied from OpenZeppelin and modified to be friendlier @@ -7,11 +7,10 @@ pragma solidity ^0.4.24; * @dev Math operations with safety checks that throw on error */ library KindMath { - /** * @dev Multiplies two numbers, throws on overflow. */ - function mul(uint256 a, uint256 b) internal pure returns (uint256 c) { + function mul(uint256 a, uint256 b) internal pure returns(uint256 c) { // Gas optimization: this is cheaper than requireing 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522 @@ -27,7 +26,7 @@ library KindMath { /** * @dev Integer division of two numbers, truncating the quotient. */ - function div(uint256 a, uint256 b) internal pure returns (uint256) { + function div(uint256 a, uint256 b) internal pure returns(uint256) { // require(b > 0); // Solidity automatically throws when dividing by 0 // uint256 c = a / b; // require(a == b * c + a % b); // There is no case in which this doesn't hold @@ -37,7 +36,7 @@ library KindMath { /** * @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend). */ - function sub(uint256 a, uint256 b) internal pure returns (uint256) { + function sub(uint256 a, uint256 b) internal pure returns(uint256) { require(b <= a, "sub overflow"); return a - b; } @@ -45,7 +44,7 @@ library KindMath { /** * @dev Adds two numbers, throws on overflow. */ - function add(uint256 a, uint256 b) internal pure returns (uint256 c) { + function add(uint256 a, uint256 b) internal pure returns(uint256 c) { c = a + b; require(c >= a, "add overflow"); return c; diff --git a/contracts/libraries/TokenLib.sol b/contracts/libraries/TokenLib.sol index 8c823ae29..8585a3dba 100644 --- a/contracts/libraries/TokenLib.sol +++ b/contracts/libraries/TokenLib.sol @@ -1,10 +1,10 @@ -pragma solidity ^0.4.24; +pragma solidity ^0.5.0; import "../modules/PermissionManager/IPermissionManager.sol"; import "openzeppelin-solidity/contracts/math/SafeMath.sol"; +import "../interfaces/IPoly.sol"; library TokenLib { - using SafeMath for uint256; // Struct for module data @@ -27,7 +27,7 @@ library TokenLib { struct InvestorDataStorage { // List of investors who have ever held a non-zero token balance - mapping (address => bool) investorListed; + mapping(address => bool) investorListed; // List of token holders address[] investors; // Total number of non-zero token holders @@ -38,6 +38,10 @@ library TokenLib { event ModuleArchived(uint8[] _types, address _module, uint256 _timestamp); // Emit when Module is unarchived from the SecurityToken event ModuleUnarchived(uint8[] _types, address _module, uint256 _timestamp); + // Emit when Module get removed from the securityToken + event ModuleRemoved(uint8[] _types, address _module, uint256 _timestamp); + // Emit when the budget allocated to a module is changed + event ModuleBudgetChanged(uint8[] _moduleTypes, address _module, uint256 _oldBudget, uint256 _budget); /** * @notice Archives a module attached to the SecurityToken @@ -64,6 +68,95 @@ library TokenLib { _moduleData.isArchived = false; } + /** + * @notice Removes a module attached to the SecurityToken + * @param _module address of module to unarchive + */ + function removeModule( + address _module, + mapping(uint8 => address[]) storage _modules, + mapping(address => ModuleData) storage _modulesToData, + mapping(bytes32 => address[]) storage _names + ) + public + { + require(_modulesToData[_module].isArchived, "Not archived"); + require(_modulesToData[_module].module != address(0), "Module missing"); + /*solium-disable-next-line security/no-block-members*/ + emit ModuleRemoved(_modulesToData[_module].moduleTypes, _module, now); + // Remove from module type list + uint8[] memory moduleTypes = _modulesToData[_module].moduleTypes; + for (uint256 i = 0; i < moduleTypes.length; i++) { + _removeModuleWithIndex(moduleTypes[i], _modulesToData[_module].moduleIndexes[i], _modules, _modulesToData); + /* modulesToData[_module].moduleType[moduleTypes[i]] = false; */ + } + // Remove from module names list + uint256 index = _modulesToData[_module].nameIndex; + bytes32 name = _modulesToData[_module].name; + uint256 length = _names[name].length; + _names[name][index] = _names[name][length - 1]; + _names[name].length = length - 1; + if ((length - 1) != index) { + _modulesToData[_names[name][index]].nameIndex = index; + } + // Remove from modulesToData + delete _modulesToData[_module]; + } + + /** + * @notice Internal - Removes a module attached to the SecurityToken by index + */ + function _removeModuleWithIndex( + uint8 _type, + uint256 _index, + mapping(uint8 => address[]) storage _modules, + mapping(address => ModuleData) storage _modulesToData + ) + internal + { + uint256 length = _modules[_type].length; + _modules[_type][_index] = _modules[_type][length - 1]; + _modules[_type].length = length - 1; + + if ((length - 1) != _index) { + //Need to find index of _type in moduleTypes of module we are moving + uint8[] memory newTypes = _modulesToData[_modules[_type][_index]].moduleTypes; + for (uint256 i = 0; i < newTypes.length; i++) { + if (newTypes[i] == _type) { + _modulesToData[_modules[_type][_index]].moduleIndexes[i] = _index; + } + } + } + } + + /** + * @notice allows owner to increase/decrease POLY approval of one of the modules + * @param _module module address + * @param _change change in allowance + * @param _increase true if budget has to be increased, false if decrease + */ + function changeModuleBudget( + address _module, + uint256 _change, + bool _increase, + address _polyToken, + mapping(address => ModuleData) storage _modulesToData + ) + public + { + require(_modulesToData[_module].module != address(0), "Module missing"); + uint256 currentAllowance = IPoly(_polyToken).allowance(address(this), _module); + uint256 newAllowance; + if (_increase) { + require(IPoly(_polyToken).increaseApproval(_module, _change), "IncreaseApproval fail"); + newAllowance = currentAllowance.add(_change); + } else { + require(IPoly(_polyToken).decreaseApproval(_module, _change), "Insufficient allowance"); + newAllowance = currentAllowance.sub(_change); + } + emit ModuleBudgetChanged(_modulesToData[_module].moduleTypes, _module, currentAllowance, newAllowance); + } + /** * @notice Validates permissions with PermissionManager if it exists. If there's no permission return false * @dev Note that IModule withPerm will allow ST owner all permissions by default @@ -144,12 +237,7 @@ library TokenLib { return; } //New checkpoint, so record balance - _checkpoints.push( - TokenLib.Checkpoint({ - checkpointId: _currentCheckpointId, - value: _newValue - }) - ); + _checkpoints.push(TokenLib.Checkpoint({checkpointId: _currentCheckpointId, value: _newValue})); } /** @@ -168,7 +256,9 @@ library TokenLib { uint256 _value, uint256 _balanceTo, uint256 _balanceFrom - ) public { + ) + public + { if ((_value == 0) || (_from == _to)) { return; } diff --git a/contracts/libraries/Util.sol b/contracts/libraries/Util.sol index 5d4cce83e..b502ca305 100644 --- a/contracts/libraries/Util.sol +++ b/contracts/libraries/Util.sol @@ -1,20 +1,19 @@ -pragma solidity ^0.4.24; +pragma solidity ^0.5.0; /** * @title Utility contract for reusable code */ library Util { - - /** + /** * @notice Changes a string to upper case * @param _base String to change */ - function upper(string _base) internal pure returns (string) { + function upper(string memory _base) internal pure returns(string memory) { bytes memory _baseBytes = bytes(_base); for (uint i = 0; i < _baseBytes.length; i++) { bytes1 b1 = _baseBytes[i]; if (b1 >= 0x61 && b1 <= 0x7A) { - b1 = bytes1(uint8(b1)-32); + b1 = bytes1(uint8(b1) - 32); } _baseBytes[i] = b1; } @@ -26,7 +25,7 @@ library Util { * @param _source String that need to convert into bytes32 */ /// Notice - Maximum Length for _source will be 32 chars otherwise returned bytes32 value will have lossy value. - function stringToBytes32(string memory _source) internal pure returns (bytes32) { + function stringToBytes32(string memory _source) internal pure returns(bytes32) { return bytesToBytes32(bytes(_source), 0); } @@ -36,7 +35,7 @@ library Util { * @param _offset Offset from which to begin conversion */ /// Notice - Maximum length for _source will be 32 chars otherwise returned bytes32 value will have lossy value. - function bytesToBytes32(bytes _b, uint _offset) internal pure returns (bytes32) { + function bytesToBytes32(bytes memory _b, uint _offset) internal pure returns(bytes32) { bytes32 result; for (uint i = 0; i < _b.length; i++) { @@ -49,10 +48,11 @@ library Util { * @notice Changes the bytes32 into string * @param _source that need to convert into string */ - function bytes32ToString(bytes32 _source) internal pure returns (string result) { + function bytes32ToString(bytes32 _source) internal pure returns(string memory) { bytes memory bytesString = new bytes(32); uint charCount = 0; - for (uint j = 0; j < 32; j++) { + uint j = 0; + for (j = 0; j < 32; j++) { byte char = byte(bytes32(uint(_source) * 2 ** (8 * j))); if (char != 0) { bytesString[charCount] = char; @@ -71,12 +71,11 @@ library Util { * @param _data Passed data * @return bytes4 sig */ - function getSig(bytes _data) internal pure returns (bytes4 sig) { + function getSig(bytes memory _data) internal pure returns(bytes4 sig) { uint len = _data.length < 4 ? _data.length : 4; - for (uint i = 0; i < len; i++) { - sig = bytes4(uint(sig) + uint(_data[i]) * (2 ** (8 * (len - 1 - i)))); + for (uint256 i = 0; i < len; i++) { + sig |= bytes4(_data[i] & 0xFF) >> (i * 8); } + return sig; } - - } diff --git a/contracts/libraries/VersionUtils.sol b/contracts/libraries/VersionUtils.sol index 71376aa45..645e183b4 100644 --- a/contracts/libraries/VersionUtils.sol +++ b/contracts/libraries/VersionUtils.sol @@ -1,48 +1,39 @@ -pragma solidity ^0.4.24; +pragma solidity ^0.5.0; /** * @title Helper library use to compare or validate the semantic versions */ library VersionUtils { - /** * @notice This function is used to validate the version submitted * @param _current Array holds the present version of ST * @param _new Array holds the latest version of the ST * @return bool */ - function isValidVersion(uint8[] _current, uint8[] _new) internal pure returns(bool) { + function isValidVersion(uint8[] memory _current, uint8[] memory _new) internal pure returns(bool) { bool[] memory _temp = new bool[](_current.length); uint8 counter = 0; - for (uint8 i = 0; i < _current.length; i++) { - if (_current[i] < _new[i]) - _temp[i] = true; - else - _temp[i] = false; + uint8 i = 0; + for (i = 0; i < _current.length; i++) { + if (_current[i] < _new[i]) _temp[i] = true; + else _temp[i] = false; } for (i = 0; i < _current.length; i++) { if (i == 0) { - if (_current[i] <= _new[i]) - if(_temp[0]) { - counter = counter + 3; - break; - } else - counter++; - else - return false; + if (_current[i] <= _new[i]) if (_temp[0]) { + counter = counter + 3; + break; + } else counter++; + else return false; } else { - if (_temp[i-1]) - counter++; - else if (_current[i] <= _new[i]) - counter++; - else - return false; + if (_temp[i - 1]) counter++; + else if (_current[i] <= _new[i]) counter++; + else return false; } } - if (counter == _current.length) - return true; + if (counter == _current.length) return true; } /** @@ -51,29 +42,22 @@ library VersionUtils { * @param _version2 Array holds the latest version of the ST * @return bool */ - function compareLowerBound(uint8[] _version1, uint8[] _version2) internal pure returns(bool) { + function compareLowerBound(uint8[] memory _version1, uint8[] memory _version2) internal pure returns(bool) { require(_version1.length == _version2.length, "Input length mismatch"); uint counter = 0; for (uint8 j = 0; j < _version1.length; j++) { - if (_version1[j] == 0) - counter ++; + if (_version1[j] == 0) counter++; } if (counter != _version1.length) { counter = 0; for (uint8 i = 0; i < _version1.length; i++) { - if (_version2[i] > _version1[i]) - return true; - else if (_version2[i] < _version1[i]) - return false; - else - counter++; + if (_version2[i] > _version1[i]) return true; + else if (_version2[i] < _version1[i]) return false; + else counter++; } - if (counter == _version1.length - 1) - return true; - else - return false; - } else - return true; + if (counter == _version1.length - 1) return true; + else return false; + } else return true; } /** @@ -82,32 +66,24 @@ library VersionUtils { * @param _version2 Array holds the latest version of the ST * @return bool */ - function compareUpperBound(uint8[] _version1, uint8[] _version2) internal pure returns(bool) { + function compareUpperBound(uint8[] memory _version1, uint8[] memory _version2) internal pure returns(bool) { require(_version1.length == _version2.length, "Input length mismatch"); uint counter = 0; for (uint8 j = 0; j < _version1.length; j++) { - if (_version1[j] == 0) - counter ++; + if (_version1[j] == 0) counter++; } if (counter != _version1.length) { counter = 0; for (uint8 i = 0; i < _version1.length; i++) { - if (_version1[i] > _version2[i]) - return true; - else if (_version1[i] < _version2[i]) - return false; - else - counter++; + if (_version1[i] > _version2[i]) return true; + else if (_version1[i] < _version2[i]) return false; + else counter++; } - if (counter == _version1.length - 1) - return true; - else - return false; - } else - return true; + if (counter == _version1.length - 1) return true; + else return false; + } else return true; } - /** * @notice Used to pack the uint8[] array data into uint24 value * @param _major Major version @@ -122,7 +98,7 @@ library VersionUtils { * @notice Used to convert packed data into uint8 array * @param _packedVersion Packed data */ - function unpack(uint24 _packedVersion) internal pure returns (uint8[]) { + function unpack(uint24 _packedVersion) internal pure returns(uint8[] memory) { uint8[] memory _unpackVersion = new uint8[](3); _unpackVersion[0] = uint8(_packedVersion >> 16); _unpackVersion[1] = uint8(_packedVersion >> 8); @@ -130,5 +106,4 @@ library VersionUtils { return _unpackVersion; } - } diff --git a/contracts/mocks/MockBurnFactory.sol b/contracts/mocks/MockBurnFactory.sol index a5f365050..720c480f7 100644 --- a/contracts/mocks/MockBurnFactory.sol +++ b/contracts/mocks/MockBurnFactory.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.24; +pragma solidity ^0.5.0; import "./MockRedemptionManager.sol"; import "../modules/Experimental/Burn/TrackedRedemptionFactory.sol"; @@ -8,23 +8,33 @@ import "../modules/Experimental/Burn/TrackedRedemptionFactory.sol"; */ contract MockBurnFactory is TrackedRedemptionFactory { - /** * @notice Constructor * @param _setupCost Setup cost of the module * @param _usageCost Usage cost of the module * @param _subscriptionCost Subscription cost of the module */ - constructor (uint256 _setupCost, uint256 _usageCost, uint256 _subscriptionCost) public - TrackedRedemptionFactory(_setupCost, _usageCost, _subscriptionCost) + constructor( + uint256 _setupCost, + uint256 _usageCost, + uint256 _subscriptionCost + ) + public + TrackedRedemptionFactory(_setupCost, _usageCost, _subscriptionCost) { + } /** * @notice Used to launch the Module with the help of factory * @return Address Contract address of the Module */ - function deploy(bytes /*_data*/) external returns(address) { + function deploy( + bytes calldata /*_data*/ + ) + external + returns(address) + { address polyToken = _takeFee(); //Check valid bytes - can only call module init function MockRedemptionManager mockRedemptionManager = new MockRedemptionManager(msg.sender, polyToken); diff --git a/contracts/mocks/MockFactory.sol b/contracts/mocks/MockFactory.sol index 73f5aaa27..558323584 100644 --- a/contracts/mocks/MockFactory.sol +++ b/contracts/mocks/MockFactory.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.24; +pragma solidity ^0.5.0; import "../modules/STO/DummySTOFactory.sol"; @@ -7,7 +7,6 @@ import "../modules/STO/DummySTOFactory.sol"; */ contract MockFactory is DummySTOFactory { - bool public switchTypes = false; /** @@ -17,16 +16,21 @@ contract MockFactory is DummySTOFactory { * @param _subscriptionCost Subscription cost of the module * @param _logicContract Contract address that contains the logic related to `description` */ - constructor (uint256 _setupCost, uint256 _usageCost, uint256 _subscriptionCost, address _logicContract) public - DummySTOFactory(_setupCost, _usageCost, _subscriptionCost, _logicContract) + constructor( + uint256 _setupCost, + uint256 _usageCost, + uint256 _subscriptionCost, + address _logicContract + ) + public + DummySTOFactory(_setupCost, _usageCost, _subscriptionCost, _logicContract) { - } /** * @notice Type of the Module factory */ - function getTypes() external view returns(uint8[]) { + function getTypes() external view returns(uint8[] memory) { if (!switchTypes) { uint8[] memory types = new uint8[](0); return types; @@ -36,7 +40,7 @@ contract MockFactory is DummySTOFactory { res[1] = 1; return res; } - + } function changeTypes() external onlyOwner { diff --git a/contracts/mocks/MockModuleRegistry.sol b/contracts/mocks/MockModuleRegistry.sol index 5711108c1..8dccc7bf6 100644 --- a/contracts/mocks/MockModuleRegistry.sol +++ b/contracts/mocks/MockModuleRegistry.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.24; +pragma solidity ^0.5.0; import "../ModuleRegistry.sol"; @@ -6,14 +6,12 @@ import "../ModuleRegistry.sol"; * @title Registry contract for issuers to register their security tokens */ contract MockModuleRegistry is ModuleRegistry { - /// @notice It is dummy functionality /// Alert! Alert! Do not use it for the mainnet release - function addMoreReputation(address _moduleFactory, address[] _tokens) public onlyOwner { + function addMoreReputation(address _moduleFactory, address[] memory _tokens) public onlyOwner { for (uint8 i = 0; i < _tokens.length; i++) { pushArray(Encoder.getKey("reputation", _moduleFactory), _tokens[i]); } } - } diff --git a/contracts/mocks/MockOracle.sol b/contracts/mocks/MockOracle.sol index d7cf14a2a..8208f8024 100644 --- a/contracts/mocks/MockOracle.sol +++ b/contracts/mocks/MockOracle.sol @@ -1,9 +1,8 @@ -pragma solidity ^0.4.24; +pragma solidity ^0.5.0; import "../interfaces/IOracle.sol"; contract MockOracle is IOracle { - address public currency; bytes32 public currencySymbol; bytes32 public denominatedCurrency; diff --git a/contracts/mocks/MockPolyOracle.sol b/contracts/mocks/MockPolyOracle.sol index 681bb2681..15041a42d 100644 --- a/contracts/mocks/MockPolyOracle.sol +++ b/contracts/mocks/MockPolyOracle.sol @@ -1,11 +1,10 @@ -pragma solidity ^0.4.24; +pragma solidity ^0.5.0; import "../oracles/PolyOracle.sol"; contract MockPolyOracle is PolyOracle { - - constructor() payable public { + constructor() public payable { OAR = OraclizeAddrResolverI(0x6f485C8BF6fc43eA212E93BBF8ce046C7f1cb475); } -} \ No newline at end of file +} diff --git a/contracts/mocks/MockRedemptionManager.sol b/contracts/mocks/MockRedemptionManager.sol index 8f7abfb80..f5d117497 100644 --- a/contracts/mocks/MockRedemptionManager.sol +++ b/contracts/mocks/MockRedemptionManager.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.24; +pragma solidity ^0.5.0; import "../modules/Experimental/Burn/TrackedRedemption.sol"; @@ -6,8 +6,7 @@ import "../modules/Experimental/Burn/TrackedRedemption.sol"; * @title Burn module for burning tokens and keeping track of burnt amounts */ contract MockRedemptionManager is TrackedRedemption { - - mapping (address => uint256) tokenToRedeem; + mapping(address => uint256) tokenToRedeem; event RedeemedTokenByOwner(address _investor, address _byWhoom, uint256 _value, uint256 _timestamp); @@ -15,9 +14,8 @@ contract MockRedemptionManager is TrackedRedemption { * @notice Constructor * @param _securityToken Address of the security token */ - constructor (address _securityToken, address _polyToken) public - TrackedRedemption(_securityToken, _polyToken) - { + constructor(address _securityToken, address _polyToken) public TrackedRedemption(_securityToken, _polyToken) { + } /** diff --git a/contracts/mocks/MockWrongTypeFactory.sol b/contracts/mocks/MockWrongTypeFactory.sol index 9da441072..a5d2b74ec 100644 --- a/contracts/mocks/MockWrongTypeFactory.sol +++ b/contracts/mocks/MockWrongTypeFactory.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.24; +pragma solidity ^0.5.0; import "./MockBurnFactory.sol"; import "../modules/ModuleFactory.sol"; @@ -9,22 +9,27 @@ import "../libraries/Util.sol"; */ contract MockWrongTypeFactory is MockBurnFactory { - /** * @notice Constructor * @param _setupCost Setup cost of the module * @param _usageCost Usage cost of the module * @param _subscriptionCost Subscription cost of the module */ - constructor (uint256 _setupCost, uint256 _usageCost, uint256 _subscriptionCost) public - MockBurnFactory(_setupCost, _usageCost, _subscriptionCost) + constructor( + uint256 _setupCost, + uint256 _usageCost, + uint256 _subscriptionCost + ) + public + MockBurnFactory(_setupCost, _usageCost, _subscriptionCost) { + } /** * @notice Type of the Module factory */ - function getTypes() external view returns(uint8[]) { + function getTypes() external view returns(uint8[] memory) { uint8[] memory types = new uint8[](1); types[0] = 4; return types; diff --git a/contracts/mocks/PolyTokenFaucet.sol b/contracts/mocks/PolyTokenFaucet.sol index 76f1a5596..c903223f6 100644 --- a/contracts/mocks/PolyTokenFaucet.sol +++ b/contracts/mocks/PolyTokenFaucet.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.24; +pragma solidity ^0.5.0; import "openzeppelin-solidity/contracts/math/SafeMath.sol"; @@ -8,7 +8,6 @@ import "openzeppelin-solidity/contracts/math/SafeMath.sol"; */ contract PolyTokenFaucet { - using SafeMath for uint256; uint256 totalSupply_; string public name = "Polymath Network"; @@ -23,14 +22,14 @@ contract PolyTokenFaucet { constructor() public { decimals = 18; - totalSupply_ = 1000000 * uint256(10)**decimals; + totalSupply_ = 1000000 * uint256(10) ** decimals; balances[msg.sender] = totalSupply_; emit Transfer(address(0), msg.sender, totalSupply_); } /* Token faucet - Not part of the ERC20 standard */ - function getTokens(uint256 _amount, address _recipient) public returns (bool) { - require(_amount <= 1000000 * uint256(10)**decimals, "Amount should not exceed 1 million"); + function getTokens(uint256 _amount, address _recipient) public returns(bool) { + require(_amount <= 1000000 * uint256(10) ** decimals, "Amount should not exceed 1 million"); require(_recipient != address(0), "Recipient address can not be empty"); balances[_recipient] = balances[_recipient].add(_amount); totalSupply_ = totalSupply_.add(_amount); @@ -44,7 +43,7 @@ contract PolyTokenFaucet { * @param _value The amount of token to be transferred * @return Whether the transfer was successful or not */ - function transfer(address _to, uint256 _value) public returns (bool) { + function transfer(address _to, uint256 _value) public returns(bool) { balances[msg.sender] = balances[msg.sender].sub(_value); balances[_to] = balances[_to].add(_value); emit Transfer(msg.sender, _to, _value); @@ -58,7 +57,7 @@ contract PolyTokenFaucet { * @param _value The amount of token to be transferred * @return Whether the transfer was successful or not */ - function transferFrom(address _from, address _to, uint256 _value) public returns (bool) { + function transferFrom(address _from, address _to, uint256 _value) public returns(bool) { require(_to != address(0), "Invalid address"); require(_value <= balances[_from], "Insufficient tokens transferable"); require(_value <= allowed[_from][msg.sender], "Insufficient tokens allowable"); @@ -75,7 +74,7 @@ contract PolyTokenFaucet { * @param _owner The address from which the balance will be retrieved * @return The balance */ - function balanceOf(address _owner) public view returns (uint256 balance) { + function balanceOf(address _owner) public view returns(uint256 balance) { return balances[_owner]; } @@ -85,7 +84,7 @@ contract PolyTokenFaucet { * @param _value The amount of tokens to be approved for transfer * @return Whether the approval was successful or not */ - function approve(address _spender, uint256 _value) public returns (bool) { + function approve(address _spender, uint256 _value) public returns(bool) { allowed[msg.sender][_spender] = _value; emit Approval(msg.sender, _spender, _value); return true; @@ -96,11 +95,11 @@ contract PolyTokenFaucet { * @param _spender The address of the account able to transfer the tokens * @return Amount of remaining tokens allowed to be spent */ - function allowance(address _owner, address _spender) public view returns (uint256 remaining) { + function allowance(address _owner, address _spender) public view returns(uint256 remaining) { return allowed[_owner][_spender]; } - function totalSupply() public view returns (uint256) { + function totalSupply() public view returns(uint256) { return totalSupply_; } @@ -113,15 +112,8 @@ contract PolyTokenFaucet { * @param _spender The address which will spend the funds. * @param _addedValue The amount of tokens to increase the allowance by. */ - function increaseApproval( - address _spender, - uint _addedValue - ) - public - returns (bool) - { - allowed[msg.sender][_spender] = ( - allowed[msg.sender][_spender].add(_addedValue)); + function increaseApproval(address _spender, uint _addedValue) public returns(bool) { + allowed[msg.sender][_spender] = (allowed[msg.sender][_spender].add(_addedValue)); emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; } @@ -136,13 +128,7 @@ contract PolyTokenFaucet { * @param _spender The address which will spend the funds. * @param _subtractedValue The amount of tokens to decrease the allowance by. */ - function decreaseApproval( - address _spender, - uint _subtractedValue - ) - public - returns (bool) - { + function decreaseApproval(address _spender, uint _subtractedValue) public returns(bool) { uint oldValue = allowed[msg.sender][_spender]; if (_subtractedValue > oldValue) { allowed[msg.sender][_spender] = 0; diff --git a/contracts/mocks/SecurityTokenRegistryMock.sol b/contracts/mocks/SecurityTokenRegistryMock.sol index d0a6de099..2ec9d8edd 100644 --- a/contracts/mocks/SecurityTokenRegistryMock.sol +++ b/contracts/mocks/SecurityTokenRegistryMock.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.24; +pragma solidity ^0.5.0; import "../SecurityTokenRegistry.sol"; @@ -6,11 +6,10 @@ import "../SecurityTokenRegistry.sol"; * @title Registry contract for issuers to register their security tokens */ contract SecurityTokenRegistryMock is SecurityTokenRegistry { - /// @notice It is a dummy function - /// Alert! Alert! Do not use it for the mainnet release - function changeTheDeployedAddress(string _ticker, address _newSecurityTokenAddress) public { + /// Alert! Alert! Do NOT use it for the mainnet release + function changeTheDeployedAddress(string memory _ticker, address _newSecurityTokenAddress) public { set(Encoder.getKey("tickerToSecurityToken", _ticker), _newSecurityTokenAddress); - } - + } + } diff --git a/contracts/mocks/TestSTOFactory.sol b/contracts/mocks/TestSTOFactory.sol index f9fad0c4e..47c7cd280 100644 --- a/contracts/mocks/TestSTOFactory.sol +++ b/contracts/mocks/TestSTOFactory.sol @@ -1,9 +1,8 @@ -pragma solidity ^0.4.24; +pragma solidity ^0.5.0; import "../modules/STO/DummySTOFactory.sol"; contract TestSTOFactory is DummySTOFactory { - /** * @notice Constructor * @param _setupCost Setup cost of the module @@ -11,8 +10,14 @@ contract TestSTOFactory is DummySTOFactory { * @param _subscriptionCost Subscription cost of the module * @param _logicContract Contract address that contains the logic related to `description` */ - constructor (uint256 _setupCost, uint256 _usageCost, uint256 _subscriptionCost, address _logicContract) public - DummySTOFactory(_setupCost, _usageCost, _subscriptionCost, _logicContract) + constructor( + uint256 _setupCost, + uint256 _usageCost, + uint256 _subscriptionCost, + address _logicContract + ) + public + DummySTOFactory(_setupCost, _usageCost, _subscriptionCost, _logicContract) { version = "1.0.0"; name = "TestSTO"; @@ -25,14 +30,14 @@ contract TestSTOFactory is DummySTOFactory { /** * @notice Returns the instructions associated with the module */ - function getInstructions() external view returns(string) { + function getInstructions() external view returns(string memory) { return "Test STO - you can mint tokens at will"; } /** * @notice Gets the tags related to the module factory */ - function getTags() external view returns(bytes32[]) { + function getTags() external view returns(bytes32[] memory) { bytes32[] memory availableTags = new bytes32[](4); availableTags[0] = "Test"; availableTags[1] = "Non-refundable"; diff --git a/contracts/modules/Burn/IBurn.sol b/contracts/modules/Burn/IBurn.sol index 7a84a802b..64a9b7de9 100644 --- a/contracts/modules/Burn/IBurn.sol +++ b/contracts/modules/Burn/IBurn.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.24; +pragma solidity ^0.5.0; /** * @title Interface to be implemented by all checkpoint modules diff --git a/contracts/modules/Checkpoint/DividendCheckpoint.sol b/contracts/modules/Checkpoint/DividendCheckpoint.sol index 9d2bcef8a..e54aa27fa 100644 --- a/contracts/modules/Checkpoint/DividendCheckpoint.sol +++ b/contracts/modules/Checkpoint/DividendCheckpoint.sol @@ -5,7 +5,7 @@ * the function may fail. If this happens investors can pull their dividends, or the Issuer * can use pushDividendPaymentToAddresses to provide an explict address list in batches */ -pragma solidity ^0.4.24; +pragma solidity ^0.5.0; import "./ICheckpoint.sol"; import "./DividendCheckpointStorage.sol"; @@ -39,7 +39,7 @@ contract DividendCheckpoint is DividendCheckpointStorage, ICheckpoint, Module { * @notice Init function i.e generalise function to maintain the structure of the module contract * @return bytes4 */ - function getInitFunction() public pure returns (bytes4) { + function getInitFunction() public pure returns(bytes4) { return bytes4(0); } @@ -47,7 +47,7 @@ contract DividendCheckpoint is DividendCheckpointStorage, ICheckpoint, Module { * @notice Return the default excluded addresses * @return List of excluded addresses */ - function getDefaultExcluded() external view returns (address[]) { + function getDefaultExcluded() external view returns(address[] memory) { return excluded; } @@ -55,7 +55,7 @@ contract DividendCheckpoint is DividendCheckpointStorage, ICheckpoint, Module { * @notice Creates a checkpoint on the security token * @return Checkpoint ID */ - function createCheckpoint() public withPerm(CHECKPOINT) returns (uint256) { + function createCheckpoint() public withPerm(CHECKPOINT) returns(uint256) { return ISecurityToken(securityToken).createCheckpoint(); } @@ -63,12 +63,12 @@ contract DividendCheckpoint is DividendCheckpointStorage, ICheckpoint, Module { * @notice Function to clear and set list of excluded addresses used for future dividends * @param _excluded Addresses of investors */ - function setDefaultExcluded(address[] _excluded) public withPerm(MANAGE) { + function setDefaultExcluded(address[] memory _excluded) public withPerm(MANAGE) { require(_excluded.length <= EXCLUDED_ADDRESS_LIMIT, "Too many excluded addresses"); for (uint256 j = 0; j < _excluded.length; j++) { - require (_excluded[j] != address(0), "Invalid address"); + require(_excluded[j] != address(0), "Invalid address"); for (uint256 i = j + 1; i < _excluded.length; i++) { - require (_excluded[j] != _excluded[i], "Duplicate exclude address"); + require(_excluded[j] != _excluded[i], "Duplicate exclude address"); } } excluded = _excluded; @@ -81,12 +81,12 @@ contract DividendCheckpoint is DividendCheckpointStorage, ICheckpoint, Module { * @param _investors Addresses of investors * @param _withholding Withholding tax for individual investors (multiplied by 10**16) */ - function setWithholding(address[] _investors, uint256[] _withholding) public withPerm(MANAGE) { + function setWithholding(address[] memory _investors, uint256[] memory _withholding) public withPerm(MANAGE) { require(_investors.length == _withholding.length, "Mismatched input lengths"); /*solium-disable-next-line security/no-block-members*/ emit SetWithholding(_investors, _withholding, now); for (uint256 i = 0; i < _investors.length; i++) { - require(_withholding[i] <= 10**18, "Incorrect withholding tax"); + require(_withholding[i] <= 10 ** 18, "Incorrect withholding tax"); withholdingTax[_investors[i]] = _withholding[i]; } } @@ -96,8 +96,8 @@ contract DividendCheckpoint is DividendCheckpointStorage, ICheckpoint, Module { * @param _investors Addresses of investor * @param _withholding Withholding tax for all investors (multiplied by 10**16) */ - function setWithholdingFixed(address[] _investors, uint256 _withholding) public withPerm(MANAGE) { - require(_withholding <= 10**18, "Incorrect withholding tax"); + function setWithholdingFixed(address[] memory _investors, uint256 _withholding) public withPerm(MANAGE) { + require(_withholding <= 10 ** 18, "Incorrect withholding tax"); /*solium-disable-next-line security/no-block-members*/ emit SetWithholdingFixed(_investors, _withholding, now); for (uint256 i = 0; i < _investors.length; i++) { @@ -112,11 +112,11 @@ contract DividendCheckpoint is DividendCheckpointStorage, ICheckpoint, Module { */ function pushDividendPaymentToAddresses( uint256 _dividendIndex, - address[] _payees - ) - public - withPerm(DISTRIBUTE) - validDividendIndex(_dividendIndex) + address payable[] memory _payees + ) + public + withPerm(DISTRIBUTE) + validDividendIndex(_dividendIndex) { Dividend storage dividend = dividends[_dividendIndex]; for (uint256 i = 0; i < _payees.length; i++) { @@ -136,16 +136,15 @@ contract DividendCheckpoint is DividendCheckpointStorage, ICheckpoint, Module { uint256 _dividendIndex, uint256 _start, uint256 _iterations - ) - public - withPerm(DISTRIBUTE) - validDividendIndex(_dividendIndex) + ) public + withPerm(DISTRIBUTE) + validDividendIndex(_dividendIndex) { Dividend storage dividend = dividends[_dividendIndex]; address[] memory investors = ISecurityToken(securityToken).getInvestors(); uint256 numberInvestors = Math.min(investors.length, _start.add(_iterations)); for (uint256 i = _start; i < numberInvestors; i++) { - address payee = investors[i]; + address payable payee = address(uint160(investors[i])); if ((!dividend.claimed[payee]) && (!dividend.dividendExcluded[payee])) { _payDividend(payee, dividend, _dividendIndex); } @@ -156,8 +155,7 @@ contract DividendCheckpoint is DividendCheckpointStorage, ICheckpoint, Module { * @notice Investors can pull their own dividends * @param _dividendIndex Dividend to pull */ - function pullDividendPayment(uint256 _dividendIndex) public validDividendIndex(_dividendIndex) - { + function pullDividendPayment(uint256 _dividendIndex) public validDividendIndex(_dividendIndex) { Dividend storage dividend = dividends[_dividendIndex]; require(!dividend.claimed[msg.sender], "Dividend already claimed"); require(!dividend.dividendExcluded[msg.sender], "msg.sender excluded from Dividend"); @@ -170,7 +168,7 @@ contract DividendCheckpoint is DividendCheckpointStorage, ICheckpoint, Module { * @param _dividend Storage with previously issued dividends * @param _dividendIndex Dividend to pay */ - function _payDividend(address _payee, Dividend storage _dividend, uint256 _dividendIndex) internal; + function _payDividend(address payable _payee, Dividend storage _dividend, uint256 _dividendIndex) internal; /** * @notice Issuer can reclaim remaining unclaimed dividend amounts, for expired dividends @@ -192,7 +190,7 @@ contract DividendCheckpoint is DividendCheckpointStorage, ICheckpoint, Module { } uint256 balance = ISecurityToken(securityToken).balanceOfAt(_payee, dividend.checkpointId); uint256 claim = balance.mul(dividend.amount).div(dividend.totalSupply); - uint256 withheld = claim.mul(withholdingTax[_payee]).div(uint256(10**18)); + uint256 withheld = claim.mul(withholdingTax[_payee]).div(uint256(10 ** 18)); return (claim, withheld); } @@ -201,9 +199,9 @@ contract DividendCheckpoint is DividendCheckpointStorage, ICheckpoint, Module { * @param _checkpointId Checkpoint id to query * @return uint256[] */ - function getDividendIndex(uint256 _checkpointId) public view returns(uint256[]) { + function getDividendIndex(uint256 _checkpointId) public view returns(uint256[] memory) { uint256 counter = 0; - for(uint256 i = 0; i < dividends.length; i++) { + for (uint256 i = 0; i < dividends.length; i++) { if (dividends[i].checkpointId == _checkpointId) { counter++; } @@ -211,7 +209,7 @@ contract DividendCheckpoint is DividendCheckpointStorage, ICheckpoint, Module { uint256[] memory index = new uint256[](counter); counter = 0; - for(uint256 j = 0; j < dividends.length; j++) { + for (uint256 j = 0; j < dividends.length; j++) { if (dividends[j].checkpointId == _checkpointId) { index[counter] = j; counter++; @@ -230,7 +228,7 @@ contract DividendCheckpoint is DividendCheckpointStorage, ICheckpoint, Module { * @notice Return the permissions flag that are associated with this module * @return bytes32 array */ - function getPermissions() public view returns(bytes32[]) { + function getPermissions() public view returns(bytes32[] memory) { bytes32[] memory allPermissions = new bytes32[](2); allPermissions[0] = DISTRIBUTE; allPermissions[1] = MANAGE; diff --git a/contracts/modules/Checkpoint/DividendCheckpointStorage.sol b/contracts/modules/Checkpoint/DividendCheckpointStorage.sol index 4cf1f2838..fa2f2793f 100644 --- a/contracts/modules/Checkpoint/DividendCheckpointStorage.sol +++ b/contracts/modules/Checkpoint/DividendCheckpointStorage.sol @@ -1,11 +1,10 @@ -pragma solidity ^0.4.24; +pragma solidity ^0.5.0; /** * @title Holds the storage variable for the DividendCheckpoint modules (i.e ERC20, Ether) * @dev abstract contract */ contract DividendCheckpointStorage { - uint256 public EXCLUDED_ADDRESS_LIMIT = 50; bytes32 public constant DISTRIBUTE = "DISTRIBUTE"; bytes32 public constant MANAGE = "MANAGE"; @@ -15,16 +14,16 @@ contract DividendCheckpointStorage { uint256 checkpointId; uint256 created; // Time at which the dividend was created uint256 maturity; // Time after which dividend can be claimed - set to 0 to bypass - uint256 expiry; // Time until which dividend can be claimed - after this time any remaining amount can be withdrawn by issuer - - // set to very high value to bypass + uint256 expiry; // Time until which dividend can be claimed - after this time any remaining amount can be withdrawn by issuer - + // set to very high value to bypass uint256 amount; // Dividend amount in WEI uint256 claimedAmount; // Amount of dividend claimed so far uint256 totalSupply; // Total supply at the associated checkpoint (avoids recalculating this) - bool reclaimed; // True if expiry has passed and issuer has reclaimed remaining dividend + bool reclaimed; // True if expiry has passed and issuer has reclaimed remaining dividend uint256 dividendWithheld; uint256 dividendWithheldReclaimed; - mapping (address => bool) claimed; // List of addresses which have claimed dividend - mapping (address => bool) dividendExcluded; // List of addresses which cannot claim dividends + mapping(address => bool) claimed; // List of addresses which have claimed dividend + mapping(address => bool) dividendExcluded; // List of addresses which cannot claim dividends bytes32 name; // Name/title - used for identification } @@ -35,9 +34,9 @@ contract DividendCheckpointStorage { address[] public excluded; // Mapping from address to withholding tax as a percentage * 10**16 - mapping (address => uint256) public withholdingTax; + mapping(address => uint256) public withholdingTax; // Total amount of ETH withheld per investor - mapping (address => uint256) public investorWithheld; + mapping(address => uint256) public investorWithheld; } diff --git a/contracts/modules/Checkpoint/ERC20DividendCheckpoint.sol b/contracts/modules/Checkpoint/ERC20DividendCheckpoint.sol index 6f1f21428..fecf21f8f 100644 --- a/contracts/modules/Checkpoint/ERC20DividendCheckpoint.sol +++ b/contracts/modules/Checkpoint/ERC20DividendCheckpoint.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.24; +pragma solidity ^0.5.0; import "./DividendCheckpoint.sol"; import "./ERC20DividendCheckpointStorage.sol"; @@ -23,19 +23,8 @@ contract ERC20DividendCheckpoint is ERC20DividendCheckpointStorage, DividendChec uint256 _dividendIndex, bytes32 indexed _name ); - event ERC20DividendClaimed( - address indexed _payee, - uint256 _dividendIndex, - address indexed _token, - uint256 _amount, - uint256 _withheld - ); - event ERC20DividendReclaimed( - address indexed _claimer, - uint256 _dividendIndex, - address indexed _token, - uint256 _claimedAmount - ); + event ERC20DividendClaimed(address indexed _payee, uint256 _dividendIndex, address indexed _token, uint256 _amount, uint256 _withheld); + event ERC20DividendReclaimed(address indexed _claimer, uint256 _dividendIndex, address indexed _token, uint256 _claimedAmount); event ERC20DividendWithholdingWithdrawn( address indexed _claimer, uint256 _dividendIndex, @@ -47,9 +36,8 @@ contract ERC20DividendCheckpoint is ERC20DividendCheckpointStorage, DividendChec * @notice Constructor * @param _securityToken Address of the security token */ - constructor (address _securityToken, address _polyToken) public - Module(_securityToken, _polyToken) - { + constructor(address _securityToken, address _polyToken) public Module(_securityToken, _polyToken) { + } /** @@ -61,14 +49,14 @@ contract ERC20DividendCheckpoint is ERC20DividendCheckpointStorage, DividendChec * @param _name Name/Title for identification */ function createDividend( - uint256 _maturity, - uint256 _expiry, - address _token, - uint256 _amount, + uint256 _maturity, + uint256 _expiry, + address _token, + uint256 _amount, bytes32 _name - ) - external - withPerm(MANAGE) + ) + external + withPerm(MANAGE) { createDividendWithExclusions(_maturity, _expiry, _token, _amount, excluded, _name); } @@ -89,9 +77,9 @@ contract ERC20DividendCheckpoint is ERC20DividendCheckpointStorage, DividendChec uint256 _amount, uint256 _checkpointId, bytes32 _name - ) - external - withPerm(MANAGE) + ) + external + withPerm(MANAGE) { _createDividendWithCheckpointAndExclusions(_maturity, _expiry, _token, _amount, _checkpointId, excluded, _name); } @@ -110,11 +98,11 @@ contract ERC20DividendCheckpoint is ERC20DividendCheckpointStorage, DividendChec uint256 _expiry, address _token, uint256 _amount, - address[] _excluded, + address[] memory _excluded, bytes32 _name - ) - public - withPerm(MANAGE) + ) + public + withPerm(MANAGE) { uint256 checkpointId = ISecurityToken(securityToken).createCheckpoint(); _createDividendWithCheckpointAndExclusions(_maturity, _expiry, _token, _amount, checkpointId, _excluded, _name); @@ -136,11 +124,11 @@ contract ERC20DividendCheckpoint is ERC20DividendCheckpointStorage, DividendChec address _token, uint256 _amount, uint256 _checkpointId, - address[] _excluded, + address[] memory _excluded, bytes32 _name - ) - public - withPerm(MANAGE) + ) + public + withPerm(MANAGE) { _createDividendWithCheckpointAndExclusions(_maturity, _expiry, _token, _amount, _checkpointId, _excluded, _name); } @@ -161,10 +149,10 @@ contract ERC20DividendCheckpoint is ERC20DividendCheckpointStorage, DividendChec address _token, uint256 _amount, uint256 _checkpointId, - address[] _excluded, + address[] memory _excluded, bytes32 _name - ) - internal + ) + internal { ISecurityToken securityTokenInstance = ISecurityToken(securityToken); require(_excluded.length <= EXCLUDED_ADDRESS_LIMIT, "Too many addresses excluded"); @@ -180,23 +168,23 @@ contract ERC20DividendCheckpoint is ERC20DividendCheckpointStorage, DividendChec uint256 currentSupply = securityTokenInstance.totalSupplyAt(_checkpointId); uint256 excludedSupply = 0; dividends.push( - Dividend( - _checkpointId, - now, /*solium-disable-line security/no-block-members*/ - _maturity, - _expiry, - _amount, - 0, - 0, - false, - 0, - 0, - _name - ) + Dividend( + _checkpointId, + now, /*solium-disable-line security/no-block-members*/ + _maturity, + _expiry, + _amount, + 0, + 0, + false, + 0, + 0, + _name + ) ); for (uint256 j = 0; j < _excluded.length; j++) { - require (_excluded[j] != address(0), "Invalid address"); + require(_excluded[j] != address(0), "Invalid address"); require(!dividends[dividendIndex].dividendExcluded[_excluded[j]], "duped exclude address"); excludedSupply = excludedSupply.add(securityTokenInstance.balanceOfAt(_excluded[j], _checkpointId)); dividends[dividendIndex].dividendExcluded[_excluded[j]] = true; @@ -220,11 +208,22 @@ contract ERC20DividendCheckpoint is ERC20DividendCheckpointStorage, DividendChec uint256 currentSupply, uint256 dividendIndex, bytes32 _name - ) - internal + ) + internal { /*solium-disable-next-line security/no-block-members*/ - emit ERC20DividendDeposited(msg.sender, _checkpointId, now, _maturity, _expiry, _token, _amount, currentSupply, dividendIndex, _name); + emit ERC20DividendDeposited( + msg.sender, + _checkpointId, + now, + _maturity, + _expiry, + _token, + _amount, + currentSupply, + dividendIndex, + _name + ); } /** @@ -233,7 +232,7 @@ contract ERC20DividendCheckpoint is ERC20DividendCheckpointStorage, DividendChec * @param _dividend Storage with previously issued dividends * @param _dividendIndex Dividend to pay */ - function _payDividend(address _payee, Dividend storage _dividend, uint256 _dividendIndex) internal { + function _payDividend(address payable _payee, Dividend storage _dividend, uint256 _dividendIndex) internal { (uint256 claim, uint256 withheld) = calculateDividend(_dividendIndex, _payee); _dividend.claimed[_payee] = true; _dividend.claimedAmount = claim.add(_dividend.claimedAmount); diff --git a/contracts/modules/Checkpoint/ERC20DividendCheckpointFactory.sol b/contracts/modules/Checkpoint/ERC20DividendCheckpointFactory.sol index 502ad6b80..b9b83ef0d 100644 --- a/contracts/modules/Checkpoint/ERC20DividendCheckpointFactory.sol +++ b/contracts/modules/Checkpoint/ERC20DividendCheckpointFactory.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.24; +pragma solidity ^0.5.0; import "../../proxy/ERC20DividendCheckpointProxy.sol"; import "../ModuleFactory.sol"; @@ -7,7 +7,6 @@ import "../ModuleFactory.sol"; * @title Factory for deploying ERC20DividendCheckpoint module */ contract ERC20DividendCheckpointFactory is ModuleFactory { - address public logicContract; /** @@ -17,8 +16,14 @@ contract ERC20DividendCheckpointFactory is ModuleFactory { * @param _subscriptionCost Subscription cost of the module * @param _logicContract Contract address that contains the logic related to `description` */ - constructor (uint256 _setupCost, uint256 _usageCost, uint256 _subscriptionCost, address _logicContract) public - ModuleFactory(_setupCost, _usageCost, _subscriptionCost) + constructor( + uint256 _setupCost, + uint256 _usageCost, + uint256 _subscriptionCost, + address _logicContract + ) + public + ModuleFactory(_setupCost, _usageCost, _subscriptionCost) { require(_logicContract != address(0), "Invalid logic contract"); version = "2.1.0"; @@ -34,9 +39,14 @@ contract ERC20DividendCheckpointFactory is ModuleFactory { * @notice Used to launch the Module with the help of factory * @return Address Contract address of the Module */ - function deploy(bytes /* _data */) external returns(address) { + function deploy( + bytes calldata /* _data */ + ) + external + returns(address) + { address polyToken = _takeFee(); - address erc20DividendCheckpoint = new ERC20DividendCheckpointProxy(msg.sender, polyToken, logicContract); + address erc20DividendCheckpoint = address(new ERC20DividendCheckpointProxy(msg.sender, polyToken, logicContract)); /*solium-disable-next-line security/no-block-members*/ emit GenerateModuleFromFactory(erc20DividendCheckpoint, getName(), address(this), msg.sender, setupCost, now); return erc20DividendCheckpoint; @@ -45,7 +55,7 @@ contract ERC20DividendCheckpointFactory is ModuleFactory { /** * @notice Type of the Module factory */ - function getTypes() external view returns(uint8[]) { + function getTypes() external view returns(uint8[] memory) { uint8[] memory res = new uint8[](1); res[0] = 4; return res; @@ -54,14 +64,14 @@ contract ERC20DividendCheckpointFactory is ModuleFactory { /** * @notice Returns the instructions associated with the module */ - function getInstructions() external view returns(string) { + function getInstructions() external view returns(string memory) { return "Create ERC20 dividend to be paid out to token holders based on their balances at dividend creation time"; } /** * @notice Get the tags related to the module factory */ - function getTags() external view returns(bytes32[]) { + function getTags() external view returns(bytes32[] memory) { bytes32[] memory availableTags = new bytes32[](3); availableTags[0] = "ERC20"; availableTags[1] = "Dividend"; diff --git a/contracts/modules/Checkpoint/ERC20DividendCheckpointStorage.sol b/contracts/modules/Checkpoint/ERC20DividendCheckpointStorage.sol index 29401f8d9..1c6bca68c 100644 --- a/contracts/modules/Checkpoint/ERC20DividendCheckpointStorage.sol +++ b/contracts/modules/Checkpoint/ERC20DividendCheckpointStorage.sol @@ -1,11 +1,10 @@ -pragma solidity ^0.4.24; +pragma solidity ^0.5.0; /** * @title It holds the storage variables related to ERC20DividendCheckpoint module */ contract ERC20DividendCheckpointStorage { - // Mapping to token address for each dividend - mapping (uint256 => address) public dividendTokens; + mapping(uint256 => address) public dividendTokens; } diff --git a/contracts/modules/Checkpoint/EtherDividendCheckpoint.sol b/contracts/modules/Checkpoint/EtherDividendCheckpoint.sol index eee93e587..30ac0e724 100644 --- a/contracts/modules/Checkpoint/EtherDividendCheckpoint.sol +++ b/contracts/modules/Checkpoint/EtherDividendCheckpoint.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.24; +pragma solidity ^0.5.0; import "./DividendCheckpoint.sol"; import "../../interfaces/IOwnable.sol"; @@ -29,9 +29,8 @@ contract EtherDividendCheckpoint is DividendCheckpoint { * @notice Constructor * @param _securityToken Address of the security token */ - constructor (address _securityToken, address _polyToken) public - Module(_securityToken, _polyToken) - { + constructor(address _securityToken, address _polyToken) public Module(_securityToken, _polyToken) { + } /** @@ -56,10 +55,10 @@ contract EtherDividendCheckpoint is DividendCheckpoint { uint256 _expiry, uint256 _checkpointId, bytes32 _name - ) - external - payable - withPerm(MANAGE) + ) + external + payable + withPerm(MANAGE) { _createDividendWithCheckpointAndExclusions(_maturity, _expiry, _checkpointId, excluded, _name); } @@ -74,12 +73,12 @@ contract EtherDividendCheckpoint is DividendCheckpoint { function createDividendWithExclusions( uint256 _maturity, uint256 _expiry, - address[] _excluded, + address[] memory _excluded, bytes32 _name - ) - public - payable - withPerm(MANAGE) + ) + public + payable + withPerm(MANAGE) { uint256 checkpointId = ISecurityToken(securityToken).createCheckpoint(); _createDividendWithCheckpointAndExclusions(_maturity, _expiry, checkpointId, _excluded, _name); @@ -97,12 +96,12 @@ contract EtherDividendCheckpoint is DividendCheckpoint { uint256 _maturity, uint256 _expiry, uint256 _checkpointId, - address[] _excluded, + address[] memory _excluded, bytes32 _name - ) - public - payable - withPerm(MANAGE) + ) + public + payable + withPerm(MANAGE) { _createDividendWithCheckpointAndExclusions(_maturity, _expiry, _checkpointId, _excluded, _name); } @@ -119,10 +118,10 @@ contract EtherDividendCheckpoint is DividendCheckpoint { uint256 _maturity, uint256 _expiry, uint256 _checkpointId, - address[] _excluded, + address[] memory _excluded, bytes32 _name - ) - internal + ) + internal { require(_excluded.length <= EXCLUDED_ADDRESS_LIMIT, "Too many addresses excluded"); require(_expiry > _maturity, "Expiry is before maturity"); @@ -135,23 +134,23 @@ contract EtherDividendCheckpoint is DividendCheckpoint { uint256 currentSupply = ISecurityToken(securityToken).totalSupplyAt(_checkpointId); uint256 excludedSupply = 0; dividends.push( - Dividend( - _checkpointId, - now, /*solium-disable-line security/no-block-members*/ - _maturity, - _expiry, - msg.value, - 0, - 0, - false, - 0, - 0, - _name - ) + Dividend( + _checkpointId, + now, /*solium-disable-line security/no-block-members*/ + _maturity, + _expiry, + msg.value, + 0, + 0, + false, + 0, + 0, + _name + ) ); for (uint256 j = 0; j < _excluded.length; j++) { - require (_excluded[j] != address(0), "Invalid address"); + require(_excluded[j] != address(0), "Invalid address"); require(!dividends[dividendIndex].dividendExcluded[_excluded[j]], "duped exclude address"); excludedSupply = excludedSupply.add(ISecurityToken(securityToken).balanceOfAt(_excluded[j], _checkpointId)); dividends[dividendIndex].dividendExcluded[_excluded[j]] = true; @@ -167,7 +166,7 @@ contract EtherDividendCheckpoint is DividendCheckpoint { * @param _dividend storage with previously issued dividends * @param _dividendIndex Dividend to pay */ - function _payDividend(address _payee, Dividend storage _dividend, uint256 _dividendIndex) internal { + function _payDividend(address payable _payee, Dividend storage _dividend, uint256 _dividendIndex) internal { (uint256 claim, uint256 withheld) = calculateDividend(_dividendIndex, _payee); _dividend.claimed[_payee] = true; uint256 claimAfterWithheld = claim.sub(withheld); @@ -197,7 +196,7 @@ contract EtherDividendCheckpoint is DividendCheckpoint { Dividend storage dividend = dividends[_dividendIndex]; dividend.reclaimed = true; uint256 remainingAmount = dividend.amount.sub(dividend.claimedAmount); - address owner = IOwnable(securityToken).owner(); + address payable owner = address(uint160(IOwnable(securityToken).owner())); owner.transfer(remainingAmount); emit EtherDividendReclaimed(owner, _dividendIndex, remainingAmount); } @@ -211,7 +210,7 @@ contract EtherDividendCheckpoint is DividendCheckpoint { Dividend storage dividend = dividends[_dividendIndex]; uint256 remainingWithheld = dividend.dividendWithheld.sub(dividend.dividendWithheldReclaimed); dividend.dividendWithheldReclaimed = dividend.dividendWithheld; - address owner = IOwnable(securityToken).owner(); + address payable owner = address(uint160(IOwnable(securityToken).owner())); owner.transfer(remainingWithheld); emit EtherDividendWithholdingWithdrawn(owner, _dividendIndex, remainingWithheld); } diff --git a/contracts/modules/Checkpoint/EtherDividendCheckpointFactory.sol b/contracts/modules/Checkpoint/EtherDividendCheckpointFactory.sol index f51677d00..92b1ba7f3 100644 --- a/contracts/modules/Checkpoint/EtherDividendCheckpointFactory.sol +++ b/contracts/modules/Checkpoint/EtherDividendCheckpointFactory.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.24; +pragma solidity ^0.5.0; import "../../proxy/EtherDividendCheckpointProxy.sol"; import "../ModuleFactory.sol"; @@ -7,7 +7,6 @@ import "../ModuleFactory.sol"; * @title Factory for deploying EtherDividendCheckpoint module */ contract EtherDividendCheckpointFactory is ModuleFactory { - address public logicContract; /** @@ -17,8 +16,14 @@ contract EtherDividendCheckpointFactory is ModuleFactory { * @param _subscriptionCost Subscription cost of the module * @param _logicContract Contract address that contains the logic related to `description` */ - constructor (uint256 _setupCost, uint256 _usageCost, uint256 _subscriptionCost, address _logicContract) public - ModuleFactory(_setupCost, _usageCost, _subscriptionCost) + constructor( + uint256 _setupCost, + uint256 _usageCost, + uint256 _subscriptionCost, + address _logicContract + ) + public + ModuleFactory(_setupCost, _usageCost, _subscriptionCost) { require(_logicContract != address(0), "Invalid logic contract"); version = "2.1.0"; @@ -34,9 +39,14 @@ contract EtherDividendCheckpointFactory is ModuleFactory { * @notice Used to launch the Module with the help of factory * @return address Contract address of the Module */ - function deploy(bytes /* _data */) external returns(address) { + function deploy( + bytes calldata /* _data */ + ) + external + returns(address) + { address polyToken = _takeFee(); - address ethDividendCheckpoint = new EtherDividendCheckpointProxy(msg.sender, polyToken, logicContract); + address ethDividendCheckpoint = address(new EtherDividendCheckpointProxy(msg.sender, polyToken, logicContract)); /*solium-disable-next-line security/no-block-members*/ emit GenerateModuleFromFactory(ethDividendCheckpoint, getName(), address(this), msg.sender, setupCost, now); return ethDividendCheckpoint; @@ -45,7 +55,7 @@ contract EtherDividendCheckpointFactory is ModuleFactory { /** * @notice Type of the Module factory */ - function getTypes() external view returns(uint8[]) { + function getTypes() external view returns(uint8[] memory) { uint8[] memory res = new uint8[](1); res[0] = 4; return res; @@ -54,14 +64,14 @@ contract EtherDividendCheckpointFactory is ModuleFactory { /** * @notice Returns the instructions associated with the module */ - function getInstructions() external view returns(string) { + function getInstructions() external view returns(string memory) { return "Create a dividend which will be paid out to token holders proportionally according to their balances at the point the dividend is created"; } /** * @notice Get the tags related to the module factory */ - function getTags() external view returns(bytes32[]) { + function getTags() external view returns(bytes32[] memory) { bytes32[] memory availableTags = new bytes32[](3); availableTags[0] = "ETH"; availableTags[1] = "Checkpoint"; diff --git a/contracts/modules/Checkpoint/ICheckpoint.sol b/contracts/modules/Checkpoint/ICheckpoint.sol index f2a7417b2..f7b10b77d 100644 --- a/contracts/modules/Checkpoint/ICheckpoint.sol +++ b/contracts/modules/Checkpoint/ICheckpoint.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.24; +pragma solidity ^0.5.0; /** * @title Interface to be implemented by all checkpoint modules diff --git a/contracts/modules/Experimental/Burn/TrackedRedemption.sol b/contracts/modules/Experimental/Burn/TrackedRedemption.sol index 5e34bbaba..9b86ef82f 100644 --- a/contracts/modules/Experimental/Burn/TrackedRedemption.sol +++ b/contracts/modules/Experimental/Burn/TrackedRedemption.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.24; +pragma solidity ^0.5.0; import "../../Burn/IBurn.sol"; import "../../Module.sol"; @@ -11,7 +11,7 @@ import "openzeppelin-solidity/contracts/math/SafeMath.sol"; contract TrackedRedemption is IBurn, Module { using SafeMath for uint256; - mapping (address => uint256) redeemedTokens; + mapping(address => uint256) redeemedTokens; event Redeemed(address _investor, uint256 _value, uint256 _timestamp); @@ -19,15 +19,14 @@ contract TrackedRedemption is IBurn, Module { * @notice Constructor * @param _securityToken Address of the security token */ - constructor (address _securityToken, address _polyToken) public - Module(_securityToken, _polyToken) - { + constructor(address _securityToken, address _polyToken) public Module(_securityToken, _polyToken) { + } /** * @notice This function returns the signature of configure function */ - function getInitFunction() public pure returns (bytes4) { + function getInitFunction() public pure returns(bytes4) { return bytes4(0); } @@ -45,7 +44,7 @@ contract TrackedRedemption is IBurn, Module { /** * @notice Returns the permissions flag that are associated with CountTransferManager */ - function getPermissions() public view returns(bytes32[]) { + function getPermissions() public view returns(bytes32[] memory) { bytes32[] memory allPermissions = new bytes32[](0); return allPermissions; } diff --git a/contracts/modules/Experimental/Burn/TrackedRedemptionFactory.sol b/contracts/modules/Experimental/Burn/TrackedRedemptionFactory.sol index f2b18ee4d..729bfe854 100644 --- a/contracts/modules/Experimental/Burn/TrackedRedemptionFactory.sol +++ b/contracts/modules/Experimental/Burn/TrackedRedemptionFactory.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.24; +pragma solidity ^0.5.0; import "./TrackedRedemption.sol"; import "../../ModuleFactory.sol"; @@ -7,15 +7,19 @@ import "../../ModuleFactory.sol"; * @title Factory for deploying GeneralTransferManager module */ contract TrackedRedemptionFactory is ModuleFactory { - /** * @notice Constructor * @param _setupCost Setup cost of module * @param _usageCost Usage cost of module * @param _subscriptionCost Monthly cost of module */ - constructor (uint256 _setupCost, uint256 _usageCost, uint256 _subscriptionCost) public - ModuleFactory(_setupCost, _usageCost, _subscriptionCost) + constructor( + uint256 _setupCost, + uint256 _usageCost, + uint256 _subscriptionCost + ) + public + ModuleFactory(_setupCost, _usageCost, _subscriptionCost) { version = "1.0.0"; name = "TrackedRedemption"; @@ -29,9 +33,14 @@ contract TrackedRedemptionFactory is ModuleFactory { * @notice Used to launch the Module with the help of factory * @return Address Contract address of the Module */ - function deploy(bytes /* _data */) external returns(address) { + function deploy( + bytes calldata /* _data */ + ) + external + returns(address) + { address polyToken = _takeFee(); - address trackedRedemption = new TrackedRedemption(msg.sender, polyToken); + address trackedRedemption = address(new TrackedRedemption(msg.sender, polyToken)); /*solium-disable-next-line security/no-block-members*/ emit GenerateModuleFromFactory(address(trackedRedemption), getName(), address(this), msg.sender, setupCost, now); return address(trackedRedemption); @@ -40,7 +49,7 @@ contract TrackedRedemptionFactory is ModuleFactory { /** * @notice Type of the Module factory */ - function getTypes() external view returns(uint8[]) { + function getTypes() external view returns(uint8[] memory) { uint8[] memory res = new uint8[](1); res[0] = 5; return res; @@ -49,14 +58,14 @@ contract TrackedRedemptionFactory is ModuleFactory { /** * @notice Returns the instructions associated with the module */ - function getInstructions() external view returns(string) { + function getInstructions() external view returns(string memory) { return "Allows an investor to redeem security tokens which are tracked by this module"; } /** * @notice Get the tags related to the module factory */ - function getTags() external view returns(bytes32[]) { + function getTags() external view returns(bytes32[] memory) { bytes32[] memory availableTags = new bytes32[](2); availableTags[0] = "Redemption"; availableTags[1] = "Tracked"; diff --git a/contracts/modules/Experimental/Mixed/ScheduledCheckpoint.sol b/contracts/modules/Experimental/Mixed/ScheduledCheckpoint.sol index e838f78e6..e2aed863f 100644 --- a/contracts/modules/Experimental/Mixed/ScheduledCheckpoint.sol +++ b/contracts/modules/Experimental/Mixed/ScheduledCheckpoint.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.24; +pragma solidity ^0.5.0; import "./../../Checkpoint/ICheckpoint.sol"; import "../../TransferManager/TransferManager.sol"; @@ -24,7 +24,7 @@ contract ScheduledCheckpoint is ICheckpoint, TransferManager { bytes32[] public names; - mapping (bytes32 => Schedule) public schedules; + mapping(bytes32 => Schedule) public schedules; event AddSchedule(bytes32 _name, uint256 _startTime, uint256 _interval, uint256 _timestamp); event RemoveSchedule(bytes32 _name, uint256 _timestamp); @@ -33,15 +33,14 @@ contract ScheduledCheckpoint is ICheckpoint, TransferManager { * @notice Constructor * @param _securityToken Address of the security token */ - constructor (address _securityToken, address _polyToken) public - Module(_securityToken, _polyToken) - { + constructor(address _securityToken, address _polyToken) public Module(_securityToken, _polyToken) { + } /** * @notice This function returns the signature of configure function */ - function getInitFunction() public pure returns (bytes4) { + function getInitFunction() public pure returns(bytes4) { return bytes4(0); } @@ -79,13 +78,21 @@ contract ScheduledCheckpoint is ICheckpoint, TransferManager { emit RemoveSchedule(_name, now); } - /** * @notice Used to create checkpoints that correctly reflect balances * @param _isTransfer whether or not an actual transfer is occuring * @return always returns Result.NA */ - function verifyTransfer(address /* _from */, address /* _to */, uint256 /* _amount */, bytes /* _data */, bool _isTransfer) external returns(Result) { + function verifyTransfer( + address, /* _from */ + address, /* _to */ + uint256, /* _amount */ + bytes calldata, /* _data */ + bool _isTransfer + ) + external + returns(Result) + { require(_isTransfer == false || msg.sender == securityToken, "Sender is not owner"); if (paused || !_isTransfer) { return Result.NA; @@ -98,16 +105,16 @@ contract ScheduledCheckpoint is ICheckpoint, TransferManager { * @notice gets schedule details * @param _name name of the schedule */ - function getSchedule(bytes32 _name) view external returns(bytes32, uint256, uint256, uint256, uint256[], uint256[], uint256[]) { - return ( - schedules[_name].name, - schedules[_name].startTime, - schedules[_name].nextTime, - schedules[_name].interval, - schedules[_name].checkpointIds, - schedules[_name].timestamps, - schedules[_name].periods - ); + function getSchedule(bytes32 _name) external view returns( + bytes32, + uint256, + uint256, + uint256, + uint256[] memory, + uint256[] memory, + uint256[] memory + ){ + return (schedules[_name].name, schedules[_name].startTime, schedules[_name].nextTime, schedules[_name].interval, schedules[_name].checkpointIds, schedules[_name].timestamps, schedules[_name].periods); } /** @@ -133,7 +140,7 @@ contract ScheduledCheckpoint is ICheckpoint, TransferManager { /** * @notice manually triggers update outside of transfer request for all schedules (can be used to reduce user gas costs) */ - function updateAll() onlyOwner external { + function updateAll() external onlyOwner { _updateAll(); } @@ -147,7 +154,7 @@ contract ScheduledCheckpoint is ICheckpoint, TransferManager { /** * @notice Return the permissions flag that are associated with CountTransferManager */ - function getPermissions() view external returns(bytes32[]) { + function getPermissions() external view returns(bytes32[] memory) { bytes32[] memory allPermissions = new bytes32[](0); return allPermissions; } diff --git a/contracts/modules/Experimental/Mixed/ScheduledCheckpointFactory.sol b/contracts/modules/Experimental/Mixed/ScheduledCheckpointFactory.sol index 6ef2fc34a..e2b9e57c4 100644 --- a/contracts/modules/Experimental/Mixed/ScheduledCheckpointFactory.sol +++ b/contracts/modules/Experimental/Mixed/ScheduledCheckpointFactory.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.24; +pragma solidity ^0.5.0; import "./ScheduledCheckpoint.sol"; import "../../ModuleFactory.sol"; @@ -7,15 +7,19 @@ import "../../ModuleFactory.sol"; * @title Factory for deploying EtherDividendCheckpoint module */ contract ScheduledCheckpointFactory is ModuleFactory { - /** * @notice Constructor * @param _setupCost Setup cost of the module * @param _usageCost Usage cost of the module * @param _subscriptionCost Subscription cost of the module */ - constructor (uint256 _setupCost, uint256 _usageCost, uint256 _subscriptionCost) public - ModuleFactory(_setupCost, _usageCost, _subscriptionCost) + constructor( + uint256 _setupCost, + uint256 _usageCost, + uint256 _subscriptionCost + ) + public + ModuleFactory(_setupCost, _usageCost, _subscriptionCost) { version = "1.0.0"; name = "ScheduledCheckpoint"; @@ -29,9 +33,14 @@ contract ScheduledCheckpointFactory is ModuleFactory { * @notice used to launch the Module with the help of factory * @return address Contract address of the Module */ - function deploy(bytes /* _data */) external returns(address) { + function deploy( + bytes calldata /* _data */ + ) + external + returns(address) + { address polyToken = _takeFee(); - address scheduledCheckpoint = new ScheduledCheckpoint(msg.sender, polyToken); + address scheduledCheckpoint = address(new ScheduledCheckpoint(msg.sender, polyToken)); emit GenerateModuleFromFactory(scheduledCheckpoint, getName(), address(this), msg.sender, setupCost, now); return scheduledCheckpoint; } @@ -39,7 +48,7 @@ contract ScheduledCheckpointFactory is ModuleFactory { /** * @notice Type of the Module factory */ - function getTypes() external view returns(uint8[]) { + function getTypes() external view returns(uint8[] memory) { uint8[] memory res = new uint8[](2); res[0] = 4; res[1] = 2; @@ -56,42 +65,42 @@ contract ScheduledCheckpointFactory is ModuleFactory { /** * @notice Get the description of the Module */ - function getDescription() external view returns(string) { + function getDescription() external view returns(string memory) { return description; } /** * @notice Get the title of the Module */ - function getTitle() external view returns(string) { + function getTitle() external view returns(string memory) { return title; } /** * @notice Get the version of the Module */ - function getVersion() external view returns(string) { + function getVersion() external view returns(string memory) { return version; } /** * @notice Get the setup cost of the module */ - function getSetupCost() external view returns (uint256) { + function getSetupCost() external view returns(uint256) { return setupCost; } /** * @notice Get the Instructions that helped to used the module */ - function getInstructions() external view returns(string) { + function getInstructions() external view returns(string memory) { return "Schedule a series of future checkpoints by specifying a start time and interval of each checkpoint"; } /** * @notice Get the tags related to the module factory */ - function getTags() external view returns(bytes32[]) { + function getTags() external view returns(bytes32[] memory) { bytes32[] memory availableTags = new bytes32[](2); availableTags[0] = "Scheduled"; availableTags[1] = "Checkpoint"; diff --git a/contracts/modules/Experimental/TransferManager/LockupVolumeRestrictionTM.sol b/contracts/modules/Experimental/TransferManager/LockupVolumeRestrictionTM.sol index a4f6b95f6..5d0ac2307 100644 --- a/contracts/modules/Experimental/TransferManager/LockupVolumeRestrictionTM.sol +++ b/contracts/modules/Experimental/TransferManager/LockupVolumeRestrictionTM.sol @@ -1,11 +1,9 @@ -pragma solidity ^0.4.24; +pragma solidity ^0.5.0; import "./../../TransferManager/TransferManager.sol"; import "openzeppelin-solidity/contracts/math/SafeMath.sol"; - contract LockupVolumeRestrictionTM is TransferManager { - using SafeMath for uint256; // permission definition @@ -21,7 +19,7 @@ contract LockupVolumeRestrictionTM is TransferManager { } // maps user addresses to an array of lockups for that user - mapping (address => LockUp[]) internal lockUps; + mapping(address => LockUp[]) internal lockUps; event AddNewLockUp( address indexed userAddress, @@ -54,19 +52,25 @@ contract LockupVolumeRestrictionTM is TransferManager { * @notice Constructor * @param _securityToken Address of the security token */ - constructor (address _securityToken, address _polyToken) - public - Module(_securityToken, _polyToken) - { - } + constructor(address _securityToken, address _polyToken) public Module(_securityToken, _polyToken) { + } /** @notice Used to verify the transfer transaction and prevent locked up tokens from being transferred * @param _from Address of the sender * @param _amount The amount of tokens to transfer * @param _isTransfer Whether or not this is an actual transfer or just a test to see if the tokens would be transferrable */ - function verifyTransfer(address _from, address /* _to*/, uint256 _amount, bytes /* _data */, bool _isTransfer) external returns(Result) { + function verifyTransfer( + address _from, + address, /* _to*/ + uint256 _amount, + bytes calldata, /* _data */ + bool _isTransfer + ) + external + returns(Result) + { // only attempt to verify the transfer if the token is unpaused, this isn't a mint txn, and there exists a lockup for this user if (!paused && _from != address(0) && lockUps[_from].length != 0) { // check if this transfer is valid @@ -89,7 +93,10 @@ contract LockupVolumeRestrictionTM is TransferManager { uint _releaseFrequencySeconds, uint _startTime, uint _totalAmount - ) public withPerm(ADMIN) { + ) + public + withPerm(ADMIN) + { uint256 startTime = _startTime; _checkLockUpParams(_lockUpPeriodSeconds, _releaseFrequencySeconds, _totalAmount); @@ -120,17 +127,17 @@ contract LockupVolumeRestrictionTM is TransferManager { * @param _totalAmounts Array of total amount of locked up tokens */ function addLockUpMulti( - address[] _userAddresses, - uint[] _lockUpPeriodsSeconds, - uint[] _releaseFrequenciesSeconds, - uint[] _startTimes, - uint[] _totalAmounts - ) external withPerm(ADMIN) { + address[] calldata _userAddresses, + uint[] calldata _lockUpPeriodsSeconds, + uint[] calldata _releaseFrequenciesSeconds, + uint[] calldata _startTimes, + uint[] calldata _totalAmounts + ) + external + withPerm(ADMIN) + { require( - _userAddresses.length == _lockUpPeriodsSeconds.length && /*solium-disable-line operator-whitespace*/ - _userAddresses.length == _releaseFrequenciesSeconds.length && /*solium-disable-line operator-whitespace*/ - _userAddresses.length == _startTimes.length && - _userAddresses.length == _totalAmounts.length, + _userAddresses.length == _lockUpPeriodsSeconds.length && _userAddresses.length == _releaseFrequenciesSeconds.length && _userAddresses.length == _startTimes.length && _userAddresses.length == _totalAmounts.length, /*solium-disable-line operator-whitespace*/ /*solium-disable-line operator-whitespace*/ "Input array length mismatch" ); @@ -184,7 +191,10 @@ contract LockupVolumeRestrictionTM is TransferManager { uint _releaseFrequencySeconds, uint _startTime, uint _totalAmount - ) public withPerm(ADMIN) { + ) + public + withPerm(ADMIN) + { require(_lockUpIndex < lockUps[_userAddress].length, "Array out of bounds exception"); uint256 startTime = _startTime; @@ -205,21 +215,14 @@ contract LockupVolumeRestrictionTM is TransferManager { lockUps[_userAddress][_lockUpIndex].alreadyWithdrawn ); - emit ModifyLockUp( - _userAddress, - _lockUpPeriodSeconds, - _releaseFrequencySeconds, - startTime, - _totalAmount, - _lockUpIndex - ); + emit ModifyLockUp(_userAddress, _lockUpPeriodSeconds, _releaseFrequencySeconds, startTime, _totalAmount, _lockUpIndex); } /** * @notice Get the length of the lockups array for a specific user address * @param _userAddress Address of the user whose tokens should be locked up */ - function getLockUpsLength(address _userAddress) public view returns (uint) { + function getLockUpsLength(address _userAddress) public view returns(uint) { return lockUps[_userAddress].length; } @@ -228,43 +231,30 @@ contract LockupVolumeRestrictionTM is TransferManager { * @param _userAddress Address of the user whose tokens should be locked up * @param _lockUpIndex The index of the LockUp to edit for the given userAddress */ - function getLockUp( - address _userAddress, - uint _lockUpIndex) - public view returns ( + function getLockUp(address _userAddress, uint _lockUpIndex) public view returns( uint lockUpPeriodSeconds, uint releaseFrequencySeconds, uint startTime, uint totalAmount, uint alreadyWithdrawn - ) { + ) { require(_lockUpIndex < lockUps[_userAddress].length, "Array out of bounds exception"); LockUp storage userLockUp = lockUps[_userAddress][_lockUpIndex]; - return ( - userLockUp.lockUpPeriodSeconds, - userLockUp.releaseFrequencySeconds, - userLockUp.startTime, - userLockUp.totalAmount, - userLockUp.alreadyWithdrawn - ); + return (userLockUp.lockUpPeriodSeconds, userLockUp.releaseFrequencySeconds, userLockUp.startTime, userLockUp.totalAmount, userLockUp.alreadyWithdrawn); } /** * @notice Takes a userAddress as input, and returns a uint that represents the number of tokens allowed to be withdrawn right now * @param userAddress Address of the user whose lock ups should be checked */ - function _checkIfValidTransfer(address userAddress, uint amount, bool isTransfer) internal returns (Result) { + function _checkIfValidTransfer(address userAddress, uint amount, bool isTransfer) internal returns(Result) { // get lock up array for this user LockUp[] storage userLockUps = lockUps[userAddress]; // maps the index of userLockUps to the amount allowed in this transfer uint[] memory allowedAmountPerLockup = new uint[](userLockUps.length); - uint[3] memory tokenSums = [ - uint256(0), // allowed amount right now - uint256(0), // total locked up, ever - uint256(0) // already withdrawn, ever - ]; + uint[3] memory tokenSums = [uint256(0), uint256(0), uint256(0)]; // allowed amount right now // total locked up, ever // already withdrawn, ever // loop over the user's lock ups for (uint i = 0; i < userLockUps.length; i++) { @@ -315,8 +305,8 @@ contract LockupVolumeRestrictionTM is TransferManager { require(msg.sender == securityToken, "Sender is not securityToken"); // subtract amounts so they are now known to be withdrawen - for (i = 0; i < userLockUps.length; i++) { - aLockUp = userLockUps[i]; + for (uint256 i = 0; i < userLockUps.length; i++) { + LockUp storage aLockUp = userLockUps[i]; // tokenSums[0] is allowed sum if (allowedAmountPerLockup[i] >= tokenSums[0]) { @@ -342,7 +332,11 @@ contract LockupVolumeRestrictionTM is TransferManager { uint amount, uint totalSum, uint alreadyWithdrawnSum - ) internal view returns (Result) { + ) + internal + view + returns(Result) + { // the amount the user wants to withdraw is greater than their allowed amounts according to the lockups. however, if the user has like, 10 tokens, but only 4 are locked up, we should let the transfer go through for those 6 that aren't locked up uint currentUserBalance = ISecurityToken(securityToken).balanceOf(userAddress); uint stillLockedAmount = totalSum.sub(alreadyWithdrawnSum); @@ -353,7 +347,6 @@ contract LockupVolumeRestrictionTM is TransferManager { return Result.INVALID; } - /** * @notice Parameter checking function for creating or editing a lockup. This function will cause an exception if any of the parameters are bad. * @param lockUpPeriodSeconds Total period of lockup (seconds) @@ -395,14 +388,14 @@ contract LockupVolumeRestrictionTM is TransferManager { /** * @notice This function returns the signature of configure function */ - function getInitFunction() public pure returns (bytes4) { + function getInitFunction() public pure returns(bytes4) { return bytes4(0); } /** * @notice Returns the permissions flag that are associated with Percentage transfer Manager */ - function getPermissions() public view returns(bytes32[]) { + function getPermissions() public view returns(bytes32[] memory) { bytes32[] memory allPermissions = new bytes32[](1); allPermissions[0] = ADMIN; return allPermissions; diff --git a/contracts/modules/Experimental/TransferManager/LockupVolumeRestrictionTMFactory.sol b/contracts/modules/Experimental/TransferManager/LockupVolumeRestrictionTMFactory.sol index d751f0b1c..a677cccdf 100644 --- a/contracts/modules/Experimental/TransferManager/LockupVolumeRestrictionTMFactory.sol +++ b/contracts/modules/Experimental/TransferManager/LockupVolumeRestrictionTMFactory.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.24; +pragma solidity ^0.5.0; import "./../../ModuleFactory.sol"; import "./LockupVolumeRestrictionTM.sol"; @@ -7,15 +7,19 @@ import "./LockupVolumeRestrictionTM.sol"; * @title Factory for deploying ManualApprovalTransferManager module */ contract LockupVolumeRestrictionTMFactory is ModuleFactory { - /** * @notice Constructor * @param _setupCost Setup cost of the module * @param _usageCost Usage cost of the module * @param _subscriptionCost Subscription cost of the module */ - constructor (uint256 _setupCost, uint256 _usageCost, uint256 _subscriptionCost) public - ModuleFactory(_setupCost, _usageCost, _subscriptionCost) + constructor( + uint256 _setupCost, + uint256 _usageCost, + uint256 _subscriptionCost + ) + public + ModuleFactory(_setupCost, _usageCost, _subscriptionCost) { version = "1.0.0"; name = "LockupVolumeRestrictionTM"; @@ -25,11 +29,16 @@ contract LockupVolumeRestrictionTMFactory is ModuleFactory { compatibleSTVersionRange["upperBound"] = VersionUtils.pack(uint8(0), uint8(0), uint8(0)); } - /** + /** * @notice Used to launch the Module with the help of factory * @return address Contract address of the Module */ - function deploy(bytes /* _data */) external returns(address) { + function deploy( + bytes calldata /* _data */ + ) + external + returns(address) + { address polyToken = _takeFee(); LockupVolumeRestrictionTM lockupVolumeRestrictionTransferManager = new LockupVolumeRestrictionTM(msg.sender, polyToken); /*solium-disable-next-line security/no-block-members*/ @@ -41,7 +50,7 @@ contract LockupVolumeRestrictionTMFactory is ModuleFactory { * @notice Type of the Module factory * @return uint8 */ - function getTypes() external view returns(uint8[]) { + function getTypes() external view returns(uint8[] memory) { uint8[] memory res = new uint8[](1); res[0] = 2; return res; @@ -50,19 +59,18 @@ contract LockupVolumeRestrictionTMFactory is ModuleFactory { /** * @notice Returns the instructions associated with the module */ - function getInstructions() external view returns(string) { + function getInstructions() external view returns(string memory) { return "Allows an issuer to set lockup periods for user addresses, with funds distributed over time. Init function takes no parameters."; } /** * @notice Get the tags related to the module factory */ - function getTags() external view returns(bytes32[]) { + function getTags() external view returns(bytes32[] memory) { bytes32[] memory availableTags = new bytes32[](2); availableTags[0] = "Volume"; availableTags[1] = "Transfer Restriction"; return availableTags; } - } diff --git a/contracts/modules/Experimental/TransferManager/SingleTradeVolumeRestrictionTM.sol b/contracts/modules/Experimental/TransferManager/SingleTradeVolumeRestrictionTM.sol index 8dd1d3a66..431408336 100644 --- a/contracts/modules/Experimental/TransferManager/SingleTradeVolumeRestrictionTM.sol +++ b/contracts/modules/Experimental/TransferManager/SingleTradeVolumeRestrictionTM.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.24; +pragma solidity ^0.5.0; import "./../../TransferManager/TransferManager.sol"; import "openzeppelin-solidity/contracts/math/SafeMath.sol"; @@ -10,7 +10,7 @@ import "openzeppelin-solidity/contracts/math/SafeMath.sol"; contract SingleTradeVolumeRestrictionTM is TransferManager { using SafeMath for uint256; - bytes32 constant public ADMIN = "ADMIN"; + bytes32 public constant ADMIN = "ADMIN"; bool public isTransferLimitInPercentage; @@ -46,9 +46,7 @@ contract SingleTradeVolumeRestrictionTM is TransferManager { * @notice Constructor * @param _securityToken Address of the security token */ - constructor(address _securityToken, address _polyToken) public - Module(_securityToken, _polyToken) - { + constructor(address _securityToken, address _polyToken) public Module(_securityToken, _polyToken) { } @@ -60,11 +58,11 @@ contract SingleTradeVolumeRestrictionTM is TransferManager { address _from, address /* _to */, uint256 _amount, - bytes /* _data */, + bytes calldata /* _data */, bool /* _isTransfer */ - ) - external - returns(Result) + ) + external + returns(Result) { bool validTransfer; @@ -75,12 +73,14 @@ contract SingleTradeVolumeRestrictionTM is TransferManager { } if (isTransferLimitInPercentage) { - if(specialTransferLimitsInPercentages[_from] > 0) { - validTransfer = (_amount.mul(10**18).div(ISecurityToken(securityToken).totalSupply())) <= specialTransferLimitsInPercentages[_from]; + if (specialTransferLimitsInPercentages[_from] > 0) { + validTransfer = (_amount.mul(10 ** 18).div( + ISecurityToken(securityToken).totalSupply() + )) <= specialTransferLimitsInPercentages[_from]; } else { - validTransfer = (_amount.mul(10**18).div(ISecurityToken(securityToken).totalSupply())) <= globalTransferLimitInPercentage; + validTransfer = (_amount.mul(10 ** 18).div(ISecurityToken(securityToken).totalSupply())) <= globalTransferLimitInPercentage; } - } else { + } else { if (specialTransferLimitsInTokens[_from] > 0) { validTransfer = _amount <= specialTransferLimitsInTokens[_from]; } else { @@ -100,7 +100,10 @@ contract SingleTradeVolumeRestrictionTM is TransferManager { bool _isTransferLimitInPercentage, uint256 _globalTransferLimitInPercentageOrToken, bool _allowPrimaryIssuance - ) public onlyFactory { + ) + public + onlyFactory + { isTransferLimitInPercentage = _isTransferLimitInPercentage; if (isTransferLimitInPercentage) { changeGlobalLimitInPercentage(_globalTransferLimitInPercentageOrToken); @@ -165,7 +168,10 @@ contract SingleTradeVolumeRestrictionTM is TransferManager { */ function changeGlobalLimitInPercentage(uint256 _newGlobalTransferLimitInPercentage) public withPerm(ADMIN) { require(isTransferLimitInPercentage, "Transfer limit not set in Percentage"); - require(_newGlobalTransferLimitInPercentage > 0 && _newGlobalTransferLimitInPercentage <= 100 * 10 ** 16, "Limit not within [0,100]"); + require( + _newGlobalTransferLimitInPercentage > 0 && _newGlobalTransferLimitInPercentage <= 100 * 10 ** 16, + "Limit not within [0,100]" + ); emit GlobalTransferLimitInPercentageSet(_newGlobalTransferLimitInPercentage, globalTransferLimitInPercentage); globalTransferLimitInPercentage = _newGlobalTransferLimitInPercentage; @@ -195,7 +201,7 @@ contract SingleTradeVolumeRestrictionTM is TransferManager { * @notice Adds an array of exempt wallet * @param _wallets array of exempt wallet addresses */ - function addExemptWalletMulti(address[] _wallets) public withPerm(ADMIN) { + function addExemptWalletMulti(address[] memory _wallets) public withPerm(ADMIN) { require(_wallets.length > 0, "Wallets cannot be empty"); for (uint256 i = 0; i < _wallets.length; i++) { addExemptWallet(_wallets[i]); @@ -206,7 +212,7 @@ contract SingleTradeVolumeRestrictionTM is TransferManager { * @notice Removes an array of exempt wallet * @param _wallets array of exempt wallet addresses */ - function removeExemptWalletMulti(address[] _wallets) public withPerm(ADMIN) { + function removeExemptWalletMulti(address[] memory _wallets) public withPerm(ADMIN) { require(_wallets.length > 0, "Wallets cannot be empty"); for (uint256 i = 0; i < _wallets.length; i++) { removeExemptWallet(_wallets[i]); @@ -240,7 +246,6 @@ contract SingleTradeVolumeRestrictionTM is TransferManager { emit TransferLimitInPercentageSet(_wallet, _transferLimitInPercentage); } - /** * @notice Removes transfer limit set in percentage for a wallet * @param _wallet wallet address @@ -267,10 +272,10 @@ contract SingleTradeVolumeRestrictionTM is TransferManager { * @param _transferLimits array of transfer limits for each wallet in tokens * @dev The manager has to be configured to use tokens as limit */ - function setTransferLimitInTokensMulti(address[] _wallets, uint[] _transferLimits) public withPerm(ADMIN) { + function setTransferLimitInTokensMulti(address[] memory _wallets, uint[] memory _transferLimits) public withPerm(ADMIN) { require(_wallets.length > 0, "Wallets cannot be empty"); require(_wallets.length == _transferLimits.length, "Wallets don't match to transfer limits"); - for (uint256 i = 0; i < _wallets.length; i++ ) { + for (uint256 i = 0; i < _wallets.length; i++) { setTransferLimitInTokens(_wallets[i], _transferLimits[i]); } } @@ -282,7 +287,10 @@ contract SingleTradeVolumeRestrictionTM is TransferManager { * The percentage has to be multipled by 10 ** 16. Eg: 20% would be 20 * 10 ** 16 * @dev The manager has to be configured to use percentage as limit */ - function setTransferLimitInPercentageMulti(address[] _wallets, uint[] _transferLimitsInPercentage) public withPerm(ADMIN) { + function setTransferLimitInPercentageMulti( + address[] memory _wallets, + uint[] memory _transferLimitsInPercentage + ) public withPerm(ADMIN) { require(_wallets.length > 0, "Wallets cannot be empty"); require(_wallets.length == _transferLimitsInPercentage.length, "Wallets don't match to percentage limits"); for (uint256 i = 0; i < _wallets.length; i++) { @@ -294,7 +302,7 @@ contract SingleTradeVolumeRestrictionTM is TransferManager { * @notice Removes transfer limits set in tokens for an array of wallet * @param _wallets array of wallet addresses */ - function removeTransferLimitInTokensMulti(address[] _wallets) public withPerm(ADMIN) { + function removeTransferLimitInTokensMulti(address[] memory _wallets) public withPerm(ADMIN) { require(_wallets.length > 0, "Wallets cannot be empty"); for (uint i = 0; i < _wallets.length; i++) { removeTransferLimitInTokens(_wallets[i]); @@ -305,7 +313,7 @@ contract SingleTradeVolumeRestrictionTM is TransferManager { * @notice Removes transfer limits set in percentage for an array of wallet * @param _wallets array of wallet addresses */ - function removeTransferLimitInPercentageMulti(address[] _wallets) public withPerm(ADMIN) { + function removeTransferLimitInPercentageMulti(address[] memory _wallets) public withPerm(ADMIN) { require(_wallets.length > 0, "Wallets cannot be empty"); for (uint i = 0; i < _wallets.length; i++) { removeTransferLimitInPercentage(_wallets[i]); @@ -315,14 +323,14 @@ contract SingleTradeVolumeRestrictionTM is TransferManager { /** * @notice This function returns the signature of configure function */ - function getInitFunction() public pure returns (bytes4) { + function getInitFunction() public pure returns(bytes4) { return bytes4(keccak256("configure(bool,uint256,bool)")); } /** * @notice Returns the permissions flag that are associated with SingleTradeVolumeRestrictionManager */ - function getPermissions() public view returns(bytes32[]) { + function getPermissions() public view returns(bytes32[] memory) { bytes32[] memory allPermissions = new bytes32[](1); allPermissions[0] = ADMIN; return allPermissions; diff --git a/contracts/modules/Experimental/TransferManager/SingleTradeVolumeRestrictionTMFactory.sol b/contracts/modules/Experimental/TransferManager/SingleTradeVolumeRestrictionTMFactory.sol index 4e2b1ff1b..d00a32bf0 100644 --- a/contracts/modules/Experimental/TransferManager/SingleTradeVolumeRestrictionTMFactory.sol +++ b/contracts/modules/Experimental/TransferManager/SingleTradeVolumeRestrictionTMFactory.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.24; +pragma solidity ^0.5.0; import "./../../ModuleFactory.sol"; import "./SingleTradeVolumeRestrictionTM.sol"; @@ -8,16 +8,19 @@ import "../../../libraries/Util.sol"; * @title Factory for deploying SingleTradeVolumeRestrictionManager */ contract SingleTradeVolumeRestrictionTMFactory is ModuleFactory { - - /** * @notice Constructor * @param _setupCost Setup cost of the module * @param _usageCost Usage cost of the module * @param _subscriptionCost Subscription cost of the module */ - constructor(uint256 _setupCost, uint256 _usageCost, uint256 _subscriptionCost) public - ModuleFactory(_setupCost, _usageCost, _subscriptionCost) + constructor( + uint256 _setupCost, + uint256 _usageCost, + uint256 _subscriptionCost + ) + public + ModuleFactory(_setupCost, _usageCost, _subscriptionCost) { version = "1.0.0"; name = "SingleTradeVolumeRestrictionTM"; @@ -31,12 +34,14 @@ contract SingleTradeVolumeRestrictionTMFactory is ModuleFactory { * @notice Used to launch the Module with the help of factory * @return address Contract address of the Module */ - function deploy(bytes _data) external returns(address) { + function deploy(bytes calldata _data) external returns(address) { address polyToken = _takeFee(); SingleTradeVolumeRestrictionTM singleTradeVolumeRestrictionManager = new SingleTradeVolumeRestrictionTM(msg.sender, polyToken); require(Util.getSig(_data) == singleTradeVolumeRestrictionManager.getInitFunction(), "Provided data is not valid"); + bool success; /*solium-disable-next-line security/no-low-level-calls*/ - require(address(singleTradeVolumeRestrictionManager).call(_data), "Unsuccessful call"); + (success, ) = address(singleTradeVolumeRestrictionManager).call(_data); + require(success, "Unsuccessful call"); /*solium-disable-next-line security/no-block-members*/ emit GenerateModuleFromFactory(address(singleTradeVolumeRestrictionManager), getName(), address(this), msg.sender, setupCost, now); return address(singleTradeVolumeRestrictionManager); @@ -46,7 +51,7 @@ contract SingleTradeVolumeRestrictionTMFactory is ModuleFactory { * @notice Get the types of the Module factory * @return uint8[] */ - function getTypes() external view returns(uint8[]) { + function getTypes() external view returns(uint8[] memory) { uint8[] memory res = new uint8[](1); res[0] = 2; return res; @@ -56,7 +61,7 @@ contract SingleTradeVolumeRestrictionTMFactory is ModuleFactory { * @notice Get the Instructions that help to use the module * @return string */ - function getInstructions() external view returns(string) { + function getInstructions() external view returns(string memory) { /*solium-disable-next-line max-len*/ return "Allows an issuer to impose volume restriction on a single trade. Init function takes two parameters. First parameter is a bool indicating if restriction is in percentage. The second parameter is the value in percentage or amount of tokens"; } @@ -65,7 +70,7 @@ contract SingleTradeVolumeRestrictionTMFactory is ModuleFactory { * @notice Get the tags related to the module factory * @return bytes32[] */ - function getTags() external view returns(bytes32[]) { + function getTags() external view returns(bytes32[] memory) { bytes32[] memory availableTags = new bytes32[](3); availableTags[0] = "Single Trade"; availableTags[1] = "Transfer"; diff --git a/contracts/modules/Module.sol b/contracts/modules/Module.sol index aae15670a..e2db5f6d9 100644 --- a/contracts/modules/Module.sol +++ b/contracts/modules/Module.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.24; +pragma solidity ^0.5.0; import "../RegistryUpdater.sol"; import "../interfaces/IModule.sol"; @@ -12,40 +12,41 @@ import "openzeppelin-solidity/contracts/ownership/Ownable.sol"; * @notice Contract is abstract */ contract Module is IModule, ModuleStorage { - /** * @notice Constructor * @param _securityToken Address of the security token */ - constructor (address _securityToken, address _polyToken) public - ModuleStorage(_securityToken, _polyToken) - { + constructor(address _securityToken, address _polyToken) public ModuleStorage(_securityToken, _polyToken) { + } //Allows owner, factory or permissioned delegate modifier withPerm(bytes32 _perm) { bool isOwner = msg.sender == Ownable(securityToken).owner(); bool isFactory = msg.sender == factory; - require(isOwner||isFactory||ISecurityToken(securityToken).checkPermission(msg.sender, address(this), _perm), "Permission check failed"); + require( + isOwner || isFactory || ISecurityToken(securityToken).checkPermission(msg.sender, address(this), _perm), + "Permission check failed" + ); _; } - modifier onlyOwner { + modifier onlyOwner() { require(msg.sender == Ownable(securityToken).owner(), "Sender is not owner"); _; } - modifier onlyFactory { + modifier onlyFactory() { require(msg.sender == factory, "Sender is not factory"); _; } - modifier onlyFactoryOwner { + modifier onlyFactoryOwner() { require(msg.sender == Ownable(factory).owner(), "Sender is not factory owner"); _; } - modifier onlyFactoryOrOwner { + modifier onlyFactoryOrOwner() { require((msg.sender == Ownable(securityToken).owner()) || (msg.sender == factory), "Sender is not factory or owner"); _; } diff --git a/contracts/modules/ModuleFactory.sol b/contracts/modules/ModuleFactory.sol index adc4432b6..9cf1ffcc4 100644 --- a/contracts/modules/ModuleFactory.sol +++ b/contracts/modules/ModuleFactory.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.24; +pragma solidity ^0.5.0; import "../RegistryUpdater.sol"; import "openzeppelin-solidity/contracts/token/ERC20/IERC20.sol"; @@ -11,7 +11,6 @@ import "../libraries/VersionUtils.sol"; * @notice Contract is abstract */ contract ModuleFactory is IModuleFactory, Ownable { - uint256 public usageCost; uint256 public monthlySubscriptionCost; @@ -43,7 +42,7 @@ contract ModuleFactory is IModuleFactory, Ownable { /** * @notice Constructor */ - constructor (uint256 _setupCost, uint256 _usageCost, uint256 _subscriptionCost) public { + constructor(uint256 _setupCost, uint256 _usageCost, uint256 _subscriptionCost) public { setupCost = _setupCost; usageCost = _usageCost; monthlySubscriptionCost = _subscriptionCost; @@ -81,7 +80,7 @@ contract ModuleFactory is IModuleFactory, Ownable { * @notice Updates the title of the ModuleFactory * @param _newTitle New Title that will replace the old one. */ - function changeTitle(string _newTitle) public onlyOwner { + function changeTitle(string memory _newTitle) public onlyOwner { require(bytes(_newTitle).length > 0, "Invalid title"); title = _newTitle; } @@ -90,7 +89,7 @@ contract ModuleFactory is IModuleFactory, Ownable { * @notice Updates the description of the ModuleFactory * @param _newDesc New description that will replace the old one. */ - function changeDescription(string _newDesc) public onlyOwner { + function changeDescription(string memory _newDesc) public onlyOwner { require(bytes(_newDesc).length > 0, "Invalid description"); description = _newDesc; } @@ -100,7 +99,7 @@ contract ModuleFactory is IModuleFactory, Ownable { * @param _newName New name that will replace the old one. */ function changeName(bytes32 _newName) public onlyOwner { - require(_newName != bytes32(0),"Invalid name"); + require(_newName != bytes32(0), "Invalid name"); name = _newName; } @@ -108,7 +107,7 @@ contract ModuleFactory is IModuleFactory, Ownable { * @notice Updates the version of the ModuleFactory * @param _newVersion New name that will replace the old one. */ - function changeVersion(string _newVersion) public onlyOwner { + function changeVersion(string memory _newVersion) public onlyOwner { require(bytes(_newVersion).length > 0, "Invalid version"); version = _newVersion; } @@ -118,10 +117,11 @@ contract ModuleFactory is IModuleFactory, Ownable { * @param _boundType Type of bound * @param _newVersion new version array */ - function changeSTVersionBounds(string _boundType, uint8[] _newVersion) external onlyOwner { + function changeSTVersionBounds(string calldata _boundType, uint8[] calldata _newVersion) external onlyOwner { require( - keccak256(abi.encodePacked(_boundType)) == keccak256(abi.encodePacked("lowerBound")) || - keccak256(abi.encodePacked(_boundType)) == keccak256(abi.encodePacked("upperBound")), + keccak256(abi.encodePacked(_boundType)) == keccak256(abi.encodePacked("lowerBound")) || keccak256( + abi.encodePacked(_boundType) + ) == keccak256(abi.encodePacked("upperBound")), "Must be a valid bound type" ); require(_newVersion.length == 3); @@ -137,7 +137,7 @@ contract ModuleFactory is IModuleFactory, Ownable { * @notice Used to get the lower bound * @return lower bound */ - function getLowerSTVersionBounds() external view returns(uint8[]) { + function getLowerSTVersionBounds() external view returns(uint8[] memory) { return VersionUtils.unpack(compatibleSTVersionRange["lowerBound"]); } @@ -145,30 +145,29 @@ contract ModuleFactory is IModuleFactory, Ownable { * @notice Used to get the upper bound * @return upper bound */ - function getUpperSTVersionBounds() external view returns(uint8[]) { + function getUpperSTVersionBounds() external view returns(uint8[] memory) { return VersionUtils.unpack(compatibleSTVersionRange["upperBound"]); } /** * @notice Get the setup cost of the module */ - function getSetupCost() external view returns (uint256) { + function getSetupCost() external view returns(uint256) { return setupCost; } - /** + /** * @notice Get the name of the Module */ - function getName() public view returns (bytes32) { + function getName() public view returns(bytes32) { return name; } - function _takeFee() internal returns (address) { + function _takeFee() internal returns(address) { address polyToken = RegistryUpdater(msg.sender).polyToken(); require(polyToken != address(0), "Invalid POLY token"); if (setupCost > 0) { - require(IERC20(polyToken).transferFrom(msg.sender, owner(), setupCost), - "Insufficient allowance for module fee"); + require(IERC20(polyToken).transferFrom(msg.sender, owner(), setupCost), "Insufficient allowance for module fee"); } return polyToken; } diff --git a/contracts/modules/ModuleStorage.sol b/contracts/modules/ModuleStorage.sol index fd9307934..720c653fb 100644 --- a/contracts/modules/ModuleStorage.sol +++ b/contracts/modules/ModuleStorage.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.24; +pragma solidity ^0.5.0; import "openzeppelin-solidity/contracts/token/ERC20/IERC20.sol"; @@ -7,7 +7,6 @@ import "openzeppelin-solidity/contracts/token/ERC20/IERC20.sol"; * @notice Contract is abstract */ contract ModuleStorage { - address public factory; address public securityToken; @@ -21,7 +20,7 @@ contract ModuleStorage { * @param _securityToken Address of the security token * @param _polyAddress Address of the polytoken */ - constructor (address _securityToken, address _polyAddress) public { + constructor(address _securityToken, address _polyAddress) public { securityToken = _securityToken; factory = msg.sender; polyToken = IERC20(_polyAddress); diff --git a/contracts/modules/PermissionManager/GeneralPermissionManager.sol b/contracts/modules/PermissionManager/GeneralPermissionManager.sol index 6c41a25ce..4587785f0 100644 --- a/contracts/modules/PermissionManager/GeneralPermissionManager.sol +++ b/contracts/modules/PermissionManager/GeneralPermissionManager.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.24; +pragma solidity ^0.5.0; import "./IPermissionManager.sol"; import "../Module.sol"; @@ -14,18 +14,16 @@ contract GeneralPermissionManager is GeneralPermissionManagerStorage, IPermissio /// Used to notify when delegate is added in permission manager contract event AddDelegate(address indexed _delegate, bytes32 _details, uint256 _timestamp); - /// @notice constructor - constructor (address _securityToken, address _polyToken) public - Module(_securityToken, _polyToken) - { + constructor(address _securityToken, address _polyToken) public Module(_securityToken, _polyToken) { + } /** * @notice Init function i.e generalise function to maintain the structure of the module contract * @return bytes4 */ - function getInitFunction() public pure returns (bytes4) { + function getInitFunction() public pure returns(bytes4) { return bytes4(0); } @@ -39,8 +37,7 @@ contract GeneralPermissionManager is GeneralPermissionManagerStorage, IPermissio function checkPermission(address _delegate, address _module, bytes32 _perm) external view returns(bool) { if (delegateDetails[_delegate] != bytes32(0)) { return perms[_module][_delegate][_perm]; - } else - return false; + } else return false; } /** @@ -83,8 +80,7 @@ contract GeneralPermissionManager is GeneralPermissionManagerStorage, IPermissio if (delegateDetails[_potentialDelegate] != bytes32(0)) { return true; - } else - return false; + } else return false; } /** @@ -95,15 +91,7 @@ contract GeneralPermissionManager is GeneralPermissionManagerStorage, IPermissio * @param _valid Bool flag use to switch on/off the permission * @return bool */ - function changePermission( - address _delegate, - address _module, - bytes32 _perm, - bool _valid - ) - public - withPerm(CHANGE_PERMISSION) - { + function changePermission(address _delegate, address _module, bytes32 _perm, bool _valid) public withPerm(CHANGE_PERMISSION) { require(_delegate != address(0), "invalid address"); _changePermission(_delegate, _module, _perm, _valid); } @@ -118,18 +106,18 @@ contract GeneralPermissionManager is GeneralPermissionManagerStorage, IPermissio */ function changePermissionMulti( address _delegate, - address[] _modules, - bytes32[] _perms, - bool[] _valids - ) - external - withPerm(CHANGE_PERMISSION) + address[] calldata _modules, + bytes32[] calldata _perms, + bool[] calldata _valids + ) + external + withPerm(CHANGE_PERMISSION) { require(_delegate != address(0), "invalid address"); require(_modules.length > 0, "0 length is not allowed"); require(_modules.length == _perms.length, "Array length mismatch"); require(_valids.length == _perms.length, "Array length mismatch"); - for(uint256 i = 0; i < _perms.length; i++) { + for (uint256 i = 0; i < _perms.length; i++) { _changePermission(_delegate, _modules[i], _perms[i], _valids[i]); } } @@ -140,7 +128,7 @@ contract GeneralPermissionManager is GeneralPermissionManagerStorage, IPermissio * @param _perm Permission flag * @return address[] */ - function getAllDelegatesWithPerm(address _module, bytes32 _perm) external view returns(address[]) { + function getAllDelegatesWithPerm(address _module, bytes32 _perm) external view returns(address[] memory) { uint256 counter = 0; uint256 i = 0; for (i = 0; i < allDelegates.length; i++) { @@ -151,7 +139,7 @@ contract GeneralPermissionManager is GeneralPermissionManagerStorage, IPermissio address[] memory allDelegatesWithPerm = new address[](counter); counter = 0; for (i = 0; i < allDelegates.length; i++) { - if (perms[_module][allDelegates[i]][_perm]){ + if (perms[_module][allDelegates[i]][_perm]) { allDelegatesWithPerm[counter] = allDelegates[i]; counter++; } @@ -167,18 +155,21 @@ contract GeneralPermissionManager is GeneralPermissionManagerStorage, IPermissio * @return address[] the address array of Modules this delegate has permission * @return bytes32[] the permission array of the corresponding Modules */ - function getAllModulesAndPermsFromTypes(address _delegate, uint8[] _types) external view returns(address[], bytes32[]) { + function getAllModulesAndPermsFromTypes(address _delegate, uint8[] calldata _types) external view returns( + address[] memory, + bytes32[] memory + ) { uint256 counter = 0; // loop through _types and get their modules from securityToken->getModulesByType for (uint256 i = 0; i < _types.length; i++) { address[] memory _currentTypeModules = ISecurityToken(securityToken).getModulesByType(_types[i]); // loop through each modules to get their perms from IModule->getPermissions - for (uint256 j = 0; j < _currentTypeModules.length; j++){ + for (uint256 j = 0; j < _currentTypeModules.length; j++) { bytes32[] memory _allModulePerms = IModule(_currentTypeModules[j]).getPermissions(); // loop through each perm, if it is true, push results into arrays for (uint256 k = 0; k < _allModulePerms.length; k++) { if (perms[_currentTypeModules[j]][_delegate][_allModulePerms[k]]) { - counter ++; + counter++; } } } @@ -188,11 +179,11 @@ contract GeneralPermissionManager is GeneralPermissionManagerStorage, IPermissio bytes32[] memory _allPerms = new bytes32[](counter); counter = 0; - for (i = 0; i < _types.length; i++){ - _currentTypeModules = ISecurityToken(securityToken).getModulesByType(_types[i]); - for (j = 0; j < _currentTypeModules.length; j++) { - _allModulePerms = IModule(_currentTypeModules[j]).getPermissions(); - for (k = 0; k < _allModulePerms.length; k++) { + for (uint256 i = 0; i < _types.length; i++) { + address[] memory _currentTypeModules = ISecurityToken(securityToken).getModulesByType(_types[i]); + for (uint256 j = 0; j < _currentTypeModules.length; j++) { + bytes32[] memory _allModulePerms = IModule(_currentTypeModules[j]).getPermissions(); + for (uint256 k = 0; k < _allModulePerms.length; k++) { if (perms[_currentTypeModules[j]][_delegate][_allModulePerms[k]]) { _allModules[counter] = _currentTypeModules[j]; _allPerms[counter] = _allModulePerms[k]; @@ -202,7 +193,7 @@ contract GeneralPermissionManager is GeneralPermissionManagerStorage, IPermissio } } - return(_allModules, _allPerms); + return (_allModules, _allPerms); } /** @@ -213,14 +204,7 @@ contract GeneralPermissionManager is GeneralPermissionManagerStorage, IPermissio * @param _valid Bool flag use to switch on/off the permission * @return bool */ - function _changePermission( - address _delegate, - address _module, - bytes32 _perm, - bool _valid - ) - internal - { + function _changePermission(address _delegate, address _module, bytes32 _perm, bool _valid) internal { perms[_module][_delegate][_perm] = _valid; /*solium-disable-next-line security/no-block-members*/ emit ChangePermission(_delegate, _module, _perm, _valid, now); @@ -230,7 +214,7 @@ contract GeneralPermissionManager is GeneralPermissionManagerStorage, IPermissio * @notice Used to get all delegates * @return address[] */ - function getAllDelegates() external view returns(address[]) { + function getAllDelegates() external view returns(address[] memory) { return allDelegates; } @@ -238,7 +222,7 @@ contract GeneralPermissionManager is GeneralPermissionManagerStorage, IPermissio * @notice Returns the Permission flag related the `this` contract * @return Array of permission flags */ - function getPermissions() public view returns(bytes32[]) { + function getPermissions() public view returns(bytes32[] memory) { bytes32[] memory allPermissions = new bytes32[](1); allPermissions[0] = CHANGE_PERMISSION; return allPermissions; diff --git a/contracts/modules/PermissionManager/GeneralPermissionManagerFactory.sol b/contracts/modules/PermissionManager/GeneralPermissionManagerFactory.sol index 77792b2b7..f1b52dd9f 100644 --- a/contracts/modules/PermissionManager/GeneralPermissionManagerFactory.sol +++ b/contracts/modules/PermissionManager/GeneralPermissionManagerFactory.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.24; +pragma solidity ^0.5.0; import "../ModuleFactory.sol"; import "../../proxy/GeneralPermissionManagerProxy.sol"; @@ -17,8 +17,14 @@ contract GeneralPermissionManagerFactory is ModuleFactory { * @param _subscriptionCost Subscription cost of the module * @param _logicContract Contract address that contains the logic related to `description` */ - constructor (uint256 _setupCost, uint256 _usageCost, uint256 _subscriptionCost, address _logicContract) public - ModuleFactory(_setupCost, _usageCost, _subscriptionCost) + constructor( + uint256 _setupCost, + uint256 _usageCost, + uint256 _subscriptionCost, + address _logicContract + ) + public + ModuleFactory(_setupCost, _usageCost, _subscriptionCost) { require(_logicContract != address(0), "Invalid address"); version = "1.0.0"; @@ -34,9 +40,14 @@ contract GeneralPermissionManagerFactory is ModuleFactory { * @notice Used to launch the Module with the help of factory * @return address Contract address of the Module */ - function deploy(bytes /* _data */) external returns(address) { + function deploy( + bytes calldata /* _data */ + ) + external + returns(address) + { address polyToken = _takeFee(); - address permissionManager = new GeneralPermissionManagerProxy(msg.sender, polyToken, logicContract); + address permissionManager = address(new GeneralPermissionManagerProxy(msg.sender, polyToken, logicContract)); /*solium-disable-next-line security/no-block-members*/ emit GenerateModuleFromFactory(address(permissionManager), getName(), address(this), msg.sender, setupCost, now); return permissionManager; @@ -45,7 +56,7 @@ contract GeneralPermissionManagerFactory is ModuleFactory { /** * @notice Type of the Module factory */ - function getTypes() external view returns(uint8[]) { + function getTypes() external view returns(uint8[] memory) { uint8[] memory res = new uint8[](1); res[0] = 1; return res; @@ -54,7 +65,7 @@ contract GeneralPermissionManagerFactory is ModuleFactory { /** * @notice Returns the instructions associated with the module */ - function getInstructions() external view returns(string) { + function getInstructions() external view returns(string memory) { /*solium-disable-next-line max-len*/ return "Add and remove permissions for the SecurityToken and associated modules. Permission types should be encoded as bytes32 values and attached using withPerm modifier to relevant functions. No initFunction required."; } @@ -62,7 +73,7 @@ contract GeneralPermissionManagerFactory is ModuleFactory { /** * @notice Get the tags related to the module factory */ - function getTags() external view returns(bytes32[]) { + function getTags() external view returns(bytes32[] memory) { bytes32[] memory availableTags = new bytes32[](0); return availableTags; } diff --git a/contracts/modules/PermissionManager/GeneralPermissionManagerStorage.sol b/contracts/modules/PermissionManager/GeneralPermissionManagerStorage.sol index 3a1a43513..cc50bc871 100644 --- a/contracts/modules/PermissionManager/GeneralPermissionManagerStorage.sol +++ b/contracts/modules/PermissionManager/GeneralPermissionManagerStorage.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.24; +pragma solidity ^0.5.0; /** * @title Contract used to store layout for the GeneralPermissionManager storage diff --git a/contracts/modules/PermissionManager/IPermissionManager.sol b/contracts/modules/PermissionManager/IPermissionManager.sol index d9b78944d..f1fdc69b5 100644 --- a/contracts/modules/PermissionManager/IPermissionManager.sol +++ b/contracts/modules/PermissionManager/IPermissionManager.sol @@ -1,10 +1,9 @@ -pragma solidity ^0.4.24; +pragma solidity ^0.5.0; /** * @title Interface to be implemented by all permission manager modules */ interface IPermissionManager { - /** * @notice Used to check the permission on delegate corresponds to module contract address * @param _delegate Ethereum address of the delegate @@ -42,13 +41,7 @@ interface IPermissionManager { * @param _valid Bool flag use to switch on/off the permission * @return bool */ - function changePermission( - address _delegate, - address _module, - bytes32 _perm, - bool _valid - ) - external; + function changePermission(address _delegate, address _module, bytes32 _perm, bool _valid) external; /** * @notice Used to change one or more permissions for a single delegate at once @@ -60,11 +53,10 @@ interface IPermissionManager { */ function changePermissionMulti( address _delegate, - address[] _modules, - bytes32[] _perms, - bool[] _valids - ) - external; + address[] calldata _modules, + bytes32[] calldata _perms, + bool[] calldata _valids + ) external; /** * @notice Used to return all delegates with a given permission and module @@ -72,9 +64,9 @@ interface IPermissionManager { * @param _perm Permission flag * @return address[] */ - function getAllDelegatesWithPerm(address _module, bytes32 _perm) external view returns(address[]); + function getAllDelegatesWithPerm(address _module, bytes32 _perm) external view returns(address[] memory); - /** + /** * @notice Used to return all permission of a single or multiple module * @dev possible that function get out of gas is there are lot of modules and perm related to them * @param _delegate Ethereum address of the delegate @@ -82,18 +74,21 @@ interface IPermissionManager { * @return address[] the address array of Modules this delegate has permission * @return bytes32[] the permission array of the corresponding Modules */ - function getAllModulesAndPermsFromTypes(address _delegate, uint8[] _types) external view returns(address[], bytes32[]); + function getAllModulesAndPermsFromTypes(address _delegate, uint8[] calldata _types) external view returns( + address[] memory, + bytes32[] memory + ); /** * @notice Used to get the Permission flag related the `this` contract * @return Array of permission flags */ - function getPermissions() external view returns(bytes32[]); + function getPermissions() external view returns(bytes32[] memory); /** * @notice Used to get all delegates * @return address[] */ - function getAllDelegates() external view returns(address[]); + function getAllDelegates() external view returns(address[] memory); } diff --git a/contracts/modules/STO/CappedSTO.sol b/contracts/modules/STO/CappedSTO.sol index 1cdc08984..3c7adcd0b 100644 --- a/contracts/modules/STO/CappedSTO.sol +++ b/contracts/modules/STO/CappedSTO.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.24; +pragma solidity ^0.5.0; import "./STO.sol"; import "../../interfaces/ISecurityToken.sol"; @@ -23,16 +23,15 @@ contract CappedSTO is CappedSTOStorage, STO, ReentrancyGuard { event SetAllowBeneficialInvestments(bool _allowed); - constructor (address _securityToken, address _polyToken) public - Module(_securityToken, _polyToken) - { + constructor(address _securityToken, address _polyToken) public Module(_securityToken, _polyToken) { + } ////////////////////////////////// /** * @notice fallback function ***DO NOT OVERRIDE*** */ - function () external payable { + function() external payable { buyTokens(msg.sender); } @@ -50,11 +49,11 @@ contract CappedSTO is CappedSTOStorage, STO, ReentrancyGuard { uint256 _endTime, uint256 _cap, uint256 _rate, - FundRaiseType[] _fundRaiseTypes, - address _fundsReceiver - ) - public - onlyFactory + FundRaiseType[] memory _fundRaiseTypes, + address payable _fundsReceiver + ) + public + onlyFactory { require(endTime == 0, "Already configured"); require(_rate > 0, "Rate of token should be greater than 0"); @@ -74,7 +73,7 @@ contract CappedSTO is CappedSTOStorage, STO, ReentrancyGuard { /** * @notice This function returns the signature of configure function */ - function getInitFunction() public pure returns (bytes4) { + function getInitFunction() public pure returns(bytes4) { return bytes4(keccak256("configure(uint256,uint256,uint256,uint256,uint8[],address)")); } @@ -112,7 +111,7 @@ contract CappedSTO is CappedSTOStorage, STO, ReentrancyGuard { * @notice low level token purchase * @param _investedPOLY Amount of POLY invested */ - function buyTokensWithPoly(uint256 _investedPOLY) public nonReentrant{ + function buyTokensWithPoly(uint256 _investedPOLY) public nonReentrant { require(!paused, "Should not be paused"); require(fundRaiseTypes[uint8(FundRaiseType.POLY)], "Mode of investment is not POLY"); uint256 refund = _processTx(msg.sender, _investedPOLY); @@ -124,7 +123,7 @@ contract CappedSTO is CappedSTOStorage, STO, ReentrancyGuard { * @notice Checks whether the cap has been reached. * @return bool Whether the cap was reached */ - function capReached() public view returns (bool) { + function capReached() public view returns(bool) { return totalTokensSold >= cap; } @@ -138,7 +137,7 @@ contract CappedSTO is CappedSTOStorage, STO, ReentrancyGuard { /** * @notice Return the permissions flag that are associated with STO */ - function getPermissions() public view returns(bytes32[]) { + function getPermissions() public view returns(bytes32[] memory) { bytes32[] memory allPermissions = new bytes32[](0); return allPermissions; } @@ -155,16 +154,9 @@ contract CappedSTO is CappedSTOStorage, STO, ReentrancyGuard { * @return Boolean value to justify whether the fund raise type is POLY or not, i.e true for POLY. */ function getSTODetails() public view returns(uint256, uint256, uint256, uint256, uint256, uint256, uint256, bool) { - return ( - startTime, - endTime, - cap, - rate, - (fundRaiseTypes[uint8(FundRaiseType.POLY)]) ? fundsRaised[uint8(FundRaiseType.POLY)]: fundsRaised[uint8(FundRaiseType.ETH)], - investorCount, - totalTokensSold, - (fundRaiseTypes[uint8(FundRaiseType.POLY)]) - ); + return (startTime, endTime, cap, rate, (fundRaiseTypes[uint8(FundRaiseType.POLY)]) ? fundsRaised[uint8( + FundRaiseType.POLY + )] : fundsRaised[uint8(FundRaiseType.ETH)], investorCount, totalTokensSold, (fundRaiseTypes[uint8(FundRaiseType.POLY)])); } // ----------------------------------------- @@ -176,7 +168,6 @@ contract CappedSTO is CappedSTOStorage, STO, ReentrancyGuard { * @param _investedAmount Value in wei involved in the purchase */ function _processTx(address _beneficiary, uint256 _investedAmount) internal returns(uint256 refund) { - _preValidatePurchase(_beneficiary, _investedAmount); // calculate token amount to be created uint256 tokens; @@ -217,8 +208,11 @@ contract CappedSTO is CappedSTOStorage, STO, ReentrancyGuard { * @notice Validation of an executed purchase. Observe state and use revert statements to undo rollback when valid conditions are not met. */ - function _postValidatePurchase(address /*_beneficiary*/, uint256 /*_investedAmount*/) internal pure { - // optional override + function _postValidatePurchase( + address, /*_beneficiary*/ + uint256 /*_investedAmount*/ + ) internal pure { + // optional override } /** @@ -249,8 +243,11 @@ contract CappedSTO is CappedSTOStorage, STO, ReentrancyGuard { * @notice Overrides for extensions that require an internal state to check for validity (current user contributions, etc.) */ - function _updatePurchasingState(address /*_beneficiary*/, uint256 /*_investedAmount*/) internal pure { - // optional override + function _updatePurchasingState( + address, /*_beneficiary*/ + uint256 _investedAmount + ) internal pure { + _investedAmount = 0; //yolo } /** @@ -259,7 +256,7 @@ contract CappedSTO is CappedSTOStorage, STO, ReentrancyGuard { * @return Number of tokens that can be purchased with the specified _investedAmount * @return Remaining amount that should be refunded to the investor */ - function _getTokenAmount(uint256 _investedAmount) internal view returns (uint256 _tokens, uint256 _refund) { + function _getTokenAmount(uint256 _investedAmount) internal view returns(uint256 _tokens, uint256 _refund) { _tokens = _investedAmount.mul(rate); _tokens = _tokens.div(uint256(10) ** 18); uint256 granularity = ISecurityToken(securityToken).granularity(); diff --git a/contracts/modules/STO/CappedSTOFactory.sol b/contracts/modules/STO/CappedSTOFactory.sol index 24bf5de06..06090758c 100644 --- a/contracts/modules/STO/CappedSTOFactory.sol +++ b/contracts/modules/STO/CappedSTOFactory.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.24; +pragma solidity ^0.5.0; import "../ModuleFactory.sol"; import "../../libraries/Util.sol"; @@ -19,8 +19,14 @@ contract CappedSTOFactory is ModuleFactory { * @param _subscriptionCost Subscription cost of the module * @param _logicContract Contract address that contains the logic related to `description` */ - constructor (uint256 _setupCost, uint256 _usageCost, uint256 _subscriptionCost, address _logicContract) public - ModuleFactory(_setupCost, _usageCost, _subscriptionCost) + constructor( + uint256 _setupCost, + uint256 _usageCost, + uint256 _subscriptionCost, + address _logicContract + ) + public + ModuleFactory(_setupCost, _usageCost, _subscriptionCost) { require(_logicContract != address(0), "Invalid address"); version = "1.0.0"; @@ -32,27 +38,30 @@ contract CappedSTOFactory is ModuleFactory { logicContract = _logicContract; } - /** + /** * @notice Used to launch the Module with the help of factory + * @param _data Data used for the intialization of the module factory variables * @return address Contract address of the Module */ - function deploy(bytes _data) external returns(address) { + function deploy(bytes calldata _data) external returns(address) { address polyToken = _takeFee(); //Check valid bytes - can only call module init function - CappedSTOProxy cappedSTO = new CappedSTOProxy(msg.sender, polyToken, logicContract); + address cappedSTO = address(new CappedSTOProxy(msg.sender, polyToken, logicContract)); //Checks that _data is valid (not calling anything it shouldn't) require(Util.getSig(_data) == IBoot(cappedSTO).getInitFunction(), "Invalid data"); + bool success; /*solium-disable-next-line security/no-low-level-calls*/ - require(address(cappedSTO).call(_data), "Unsuccessfull call"); + (success, ) = cappedSTO.call(_data); + require(success, "Unsuccessfull call"); /*solium-disable-next-line security/no-block-members*/ - emit GenerateModuleFromFactory(address(cappedSTO), getName(), address(this), msg.sender, setupCost, now); - return address(cappedSTO); + emit GenerateModuleFromFactory(cappedSTO, getName(), address(this), msg.sender, setupCost, now); + return cappedSTO; } /** * @notice Type of the Module factory */ - function getTypes() external view returns(uint8[]) { + function getTypes() external view returns(uint8[] memory) { uint8[] memory res = new uint8[](1); res[0] = 3; return res; @@ -61,7 +70,7 @@ contract CappedSTOFactory is ModuleFactory { /** * @notice Returns the instructions associated with the module */ - function getInstructions() external view returns(string) { + function getInstructions() external view returns(string memory) { /*solium-disable-next-line max-len*/ return "Initialises a capped STO. Init parameters are _startTime (time STO starts), _endTime (time STO ends), _cap (cap in tokens for STO), _rate (POLY/ETH to token rate), _fundRaiseType (whether you are raising in POLY or ETH), _polyToken (address of POLY token), _fundsReceiver (address which will receive funds)"; } @@ -69,7 +78,7 @@ contract CappedSTOFactory is ModuleFactory { /** * @notice Get the tags related to the module factory */ - function getTags() external view returns(bytes32[]) { + function getTags() external view returns(bytes32[] memory) { bytes32[] memory availableTags = new bytes32[](4); availableTags[0] = "Capped"; availableTags[1] = "Non-refundable"; diff --git a/contracts/modules/STO/CappedSTOStorage.sol b/contracts/modules/STO/CappedSTOStorage.sol index 51afb048e..7ddeea403 100644 --- a/contracts/modules/STO/CappedSTOStorage.sol +++ b/contracts/modules/STO/CappedSTOStorage.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.24; +pragma solidity ^0.5.0; /** * @title Contract used to store layout for the CappedSTO storage diff --git a/contracts/modules/STO/DummySTO.sol b/contracts/modules/STO/DummySTO.sol index cdd770ac7..5a4e5e560 100644 --- a/contracts/modules/STO/DummySTO.sol +++ b/contracts/modules/STO/DummySTO.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.24; +pragma solidity ^0.5.0; import "./STO.sol"; import "../../interfaces/ISecurityToken.sol"; @@ -15,9 +15,8 @@ contract DummySTO is DummySTOStorage, STO { * @notice Constructor * @param _securityToken Address of the security token */ - constructor (address _securityToken, address _polyToken) public - Module(_securityToken, _polyToken) - { + constructor(address _securityToken, address _polyToken) public Module(_securityToken, _polyToken) { + } /** @@ -27,7 +26,7 @@ contract DummySTO is DummySTOStorage, STO { * @param _cap Maximum No. of tokens for sale * @param _someString Any string that contails the details */ - function configure(uint256 _startTime, uint256 _endTime, uint256 _cap, string _someString) public onlyFactory { + function configure(uint256 _startTime, uint256 _endTime, uint256 _cap, string memory _someString) public onlyFactory { startTime = _startTime; endTime = _endTime; cap = _cap; @@ -37,7 +36,7 @@ contract DummySTO is DummySTOStorage, STO { /** * @notice This function returns the signature of configure function */ - function getInitFunction() public pure returns (bytes4) { + function getInitFunction() public pure returns(bytes4) { return bytes4(keccak256("configure(uint256,uint256,uint256,string)")); } @@ -55,27 +54,27 @@ contract DummySTO is DummySTOStorage, STO { } //TODO: Add SafeMath maybe investors[_investor] = investors[_investor] + _amount; - emit GenerateTokens (_investor, _amount); + emit GenerateTokens(_investor, _amount); } /** * @notice Returns the total no. of investors */ - function getNumberInvestors() public view returns (uint256) { + function getNumberInvestors() public view returns(uint256) { return investorCount; } /** * @notice Returns the total no. of investors */ - function getTokensSold() external view returns (uint256) { + function getTokensSold() external view returns(uint256) { return 0; } /** * @notice Returns the permissions flag that are associated with STO */ - function getPermissions() public view returns(bytes32[]) { + function getPermissions() public view returns(bytes32[] memory) { bytes32[] memory allPermissions = new bytes32[](1); allPermissions[0] = ADMIN; return allPermissions; diff --git a/contracts/modules/STO/DummySTOFactory.sol b/contracts/modules/STO/DummySTOFactory.sol index ac3e3cb79..ee84a4251 100644 --- a/contracts/modules/STO/DummySTOFactory.sol +++ b/contracts/modules/STO/DummySTOFactory.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.24; +pragma solidity ^0.5.0; import "../ModuleFactory.sol"; import "../../libraries/Util.sol"; @@ -19,8 +19,14 @@ contract DummySTOFactory is ModuleFactory { * @param _subscriptionCost Subscription cost of the module * @param _logicContract Contract address that contains the logic related to `description` */ - constructor (uint256 _setupCost, uint256 _usageCost, uint256 _subscriptionCost, address _logicContract) public - ModuleFactory(_setupCost, _usageCost, _subscriptionCost) + constructor( + uint256 _setupCost, + uint256 _usageCost, + uint256 _subscriptionCost, + address _logicContract + ) + public + ModuleFactory(_setupCost, _usageCost, _subscriptionCost) { version = "1.0.0"; name = "DummySTO"; @@ -33,25 +39,28 @@ contract DummySTOFactory is ModuleFactory { /** * @notice Used to launch the Module with the help of factory + * @param _data Data used for the intialization of the module factory variables * @return address Contract address of the Module */ - function deploy(bytes _data) external returns(address) { + function deploy(bytes calldata _data) external returns(address) { address polyToken = _takeFee(); //Check valid bytes - can only call module init function - DummySTOProxy dummySTO = new DummySTOProxy(msg.sender, polyToken, logicContract); + address dummySTO = address(new DummySTOProxy(msg.sender, polyToken, logicContract)); //Checks that _data is valid (not calling anything it shouldn't) require(Util.getSig(_data) == IBoot(dummySTO).getInitFunction(), "Invalid data"); + bool success; /*solium-disable-next-line security/no-low-level-calls*/ - require(address(dummySTO).call(_data), "Unsuccessfull call"); + (success, ) = dummySTO.call(_data); + require(success, "Unsuccessfull call"); /*solium-disable-next-line security/no-block-members*/ - emit GenerateModuleFromFactory(address(dummySTO), getName(), address(this), msg.sender, setupCost, now); - return address(dummySTO); + emit GenerateModuleFromFactory(dummySTO, getName(), address(this), msg.sender, setupCost, now); + return dummySTO; } /** * @notice Type of the Module factory */ - function getTypes() external view returns(uint8[]) { + function getTypes() external view returns(uint8[] memory) { uint8[] memory res = new uint8[](1); res[0] = 3; return res; @@ -60,14 +69,14 @@ contract DummySTOFactory is ModuleFactory { /** * @notice Returns the instructions associated with the module */ - function getInstructions() external view returns(string) { + function getInstructions() external view returns(string memory) { return "Dummy STO - you can mint tokens at will"; } /** * @notice Get the tags related to the module factory */ - function getTags() external view returns(bytes32[]) { + function getTags() external view returns(bytes32[] memory) { bytes32[] memory availableTags = new bytes32[](4); availableTags[0] = "Dummy"; availableTags[1] = "Non-refundable"; diff --git a/contracts/modules/STO/DummySTOStorage.sol b/contracts/modules/STO/DummySTOStorage.sol index 5e841b261..0979974ec 100644 --- a/contracts/modules/STO/DummySTOStorage.sol +++ b/contracts/modules/STO/DummySTOStorage.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.24; +pragma solidity ^0.5.0; /** * @title Contract used to store layout for the DummySTO storage diff --git a/contracts/modules/STO/PreSaleSTO.sol b/contracts/modules/STO/PreSaleSTO.sol index dbc0bccfb..09f4a1ce9 100644 --- a/contracts/modules/STO/PreSaleSTO.sol +++ b/contracts/modules/STO/PreSaleSTO.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.24; +pragma solidity ^0.5.0; import "./STO.sol"; import "../../interfaces/ISecurityToken.sol"; @@ -17,9 +17,8 @@ contract PreSaleSTO is PreSaleSTOStorage, STO { * @notice Constructor * @param _securityToken Address of the security token */ - constructor (address _securityToken, address _polyToken) public - Module(_securityToken, _polyToken) - { + constructor(address _securityToken, address _polyToken) public Module(_securityToken, _polyToken) { + } /** @@ -34,28 +33,28 @@ contract PreSaleSTO is PreSaleSTOStorage, STO { /** * @notice This function returns the signature of the configure function */ - function getInitFunction() public pure returns (bytes4) { + function getInitFunction() public pure returns(bytes4) { return bytes4(keccak256("configure(uint256)")); } /** * @notice Returns the total no. of investors */ - function getNumberInvestors() public view returns (uint256) { + function getNumberInvestors() public view returns(uint256) { return investorCount; } /** * @notice Returns the total no. of tokens sold */ - function getTokensSold() external view returns (uint256) { + function getTokensSold() external view returns(uint256) { return totalTokensSold; } /** * @notice Returns the permissions flag that are associated with STO */ - function getPermissions() public view returns(bytes32[]) { + function getPermissions() public view returns(bytes32[] memory) { bytes32[] memory allPermissions = new bytes32[](1); allPermissions[0] = PRE_SALE_ADMIN; return allPermissions; @@ -73,9 +72,9 @@ contract PreSaleSTO is PreSaleSTOStorage, STO { uint256 _amount, uint256 _etherContributed, uint256 _polyContributed - ) - public - withPerm(PRE_SALE_ADMIN) + ) + public + withPerm(PRE_SALE_ADMIN) { /*solium-disable-next-line security/no-block-members*/ require(now <= endTime, "Already passed Endtime"); @@ -99,13 +98,13 @@ contract PreSaleSTO is PreSaleSTOStorage, STO { * @param _polyContributed Array of amount of POLY contributed by each investor */ function allocateTokensMulti( - address[] _investors, - uint256[] _amounts, - uint256[] _etherContributed, - uint256[] _polyContributed - ) - public - withPerm(PRE_SALE_ADMIN) + address[] memory _investors, + uint256[] memory _amounts, + uint256[] memory _etherContributed, + uint256[] memory _polyContributed + ) + public + withPerm(PRE_SALE_ADMIN) { require(_investors.length == _amounts.length, "Mis-match in length of the arrays"); require(_etherContributed.length == _polyContributed.length, "Mis-match in length of the arrays"); diff --git a/contracts/modules/STO/PreSaleSTOFactory.sol b/contracts/modules/STO/PreSaleSTOFactory.sol index a1103ac0d..e3ae055d1 100644 --- a/contracts/modules/STO/PreSaleSTOFactory.sol +++ b/contracts/modules/STO/PreSaleSTOFactory.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.24; +pragma solidity ^0.5.0; import "../ModuleFactory.sol"; import "../../libraries/Util.sol"; @@ -19,8 +19,14 @@ contract PreSaleSTOFactory is ModuleFactory { * @param _subscriptionCost Subscription cost of the module * @param _logicContract Contract address that contains the logic related to `description` */ - constructor (uint256 _setupCost, uint256 _usageCost, uint256 _subscriptionCost, address _logicContract) public - ModuleFactory(_setupCost, _usageCost, _subscriptionCost) + constructor( + uint256 _setupCost, + uint256 _usageCost, + uint256 _subscriptionCost, + address _logicContract + ) + public + ModuleFactory(_setupCost, _usageCost, _subscriptionCost) { require(_logicContract != address(0), "Invalid address"); version = "1.0.0"; @@ -37,23 +43,25 @@ contract PreSaleSTOFactory is ModuleFactory { * @param _data Data used for the intialization of the module factory variables * @return address Contract address of the Module */ - function deploy(bytes _data) external returns(address) { + function deploy(bytes calldata _data) external returns(address) { address polyToken = _takeFee(); //Check valid bytes - can only call module init function - PreSaleSTOProxy preSaleSTO = new PreSaleSTOProxy(msg.sender, polyToken, logicContract); + address preSaleSTO = address(new PreSaleSTOProxy(msg.sender, polyToken, logicContract)); //Checks that _data is valid (not calling anything it shouldn't) require(Util.getSig(_data) == IBoot(preSaleSTO).getInitFunction(), "Invalid data"); + bool success; /*solium-disable-next-line security/no-low-level-calls*/ - require(address(preSaleSTO).call(_data), "Unsuccessfull call"); + (success, ) = preSaleSTO.call(_data); + require(success, "Unsuccessfull call"); /*solium-disable-next-line security/no-block-members*/ - emit GenerateModuleFromFactory(address(preSaleSTO), getName(), address(this), msg.sender, setupCost, now); - return address(preSaleSTO); + emit GenerateModuleFromFactory(preSaleSTO, getName(), address(this), msg.sender, setupCost, now); + return preSaleSTO; } /** * @notice Type of the Module factory */ - function getTypes() external view returns(uint8[]) { + function getTypes() external view returns(uint8[] memory) { uint8[] memory res = new uint8[](1); res[0] = 3; return res; @@ -62,14 +70,14 @@ contract PreSaleSTOFactory is ModuleFactory { /** * @notice Returns the instructions associated with the module */ - function getInstructions() external view returns(string) { + function getInstructions() external view returns(string memory) { return "Configure and track pre-sale token allocations"; } /** * @notice Get the tags related to the module factory */ - function getTags() external view returns(bytes32[]) { + function getTags() external view returns(bytes32[] memory) { bytes32[] memory availableTags = new bytes32[](1); availableTags[0] = "Presale"; return availableTags; diff --git a/contracts/modules/STO/PreSaleSTOStorage.sol b/contracts/modules/STO/PreSaleSTOStorage.sol index 956284e3d..9c8ecc0a6 100644 --- a/contracts/modules/STO/PreSaleSTOStorage.sol +++ b/contracts/modules/STO/PreSaleSTOStorage.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.24; +pragma solidity ^0.5.0; /** * @title Contract used to store layout for the PreSaleSTO storage diff --git a/contracts/modules/STO/STO.sol b/contracts/modules/STO/STO.sol index ef5d028a8..088e84951 100644 --- a/contracts/modules/STO/STO.sol +++ b/contracts/modules/STO/STO.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.24; +pragma solidity ^0.5.0; import "../../Pausable.sol"; import "../Module.sol"; @@ -10,10 +10,10 @@ import "../../interfaces/ISTO.sol"; /** * @title Base abstract contract to be extended by all STO modules */ -contract STO is ISTO, STOStorage, Module, Pausable { +contract STO is ISTO, STOStorage, Module, Pausable { using SafeMath for uint256; - enum FundRaiseType { ETH, POLY, DAI } + enum FundRaiseType {ETH, POLY, DAI} // Event event SetFundRaiseTypes(FundRaiseType[] _fundRaiseTypes); @@ -33,7 +33,7 @@ contract STO is ISTO, STOStorage, Module, Pausable { /** * @notice Returns funds raised by the STO */ - function getRaised(FundRaiseType _fundRaiseType) public view returns (uint256) { + function getRaised(FundRaiseType _fundRaiseType) public view returns(uint256) { return fundsRaised[uint8(_fundRaiseType)]; } @@ -53,7 +53,7 @@ contract STO is ISTO, STOStorage, Module, Pausable { super._unpause(); } - function _setFundRaiseType(FundRaiseType[] _fundRaiseTypes) internal { + function _setFundRaiseType(FundRaiseType[] memory _fundRaiseTypes) internal { // FundRaiseType[] parameter type ensures only valid values for _fundRaiseTypes require(_fundRaiseTypes.length > 0, "Raise type is not specified"); fundRaiseTypes[uint8(FundRaiseType.ETH)] = false; diff --git a/contracts/modules/STO/STOStorage.sol b/contracts/modules/STO/STOStorage.sol index aecfaf3d7..96793d6d5 100644 --- a/contracts/modules/STO/STOStorage.sol +++ b/contracts/modules/STO/STOStorage.sol @@ -1,8 +1,9 @@ -pragma solidity ^0.4.24; +pragma solidity ^0.5.0; /** * @title Storage layout for the STO contract */ + contract STOStorage { mapping (uint8 => bool) public fundRaiseTypes; @@ -17,8 +18,8 @@ contract STOStorage { // Number of individual investors uint256 public investorCount; // Address where ETH & POLY funds are delivered - address public wallet; - // Final amount of tokens sold + address payable public wallet; + // Final amount of tokens sold uint256 public totalTokensSold; -} \ No newline at end of file +} diff --git a/contracts/modules/STO/USDTieredSTO.sol b/contracts/modules/STO/USDTieredSTO.sol index 2c1bfced9..cea3a45f5 100644 --- a/contracts/modules/STO/USDTieredSTO.sol +++ b/contracts/modules/STO/USDTieredSTO.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.24; +pragma solidity ^0.5.0; import "./STO.sol"; import "../../interfaces/ISecurityToken.sol"; @@ -43,19 +43,9 @@ contract USDTieredSTO is USDTieredSTOStorage, STO, ReentrancyGuard { uint256 _rate ); event ReserveTokenMint(address indexed _owner, address indexed _wallet, uint256 _tokens, uint256 _latestTier); - event SetAddresses( - address indexed _wallet, - address indexed _reserveWallet, - address indexed _usdToken - ); - event SetLimits( - uint256 _nonAccreditedLimitUSD, - uint256 _minimumInvestmentUSD - ); - event SetTimes( - uint256 _startTime, - uint256 _endTime - ); + event SetAddresses(address indexed _wallet, address indexed _reserveWallet, address indexed _usdToken); + event SetLimits(uint256 _nonAccreditedLimitUSD, uint256 _minimumInvestmentUSD); + event SetTimes(uint256 _startTime, uint256 _endTime); event SetTiers( uint256[] _ratePerTier, uint256[] _ratePerTierDiscountPoly, @@ -67,19 +57,19 @@ contract USDTieredSTO is USDTieredSTOStorage, STO, ReentrancyGuard { // Modifiers // /////////////// - modifier validETH { + modifier validETH() { require(_getOracle(bytes32("ETH"), bytes32("USD")) != address(0), "Invalid Oracle"); require(fundRaiseTypes[uint8(FundRaiseType.ETH)], "ETH not allowed"); _; } - modifier validPOLY { + modifier validPOLY() { require(_getOracle(bytes32("POLY"), bytes32("USD")) != address(0), "Invalid Oracle"); require(fundRaiseTypes[uint8(FundRaiseType.POLY)], "POLY not allowed"); _; } - modifier validDAI { + modifier validDAI() { require(fundRaiseTypes[uint8(FundRaiseType.DAI)], "DAI not allowed"); _; } @@ -88,10 +78,8 @@ contract USDTieredSTO is USDTieredSTOStorage, STO, ReentrancyGuard { // STO Configuration // /////////////////////// - constructor (address _securityToken, address _polyAddress) - public - Module(_securityToken, _polyAddress) - { + constructor(address _securityToken, address _polyAddress) public Module(_securityToken, _polyAddress) { + } /** @@ -110,17 +98,20 @@ contract USDTieredSTO is USDTieredSTOStorage, STO, ReentrancyGuard { function configure( uint256 _startTime, uint256 _endTime, - uint256[] _ratePerTier, - uint256[] _ratePerTierDiscountPoly, - uint256[] _tokensPerTierTotal, - uint256[] _tokensPerTierDiscountPoly, + uint256[] memory _ratePerTier, + uint256[] memory _ratePerTierDiscountPoly, + uint256[] memory _tokensPerTierTotal, + uint256[] memory _tokensPerTierDiscountPoly, uint256 _nonAccreditedLimitUSD, uint256 _minimumInvestmentUSD, - FundRaiseType[] _fundRaiseTypes, - address _wallet, + FundRaiseType[] memory _fundRaiseTypes, + address payable _wallet, address _reserveWallet, address _usdToken - ) public onlyFactory { + ) + public + onlyFactory + { oracleKeys[bytes32("ETH")][bytes32("USD")] = ETH_ORACLE; oracleKeys[bytes32("POLY")][bytes32("USD")] = POLY_ORACLE; require(endTime == 0, "Already configured"); @@ -136,7 +127,7 @@ contract USDTieredSTO is USDTieredSTOStorage, STO, ReentrancyGuard { * @dev Modifies fund raise types * @param _fundRaiseTypes Array of fund raise types to allow */ - function modifyFunding(FundRaiseType[] _fundRaiseTypes) external onlyOwner { + function modifyFunding(FundRaiseType[] calldata _fundRaiseTypes) external onlyOwner { /*solium-disable-next-line security/no-block-members*/ require(now < startTime, "STO already started"); _setFundRaiseType(_fundRaiseTypes); @@ -147,10 +138,7 @@ contract USDTieredSTO is USDTieredSTOStorage, STO, ReentrancyGuard { * @param _nonAccreditedLimitUSD max non accredited invets limit * @param _minimumInvestmentUSD overall minimum investment limit */ - function modifyLimits( - uint256 _nonAccreditedLimitUSD, - uint256 _minimumInvestmentUSD - ) external onlyOwner { + function modifyLimits(uint256 _nonAccreditedLimitUSD, uint256 _minimumInvestmentUSD) external onlyOwner { /*solium-disable-next-line security/no-block-members*/ require(now < startTime, "STO already started"); _modifyLimits(_nonAccreditedLimitUSD, _minimumInvestmentUSD); @@ -164,11 +152,14 @@ contract USDTieredSTO is USDTieredSTOStorage, STO, ReentrancyGuard { * @param _tokensPerTierDiscountPoly Array of discounted tokens per tier */ function modifyTiers( - uint256[] _ratePerTier, - uint256[] _ratePerTierDiscountPoly, - uint256[] _tokensPerTierTotal, - uint256[] _tokensPerTierDiscountPoly - ) external onlyOwner { + uint256[] calldata _ratePerTier, + uint256[] calldata _ratePerTierDiscountPoly, + uint256[] calldata _tokensPerTierTotal, + uint256[] calldata _tokensPerTierDiscountPoly + ) + external + onlyOwner + { /*solium-disable-next-line security/no-block-members*/ require(now < startTime, "STO already started"); _modifyTiers(_ratePerTier, _ratePerTierDiscountPoly, _tokensPerTierTotal, _tokensPerTierDiscountPoly); @@ -179,10 +170,7 @@ contract USDTieredSTO is USDTieredSTOStorage, STO, ReentrancyGuard { * @param _startTime start time of sto * @param _endTime end time of sto */ - function modifyTimes( - uint256 _startTime, - uint256 _endTime - ) external onlyOwner { + function modifyTimes(uint256 _startTime, uint256 _endTime) external onlyOwner { /*solium-disable-next-line security/no-block-members*/ require(now < startTime, "STO already started"); _modifyTimes(_startTime, _endTime); @@ -194,35 +182,29 @@ contract USDTieredSTO is USDTieredSTOStorage, STO, ReentrancyGuard { * @param _reserveWallet Address of wallet where unsold tokens are sent * @param _usdToken Address of usd token (DAI) */ - function modifyAddresses( - address _wallet, - address _reserveWallet, - address _usdToken - ) external onlyOwner { + function modifyAddresses(address payable _wallet, address _reserveWallet, address _usdToken) external onlyOwner { /*solium-disable-next-line security/no-block-members*/ require(now < startTime, "STO already started"); _modifyAddresses(_wallet, _reserveWallet, _usdToken); } - function _modifyLimits( - uint256 _nonAccreditedLimitUSD, - uint256 _minimumInvestmentUSD - ) internal { + function _modifyLimits(uint256 _nonAccreditedLimitUSD, uint256 _minimumInvestmentUSD) internal { minimumInvestmentUSD = _minimumInvestmentUSD; nonAccreditedLimitUSD = _nonAccreditedLimitUSD; emit SetLimits(minimumInvestmentUSD, nonAccreditedLimitUSD); } function _modifyTiers( - uint256[] _ratePerTier, - uint256[] _ratePerTierDiscountPoly, - uint256[] _tokensPerTierTotal, - uint256[] _tokensPerTierDiscountPoly - ) internal { + uint256[] memory _ratePerTier, + uint256[] memory _ratePerTierDiscountPoly, + uint256[] memory _tokensPerTierTotal, + uint256[] memory _tokensPerTierDiscountPoly + ) + internal + { require(_tokensPerTierTotal.length > 0, "No tiers provided"); - require(_ratePerTier.length == _tokensPerTierTotal.length && - _ratePerTierDiscountPoly.length == _tokensPerTierTotal.length && - _tokensPerTierDiscountPoly.length == _tokensPerTierTotal.length, + require( + _ratePerTier.length == _tokensPerTierTotal.length && _ratePerTierDiscountPoly.length == _tokensPerTierTotal.length && _tokensPerTierDiscountPoly.length == _tokensPerTierTotal.length, "Tier data length mismatch" ); delete tiers; @@ -236,10 +218,7 @@ contract USDTieredSTO is USDTieredSTOStorage, STO, ReentrancyGuard { emit SetTiers(_ratePerTier, _ratePerTierDiscountPoly, _tokensPerTierTotal, _tokensPerTierDiscountPoly); } - function _modifyTimes( - uint256 _startTime, - uint256 _endTime - ) internal { + function _modifyTimes(uint256 _startTime, uint256 _endTime) internal { /*solium-disable-next-line security/no-block-members*/ require((_endTime > _startTime) && (_startTime > now), "Invalid times"); startTime = _startTime; @@ -247,11 +226,7 @@ contract USDTieredSTO is USDTieredSTOStorage, STO, ReentrancyGuard { emit SetTimes(_startTime, _endTime); } - function _modifyAddresses( - address _wallet, - address _reserveWallet, - address _usdToken - ) internal { + function _modifyAddresses(address payable _wallet, address _reserveWallet, address _usdToken) internal { require(_wallet != address(0) && _reserveWallet != address(0), "Invalid wallet"); if (fundRaiseTypes[uint8(FundRaiseType.DAI)]) { require(_usdToken != address(0), "Invalid usdToken"); @@ -295,7 +270,7 @@ contract USDTieredSTO is USDTieredSTOStorage, STO, ReentrancyGuard { * @param _investors Array of investor addresses to modify * @param _accredited Array of bools specifying accreditation status */ - function changeAccredited(address[] _investors, bool[] _accredited) public onlyOwner { + function changeAccredited(address[] memory _investors, bool[] memory _accredited) public onlyOwner { require(_investors.length == _accredited.length, "Array length mismatch"); for (uint256 i = 0; i < _investors.length; i++) { accredited[_investors[i]] = _accredited[i]; @@ -308,7 +283,7 @@ contract USDTieredSTO is USDTieredSTOStorage, STO, ReentrancyGuard { * @param _investors Array of investor addresses to modify * @param _nonAccreditedLimit Array of uints specifying non-accredited limits */ - function changeNonAccreditedLimit(address[] _investors, uint256[] _nonAccreditedLimit) public onlyOwner { + function changeNonAccreditedLimit(address[] memory _investors, uint256[] memory _nonAccreditedLimit) public onlyOwner { //nonAccreditedLimitUSDOverride require(_investors.length == _nonAccreditedLimit.length, "Array length mismatch"); for (uint256 i = 0; i < _investors.length; i++) { @@ -335,7 +310,7 @@ contract USDTieredSTO is USDTieredSTOStorage, STO, ReentrancyGuard { /** * @notice fallback function - assumes ETH being invested */ - function () external payable { + function() external payable { buyWithETHRateLimited(msg.sender, 0); } @@ -418,11 +393,11 @@ contract USDTieredSTO is USDTieredSTOStorage, STO, ReentrancyGuard { uint256 _investmentValue, uint256 _rate, FundRaiseType _fundRaiseType - ) - internal - nonReentrant - whenNotPaused - returns(uint256 spentUSD, uint256 spentValue) + ) + internal + nonReentrant + whenNotPaused + returns(uint256 spentUSD, uint256 spentValue) { if (!allowBeneficialInvestments) { require(_beneficiary == msg.sender, "Beneficiary != funder"); @@ -435,22 +410,19 @@ contract USDTieredSTO is USDTieredSTOStorage, STO, ReentrancyGuard { bool gotoNextTier; uint256 tempSpentUSD; // Update current tier if needed - if (currentTier != i) - currentTier = i; + if (currentTier != i) currentTier = i; // If there are tokens remaining, process investment if (tiers[i].mintedTotal < tiers[i].tokenTotal) { (tempSpentUSD, gotoNextTier) = _calculateTier(_beneficiary, i, allowedUSD.sub(spentUSD), _fundRaiseType); spentUSD = spentUSD.add(tempSpentUSD); // If all funds have been spent, exit the loop - if (!gotoNextTier) - break; + if (!gotoNextTier) break; } } // Modify storage if (spentUSD > 0) { - if (investorInvestedUSD[_beneficiary] == 0) - investorCount = investorCount + 1; + if (investorInvestedUSD[_beneficiary] == 0) investorCount = investorCount + 1; investorInvestedUSD[_beneficiary] = investorInvestedUSD[_beneficiary].add(spentUSD); fundsRaisedUSD = fundsRaisedUSD.add(spentUSD); } @@ -464,16 +436,15 @@ contract USDTieredSTO is USDTieredSTOStorage, STO, ReentrancyGuard { * @param _investmentValue Amount of POLY, ETH or DAI invested * @param _fundRaiseType Fund raise type (POLY, ETH, DAI) */ - function buyTokensView( - address _beneficiary, - uint256 _investmentValue, - FundRaiseType _fundRaiseType - ) - public - view - returns(uint256 spentUSD, uint256 spentValue, uint256 tokensMinted) - { - require(_fundRaiseType == FundRaiseType.POLY || _fundRaiseType == FundRaiseType.DAI || _fundRaiseType == FundRaiseType.ETH, "Invalid raise type"); + function buyTokensView(address _beneficiary, uint256 _investmentValue, FundRaiseType _fundRaiseType) public view returns( + uint256 spentUSD, + uint256 spentValue, + uint256 tokensMinted + ) { + require( + _fundRaiseType == FundRaiseType.POLY || _fundRaiseType == FundRaiseType.DAI || _fundRaiseType == FundRaiseType.ETH, + "Invalid raise type" + ); uint256 rate = getRate(_fundRaiseType); uint256 originalUSD = DecimalMath.mul(rate, _investmentValue); uint256 allowedUSD = _buyTokensChecks(_beneficiary, _investmentValue, originalUSD); @@ -489,8 +460,7 @@ contract USDTieredSTO is USDTieredSTOStorage, STO, ReentrancyGuard { spentUSD = spentUSD.add(tempSpentUSD); tokensMinted = tokensMinted.add(tempTokensMinted); // If all funds have been spent, exit the loop - if (!gotoNextTier) - break; + if (!gotoNextTier) break; } } @@ -498,13 +468,13 @@ contract USDTieredSTO is USDTieredSTOStorage, STO, ReentrancyGuard { } function _buyTokensChecks( - address _beneficiary, - uint256 _investmentValue, + address _beneficiary, + uint256 _investmentValue, uint256 investedUSD - ) - internal - view - returns(uint256 netInvestedUSD) + ) + internal + view + returns(uint256 netInvestedUSD) { require(isOpen(), "STO not open"); require(_investmentValue > 0, "No funds were sent"); @@ -516,20 +486,16 @@ contract USDTieredSTO is USDTieredSTOStorage, STO, ReentrancyGuard { if (!accredited[_beneficiary]) { uint256 investorLimitUSD = (nonAccreditedLimitUSDOverride[_beneficiary] == 0) ? nonAccreditedLimitUSD : nonAccreditedLimitUSDOverride[_beneficiary]; require(investorInvestedUSD[_beneficiary] < investorLimitUSD, "Over Non-accredited investor limit"); - if (investedUSD.add(investorInvestedUSD[_beneficiary]) > investorLimitUSD) - netInvestedUSD = investorLimitUSD.sub(investorInvestedUSD[_beneficiary]); + if (investedUSD.add(investorInvestedUSD[_beneficiary]) > investorLimitUSD) netInvestedUSD = investorLimitUSD.sub( + investorInvestedUSD[_beneficiary] + ); } } - function _calculateTier( - address _beneficiary, - uint256 _tier, - uint256 _investedUSD, - FundRaiseType _fundRaiseType - ) - internal - returns(uint256 spentUSD, bool gotoNextTier) - { + function _calculateTier(address _beneficiary, uint256 _tier, uint256 _investedUSD, FundRaiseType _fundRaiseType) internal returns( + uint256 spentUSD, + bool gotoNextTier + ) { // First purchase any discounted tokens if POLY investment uint256 tierSpentUSD; uint256 tierPurchasedTokens; @@ -539,36 +505,47 @@ contract USDTieredSTO is USDTieredSTOStorage, STO, ReentrancyGuard { if ((_fundRaiseType == FundRaiseType.POLY) && (tierData.tokensDiscountPoly > tierData.mintedDiscountPoly)) { uint256 discountRemaining = tierData.tokensDiscountPoly.sub(tierData.mintedDiscountPoly); uint256 totalRemaining = tierData.tokenTotal.sub(tierData.mintedTotal); - if (totalRemaining < discountRemaining) - (spentUSD, tierPurchasedTokens, gotoNextTier) = _purchaseTier(_beneficiary, tierData.rateDiscountPoly, totalRemaining, investedUSD, _tier); - else - (spentUSD, tierPurchasedTokens, gotoNextTier) = _purchaseTier(_beneficiary, tierData.rateDiscountPoly, discountRemaining, investedUSD, _tier); + if (totalRemaining < discountRemaining) (spentUSD, tierPurchasedTokens, gotoNextTier) = _purchaseTier( + _beneficiary, + tierData.rateDiscountPoly, + totalRemaining, + investedUSD, + _tier + ); + else (spentUSD, tierPurchasedTokens, gotoNextTier) = _purchaseTier( + _beneficiary, + tierData.rateDiscountPoly, + discountRemaining, + investedUSD, + _tier + ); investedUSD = investedUSD.sub(spentUSD); tierData.mintedDiscountPoly = tierData.mintedDiscountPoly.add(tierPurchasedTokens); tierData.minted[uint8(_fundRaiseType)] = tierData.minted[uint8(_fundRaiseType)].add(tierPurchasedTokens); tierData.mintedTotal = tierData.mintedTotal.add(tierPurchasedTokens); } // Now, if there is any remaining USD to be invested, purchase at non-discounted rate - if (investedUSD > 0 && - tierData.tokenTotal.sub(tierData.mintedTotal) > 0 && - (_fundRaiseType != FundRaiseType.POLY || tierData.tokensDiscountPoly <= tierData.mintedDiscountPoly) - ) { - (tierSpentUSD, tierPurchasedTokens, gotoNextTier) = _purchaseTier(_beneficiary, tierData.rate, tierData.tokenTotal.sub(tierData.mintedTotal), investedUSD, _tier); + if (investedUSD > 0 && tierData.tokenTotal.sub( + tierData.mintedTotal + ) > 0 && (_fundRaiseType != FundRaiseType.POLY || tierData.tokensDiscountPoly <= tierData.mintedDiscountPoly)) { + (tierSpentUSD, tierPurchasedTokens, gotoNextTier) = _purchaseTier( + _beneficiary, + tierData.rate, + tierData.tokenTotal.sub(tierData.mintedTotal), + investedUSD, + _tier + ); spentUSD = spentUSD.add(tierSpentUSD); tierData.minted[uint8(_fundRaiseType)] = tierData.minted[uint8(_fundRaiseType)].add(tierPurchasedTokens); tierData.mintedTotal = tierData.mintedTotal.add(tierPurchasedTokens); } } - function _calculateTierView( - uint256 _tier, - uint256 _investedUSD, - FundRaiseType _fundRaiseType - ) - internal - view - returns(uint256 spentUSD, bool gotoNextTier, uint256 tokensMinted) - { + function _calculateTierView(uint256 _tier, uint256 _investedUSD, FundRaiseType _fundRaiseType) internal view returns( + uint256 spentUSD, + bool gotoNextTier, + uint256 tokensMinted + ) { // First purchase any discounted tokens if POLY investment uint256 tierSpentUSD; uint256 tierPurchasedTokens; @@ -577,18 +554,23 @@ contract USDTieredSTO is USDTieredSTOStorage, STO, ReentrancyGuard { if ((_fundRaiseType == FundRaiseType.POLY) && (tierData.tokensDiscountPoly > tierData.mintedDiscountPoly)) { uint256 discountRemaining = tierData.tokensDiscountPoly.sub(tierData.mintedDiscountPoly); uint256 totalRemaining = tierData.tokenTotal.sub(tierData.mintedTotal); - if (totalRemaining < discountRemaining) - (spentUSD, tokensMinted, gotoNextTier) = _purchaseTierAmount(tierData.rateDiscountPoly, totalRemaining, _investedUSD); - else - (spentUSD, tokensMinted, gotoNextTier) = _purchaseTierAmount(tierData.rateDiscountPoly, discountRemaining, _investedUSD); + if (totalRemaining < discountRemaining) (spentUSD, tokensMinted, gotoNextTier) = _purchaseTierAmount( + tierData.rateDiscountPoly, + totalRemaining, + _investedUSD + ); + else (spentUSD, tokensMinted, gotoNextTier) = _purchaseTierAmount(tierData.rateDiscountPoly, discountRemaining, _investedUSD); _investedUSD = _investedUSD.sub(spentUSD); } // Now, if there is any remaining USD to be invested, purchase at non-discounted rate - if (_investedUSD > 0 && - tierData.tokenTotal.sub(tierData.mintedTotal.add(tokensMinted)) > 0 && - (_fundRaiseType != FundRaiseType.POLY || tierData.tokensDiscountPoly <= tierData.mintedDiscountPoly) - ) { - (tierSpentUSD, tierPurchasedTokens, gotoNextTier) = _purchaseTierAmount(tierData.rate, tierData.tokenTotal.sub(tierData.mintedTotal), _investedUSD); + if (_investedUSD > 0 && tierData.tokenTotal.sub( + tierData.mintedTotal.add(tokensMinted) + ) > 0 && (_fundRaiseType != FundRaiseType.POLY || tierData.tokensDiscountPoly <= tierData.mintedDiscountPoly)) { + (tierSpentUSD, tierPurchasedTokens, gotoNextTier) = _purchaseTierAmount( + tierData.rate, + tierData.tokenTotal.sub(tierData.mintedTotal), + _investedUSD + ); spentUSD = spentUSD.add(tierSpentUSD); tokensMinted = tokensMinted.add(tierPurchasedTokens); } @@ -600,9 +582,9 @@ contract USDTieredSTO is USDTieredSTOStorage, STO, ReentrancyGuard { uint256 _tierRemaining, uint256 _investedUSD, uint256 _tier - ) - internal - returns(uint256 spentUSD, uint256 purchasedTokens, bool gotoNextTier) + ) + internal + returns(uint256 spentUSD, uint256 purchasedTokens, bool gotoNextTier) { (spentUSD, purchasedTokens, gotoNextTier) = _purchaseTierAmount(_tierPrice, _tierRemaining, _investedUSD); if (purchasedTokens > 0) { @@ -612,13 +594,13 @@ contract USDTieredSTO is USDTieredSTOStorage, STO, ReentrancyGuard { } function _purchaseTierAmount( - uint256 _tierPrice, - uint256 _tierRemaining, + uint256 _tierPrice, + uint256 _tierRemaining, uint256 _investedUSD - ) - internal - view - returns(uint256 spentUSD, uint256 purchasedTokens, bool gotoNextTier) + ) + internal + view + returns(uint256 spentUSD,uint256 purchasedTokens,bool gotoNextTier) { uint256 maximumTokens = DecimalMath.div(_investedUSD, _tierPrice); uint256 granularity = ISecurityToken(securityToken).granularity(); @@ -647,16 +629,12 @@ contract USDTieredSTO is USDTieredSTOStorage, STO, ReentrancyGuard { * @return bool Whether the STO is accepting investments */ function isOpen() public view returns(bool) { - if (isFinalized) - return false; + if (isFinalized) return false; /*solium-disable-next-line security/no-block-members*/ - if (now < startTime) - return false; + if (now < startTime) return false; /*solium-disable-next-line security/no-block-members*/ - if (now >= endTime) - return false; - if (capReached()) - return false; + if (now >= endTime) return false; + if (capReached()) return false; return true; } @@ -664,7 +642,7 @@ contract USDTieredSTO is USDTieredSTOStorage, STO, ReentrancyGuard { * @notice Checks whether the cap has been reached. * @return bool Whether the cap was reached */ - function capReached() public view returns (bool) { + function capReached() public view returns(bool) { if (isFinalized) { return (finalAmountReturned == 0); } @@ -675,13 +653,13 @@ contract USDTieredSTO is USDTieredSTOStorage, STO, ReentrancyGuard { * @dev returns current conversion rate of funds * @param _fundRaiseType Fund raise type to get rate of */ - function getRate(FundRaiseType _fundRaiseType) public view returns (uint256) { + function getRate(FundRaiseType _fundRaiseType) public view returns(uint256) { if (_fundRaiseType == FundRaiseType.ETH) { return IOracle(_getOracle(bytes32("ETH"), bytes32("USD"))).getPrice(); } else if (_fundRaiseType == FundRaiseType.POLY) { return IOracle(_getOracle(bytes32("POLY"), bytes32("USD"))).getPrice(); } else if (_fundRaiseType == FundRaiseType.DAI) { - return 1 * 10**18; + return 1 * 10 ** 18; } else { revert("Incorrect funding"); } @@ -728,7 +706,7 @@ contract USDTieredSTO is USDTieredSTOStorage, STO, ReentrancyGuard { * @notice Return the total no. of tokens minted * @return uint256 Total number of tokens minted */ - function getTokensMinted() public view returns (uint256) { + function getTokensMinted() public view returns(uint256) { uint256 tokensMinted; for (uint256 i = 0; i < tiers.length; i++) { tokensMinted = tokensMinted.add(tiers[i].mintedTotal); @@ -741,7 +719,7 @@ contract USDTieredSTO is USDTieredSTOStorage, STO, ReentrancyGuard { * param _fundRaiseType The fund raising currency (e.g. ETH, POLY, DAI) to calculate sold tokens for * @return uint256 Total number of tokens sold for ETH */ - function getTokensSoldFor(FundRaiseType _fundRaiseType) public view returns (uint256) { + function getTokensSoldFor(FundRaiseType _fundRaiseType) public view returns(uint256) { uint256 tokensSold; for (uint256 i = 0; i < tiers.length; i++) { tokensSold = tokensSold.add(tiers[i].minted[uint8(_fundRaiseType)]); @@ -754,7 +732,7 @@ contract USDTieredSTO is USDTieredSTOStorage, STO, ReentrancyGuard { * param _tier The tier to return minted tokens for * @return uint256[] array of minted tokens in each fund raise type */ - function getTokensMintedByTier(uint256 _tier) public view returns (uint256[]) { + function getTokensMintedByTier(uint256 _tier) public view returns(uint256[] memory) { require(_tier < tiers.length, "Invalid tier"); uint256[] memory tokensMinted = new uint256[](3); tokensMinted[0] = tiers[_tier].minted[uint8(FundRaiseType.ETH)]; @@ -768,7 +746,7 @@ contract USDTieredSTO is USDTieredSTOStorage, STO, ReentrancyGuard { * param _tier The tier to calculate sold tokens for * @return uint256 Total number of tokens sold in the tier */ - function getTokensSoldByTier(uint256 _tier) public view returns (uint256) { + function getTokensSoldByTier(uint256 _tier) public view returns(uint256) { require(_tier < tiers.length, "Incorrect tier"); uint256 tokensSold; tokensSold = tokensSold.add(tiers[_tier].minted[uint8(FundRaiseType.ETH)]); @@ -781,14 +759,14 @@ contract USDTieredSTO is USDTieredSTOStorage, STO, ReentrancyGuard { * @notice Return the total no. of tiers * @return uint256 Total number of tiers */ - function getNumberOfTiers() public view returns (uint256) { + function getNumberOfTiers() public view returns(uint256) { return tiers.length; } /** * @notice Return the permissions flag that are associated with STO */ - function getPermissions() public view returns(bytes32[]) { + function getPermissions() public view returns(bytes32[] memory) { bytes32[] memory allPermissions = new bytes32[](0); return allPermissions; } @@ -805,10 +783,21 @@ contract USDTieredSTO is USDTieredSTOStorage, STO, ReentrancyGuard { * @return Amount of tokens sold. * @return Array of bools to show if funding is allowed in ETH, POLY, DAI respectively */ - function getSTODetails() public view returns(uint256, uint256, uint256, uint256[], uint256[], uint256, uint256, uint256, bool[]) { + function getSTODetails() public view returns( + uint256, + uint256, + uint256, + uint256[] memory, + uint256[] memory, + uint256, + uint256, + uint256, + bool[] memory + ) + { uint256[] memory cap = new uint256[](tiers.length); uint256[] memory rate = new uint256[](tiers.length); - for(uint256 i = 0; i < tiers.length; i++) { + for (uint256 i = 0; i < tiers.length; i++) { cap[i] = tiers[i].tokenTotal; rate[i] = tiers[i].rate; } @@ -833,11 +822,11 @@ contract USDTieredSTO is USDTieredSTOStorage, STO, ReentrancyGuard { * @notice This function returns the signature of configure function * @return bytes4 Configure function signature */ - function getInitFunction() public pure returns (bytes4) { + function getInitFunction() public pure returns(bytes4) { return 0xb0ff041e; } - function _getOracle(bytes32 _currency, bytes32 _denominatedCurrency) internal view returns (address) { + function _getOracle(bytes32 _currency, bytes32 _denominatedCurrency) internal view returns(address) { return PolymathRegistry(RegistryUpdater(securityToken).polymathRegistry()).getAddress(oracleKeys[_currency][_denominatedCurrency]); } diff --git a/contracts/modules/STO/USDTieredSTOFactory.sol b/contracts/modules/STO/USDTieredSTOFactory.sol index b55b7bb81..4ad558144 100644 --- a/contracts/modules/STO/USDTieredSTOFactory.sol +++ b/contracts/modules/STO/USDTieredSTOFactory.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.24; +pragma solidity ^0.5.0; import "../../interfaces/IBoot.sol"; import "../../proxy/USDTieredSTOProxy.sol"; @@ -9,7 +9,6 @@ import "../../libraries/Util.sol"; * @title Factory for deploying CappedSTO module */ contract USDTieredSTOFactory is ModuleFactory { - address public logicContract; /** @@ -18,8 +17,14 @@ contract USDTieredSTOFactory is ModuleFactory { * @param _usageCost Usage cost of the module * @param _subscriptionCost Subscription cost of the module */ - constructor (uint256 _setupCost, uint256 _usageCost, uint256 _subscriptionCost, address _logicContract) public - ModuleFactory(_setupCost, _usageCost, _subscriptionCost) + constructor( + uint256 _setupCost, + uint256 _usageCost, + uint256 _subscriptionCost, + address _logicContract + ) + public + ModuleFactory(_setupCost, _usageCost, _subscriptionCost) { require(_logicContract != address(0), "0x address is not allowed"); logicContract = _logicContract; @@ -32,17 +37,19 @@ contract USDTieredSTOFactory is ModuleFactory { compatibleSTVersionRange["upperBound"] = VersionUtils.pack(uint8(0), uint8(0), uint8(0)); } - /** + /** * @notice Used to launch the Module with the help of factory * @return address Contract address of the Module */ - function deploy(bytes _data) external returns(address) { + function deploy(bytes calldata _data) external returns(address) { address polyToken = _takeFee(); - address usdTieredSTO = new USDTieredSTOProxy(msg.sender, polyToken, logicContract); + address usdTieredSTO = address(new USDTieredSTOProxy(msg.sender, polyToken, logicContract)); //Checks that _data is valid (not calling anything it shouldn't) require(Util.getSig(_data) == IBoot(usdTieredSTO).getInitFunction(), "Invalid data"); + bool success; /*solium-disable-next-line security/no-low-level-calls*/ - require(address(usdTieredSTO).call(_data), "Unsuccessfull call"); + (success, ) = usdTieredSTO.call(_data); + require(success, "Unsuccessfull call"); /*solium-disable-next-line security/no-block-members*/ emit GenerateModuleFromFactory(usdTieredSTO, getName(), address(this), msg.sender, setupCost, now); return address(usdTieredSTO); @@ -51,7 +58,7 @@ contract USDTieredSTOFactory is ModuleFactory { /** * @notice Type of the Module factory */ - function getTypes() external view returns(uint8[]) { + function getTypes() external view returns(uint8[] memory) { uint8[] memory res = new uint8[](1); res[0] = 3; return res; @@ -60,14 +67,14 @@ contract USDTieredSTOFactory is ModuleFactory { /** * @notice Returns the instructions associated with the module */ - function getInstructions() external view returns(string) { + function getInstructions() external view returns(string memory) { return "Initialises a USD tiered STO."; } /** * @notice Get the tags related to the module factory */ - function getTags() external view returns(bytes32[]) { + function getTags() external view returns(bytes32[] memory) { bytes32[] memory availableTags = new bytes32[](4); availableTags[0] = "USD"; availableTags[1] = "Tiered"; diff --git a/contracts/modules/STO/USDTieredSTOStorage.sol b/contracts/modules/STO/USDTieredSTOStorage.sol index 919fd2900..a1c6f88ba 100644 --- a/contracts/modules/STO/USDTieredSTOStorage.sol +++ b/contracts/modules/STO/USDTieredSTOStorage.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.24; +pragma solidity ^0.5.0; import "openzeppelin-solidity/contracts/token/ERC20/IERC20.sol"; @@ -6,34 +6,27 @@ import "openzeppelin-solidity/contracts/token/ERC20/IERC20.sol"; * @title Contract used to store layout for the USDTieredSTO storage */ contract USDTieredSTOStorage { - ///////////// // Storage // ///////////// struct Tier { // How many token units a buyer gets per USD in this tier (multiplied by 10**18) uint256 rate; - // How many token units a buyer gets per USD in this tier (multiplied by 10**18) when investing in POLY up to tokensDiscountPoly uint256 rateDiscountPoly; - // How many tokens are available in this tier (relative to totalSupply) uint256 tokenTotal; - // How many token units are available in this tier (relative to totalSupply) at the ratePerTierDiscountPoly rate uint256 tokensDiscountPoly; - // How many tokens have been minted in this tier (relative to totalSupply) uint256 mintedTotal; - // How many tokens have been minted in this tier (relative to totalSupply) for each fund raise type - mapping (uint8 => uint256) minted; - + mapping(uint8 => uint256) minted; // How many tokens have been minted in this tier (relative to totalSupply) at discounted POLY rate uint256 mintedDiscountPoly; } - mapping (bytes32 => mapping (bytes32 => string)) oracleKeys; + mapping(bytes32 => mapping(bytes32 => string)) oracleKeys; IERC20 public usdToken; @@ -44,7 +37,7 @@ contract USDTieredSTOStorage { bool public isFinalized; // Address where ETH, POLY & DAI funds are delivered - address public wallet; + address payable public wallet; // Address of issuer reserve wallet for unsold tokens address public reserveWallet; @@ -56,19 +49,19 @@ contract USDTieredSTOStorage { uint256 public fundsRaisedUSD; // Amount in USD invested by each address - mapping (address => uint256) public investorInvestedUSD; + mapping(address => uint256) public investorInvestedUSD; // Amount in fund raise type invested by each investor - mapping (address => mapping (uint8 => uint256)) public investorInvested; + mapping(address => mapping(uint8 => uint256)) public investorInvested; // List of accredited investors - mapping (address => bool) public accredited; + mapping(address => bool) public accredited; // Default limit in USD for non-accredited investors multiplied by 10**18 uint256 public nonAccreditedLimitUSD; // Overrides for default limit in USD for non-accredited investors multiplied by 10**18 - mapping (address => uint256) public nonAccreditedLimitUSDOverride; + mapping(address => uint256) public nonAccreditedLimitUSDOverride; // Minimum investable amount in USD uint256 public minimumInvestmentUSD; diff --git a/contracts/modules/TransferManager/CountTransferManager.sol b/contracts/modules/TransferManager/CountTransferManager.sol index 64f4af91f..756a9ce7c 100644 --- a/contracts/modules/TransferManager/CountTransferManager.sol +++ b/contracts/modules/TransferManager/CountTransferManager.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.24; +pragma solidity ^0.5.0; import "./TransferManager.sol"; import "./CountTransferManagerStorage.sol"; @@ -14,10 +14,8 @@ contract CountTransferManager is CountTransferManagerStorage, TransferManager { * @notice Constructor * @param _securityToken Address of the security token */ - constructor (address _securityToken, address _polyToken) - public - Module(_securityToken, _polyToken) - { + constructor(address _securityToken, address _polyToken) public Module(_securityToken, _polyToken) { + } /** @notice Used to verify the transfer transaction and prevent a transfer if it passes the allowed amount of token holders @@ -29,11 +27,11 @@ contract CountTransferManager is CountTransferManagerStorage, TransferManager { address _from, address _to, uint256 _amount, - bytes /* _data */, + bytes calldata /* _data */, bool /* _isTransfer */ - ) - external - returns(Result) + ) + external + returns(Result) { if (!paused) { if (maxHolderCount < ISecurityToken(securityToken).getInvestorCount()) { @@ -68,14 +66,14 @@ contract CountTransferManager is CountTransferManagerStorage, TransferManager { /** * @notice This function returns the signature of configure function */ - function getInitFunction() public pure returns (bytes4) { + function getInitFunction() public pure returns(bytes4) { return bytes4(keccak256("configure(uint256)")); } /** * @notice Returns the permissions flag that are associated with CountTransferManager */ - function getPermissions() public view returns(bytes32[]) { + function getPermissions() public view returns(bytes32[] memory) { bytes32[] memory allPermissions = new bytes32[](1); allPermissions[0] = ADMIN; return allPermissions; diff --git a/contracts/modules/TransferManager/CountTransferManagerFactory.sol b/contracts/modules/TransferManager/CountTransferManagerFactory.sol index b0b714fdc..f045fabc5 100644 --- a/contracts/modules/TransferManager/CountTransferManagerFactory.sol +++ b/contracts/modules/TransferManager/CountTransferManagerFactory.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.24; +pragma solidity ^0.5.0; import "../ModuleFactory.sol"; import "../../libraries/Util.sol"; @@ -19,8 +19,13 @@ contract CountTransferManagerFactory is ModuleFactory { * @param _subscriptionCost Subscription cost of the module * @param _logicContract Contract address that contains the logic related to `description` */ - constructor (uint256 _setupCost, uint256 _usageCost, uint256 _subscriptionCost, address _logicContract) public - ModuleFactory(_setupCost, _usageCost, _subscriptionCost) + constructor( + uint256 _setupCost, + uint256 _usageCost, + uint256 _subscriptionCost, + address _logicContract + ) + public ModuleFactory(_setupCost, _usageCost, _subscriptionCost) { require(_logicContract != address(0), "Invalid address"); version = "2.1.0"; @@ -37,22 +42,24 @@ contract CountTransferManagerFactory is ModuleFactory { * @param _data Data used for the intialization of the module factory variables * @return address Contract address of the Module */ - function deploy(bytes _data) external returns(address) { + function deploy(bytes calldata _data) external returns(address) { address polyToken = _takeFee(); - CountTransferManagerProxy countTransferManager = new CountTransferManagerProxy(msg.sender, polyToken, logicContract); + address countTransferManager = address(new CountTransferManagerProxy(msg.sender, polyToken, logicContract)); require(Util.getSig(_data) == IBoot(countTransferManager).getInitFunction(), "Provided data is not valid"); + bool success; /*solium-disable-next-line security/no-low-level-calls*/ - require(address(countTransferManager).call(_data), "Unsuccessful call"); + (success, ) = countTransferManager.call(_data); + require(success, "Unsuccessful call"); /*solium-disable-next-line security/no-block-members*/ - emit GenerateModuleFromFactory(address(countTransferManager), getName(), address(this), msg.sender, setupCost, now); - return address(countTransferManager); + emit GenerateModuleFromFactory(countTransferManager, getName(), address(this), msg.sender, setupCost, now); + return countTransferManager; } /** * @notice Type of the Module factory */ - function getTypes() external view returns(uint8[]) { + function getTypes() external view returns(uint8[] memory) { uint8[] memory res = new uint8[](1); res[0] = 2; return res; @@ -61,14 +68,14 @@ contract CountTransferManagerFactory is ModuleFactory { /** * @notice Returns the instructions associated with the module */ - function getInstructions() external view returns(string) { + function getInstructions() external view returns(string memory) { return "Allows an issuer to restrict the total number of non-zero token holders"; } /** * @notice Get the tags related to the module factory */ - function getTags() external view returns(bytes32[]) { + function getTags() external view returns(bytes32[] memory) { bytes32[] memory availableTags = new bytes32[](2); availableTags[0] = "Count"; availableTags[1] = "Transfer Restriction"; diff --git a/contracts/modules/TransferManager/CountTransferManagerStorage.sol b/contracts/modules/TransferManager/CountTransferManagerStorage.sol index 1c17e62d9..4a33663b1 100644 --- a/contracts/modules/TransferManager/CountTransferManagerStorage.sol +++ b/contracts/modules/TransferManager/CountTransferManagerStorage.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.24; +pragma solidity ^0.5.0; /** * @title Contract used to store layout for the CountTransferManager storage diff --git a/contracts/modules/TransferManager/GeneralTransferManager.sol b/contracts/modules/TransferManager/GeneralTransferManager.sol index 36b742f90..ec88dadc9 100644 --- a/contracts/modules/TransferManager/GeneralTransferManager.sol +++ b/contracts/modules/TransferManager/GeneralTransferManager.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.24; +pragma solidity ^0.5.0; import "./TransferManager.sol"; import "./GeneralTransferManagerStorage.sol"; @@ -8,7 +8,6 @@ import "openzeppelin-solidity/contracts/math/SafeMath.sol"; * @title Transfer Manager module for core transfer validation functionality */ contract GeneralTransferManager is GeneralTransferManagerStorage, TransferManager { - using SafeMath for uint256; // Emit when Issuance address get changed @@ -45,16 +44,14 @@ contract GeneralTransferManager is GeneralTransferManagerStorage, TransferManage * @notice Constructor * @param _securityToken Address of the security token */ - constructor (address _securityToken, address _polyToken) - public - Module(_securityToken, _polyToken) - { + constructor(address _securityToken, address _polyToken) public Module(_securityToken, _polyToken) { + } /** * @notice This function returns the signature of configure function */ - function getInitFunction() public pure returns (bytes4) { + function getInitFunction() public pure returns(bytes4) { return bytes4(0); } @@ -141,7 +138,13 @@ contract GeneralTransferManager is GeneralTransferManagerStorage, TransferManage * @param _from Address of the sender * @param _to Address of the receiver */ - function verifyTransfer(address _from, address _to, uint256 /*_amount*/, bytes /* _data */, bool /* _isTransfer */) external returns(Result) { + function verifyTransfer( + address _from, + address _to, + uint256, /*_amount*/ + bytes calldata, /* _data */ + bool /* _isTransfer */ + ) external returns(Result) { if (!paused) { if (allowAllTransfers) { //All transfers allowed, regardless of whitelist @@ -171,8 +174,8 @@ contract GeneralTransferManager is GeneralTransferManagerStorage, TransferManage //Anyone on the whitelist can transfer provided the blocknumber is large enough /*solium-disable-next-line security/no-block-members*/ - return ((_onWhitelist(_from) && (adjustedFromTime <= uint64(now))) && - (_onWhitelist(_to) && (adjustedToTime <= uint64(now)))) ? Result.VALID : Result.NA; /*solium-disable-line security/no-block-members*/ + return ((_onWhitelist(_from) && (adjustedFromTime <= uint64(now))) && (_onWhitelist(_to) && + (adjustedToTime <= uint64(now)))) ? Result.VALID : Result.NA; /*solium-disable-line security/no-block-members*/ } return Result.NA; } @@ -191,9 +194,9 @@ contract GeneralTransferManager is GeneralTransferManagerStorage, TransferManage uint256 _toTime, uint256 _expiryTime, bool _canBuyFromSTO - ) - public - withPerm(WHITELIST) + ) + public + withPerm(WHITELIST) { _modifyWhitelist(_investor, _fromTime, _toTime, _expiryTime, _canBuyFromSTO); } @@ -206,15 +209,7 @@ contract GeneralTransferManager is GeneralTransferManagerStorage, TransferManage * @param _expiryTime is the moment till investors KYC will be validated. After that investor need to do re-KYC * @param _canBuyFromSTO is used to know whether the investor is restricted investor or not. */ - function _modifyWhitelist( - address _investor, - uint256 _fromTime, - uint256 _toTime, - uint256 _expiryTime, - bool _canBuyFromSTO - ) - internal - { + function _modifyWhitelist(address _investor, uint256 _fromTime, uint256 _toTime, uint256 _expiryTime, bool _canBuyFromSTO) internal { require(_investor != address(0), "Invalid investor"); uint8 canBuyFromSTO = 0; if (_canBuyFromSTO) { @@ -236,11 +231,11 @@ contract GeneralTransferManager is GeneralTransferManagerStorage, TransferManage * @param _canBuyFromSTO An array of boolean values */ function modifyWhitelistMulti( - address[] _investors, - uint256[] _fromTimes, - uint256[] _toTimes, - uint256[] _expiryTimes, - bool[] _canBuyFromSTO + address[] memory _investors, + uint256[] memory _fromTimes, + uint256[] memory _toTimes, + uint256[] memory _expiryTimes, + bool[] memory _canBuyFromSTO ) public withPerm(WHITELIST) { require(_investors.length == _fromTimes.length, "Mismatched input lengths"); require(_fromTimes.length == _toTimes.length, "Mismatched input lengths"); @@ -277,7 +272,9 @@ contract GeneralTransferManager is GeneralTransferManagerStorage, TransferManage uint8 _v, bytes32 _r, bytes32 _s - ) public { + ) + public + { /*solium-disable-next-line security/no-block-members*/ require(_validFrom <= now, "ValidFrom is too early"); /*solium-disable-next-line security/no-block-members*/ @@ -336,16 +333,21 @@ contract GeneralTransferManager is GeneralTransferManagerStorage, TransferManage /** * @dev Returns list of all investors */ - function getInvestors() external view returns(address[]) { + function getInvestors() external view returns(address[] memory) { return investors; } /** * @dev Returns list of all investors data */ - function getAllInvestorsData() external view returns(address[], uint256[], uint256[], uint256[], bool[]) { - (uint256[] memory fromTimes, uint256[] memory toTimes, uint256[] memory expiryTimes, bool[] memory canBuyFromSTOs) - = _investorsData(investors); + function getAllInvestorsData() external view returns( + address[] memory, + uint256[] memory fromTimes, + uint256[] memory toTimes, + uint256[] memory expiryTimes, + bool[] memory canBuyFromSTOs + ) { + (fromTimes, toTimes, expiryTimes, canBuyFromSTOs) = _investorsData(investors); return (investors, fromTimes, toTimes, expiryTimes, canBuyFromSTOs); } @@ -353,11 +355,21 @@ contract GeneralTransferManager is GeneralTransferManagerStorage, TransferManage /** * @dev Returns list of specified investors data */ - function getInvestorsData(address[] _investors) external view returns(uint256[], uint256[], uint256[], bool[]) { + function getInvestorsData(address[] calldata _investors) external view returns( + uint256[] memory, + uint256[] memory, + uint256[] memory, + bool[] memory + ) { return _investorsData(_investors); } - function _investorsData(address[] _investors) internal view returns(uint256[], uint256[], uint256[], bool[]) { + function _investorsData(address[] memory _investors) internal view returns( + uint256[] memory, + uint256[] memory, + uint256[] memory, + bool[] memory + ) { uint256[] memory fromTimes = new uint256[](_investors.length); uint256[] memory toTimes = new uint256[](_investors.length); uint256[] memory expiryTimes = new uint256[](_investors.length); @@ -378,7 +390,7 @@ contract GeneralTransferManager is GeneralTransferManagerStorage, TransferManage /** * @notice Return the permissions flag that are associated with general trnasfer manager */ - function getPermissions() public view returns(bytes32[]) { + function getPermissions() public view returns(bytes32[] memory) { bytes32[] memory allPermissions = new bytes32[](2); allPermissions[0] = WHITELIST; allPermissions[1] = FLAGS; diff --git a/contracts/modules/TransferManager/GeneralTransferManagerFactory.sol b/contracts/modules/TransferManager/GeneralTransferManagerFactory.sol index cfebe557c..4c6d4a130 100644 --- a/contracts/modules/TransferManager/GeneralTransferManagerFactory.sol +++ b/contracts/modules/TransferManager/GeneralTransferManagerFactory.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.24; +pragma solidity ^0.5.0; import "../../proxy/GeneralTransferManagerProxy.sol"; import "../ModuleFactory.sol"; @@ -7,7 +7,6 @@ import "../ModuleFactory.sol"; * @title Factory for deploying GeneralTransferManager module */ contract GeneralTransferManagerFactory is ModuleFactory { - address public logicContract; /** @@ -17,8 +16,14 @@ contract GeneralTransferManagerFactory is ModuleFactory { * @param _subscriptionCost Subscription cost of the module * @param _logicContract Contract address that contains the logic related to `description` */ - constructor (uint256 _setupCost, uint256 _usageCost, uint256 _subscriptionCost, address _logicContract) public - ModuleFactory(_setupCost, _usageCost, _subscriptionCost) + constructor( + uint256 _setupCost, + uint256 _usageCost, + uint256 _subscriptionCost, + address _logicContract + ) + public + ModuleFactory(_setupCost, _usageCost, _subscriptionCost) { require(_logicContract != address(0), "Invalid logic contract"); version = "2.1.0"; @@ -30,24 +35,27 @@ contract GeneralTransferManagerFactory is ModuleFactory { logicContract = _logicContract; } - - /** + /** * @notice Used to launch the Module with the help of factory * @return address Contract address of the Module */ - function deploy(bytes /* _data */) external returns(address) { - address polyToken= _takeFee(); - address generalTransferManager = new GeneralTransferManagerProxy(msg.sender, polyToken, logicContract); + function deploy( + bytes calldata /* _data */ + ) + external + returns(address) + { + address polyToken = _takeFee(); + GeneralTransferManagerProxy generalTransferManager = new GeneralTransferManagerProxy(msg.sender, polyToken, logicContract); /*solium-disable-next-line security/no-block-members*/ emit GenerateModuleFromFactory(address(generalTransferManager), getName(), address(this), msg.sender, setupCost, now); return address(generalTransferManager); } - /** * @notice Type of the Module factory */ - function getTypes() external view returns(uint8[]) { + function getTypes() external view returns(uint8[] memory) { uint8[] memory res = new uint8[](1); res[0] = 2; return res; @@ -56,7 +64,7 @@ contract GeneralTransferManagerFactory is ModuleFactory { /** * @notice Returns the instructions associated with the module */ - function getInstructions() external view returns(string) { + function getInstructions() external view returns(string memory) { /*solium-disable-next-line max-len*/ return "Allows an issuer to maintain a time based whitelist of authorised token holders.Addresses are added via modifyWhitelist and take a fromTime (the time from which they can send tokens) and a toTime (the time from which they can receive tokens). There are additional flags, allowAllWhitelistIssuances, allowAllWhitelistTransfers & allowAllTransfers which allow you to set corresponding contract level behaviour. Init function takes no parameters."; } @@ -64,12 +72,11 @@ contract GeneralTransferManagerFactory is ModuleFactory { /** * @notice Get the tags related to the module factory */ - function getTags() public view returns(bytes32[]) { + function getTags() public view returns(bytes32[] memory) { bytes32[] memory availableTags = new bytes32[](2); availableTags[0] = "General"; availableTags[1] = "Transfer Restriction"; return availableTags; } - } diff --git a/contracts/modules/TransferManager/GeneralTransferManagerStorage.sol b/contracts/modules/TransferManager/GeneralTransferManagerStorage.sol index cca7b5dd1..b9add9a57 100644 --- a/contracts/modules/TransferManager/GeneralTransferManagerStorage.sol +++ b/contracts/modules/TransferManager/GeneralTransferManagerStorage.sol @@ -1,10 +1,9 @@ -pragma solidity ^0.4.24; +pragma solidity ^0.5.0; /** * @title Transfer Manager module for core transfer validation functionality */ contract GeneralTransferManagerStorage { - //Address from which issuances come address public issuanceAddress = address(0); @@ -37,7 +36,7 @@ contract GeneralTransferManagerStorage { // An address can only send / receive tokens once their corresponding uint256 > block.number // (unless allowAllTransfers == true or allowAllWhitelistTransfers == true) - mapping (address => TimeRestriction) public whitelist; + mapping(address => TimeRestriction) public whitelist; // Map of used nonces by customer mapping(address => mapping(uint256 => bool)) public nonceMap; diff --git a/contracts/modules/TransferManager/ManualApprovalTransferManager.sol b/contracts/modules/TransferManager/ManualApprovalTransferManager.sol index 382ffb486..3bc258c60 100644 --- a/contracts/modules/TransferManager/ManualApprovalTransferManager.sol +++ b/contracts/modules/TransferManager/ManualApprovalTransferManager.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.24; +pragma solidity ^0.5.0; import "./TransferManager.sol"; import "openzeppelin-solidity/contracts/math/SafeMath.sol"; @@ -41,16 +41,14 @@ contract ManualApprovalTransferManager is ManualApprovalTransferManagerStorage, * @notice Constructor * @param _securityToken Address of the security token */ - constructor (address _securityToken, address _polyToken) - public - Module(_securityToken, _polyToken) - { + constructor(address _securityToken, address _polyToken) public Module(_securityToken, _polyToken) { + } /** * @notice This function returns the signature of configure function */ - function getInitFunction() public pure returns (bytes4) { + function getInitFunction() public pure returns(bytes4) { return bytes4(0); } @@ -60,7 +58,16 @@ contract ManualApprovalTransferManager is ManualApprovalTransferManagerStorage, * @param _amount The amount of tokens to transfer * @param _isTransfer Whether or not this is an actual transfer or just a test to see if the tokens would be transferrable */ - function verifyTransfer(address _from, address _to, uint256 _amount, bytes /* _data */, bool _isTransfer) external returns(Result) { + function verifyTransfer( + address _from, + address _to, + uint256 _amount, + bytes calldata, /* _data */ + bool _isTransfer + ) + external + returns(Result) + { // function must only be called by the associated security token if _isTransfer == true require(_isTransfer == false || msg.sender == securityToken, "Sender is not the owner"); // manual blocking takes precidence over manual approval @@ -136,7 +143,7 @@ contract ManualApprovalTransferManager is ManualApprovalTransferManagerStorage, /** * @notice Returns the permissions flag that are associated with ManualApproval transfer manager */ - function getPermissions() public view returns(bytes32[]) { + function getPermissions() public view returns(bytes32[] memory) { bytes32[] memory allPermissions = new bytes32[](1); allPermissions[0] = TRANSFER_APPROVAL; return allPermissions; diff --git a/contracts/modules/TransferManager/ManualApprovalTransferManagerFactory.sol b/contracts/modules/TransferManager/ManualApprovalTransferManagerFactory.sol index 9a087adfd..ac4ac109c 100644 --- a/contracts/modules/TransferManager/ManualApprovalTransferManagerFactory.sol +++ b/contracts/modules/TransferManager/ManualApprovalTransferManagerFactory.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.24; +pragma solidity ^0.5.0; import "../ModuleFactory.sol"; import "../../proxy/ManualApprovalTransferManagerProxy.sol"; @@ -17,8 +17,14 @@ contract ManualApprovalTransferManagerFactory is ModuleFactory { * @param _subscriptionCost Subscription cost of the module * @param _logicContract Contract address that contains the logic related to `description` */ - constructor (uint256 _setupCost, uint256 _usageCost, uint256 _subscriptionCost, address _logicContract) public - ModuleFactory(_setupCost, _usageCost, _subscriptionCost) + constructor( + uint256 _setupCost, + uint256 _usageCost, + uint256 _subscriptionCost, + address _logicContract + ) + public + ModuleFactory(_setupCost, _usageCost, _subscriptionCost) { require(_logicContract != address(0), "Invalid address"); version = "2.0.1"; @@ -30,13 +36,18 @@ contract ManualApprovalTransferManagerFactory is ModuleFactory { logicContract = _logicContract; } - /** + /** * @notice used to launch the Module with the help of factory * @return address Contract address of the Module */ - function deploy(bytes /* _data */) external returns(address) { + function deploy( + bytes calldata /* _data */ + ) + external + returns(address) + { address polyToken = _takeFee(); - address manualTransferManager = new ManualApprovalTransferManagerProxy(msg.sender, polyToken, logicContract); + ManualApprovalTransferManagerProxy manualTransferManager = new ManualApprovalTransferManagerProxy(msg.sender, polyToken, logicContract); /*solium-disable-next-line security/no-block-members*/ emit GenerateModuleFromFactory(address(manualTransferManager), getName(), address(this), msg.sender, setupCost, now); return address(manualTransferManager); @@ -45,7 +56,7 @@ contract ManualApprovalTransferManagerFactory is ModuleFactory { /** * @notice Type of the Module factory */ - function getTypes() external view returns(uint8[]) { + function getTypes() external view returns(uint8[] memory) { uint8[] memory res = new uint8[](1); res[0] = 2; return res; @@ -54,7 +65,7 @@ contract ManualApprovalTransferManagerFactory is ModuleFactory { /** * @notice Returns the instructions associated with the module */ - function getInstructions() external view returns(string) { + function getInstructions() external view returns(string memory) { /*solium-disable-next-line max-len*/ return "Allows an issuer to set manual approvals or blocks for specific pairs of addresses and amounts. Init function takes no parameters."; } @@ -62,12 +73,11 @@ contract ManualApprovalTransferManagerFactory is ModuleFactory { /** * @notice Get the tags related to the module factory */ - function getTags() external view returns(bytes32[]) { + function getTags() external view returns(bytes32[] memory) { bytes32[] memory availableTags = new bytes32[](2); availableTags[0] = "ManualApproval"; availableTags[1] = "Transfer Restriction"; return availableTags; } - } diff --git a/contracts/modules/TransferManager/ManualApprovalTransferManagerStorage.sol b/contracts/modules/TransferManager/ManualApprovalTransferManagerStorage.sol index cc7e55d49..6f94fbac6 100644 --- a/contracts/modules/TransferManager/ManualApprovalTransferManagerStorage.sol +++ b/contracts/modules/TransferManager/ManualApprovalTransferManagerStorage.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.24; +pragma solidity ^0.5.0; /** * @title Contract used to store layout for the ManualApprovalTransferManager storage diff --git a/contracts/modules/TransferManager/PercentageTransferManager.sol b/contracts/modules/TransferManager/PercentageTransferManager.sol index 3fe58381e..43c4a6f61 100644 --- a/contracts/modules/TransferManager/PercentageTransferManager.sol +++ b/contracts/modules/TransferManager/PercentageTransferManager.sol @@ -5,7 +5,7 @@ * higher than the intended limit. */ -pragma solidity ^0.4.24; +pragma solidity ^0.5.0; import "./TransferManager.sol"; import "openzeppelin-solidity/contracts/math/SafeMath.sol"; @@ -18,22 +18,15 @@ contract PercentageTransferManager is PercentageTransferManagerStorage, Transfer using SafeMath for uint256; event ModifyHolderPercentage(uint256 _oldHolderPercentage, uint256 _newHolderPercentage); - event ModifyWhitelist( - address _investor, - uint256 _dateAdded, - address _addedBy, - bool _valid - ); + event ModifyWhitelist(address _investor, uint256 _dateAdded, address _addedBy, bool _valid); event SetAllowPrimaryIssuance(bool _allowPrimaryIssuance, uint256 _timestamp); /** * @notice Constructor * @param _securityToken Address of the security token */ - constructor (address _securityToken, address _polyToken) - public - Module(_securityToken, _polyToken) - { + constructor(address _securityToken, address _polyToken) public Module(_securityToken, _polyToken) { + } /** @notice Used to verify the transfer transaction and prevent a given account to end up with more tokens than allowed @@ -41,7 +34,16 @@ contract PercentageTransferManager is PercentageTransferManagerStorage, Transfer * @param _to Address of the receiver * @param _amount The amount of tokens to transfer */ - function verifyTransfer(address _from, address _to, uint256 _amount, bytes /* _data */, bool /* _isTransfer */) external returns(Result) { + function verifyTransfer( + address _from, + address _to, + uint256 _amount, + bytes calldata, /* _data */ + bool /* _isTransfer */ + ) + external + returns(Result) + { if (!paused) { if (_from == address(0) && allowPrimaryIssuance) { return Result.NA; @@ -51,7 +53,7 @@ contract PercentageTransferManager is PercentageTransferManagerStorage, Transfer return Result.NA; } uint256 newBalance = ISecurityToken(securityToken).balanceOf(_to).add(_amount); - if (newBalance.mul(uint256(10)**18).div(ISecurityToken(securityToken).totalSupply()) > maxHolderPercentage) { + if (newBalance.mul(uint256(10) ** 18).div(ISecurityToken(securityToken).totalSupply()) > maxHolderPercentage) { return Result.INVALID; } return Result.NA; @@ -71,7 +73,7 @@ contract PercentageTransferManager is PercentageTransferManagerStorage, Transfer /** * @notice This function returns the signature of configure function */ - function getInitFunction() public pure returns (bytes4) { + function getInitFunction() public pure returns(bytes4) { return bytes4(keccak256("configure(uint256,bool)")); } @@ -100,7 +102,7 @@ contract PercentageTransferManager is PercentageTransferManagerStorage, Transfer * @param _investors Array of the addresses to whitelist * @param _valids Array of boolean value to decide whether or not the address it to be added or removed from the whitelist */ - function modifyWhitelistMulti(address[] _investors, bool[] _valids) public withPerm(WHITELIST) { + function modifyWhitelistMulti(address[] memory _investors, bool[] memory _valids) public withPerm(WHITELIST) { require(_investors.length == _valids.length, "Input array length mis-match"); for (uint i = 0; i < _investors.length; i++) { modifyWhitelist(_investors[i], _valids[i]); @@ -121,7 +123,7 @@ contract PercentageTransferManager is PercentageTransferManagerStorage, Transfer /** * @notice Return the permissions flag that are associated with Percentage transfer Manager */ - function getPermissions() public view returns(bytes32[]) { + function getPermissions() public view returns(bytes32[] memory) { bytes32[] memory allPermissions = new bytes32[](2); allPermissions[0] = WHITELIST; allPermissions[1] = ADMIN; diff --git a/contracts/modules/TransferManager/PercentageTransferManagerFactory.sol b/contracts/modules/TransferManager/PercentageTransferManagerFactory.sol index cecc759f7..4bed16c4d 100644 --- a/contracts/modules/TransferManager/PercentageTransferManagerFactory.sol +++ b/contracts/modules/TransferManager/PercentageTransferManagerFactory.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.24; +pragma solidity ^0.5.0; import "../ModuleFactory.sol"; import "../../libraries/Util.sol"; @@ -19,8 +19,14 @@ contract PercentageTransferManagerFactory is ModuleFactory { * @param _subscriptionCost Subscription cost of the module * @param _logicContract Contract address that contains the logic related to `description` */ - constructor (uint256 _setupCost, uint256 _usageCost, uint256 _subscriptionCost, address _logicContract) public - ModuleFactory(_setupCost, _usageCost, _subscriptionCost) + constructor( + uint256 _setupCost, + uint256 _usageCost, + uint256 _subscriptionCost, + address _logicContract + ) + public + ModuleFactory(_setupCost, _usageCost, _subscriptionCost) { require(_logicContract != address(0), "Invalid address"); version = "1.0.0"; @@ -37,15 +43,17 @@ contract PercentageTransferManagerFactory is ModuleFactory { * @param _data Data used for the intialization of the module factory variables * @return address Contract address of the Module */ - function deploy(bytes _data) external returns(address) { + function deploy(bytes calldata _data) external returns(address) { address polyToken = _takeFee(); - PercentageTransferManagerProxy percentageTransferManager = new PercentageTransferManagerProxy(msg.sender, polyToken, logicContract); + address percentageTransferManager = address(new PercentageTransferManagerProxy(msg.sender, polyToken, logicContract)); require(Util.getSig(_data) == IBoot(percentageTransferManager).getInitFunction(), "Provided data is not valid"); + bool success; /*solium-disable-next-line security/no-low-level-calls*/ - require(address(percentageTransferManager).call(_data), "Unsuccessful call"); + (success, ) = percentageTransferManager.call(_data); + require(success, "Unsuccessful call"); /*solium-disable-next-line security/no-block-members*/ - emit GenerateModuleFromFactory(address(percentageTransferManager), getName(), address(this), msg.sender, setupCost, now); - return address(percentageTransferManager); + emit GenerateModuleFromFactory(percentageTransferManager, getName(), address(this), msg.sender, setupCost, now); + return percentageTransferManager; } @@ -53,7 +61,7 @@ contract PercentageTransferManagerFactory is ModuleFactory { * @notice Type of the Module factory * @return uint8 */ - function getTypes() external view returns(uint8[]) { + function getTypes() external view returns(uint8[] memory) { uint8[] memory res = new uint8[](1); res[0] = 2; return res; @@ -62,14 +70,14 @@ contract PercentageTransferManagerFactory is ModuleFactory { /** * @notice Returns the instructions associated with the module */ - function getInstructions() external view returns(string) { + function getInstructions() external view returns(string memory) { return "Allows an issuer to restrict the total number of non-zero token holders"; } /** * @notice Get the tags related to the module factory */ - function getTags() external view returns(bytes32[]) { + function getTags() external view returns(bytes32[] memory) { bytes32[] memory availableTags = new bytes32[](2); availableTags[0] = "Percentage"; availableTags[1] = "Transfer Restriction"; diff --git a/contracts/modules/TransferManager/PercentageTransferManagerStorage.sol b/contracts/modules/TransferManager/PercentageTransferManagerStorage.sol index 4656b200a..f2db59690 100644 --- a/contracts/modules/TransferManager/PercentageTransferManagerStorage.sol +++ b/contracts/modules/TransferManager/PercentageTransferManagerStorage.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.24; +pragma solidity ^0.5.0; /** * @title Contract used to store layout for the PercentageTransferManager storage diff --git a/contracts/modules/TransferManager/TransferManager.sol b/contracts/modules/TransferManager/TransferManager.sol index 5d8cde83d..dd93f5c25 100644 --- a/contracts/modules/TransferManager/TransferManager.sol +++ b/contracts/modules/TransferManager/TransferManager.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.24; +pragma solidity ^0.5.0; import "../../Pausable.sol"; import "../Module.sol"; @@ -8,7 +8,6 @@ import "../../interfaces/ITransferManager.sol"; * @title Base abstract contract to be implemented by all Transfer Manager modules */ contract TransferManager is ITransferManager, TransferManagerEnums, Module, Pausable { - function unpause() public onlyOwner { super._unpause(); } diff --git a/contracts/oracles/MakerDAOOracle.sol b/contracts/oracles/MakerDAOOracle.sol index 51773cd7d..85da5d7b6 100644 --- a/contracts/oracles/MakerDAOOracle.sol +++ b/contracts/oracles/MakerDAOOracle.sol @@ -1,11 +1,10 @@ -pragma solidity ^0.4.24; +pragma solidity ^0.5.0; import "../interfaces/IOracle.sol"; import "../external/IMedianizer.sol"; import "openzeppelin-solidity/contracts/ownership/Ownable.sol"; contract MakerDAOOracle is IOracle, Ownable { - address public medianizer; address public currencyAddress; bytes32 public currencySymbol; @@ -24,7 +23,7 @@ contract MakerDAOOracle is IOracle, Ownable { * @param _currencyAddress Address of currency (0x0 for ETH) * @param _currencySymbol Symbol of currency */ - constructor (address _medianizer, address _currencyAddress, bytes32 _currencySymbol) public { + constructor(address _medianizer, address _currencyAddress, bytes32 _currencySymbol) public { medianizer = _medianizer; currencyAddress = _currencyAddress; currencySymbol = _currencySymbol; diff --git a/contracts/oracles/PolyOracle.sol b/contracts/oracles/PolyOracle.sol index 45f068a3e..f25cd7971 100644 --- a/contracts/oracles/PolyOracle.sol +++ b/contracts/oracles/PolyOracle.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.24; +pragma solidity ^0.5.0; import "../external/oraclizeAPI.sol"; import "openzeppelin-solidity/contracts/ownership/Ownable.sol"; @@ -11,7 +11,7 @@ contract PolyOracle is usingOraclize, IOracle, Ownable { /*solium-disable-next-line max-len*/ string public oracleURL = "[URL] json(https://pro-api.coinmarketcap.com/v1/cryptocurrency/quotes/latest?id=2496&convert=USD&CMC_PRO_API_KEY=${[decrypt] BCA0Bqxmn3jkSENepaHxQv09Z/vGdEO9apO+B9RplHyV3qOL/dw5Indlei3hoXrGk9G14My8MFpHJycB7UoVnl+4mlzEsjTlS2UBAYVrl0fAepfiSyM30/GMZAoJmDagY+0YyNZvpkgXn86Q/59Bi48PWEet}).data.\"2496\".quote.USD.price"; string public oracleQueryType = "nested"; - uint256 public sanityBounds = 20*10**16; + uint256 public sanityBounds = 20 * 10 ** 16; uint256 public gasLimit = 100000; uint256 public oraclizeTimeTolerance = 5 minutes; uint256 public staleTime = 6 hours; @@ -20,10 +20,10 @@ contract PolyOracle is usingOraclize, IOracle, Ownable { uint256 public latestUpdate; uint256 public latestScheduledUpdate; - mapping (bytes32 => uint256) public requestIds; - mapping (bytes32 => bool) public ignoreRequestIds; + mapping(bytes32 => uint256) public requestIds; + mapping(bytes32 => bool) public ignoreRequestIds; - mapping (address => bool) public admin; + mapping(address => bool) public admin; bool public freezeOracle; @@ -32,7 +32,7 @@ contract PolyOracle is usingOraclize, IOracle, Ownable { event AdminSet(address _admin, bool _valid, uint256 _time); event StalePriceUpdate(bytes32 _queryId, uint256 _time, string _result); - modifier isAdminOrOwner { + modifier isAdminOrOwner() { require(admin[msg.sender] || msg.sender == owner(), "Address is not admin or owner"); _; } @@ -40,9 +40,9 @@ contract PolyOracle is usingOraclize, IOracle, Ownable { /** * @notice Constructor - accepts ETH to initialise a balance for subsequent Oraclize queries */ - constructor() payable public { + constructor() public payable { // Use 50 gwei for now - oraclize_setCustomGasPrice(50*10**9); + oraclize_setCustomGasPrice(50 * 10 ** 9); } /** @@ -50,7 +50,7 @@ contract PolyOracle is usingOraclize, IOracle, Ownable { * @param _requestId requestId corresponding to Oraclize query * @param _result data returned by Oraclize URL query */ - function __callback(bytes32 _requestId, string _result) public { + function __callback(bytes32 _requestId, string memory _result) public { require(msg.sender == oraclize_cbAddress(), "Only Oraclize can access this method"); require(!freezeOracle, "Oracle is frozen"); require(!ignoreRequestIds[_requestId], "Ignoring requestId"); @@ -63,7 +63,7 @@ contract PolyOracle is usingOraclize, IOracle, Ownable { /*solium-disable-next-line security/no-block-members*/ require(requestIds[_requestId] <= now + oraclizeTimeTolerance, "Result is early"); uint256 newPOLYUSD = parseInt(_result, 18); - uint256 bound = POLYUSD.mul(sanityBounds).div(10**18); + uint256 bound = POLYUSD.mul(sanityBounds).div(10 ** 18); if (latestUpdate != 0) { require(newPOLYUSD <= POLYUSD.add(bound), "Result is too large"); require(newPOLYUSD >= POLYUSD.sub(bound), "Result is too small"); @@ -77,7 +77,7 @@ contract PolyOracle is usingOraclize, IOracle, Ownable { * @notice Allows owner to schedule future Oraclize calls * @param _times UNIX timestamps to schedule Oraclize calls as of. Empty list means trigger an immediate query. */ - function schedulePriceUpdatesFixed(uint256[] _times) public payable isAdminOrOwner { + function schedulePriceUpdatesFixed(uint256[] memory _times) public payable isAdminOrOwner { bytes32 requestId; uint256 maximumScheduledUpdated; if (_times.length == 0) { @@ -155,7 +155,7 @@ contract PolyOracle is usingOraclize, IOracle, Ownable { * @notice Allows owner to set URL used in Oraclize queries * @param _oracleURL URL to use */ - function setOracleURL(string _oracleURL) public onlyOwner { + function setOracleURL(string memory _oracleURL) public onlyOwner { oracleURL = _oracleURL; } @@ -163,7 +163,7 @@ contract PolyOracle is usingOraclize, IOracle, Ownable { * @notice Allows owner to set type used in Oraclize queries * @param _oracleQueryType to use */ - function setOracleQueryType(string _oracleQueryType) public onlyOwner { + function setOracleQueryType(string memory _oracleQueryType) public onlyOwner { oracleQueryType = _oracleQueryType; } @@ -215,7 +215,7 @@ contract PolyOracle is usingOraclize, IOracle, Ownable { * @param _requestIds Oraclize queryIds (as logged out when Oraclize query is scheduled) * @param _ignore whether or not they should be ignored */ - function setIgnoreRequestIds(bytes32[] _requestIds, bool[] _ignore) public onlyOwner { + function setIgnoreRequestIds(bytes32[] memory _requestIds, bool[] memory _ignore) public onlyOwner { require(_requestIds.length == _ignore.length, "Incorrect parameter lengths"); for (uint256 i = 0; i < _requestIds.length; i++) { ignoreRequestIds[_requestIds[i]] = _ignore[i]; diff --git a/contracts/proxy/CappedSTOProxy.sol b/contracts/proxy/CappedSTOProxy.sol index 90084e5dc..1dc3604af 100644 --- a/contracts/proxy/CappedSTOProxy.sol +++ b/contracts/proxy/CappedSTOProxy.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.24; +pragma solidity ^0.5.0; import "./OwnedProxy.sol"; import "../Pausable.sol"; @@ -18,9 +18,13 @@ contract CappedSTOProxy is CappedSTOStorage, STOStorage, ModuleStorage, Pausable * @param _polyAddress Address of the polytoken * @param _implementation representing the address of the new implementation to be set */ - constructor (address _securityToken, address _polyAddress, address _implementation) - public - ModuleStorage(_securityToken, _polyAddress) + constructor( + address _securityToken, + address _polyAddress, + address _implementation + ) + public + ModuleStorage(_securityToken, _polyAddress) { require( _implementation != address(0), diff --git a/contracts/proxy/CountTransferManagerProxy.sol b/contracts/proxy/CountTransferManagerProxy.sol index 2c030ba89..f91c32646 100644 --- a/contracts/proxy/CountTransferManagerProxy.sol +++ b/contracts/proxy/CountTransferManagerProxy.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.24; +pragma solidity ^0.5.0; import "../modules/TransferManager/CountTransferManagerStorage.sol"; import "./OwnedProxy.sol"; @@ -16,9 +16,13 @@ contract CountTransferManagerProxy is CountTransferManagerStorage, ModuleStorage * @param _polyAddress Address of the polytoken * @param _implementation representing the address of the new implementation to be set */ - constructor (address _securityToken, address _polyAddress, address _implementation) - public - ModuleStorage(_securityToken, _polyAddress) + constructor ( + address _securityToken, + address _polyAddress, + address _implementation + ) + public + ModuleStorage(_securityToken, _polyAddress) { require( _implementation != address(0), diff --git a/contracts/proxy/DummySTOProxy.sol b/contracts/proxy/DummySTOProxy.sol index 8ff44a887..71873c4d6 100644 --- a/contracts/proxy/DummySTOProxy.sol +++ b/contracts/proxy/DummySTOProxy.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.24; +pragma solidity ^0.5.0; import "./OwnedProxy.sol"; import "../Pausable.sol"; @@ -18,9 +18,13 @@ contract DummySTOProxy is DummySTOStorage, STOStorage, ModuleStorage, Pausable, * @param _polyAddress Address of the polytoken * @param _implementation representing the address of the new implementation to be set */ - constructor (address _securityToken, address _polyAddress, address _implementation) - public - ModuleStorage(_securityToken, _polyAddress) + constructor ( + address _securityToken, + address _polyAddress, + address _implementation + ) + public + ModuleStorage(_securityToken, _polyAddress) { require( _implementation != address(0), diff --git a/contracts/proxy/ERC20DividendCheckpointProxy.sol b/contracts/proxy/ERC20DividendCheckpointProxy.sol index 8839d30e1..efd4a1445 100644 --- a/contracts/proxy/ERC20DividendCheckpointProxy.sol +++ b/contracts/proxy/ERC20DividendCheckpointProxy.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.24; +pragma solidity ^0.5.0; import "../modules/Checkpoint/ERC20DividendCheckpointStorage.sol"; import "../modules/Checkpoint/DividendCheckpointStorage.sol"; @@ -10,21 +10,21 @@ import "../modules/ModuleStorage.sol"; * @title Transfer Manager module for core transfer validation functionality */ contract ERC20DividendCheckpointProxy is ERC20DividendCheckpointStorage, DividendCheckpointStorage, ModuleStorage, Pausable, OwnedProxy { - /** * @notice Constructor * @param _securityToken Address of the security token * @param _polyAddress Address of the polytoken * @param _implementation representing the address of the new implementation to be set */ - constructor (address _securityToken, address _polyAddress, address _implementation) - public - ModuleStorage(_securityToken, _polyAddress) + constructor( + address _securityToken, + address _polyAddress, + address _implementation + ) + public + ModuleStorage(_securityToken, _polyAddress) { - require( - _implementation != address(0), - "Implementation address should not be 0x" - ); + require(_implementation != address(0), "Implementation address should not be 0x"); __implementation = _implementation; } diff --git a/contracts/proxy/EtherDividendCheckpointProxy.sol b/contracts/proxy/EtherDividendCheckpointProxy.sol index 40b1c1332..e03ccbbad 100644 --- a/contracts/proxy/EtherDividendCheckpointProxy.sol +++ b/contracts/proxy/EtherDividendCheckpointProxy.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.24; +pragma solidity ^0.5.0; import "../modules/Checkpoint/DividendCheckpointStorage.sol"; import "./OwnedProxy.sol"; @@ -9,21 +9,21 @@ import "../modules/ModuleStorage.sol"; * @title Transfer Manager module for core transfer validation functionality */ contract EtherDividendCheckpointProxy is DividendCheckpointStorage, ModuleStorage, Pausable, OwnedProxy { - /** * @notice Constructor * @param _securityToken Address of the security token * @param _polyAddress Address of the polytoken * @param _implementation representing the address of the new implementation to be set */ - constructor (address _securityToken, address _polyAddress, address _implementation) - public - ModuleStorage(_securityToken, _polyAddress) + constructor ( + address _securityToken, + address _polyAddress, + address _implementation + ) + public + ModuleStorage(_securityToken, _polyAddress) { - require( - _implementation != address(0), - "Implementation address should not be 0x" - ); + require(_implementation != address(0), "Implementation address should not be 0x"); __implementation = _implementation; } diff --git a/contracts/proxy/GeneralPermissionManagerProxy.sol b/contracts/proxy/GeneralPermissionManagerProxy.sol index 8fff0061b..6273cf874 100644 --- a/contracts/proxy/GeneralPermissionManagerProxy.sol +++ b/contracts/proxy/GeneralPermissionManagerProxy.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.24; +pragma solidity ^0.5.0; import "./OwnedProxy.sol"; import "../Pausable.sol"; @@ -18,9 +18,13 @@ contract GeneralPermissionManagerProxy is GeneralPermissionManagerStorage, Modul * @param _polyAddress Address of the polytoken * @param _implementation representing the address of the new implementation to be set */ - constructor (address _securityToken, address _polyAddress, address _implementation) - public - ModuleStorage(_securityToken, _polyAddress) + constructor ( + address _securityToken, + address _polyAddress, + address _implementation + ) + public + ModuleStorage(_securityToken, _polyAddress) { require( _implementation != address(0), diff --git a/contracts/proxy/GeneralTransferManagerProxy.sol b/contracts/proxy/GeneralTransferManagerProxy.sol index cb9b69070..c8c8ddcc1 100644 --- a/contracts/proxy/GeneralTransferManagerProxy.sol +++ b/contracts/proxy/GeneralTransferManagerProxy.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.24; +pragma solidity ^0.5.0; import "../modules/TransferManager/GeneralTransferManagerStorage.sol"; import "./OwnedProxy.sol"; @@ -9,21 +9,21 @@ import "../modules/ModuleStorage.sol"; * @title Transfer Manager module for core transfer validation functionality */ contract GeneralTransferManagerProxy is GeneralTransferManagerStorage, ModuleStorage, Pausable, OwnedProxy { - /** * @notice Constructor * @param _securityToken Address of the security token * @param _polyAddress Address of the polytoken * @param _implementation representing the address of the new implementation to be set */ - constructor (address _securityToken, address _polyAddress, address _implementation) - public - ModuleStorage(_securityToken, _polyAddress) + constructor( + address _securityToken, + address _polyAddress, + address _implementation + ) + public + ModuleStorage(_securityToken, _polyAddress) { - require( - _implementation != address(0), - "Implementation address should not be 0x" - ); + require(_implementation != address(0), "Implementation address should not be 0x"); __implementation = _implementation; } diff --git a/contracts/proxy/ManualApprovalTransferManagerProxy.sol b/contracts/proxy/ManualApprovalTransferManagerProxy.sol index 366298d59..e3b4f6bc0 100644 --- a/contracts/proxy/ManualApprovalTransferManagerProxy.sol +++ b/contracts/proxy/ManualApprovalTransferManagerProxy.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.24; +pragma solidity ^0.5.0; import "../modules/TransferManager/ManualApprovalTransferManagerStorage.sol"; import "./OwnedProxy.sol"; @@ -16,9 +16,13 @@ contract ManualApprovalTransferManagerProxy is ManualApprovalTransferManagerStor * @param _polyAddress Address of the polytoken * @param _implementation representing the address of the new implementation to be set */ - constructor (address _securityToken, address _polyAddress, address _implementation) - public - ModuleStorage(_securityToken, _polyAddress) + constructor ( + address _securityToken, + address _polyAddress, + address _implementation + ) + public + ModuleStorage(_securityToken, _polyAddress) { require( _implementation != address(0), diff --git a/contracts/proxy/ModuleRegistryProxy.sol b/contracts/proxy/ModuleRegistryProxy.sol index aea5a70c5..168905a56 100644 --- a/contracts/proxy/ModuleRegistryProxy.sol +++ b/contracts/proxy/ModuleRegistryProxy.sol @@ -1,9 +1,8 @@ -pragma solidity ^0.4.24; +pragma solidity ^0.5.0; import "../storage/EternalStorage.sol"; import "./OwnedUpgradeabilityProxy.sol"; - /** * @title ModuleRegistryProxy * @dev This proxy holds the storage of the ModuleRegistry contract and delegates every call to the current implementation set. @@ -13,4 +12,4 @@ import "./OwnedUpgradeabilityProxy.sol"; /*solium-disable-next-line no-empty-blocks*/ contract ModuleRegistryProxy is EternalStorage, OwnedUpgradeabilityProxy { -} \ No newline at end of file +} diff --git a/contracts/proxy/OwnedProxy.sol b/contracts/proxy/OwnedProxy.sol index b75142fbe..efadc00cf 100644 --- a/contracts/proxy/OwnedProxy.sol +++ b/contracts/proxy/OwnedProxy.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.18; +pragma solidity ^0.5.0; import "./Proxy.sol"; @@ -7,7 +7,6 @@ import "./Proxy.sol"; * @dev This contract combines an upgradeability proxy with basic authorization control functionalities */ contract OwnedProxy is Proxy { - // Owner of the contract address private __owner; @@ -43,7 +42,7 @@ contract OwnedProxy is Proxy { * @dev Tells the address of the owner * @return the address of the owner */ - function _owner() internal view returns (address) { + function _owner() internal view returns(address) { return __owner; } @@ -58,7 +57,7 @@ contract OwnedProxy is Proxy { /** * @notice Internal function to provide the address of the implementation contract */ - function _implementation() internal view returns (address) { + function _implementation() internal view returns(address) { return __implementation; } @@ -66,7 +65,7 @@ contract OwnedProxy is Proxy { * @dev Tells the address of the proxy owner * @return the address of the proxy owner */ - function proxyOwner() external ifOwner returns (address) { + function proxyOwner() external ifOwner returns(address) { return _owner(); } @@ -74,7 +73,7 @@ contract OwnedProxy is Proxy { * @dev Tells the address of the current implementation * @return address of the current implementation */ - function implementation() external ifOwner returns (address) { + function implementation() external ifOwner returns(address) { return _implementation(); } diff --git a/contracts/proxy/OwnedUpgradeabilityProxy.sol b/contracts/proxy/OwnedUpgradeabilityProxy.sol index 7ec520630..314dc23cb 100644 --- a/contracts/proxy/OwnedUpgradeabilityProxy.sol +++ b/contracts/proxy/OwnedUpgradeabilityProxy.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.18; +pragma solidity ^0.5.0; import "./UpgradeabilityProxy.sol"; @@ -7,7 +7,6 @@ import "./UpgradeabilityProxy.sol"; * @dev This contract combines an upgradeability proxy with basic authorization control functionalities */ contract OwnedUpgradeabilityProxy is UpgradeabilityProxy { - // Owner of the contract address private __upgradeabilityOwner; @@ -40,7 +39,7 @@ contract OwnedUpgradeabilityProxy is UpgradeabilityProxy { * @dev Tells the address of the owner * @return the address of the owner */ - function _upgradeabilityOwner() internal view returns (address) { + function _upgradeabilityOwner() internal view returns(address) { return __upgradeabilityOwner; } @@ -55,7 +54,7 @@ contract OwnedUpgradeabilityProxy is UpgradeabilityProxy { /** * @notice Internal function to provide the address of the implementation contract */ - function _implementation() internal view returns (address) { + function _implementation() internal view returns(address) { return __implementation; } @@ -63,7 +62,7 @@ contract OwnedUpgradeabilityProxy is UpgradeabilityProxy { * @dev Tells the address of the proxy owner * @return the address of the proxy owner */ - function proxyOwner() external ifOwner returns (address) { + function proxyOwner() external ifOwner returns(address) { return _upgradeabilityOwner(); } @@ -71,7 +70,7 @@ contract OwnedUpgradeabilityProxy is UpgradeabilityProxy { * @dev Tells the version name of the current implementation * @return string representing the name of the current version */ - function version() external ifOwner returns (string) { + function version() external ifOwner returns(string memory) { return __version; } @@ -79,7 +78,7 @@ contract OwnedUpgradeabilityProxy is UpgradeabilityProxy { * @dev Tells the address of the current implementation * @return address of the current implementation */ - function implementation() external ifOwner returns (address) { + function implementation() external ifOwner returns(address) { return _implementation(); } @@ -98,7 +97,7 @@ contract OwnedUpgradeabilityProxy is UpgradeabilityProxy { * @param _newVersion representing the version name of the new implementation to be set. * @param _newImplementation representing the address of the new implementation to be set. */ - function upgradeTo(string _newVersion, address _newImplementation) external ifOwner { + function upgradeTo(string calldata _newVersion, address _newImplementation) external ifOwner { _upgradeTo(_newVersion, _newImplementation); } @@ -110,10 +109,12 @@ contract OwnedUpgradeabilityProxy is UpgradeabilityProxy { * @param _data represents the msg.data to bet sent in the low level call. This parameter may include the function * signature of the implementation to be called with the needed payload */ - function upgradeToAndCall(string _newVersion, address _newImplementation, bytes _data) external payable ifOwner { + function upgradeToAndCall(string calldata _newVersion, address _newImplementation, bytes calldata _data) external payable ifOwner { _upgradeTo(_newVersion, _newImplementation); + bool success; /*solium-disable-next-line security/no-call-value*/ - require(address(this).call.value(msg.value)(_data), "Fail in executing the function of implementation contract"); + (success, ) = address(this).call.value(msg.value)(_data); + require(success, "Fail in executing the function of implementation contract"); } } diff --git a/contracts/proxy/PercentageTransferManagerProxy.sol b/contracts/proxy/PercentageTransferManagerProxy.sol index c5c93560f..6c85d0f5f 100644 --- a/contracts/proxy/PercentageTransferManagerProxy.sol +++ b/contracts/proxy/PercentageTransferManagerProxy.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.24; +pragma solidity ^0.5.0; import "../modules/TransferManager/PercentageTransferManagerStorage.sol"; import "./OwnedProxy.sol"; diff --git a/contracts/proxy/PreSaleSTOProxy.sol b/contracts/proxy/PreSaleSTOProxy.sol index 895cf3fdf..2753ec3b9 100644 --- a/contracts/proxy/PreSaleSTOProxy.sol +++ b/contracts/proxy/PreSaleSTOProxy.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.24; +pragma solidity ^0.5.0; import "./OwnedProxy.sol"; import "../Pausable.sol"; diff --git a/contracts/proxy/Proxy.sol b/contracts/proxy/Proxy.sol index 6cfbce44f..ac9d471ca 100644 --- a/contracts/proxy/Proxy.sol +++ b/contracts/proxy/Proxy.sol @@ -1,16 +1,15 @@ -pragma solidity ^0.4.24; +pragma solidity ^0.5.0; /** * @title Proxy * @dev Gives the possibility to delegate any call to a foreign implementation. */ contract Proxy { - /** * @dev Tells the address of the implementation where every call will be delegated. * @return address of the implementation to which it will be delegated */ - function _implementation() internal view returns (address); + function _implementation() internal view returns(address); /** * @dev Fallback function. @@ -31,14 +30,11 @@ contract Proxy { // block because it will not return to Solidity code. We overwrite the // Solidity scratch pad at memory position 0. calldatacopy(0, 0, calldatasize) - // Call the implementation. // out and outsize are 0 because we don't know the size yet. let result := delegatecall(gas, implementation, 0, calldatasize, 0, 0) - // Copy the returned data. returndatacopy(0, 0, returndatasize) - switch result // delegatecall returns 0 on error. case 0 { revert(0, returndatasize) } @@ -46,7 +42,7 @@ contract Proxy { } } - function () public payable { + function() external payable { _fallback(); } -} \ No newline at end of file +} diff --git a/contracts/proxy/SecurityTokenRegistryProxy.sol b/contracts/proxy/SecurityTokenRegistryProxy.sol index 6acc6e38f..906797985 100644 --- a/contracts/proxy/SecurityTokenRegistryProxy.sol +++ b/contracts/proxy/SecurityTokenRegistryProxy.sol @@ -1,9 +1,8 @@ -pragma solidity ^0.4.24; +pragma solidity ^0.5.0; import "../storage/EternalStorage.sol"; import "./OwnedUpgradeabilityProxy.sol"; - /** * @title SecurityTokenRegistryProxy * @dev This proxy holds the storage of the SecurityTokenRegistry contract and delegates every call to the current implementation set. @@ -13,4 +12,4 @@ import "./OwnedUpgradeabilityProxy.sol"; /*solium-disable-next-line no-empty-blocks*/ contract SecurityTokenRegistryProxy is EternalStorage, OwnedUpgradeabilityProxy { -} \ No newline at end of file +} diff --git a/contracts/proxy/USDTieredSTOProxy.sol b/contracts/proxy/USDTieredSTOProxy.sol index 6df4c8cf4..290cea83d 100644 --- a/contracts/proxy/USDTieredSTOProxy.sol +++ b/contracts/proxy/USDTieredSTOProxy.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.24; +pragma solidity ^0.5.0; import "../modules/STO/USDTieredSTOStorage.sol"; import "./OwnedProxy.sol"; @@ -11,21 +11,14 @@ import "../modules/ModuleStorage.sol"; * @title USDTiered STO module Proxy */ contract USDTieredSTOProxy is USDTieredSTOStorage, STOStorage, ModuleStorage, Pausable, ReentrancyGuard, OwnedProxy { - /** * @notice Constructor * @param _securityToken Address of the security token * @param _polyAddress Address of the polytoken * @param _implementation representing the address of the new implementation to be set */ - constructor (address _securityToken, address _polyAddress, address _implementation) - public - ModuleStorage(_securityToken, _polyAddress) - { - require( - _implementation != address(0), - "Implementation address should not be 0x" - ); + constructor(address _securityToken, address _polyAddress, address _implementation) public ModuleStorage(_securityToken, _polyAddress) { + require(_implementation != address(0), "Implementation address should not be 0x"); __implementation = _implementation; } diff --git a/contracts/proxy/UpgradeabilityProxy.sol b/contracts/proxy/UpgradeabilityProxy.sol index 37b64af3e..dc702dae9 100644 --- a/contracts/proxy/UpgradeabilityProxy.sol +++ b/contracts/proxy/UpgradeabilityProxy.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.24; +pragma solidity ^0.5.0; import "./Proxy.sol"; import "openzeppelin-solidity/contracts/utils/Address.sol"; @@ -8,7 +8,6 @@ import "openzeppelin-solidity/contracts/utils/Address.sol"; * @dev This contract represents a proxy where the implementation address to which it will delegate can be upgraded */ contract UpgradeabilityProxy is Proxy { - // Version name of the current implementation string internal __version; @@ -27,7 +26,7 @@ contract UpgradeabilityProxy is Proxy { * @param _newVersion representing the version name of the new implementation to be set * @param _newImplementation representing the address of the new implementation to be set */ - function _upgradeTo(string _newVersion, address _newImplementation) internal { + function _upgradeTo(string memory _newVersion, address _newImplementation) internal { require( __implementation != _newImplementation && _newImplementation != address(0), "Old address is not allowed and implementation address should not be 0x" @@ -40,4 +39,4 @@ contract UpgradeabilityProxy is Proxy { emit Upgraded(_newVersion, _newImplementation); } -} \ No newline at end of file +} diff --git a/contracts/storage/EternalStorage.sol b/contracts/storage/EternalStorage.sol index 637b5f2f3..114f0125c 100644 --- a/contracts/storage/EternalStorage.sol +++ b/contracts/storage/EternalStorage.sol @@ -1,7 +1,6 @@ -pragma solidity ^0.4.24; +pragma solidity ^0.5.0; contract EternalStorage { - /// @notice Internal mappings used to store all kinds on data into the contract mapping(bytes32 => uint256) internal uintStorage; mapping(bytes32 => string) internal stringStorage; @@ -53,7 +52,7 @@ contract EternalStorage { bytes32Storage[_key] = _value; } - function set(bytes32 _key, string _value) internal { + function set(bytes32 _key, string memory _value) internal { stringStorage[_key] = _value; } @@ -69,27 +68,26 @@ contract EternalStorage { /// {uint256 date, string name, address owner} etc. /// string _name = getString(keccak256(abi.encodePacked("registeredSymbols_name", "TOKEN")); - function getBool(bytes32 _key) internal view returns (bool) { + function getBool(bytes32 _key) internal view returns(bool) { return boolStorage[_key]; } - function getUint(bytes32 _key) internal view returns (uint256) { + function getUint(bytes32 _key) internal view returns(uint256) { return uintStorage[_key]; } - function getAddress(bytes32 _key) internal view returns (address) { + function getAddress(bytes32 _key) internal view returns(address) { return addressStorage[_key]; } - function getString(bytes32 _key) internal view returns (string) { + function getString(bytes32 _key) internal view returns(string memory) { return stringStorage[_key]; } - function getBytes32(bytes32 _key) internal view returns (bytes32) { + function getBytes32(bytes32 _key) internal view returns(bytes32) { return bytes32Storage[_key]; } - //////////////////////////// // deleteArray functions //////////////////////////// @@ -99,7 +97,6 @@ contract EternalStorage { /// in this case we have the helper function deleteArrayBytes32() which will do it for us /// deleteArrayBytes32(keccak256(abi.encodePacked("tokensOwnedByOwner", 0x1), 3); -- it will delete the index 3 - //Deletes from mapping (bytes32 => array[]) at index _index function deleteArrayAddress(bytes32 _key, uint256 _index) internal { address[] storage array = addressArrayStorage[_key]; @@ -151,7 +148,7 @@ contract EternalStorage { bytes32ArrayStorage[_key].push(_value); } - function pushArray(bytes32 _key, string _value) internal { + function pushArray(bytes32 _key, string memory _value) internal { stringArrayStorage[_key].push(_value); } @@ -165,21 +162,21 @@ contract EternalStorage { /// @notice used to intialize the array /// Ex1- mapping (address => address[]) public reputation; /// reputation[0x1] = new address[](0); It can be replaced as - /// setArray(hash('reputation', 0x1), new address[](0)); - - function setArray(bytes32 _key, address[] _value) internal { + /// setArray(hash('reputation', 0x1), new address[](0)); + + function setArray(bytes32 _key, address[] memory _value) internal { addressArrayStorage[_key] = _value; } - function setArray(bytes32 _key, uint256[] _value) internal { + function setArray(bytes32 _key, uint256[] memory _value) internal { uintArrayStorage[_key] = _value; } - function setArray(bytes32 _key, bytes32[] _value) internal { + function setArray(bytes32 _key, bytes32[] memory _value) internal { bytes32ArrayStorage[_key] = _value; } - function setArray(bytes32 _key, string[] _value) internal { + function setArray(bytes32 _key, string[] memory _value) internal { stringArrayStorage[_key] = _value; } @@ -192,19 +189,19 @@ contract EternalStorage { /// Ex2- uint256 _len = tokensOwnedByOwner[0x1].length; replace with /// getArrayBytes32(keccak256(abi.encodePacked("tokensOwnedByOwner", 0x1)).length; - function getArrayAddress(bytes32 _key) internal view returns(address[]) { + function getArrayAddress(bytes32 _key) internal view returns(address[] memory) { return addressArrayStorage[_key]; } - function getArrayBytes32(bytes32 _key) internal view returns(bytes32[]) { + function getArrayBytes32(bytes32 _key) internal view returns(bytes32[] memory) { return bytes32ArrayStorage[_key]; } - function getArrayString(bytes32 _key) internal view returns(string[]) { + function getArrayString(bytes32 _key) internal view returns(string[] memory) { return stringArrayStorage[_key]; } - function getArrayUint(bytes32 _key) internal view returns(uint[]) { + function getArrayUint(bytes32 _key) internal view returns(uint[] memory) { return uintArrayStorage[_key]; } @@ -213,8 +210,8 @@ contract EternalStorage { /////////////////////////////////// /// @notice set the value of particular index of the address array /// Ex1- mapping(bytes32 => address[]) moduleList; - /// general way is -- moduleList[moduleType][index] = temp; - /// It can be re-write as -- setArrayIndexValue(keccak256(abi.encodePacked('moduleList', moduleType)), index, temp); + /// general way is -- moduleList[moduleType][index] = temp; + /// It can be re-write as -- setArrayIndexValue(keccak256(abi.encodePacked('moduleList', moduleType)), index, temp); function setArrayIndexValue(bytes32 _key, uint256 _index, address _value) internal { addressArrayStorage[_key][_index] = _value; @@ -228,13 +225,13 @@ contract EternalStorage { bytes32ArrayStorage[_key][_index] = _value; } - function setArrayIndexValue(bytes32 _key, uint256 _index, string _value) internal { + function setArrayIndexValue(bytes32 _key, uint256 _index, string memory _value) internal { stringArrayStorage[_key][_index] = _value; } - ///////////////////////////// - /// Public getters functions - ///////////////////////////// + ///////////////////////////// + /// Public getters functions + ///////////////////////////// function getUintValues(bytes32 _variable) public view returns(uint256) { return uintStorage[_variable]; @@ -244,7 +241,7 @@ contract EternalStorage { return boolStorage[_variable]; } - function getStringValues(bytes32 _variable) public view returns(string) { + function getStringValues(bytes32 _variable) public view returns(string memory) { return stringStorage[_variable]; } @@ -256,7 +253,7 @@ contract EternalStorage { return bytes32Storage[_variable]; } - function getBytesValues(bytes32 _variable) public view returns(bytes) { + function getBytesValues(bytes32 _variable) public view returns(bytes memory) { return bytesStorage[_variable]; } diff --git a/contracts/tokens/STFactory.sol b/contracts/tokens/STFactory.sol index 85153e816..702d118f8 100644 --- a/contracts/tokens/STFactory.sol +++ b/contracts/tokens/STFactory.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.24; +pragma solidity ^0.5.0; import "./SecurityToken.sol"; import "../interfaces/ISTFactory.sol"; @@ -7,10 +7,9 @@ import "../interfaces/ISTFactory.sol"; * @title Proxy for deploying SecurityToken instances */ contract STFactory is ISTFactory { - address public transferManagerFactory; - constructor (address _transferManagerFactory) public { + constructor(address _transferManagerFactory) public { transferManagerFactory = _transferManagerFactory; } @@ -19,24 +18,27 @@ contract STFactory is ISTFactory { * Future versions of the proxy can attach different modules or pass different parameters. */ function deployToken( - string _name, - string _symbol, + string calldata _name, + string calldata _symbol, uint8 _decimals, - string _tokenDetails, + string calldata _tokenDetails, address _issuer, bool _divisible, address _polymathRegistry - ) external returns (address) { - address newSecurityTokenAddress = new SecurityToken( + ) + external + returns(address) + { + SecurityToken newSecurityToken = new SecurityToken( _name, _symbol, _decimals, - _divisible ? 1 : uint256(10)**_decimals, + _divisible ? 1 : uint256(10) ** _decimals, _tokenDetails, _polymathRegistry ); - SecurityToken(newSecurityTokenAddress).addModule(transferManagerFactory, "", 0, 0); - SecurityToken(newSecurityTokenAddress).transferOwnership(_issuer); - return newSecurityTokenAddress; + newSecurityToken.addModule(transferManagerFactory, "", 0, 0); + newSecurityToken.transferOwnership(_issuer); + return address(newSecurityToken); } } diff --git a/contracts/tokens/SecurityToken.sol b/contracts/tokens/SecurityToken.sol index f3ecbdaa3..2979a6a5d 100644 --- a/contracts/tokens/SecurityToken.sol +++ b/contracts/tokens/SecurityToken.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.24; +pragma solidity ^0.5.0; import "openzeppelin-solidity/contracts/math/Math.sol"; import "../interfaces/IPoly.sol"; @@ -65,16 +65,16 @@ contract SecurityToken is ERC20, ERC20Detailed, ReentrancyGuard, RegistryUpdater address public controller; // Records added modules - module list should be order agnostic! - mapping (uint8 => address[]) modules; + mapping(uint8 => address[]) modules; // Records information about the module - mapping (address => TokenLib.ModuleData) modulesToData; + mapping(address => TokenLib.ModuleData) modulesToData; // Records added module names - module list should be order agnostic! - mapping (bytes32 => address[]) names; + mapping(bytes32 => address[]) names; // Map each investor to a series of checkpoints - mapping (address => TokenLib.Checkpoint[]) checkpointBalances; + mapping(address => TokenLib.Checkpoint[]) checkpointBalances; // List of checkpoints that relate to total supply TokenLib.Checkpoint[] checkpointTotalSupply; @@ -126,16 +126,10 @@ contract SecurityToken is ERC20, ERC20Detailed, ReentrancyGuard, RegistryUpdater bool _verifyTransfer, bytes _data ); - event ForceBurn( - address indexed _controller, - address indexed _from, - uint256 _value, - bool _verifyTransfer, - bytes _data - ); + event ForceBurn(address indexed _controller, address indexed _from, uint256 _value, bool _verifyTransfer, bytes _data); event DisableController(uint256 _timestamp); - function _isModule(address _module, uint8 _type) internal view returns (bool) { + function _isModule(address _module, uint8 _type) internal view returns(bool) { require(modulesToData[_module].module == _module, "Wrong address"); require(!modulesToData[_module].isArchived, "Module archived"); for (uint256 i = 0; i < modulesToData[_module].moduleTypes.length; i++) { @@ -172,7 +166,7 @@ contract SecurityToken is ERC20, ERC20Detailed, ReentrancyGuard, RegistryUpdater _; } - modifier isEnabled(string _nameKey) { + modifier isEnabled(string memory _nameKey) { require(IFeatureRegistry(featureRegistry).getFeatureStatus(_nameKey)); _; } @@ -195,23 +189,22 @@ contract SecurityToken is ERC20, ERC20Detailed, ReentrancyGuard, RegistryUpdater * @param _tokenDetails Details of the token that are stored off-chain * @param _polymathRegistry Contract address of the polymath registry */ - constructor ( - string _name, - string _symbol, + constructor( + string memory _name, + string memory _symbol, uint8 _decimals, uint256 _granularity, - string _tokenDetails, + string memory _tokenDetails, address _polymathRegistry - ) - public - ERC20Detailed(_name, _symbol, _decimals) - RegistryUpdater(_polymathRegistry) + ) + public + ERC20Detailed(_name, _symbol, _decimals) RegistryUpdater(_polymathRegistry) { //When it is created, the owner is the STR updateFromRegistry(); tokenDetails = _tokenDetails; granularity = _granularity; - securityTokenVersion = SemanticVersion(2,0,0); + securityTokenVersion = SemanticVersion(2, 0, 0); } /** @@ -226,11 +219,14 @@ contract SecurityToken is ERC20, ERC20Detailed, ReentrancyGuard, RegistryUpdater */ function addModuleWithLabel( address _moduleFactory, - bytes _data, + bytes memory _data, uint256 _maxCost, - uint256 _budget, + uint256 _budget, bytes32 _label - ) public onlyOwner nonReentrant { + ) + public + onlyOwner nonReentrant + { //Check that the module factory exists in the ModuleRegistry - will throw otherwise IModuleRegistry(moduleRegistry).useModule(_moduleFactory); IModuleFactory moduleFactory = IModuleFactory(_moduleFactory); @@ -253,7 +249,14 @@ contract SecurityToken is ERC20, ERC20Detailed, ReentrancyGuard, RegistryUpdater modules[moduleTypes[i]].push(module); } modulesToData[module] = TokenLib.ModuleData( - moduleName, module, _moduleFactory, false, moduleTypes, moduleIndexes, names[moduleName].length, _label + moduleName, + module, + _moduleFactory, + false, + moduleTypes, + moduleIndexes, + names[moduleName].length, + _label ); names[moduleName].push(module); //Emit log event @@ -264,12 +267,7 @@ contract SecurityToken is ERC20, ERC20Detailed, ReentrancyGuard, RegistryUpdater /** * @notice addModule function will call addModuleWithLabel() with an empty label for backward compatible */ - function addModule( - address _moduleFactory, - bytes _data, - uint256 _maxCost, - uint256 _budget - ) external { + function addModule(address _moduleFactory, bytes calldata _data, uint256 _maxCost, uint256 _budget) external { addModuleWithLabel(_moduleFactory, _data, _maxCost, _budget, ""); } @@ -294,46 +292,7 @@ contract SecurityToken is ERC20, ERC20Detailed, ReentrancyGuard, RegistryUpdater * @param _module address of module to unarchive */ function removeModule(address _module) external onlyOwner { - require(modulesToData[_module].isArchived, "Not archived"); - require(modulesToData[_module].module != address(0), "Module missing"); - /*solium-disable-next-line security/no-block-members*/ - emit ModuleRemoved(modulesToData[_module].moduleTypes, _module, now); - // Remove from module type list - uint8[] memory moduleTypes = modulesToData[_module].moduleTypes; - for (uint256 i = 0; i < moduleTypes.length; i++) { - _removeModuleWithIndex(moduleTypes[i], modulesToData[_module].moduleIndexes[i]); - /* modulesToData[_module].moduleType[moduleTypes[i]] = false; */ - } - // Remove from module names list - uint256 index = modulesToData[_module].nameIndex; - bytes32 name = modulesToData[_module].name; - uint256 length = names[name].length; - names[name][index] = names[name][length - 1]; - names[name].length = length - 1; - if ((length - 1) != index) { - modulesToData[names[name][index]].nameIndex = index; - } - // Remove from modulesToData - delete modulesToData[_module]; - } - - /** - * @notice Internal - Removes a module attached to the SecurityToken by index - */ - function _removeModuleWithIndex(uint8 _type, uint256 _index) internal { - uint256 length = modules[_type].length; - modules[_type][_index] = modules[_type][length - 1]; - modules[_type].length = length - 1; - - if ((length - 1) != _index) { - //Need to find index of _type in moduleTypes of module we are moving - uint8[] memory newTypes = modulesToData[modules[_type][_index]].moduleTypes; - for (uint256 i = 0; i < newTypes.length; i++) { - if (newTypes[i] == _type) { - modulesToData[modules[_type][_index]].moduleIndexes[i] = _index; - } - } - } + TokenLib.removeModule(_module, modules, modulesToData, names); } /** @@ -346,13 +305,8 @@ contract SecurityToken is ERC20, ERC20Detailed, ReentrancyGuard, RegistryUpdater * @return uint8 array of module types * @return bytes32 module label */ - function getModule(address _module) external view returns (bytes32, address, address, bool, uint8[], bytes32) { - return (modulesToData[_module].name, - modulesToData[_module].module, - modulesToData[_module].moduleFactory, - modulesToData[_module].isArchived, - modulesToData[_module].moduleTypes, - modulesToData[_module].label); + function getModule(address _module) external view returns(bytes32, address, address, bool, uint8[] memory, bytes32) { + return (modulesToData[_module].name, modulesToData[_module].module, modulesToData[_module].moduleFactory, modulesToData[_module].isArchived, modulesToData[_module].moduleTypes, modulesToData[_module].label); } /** @@ -360,7 +314,7 @@ contract SecurityToken is ERC20, ERC20Detailed, ReentrancyGuard, RegistryUpdater * @param _name name of the module * @return address[] list of modules with this name */ - function getModulesByName(bytes32 _name) external view returns (address[]) { + function getModulesByName(bytes32 _name) external view returns(address[] memory) { return names[_name]; } @@ -369,11 +323,11 @@ contract SecurityToken is ERC20, ERC20Detailed, ReentrancyGuard, RegistryUpdater * @param _type type of the module * @return address[] list of modules with this type */ - function getModulesByType(uint8 _type) external view returns (address[]) { + function getModulesByType(uint8 _type) external view returns(address[] memory) { return modules[_type]; } - /** + /** * @notice Allows the owner to withdraw unspent POLY stored by them on the ST or any ERC20 token. * @dev Owner can transfer POLY to the ST which will be used to pay for modules that require a POLY fee. * @param _tokenContract Address of the ERC20Basic compliance token @@ -392,24 +346,14 @@ contract SecurityToken is ERC20, ERC20Detailed, ReentrancyGuard, RegistryUpdater * @param _increase true if budget has to be increased, false if decrease */ function changeModuleBudget(address _module, uint256 _change, bool _increase) external onlyOwner { - require(modulesToData[_module].module != address(0), "Module missing"); - uint256 currentAllowance = IPoly(polyToken).allowance(address(this), _module); - uint256 newAllowance; - if (_increase) { - require(IPoly(polyToken).increaseApproval(_module, _change), "IncreaseApproval fail"); - newAllowance = currentAllowance.add(_change); - } else { - require(IPoly(polyToken).decreaseApproval(_module, _change), "Insufficient allowance"); - newAllowance = currentAllowance.sub(_change); - } - emit ModuleBudgetChanged(modulesToData[_module].moduleTypes, _module, currentAllowance, newAllowance); + TokenLib.changeModuleBudget(_module, _change, _increase, polyToken, modulesToData); } /** * @notice updates the tokenDetails associated with the token * @param _newTokenDetails New token details */ - function updateTokenDetails(string _newTokenDetails) external onlyOwner { + function updateTokenDetails(string calldata _newTokenDetails) external onlyOwner { emit UpdateTokenDetails(tokenDetails, _newTokenDetails); tokenDetails = _newTokenDetails; } @@ -439,7 +383,7 @@ contract SecurityToken is ERC20, ERC20Detailed, ReentrancyGuard, RegistryUpdater * NB - this length may differ from investorCount as it contains all investors that ever held tokens * @return list of addresses */ - function getInvestors() external view returns(address[]) { + function getInvestors() external view returns(address[] memory) { return investorData.investors; } @@ -449,7 +393,7 @@ contract SecurityToken is ERC20, ERC20Detailed, ReentrancyGuard, RegistryUpdater * @param _checkpointId Checkpoint id at which investor list is to be populated * @return list of investors */ - function getInvestorsAt(uint256 _checkpointId) external view returns(address[]) { + function getInvestorsAt(uint256 _checkpointId) external view returns(address[] memory) { uint256 count = 0; uint256 i; for (i = 0; i < investorData.investors.length; i++) { @@ -475,7 +419,7 @@ contract SecurityToken is ERC20, ERC20Detailed, ReentrancyGuard, RegistryUpdater * @param _end Position of investor to stop iteration at * @return list of investors */ - function iterateInvestors(uint256 _start, uint256 _end) external view returns(address[]) { + function iterateInvestors(uint256 _start, uint256 _end) external view returns(address[] memory) { require(_end <= investorData.investors.length, "Invalid end"); address[] memory investors = new address[](_end.sub(_start)); uint256 index = 0; @@ -535,7 +479,7 @@ contract SecurityToken is ERC20, ERC20Detailed, ReentrancyGuard, RegistryUpdater * @param _value value of transfer * @return bool success */ - function transfer(address _to, uint256 _value) public returns (bool success) { + function transfer(address _to, uint256 _value) public returns(bool success) { return transferWithData(_to, _value, ""); } @@ -546,7 +490,7 @@ contract SecurityToken is ERC20, ERC20Detailed, ReentrancyGuard, RegistryUpdater * @param _data data to indicate validation * @return bool success */ - function transferWithData(address _to, uint256 _value, bytes _data) public returns (bool success) { + function transferWithData(address _to, uint256 _value, bytes memory _data) public returns(bool success) { require(_updateTransfer(msg.sender, _to, _value, _data), "Transfer invalid"); require(super.transfer(_to, _value)); return true; @@ -571,7 +515,7 @@ contract SecurityToken is ERC20, ERC20Detailed, ReentrancyGuard, RegistryUpdater * @param _data data to indicate validation * @return bool success */ - function transferFromWithData(address _from, address _to, uint256 _value, bytes _data) public returns(bool) { + function transferFromWithData(address _from, address _to, uint256 _value, bytes memory _data) public returns(bool) { require(_updateTransfer(_from, _to, _value, _data), "Transfer invalid"); require(super.transferFrom(_from, _to, _value)); return true; @@ -585,7 +529,7 @@ contract SecurityToken is ERC20, ERC20Detailed, ReentrancyGuard, RegistryUpdater * @param _data data to indicate validation * @return bool success */ - function _updateTransfer(address _from, address _to, uint256 _value, bytes _data) internal nonReentrant returns(bool) { + function _updateTransfer(address _from, address _to, uint256 _value, bytes memory _data) internal nonReentrant returns(bool) { // NB - the ordering in this function implies the following: // - investor counts are updated before transfer managers are called - i.e. transfer managers will see //investor counts including the current transfer. @@ -618,9 +562,13 @@ contract SecurityToken is ERC20, ERC20Detailed, ReentrancyGuard, RegistryUpdater address _from, address _to, uint256 _value, - bytes _data, + bytes memory _data, bool _isTransfer - ) internal checkGranularity(_value) returns (bool) { + ) + internal + checkGranularity(_value) + returns(bool) + { if (!transfersFrozen) { bool isInvalid = false; bool isValid = false; @@ -656,7 +604,7 @@ contract SecurityToken is ERC20, ERC20Detailed, ReentrancyGuard, RegistryUpdater * @param _data data to indicate validation * @return bool */ - function verifyTransfer(address _from, address _to, uint256 _value, bytes _data) public returns (bool) { + function verifyTransfer(address _from, address _to, uint256 _value, bytes memory _data) public returns(bool) { return _verifyTransfer(_from, _to, _value, _data, false); } @@ -664,7 +612,7 @@ contract SecurityToken is ERC20, ERC20Detailed, ReentrancyGuard, RegistryUpdater * @notice Permanently freeze minting of this security token. * @dev It MUST NOT be possible to increase `totalSuppy` after this function is called. */ - function freezeMinting() external isMintingAllowed() isEnabled("freezeMintingAllowed") onlyOwner { + function freezeMinting() external isMintingAllowed isEnabled("freezeMintingAllowed") onlyOwner { mintingFrozen = true; /*solium-disable-next-line security/no-block-members*/ emit FreezeMinting(now); @@ -677,7 +625,7 @@ contract SecurityToken is ERC20, ERC20Detailed, ReentrancyGuard, RegistryUpdater * @param _value Number of tokens be minted * @return success */ - function mint(address _investor, uint256 _value) public returns (bool success) { + function mint(address _investor, uint256 _value) public returns(bool success) { return mintWithData(_investor, _value, ""); } @@ -692,8 +640,13 @@ contract SecurityToken is ERC20, ERC20Detailed, ReentrancyGuard, RegistryUpdater function mintWithData( address _investor, uint256 _value, - bytes _data - ) public onlyModuleOrOwner(MINT_KEY) isMintingAllowed() returns (bool success) { + bytes memory _data + ) + public + onlyModuleOrOwner(MINT_KEY) + isMintingAllowed + returns(bool success) + { require(_updateTransfer(address(0), _investor, _value, _data), "Transfer invalid"); _adjustTotalSupplyCheckpoints(); _mint(_investor, _value); @@ -708,7 +661,7 @@ contract SecurityToken is ERC20, ERC20Detailed, ReentrancyGuard, RegistryUpdater * @param _values A list of number of tokens get minted and transfer to corresponding address of the investor from _investor[] list * @return success */ - function mintMulti(address[] _investors, uint256[] _values) external returns (bool success) { + function mintMulti(address[] calldata _investors, uint256[] calldata _values) external returns(bool success) { require(_investors.length == _values.length, "Incorrect inputs"); for (uint256 i = 0; i < _investors.length; i++) { mint(_investors[i], _values[i]); @@ -727,13 +680,17 @@ contract SecurityToken is ERC20, ERC20Detailed, ReentrancyGuard, RegistryUpdater */ function checkPermission(address _delegate, address _module, bytes32 _perm) public view returns(bool) { for (uint256 i = 0; i < modules[PERMISSION_KEY].length; i++) { - if (!modulesToData[modules[PERMISSION_KEY][i]].isArchived) - return TokenLib.checkPermission(modules[PERMISSION_KEY], _delegate, _module, _perm); + if (!modulesToData[modules[PERMISSION_KEY][i]].isArchived) return TokenLib.checkPermission( + modules[PERMISSION_KEY], + _delegate, + _module, + _perm + ); } return false; } - function _checkAndBurn(address _from, uint256 _value, bytes _data) internal returns(bool) { + function _checkAndBurn(address _from, uint256 _value, bytes memory _data) internal returns(bool) { bool verified = _updateTransfer(_from, address(0), _value, _data); _adjustTotalSupplyCheckpoints(); _burn(_from, _value); @@ -746,11 +703,11 @@ contract SecurityToken is ERC20, ERC20Detailed, ReentrancyGuard, RegistryUpdater * @param _value No. of tokens that get burned * @param _data data to indicate validation */ - function burnWithData(uint256 _value, bytes _data) public onlyModule(BURN_KEY) { + function burnWithData(uint256 _value, bytes memory _data) public onlyModule(BURN_KEY) { require(_checkAndBurn(msg.sender, _value, _data), "Burn invalid"); } - function _checkAndBurnFrom(address _from, uint256 _value, bytes _data) internal returns(bool) { + function _checkAndBurnFrom(address _from, uint256 _value, bytes memory _data) internal returns(bool) { bool verified = _updateTransfer(_from, address(0), _value, _data); _adjustTotalSupplyCheckpoints(); _burnFrom(_from, _value); @@ -764,7 +721,7 @@ contract SecurityToken is ERC20, ERC20Detailed, ReentrancyGuard, RegistryUpdater * @param _value No. of tokens that get burned * @param _data data to indicate validation */ - function burnFromWithData(address _from, uint256 _value, bytes _data) public onlyModule(BURN_KEY) { + function burnFromWithData(address _from, uint256 _value, bytes memory _data) public onlyModule(BURN_KEY) { require(_checkAndBurnFrom(_from, _value, _data), "Burn invalid"); } @@ -773,7 +730,7 @@ contract SecurityToken is ERC20, ERC20Detailed, ReentrancyGuard, RegistryUpdater * @return uint256 */ function createCheckpoint() external onlyModuleOrOwner(CHECKPOINT_KEY) returns(uint256) { - require(currentCheckpointId < 2**256 - 1); + require(currentCheckpointId < 2 ** 256 - 1); currentCheckpointId = currentCheckpointId + 1; /*solium-disable-next-line security/no-block-members*/ checkpointTimes.push(now); @@ -786,7 +743,7 @@ contract SecurityToken is ERC20, ERC20Detailed, ReentrancyGuard, RegistryUpdater * @notice Gets list of times that checkpoints were created * @return List of checkpoint times */ - function getCheckpointTimes() external view returns(uint256[]) { + function getCheckpointTimes() external view returns(uint256[] memory) { return checkpointTimes; } @@ -840,7 +797,7 @@ contract SecurityToken is ERC20, ERC20Detailed, ReentrancyGuard, RegistryUpdater * @param _data data to indicate validation * @param _log data attached to the transfer by controller to emit in event */ - function forceTransfer(address _from, address _to, uint256 _value, bytes _data, bytes _log) public onlyController { + function forceTransfer(address _from, address _to, uint256 _value, bytes memory _data, bytes memory _log) public onlyController { bool verified = _updateTransfer(_from, _to, _value, _data); _transfer(_from, _to, _value); emit ForceTransfer(msg.sender, _from, _to, _value, verified, _log); @@ -853,7 +810,7 @@ contract SecurityToken is ERC20, ERC20Detailed, ReentrancyGuard, RegistryUpdater * @param _data data to indicate validation * @param _log data attached to the transfer by controller to emit in event */ - function forceBurn(address _from, uint256 _value, bytes _data, bytes _log) public onlyController { + function forceBurn(address _from, uint256 _value, bytes memory _data, bytes memory _log) public onlyController { bool verified = _checkAndBurn(_from, _value, _data); emit ForceBurn(msg.sender, _from, _value, verified, _log); } @@ -861,7 +818,7 @@ contract SecurityToken is ERC20, ERC20Detailed, ReentrancyGuard, RegistryUpdater /** * @notice Returns the version of the SecurityToken */ - function getVersion() external view returns(uint8[]) { + function getVersion() external view returns(uint8[] memory) { uint8[] memory _version = new uint8[](3); _version[0] = securityTokenVersion.major; _version[1] = securityTokenVersion.minor; diff --git a/migrations/1_deploy_token.js b/migrations/1_deploy_token.js index 47f0e97a9..a31ddc4a7 100644 --- a/migrations/1_deploy_token.js +++ b/migrations/1_deploy_token.js @@ -1,9 +1,8 @@ -const DevPolyToken = artifacts.require('./helpers/PolyTokenFaucet.sol') -const Web3 = require('web3') -web3 = new Web3(new Web3.providers.HttpProvider('http://localhost:8545')) +const DevPolyToken = artifacts.require("./helpers/PolyTokenFaucet.sol"); +const Web3 = require("web3"); +web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545")); -module.exports = function (deployer, network, accounts) { - const PolymathAccount = accounts[0] - return deployer.deploy(DevPolyToken, {from: PolymathAccount}).then(() => {}) - -} \ No newline at end of file +module.exports = function(deployer, network, accounts) { + const PolymathAccount = accounts[0]; + return deployer.deploy(DevPolyToken, { from: PolymathAccount }).then(() => {}); +}; diff --git a/migrations/2_deploy_contracts.js b/migrations/2_deploy_contracts.js index ca24170c5..9618425c3 100644 --- a/migrations/2_deploy_contracts.js +++ b/migrations/2_deploy_contracts.js @@ -1,345 +1,465 @@ -const PolymathRegistry = artifacts.require('./PolymathRegistry.sol') -const GeneralTransferManagerFactory = artifacts.require('./GeneralTransferManagerFactory.sol') -const GeneralTransferManagerLogic = artifacts.require('./GeneralTransferManager.sol') -const GeneralPermissionManagerLogic = artifacts.require('./GeneralPermissionManager.sol') -const GeneralPermissionManagerFactory = artifacts.require('./GeneralPermissionManagerFactory.sol') -const PercentageTransferManagerLogic = artifacts.require('./PercentageTransferManager.sol') -const PercentageTransferManagerFactory = artifacts.require('./PercentageTransferManagerFactory.sol') -const USDTieredSTOLogic = artifacts.require('./USDTieredSTO.sol'); -const CountTransferManagerFactory = artifacts.require('./CountTransferManagerFactory.sol') -const CountTransferManagerLogic = artifacts.require('./CountTransferManager.sol') -const EtherDividendCheckpointLogic = artifacts.require('./EtherDividendCheckpoint.sol') -const ERC20DividendCheckpointLogic = artifacts.require('./ERC20DividendCheckpoint.sol') -const EtherDividendCheckpointFactory = artifacts.require('./EtherDividendCheckpointFactory.sol') -const ERC20DividendCheckpointFactory = artifacts.require('./ERC20DividendCheckpointFactory.sol') -const ModuleRegistry = artifacts.require('./ModuleRegistry.sol'); -const ModuleRegistryProxy = artifacts.require('./ModuleRegistryProxy.sol'); -const ManualApprovalTransferManagerFactory = artifacts.require('./ManualApprovalTransferManagerFactory.sol') -const ManualApprovalTransferManagerLogic = artifacts.require('./ManualApprovalTransferManager.sol') -const CappedSTOFactory = artifacts.require('./CappedSTOFactory.sol') +const PolymathRegistry = artifacts.require("./PolymathRegistry.sol"); +const GeneralTransferManagerFactory = artifacts.require("./GeneralTransferManagerFactory.sol"); +const GeneralTransferManagerLogic = artifacts.require("./GeneralTransferManager.sol"); +const GeneralPermissionManagerLogic = artifacts.require("./GeneralPermissionManager.sol"); +const GeneralPermissionManagerFactory = artifacts.require("./GeneralPermissionManagerFactory.sol"); +const PercentageTransferManagerLogic = artifacts.require("./PercentageTransferManager.sol"); +const PercentageTransferManagerFactory = artifacts.require("./PercentageTransferManagerFactory.sol"); +const USDTieredSTOLogic = artifacts.require("./USDTieredSTO.sol"); +const CountTransferManagerFactory = artifacts.require("./CountTransferManagerFactory.sol"); +const CountTransferManagerLogic = artifacts.require("./CountTransferManager.sol"); +const EtherDividendCheckpointLogic = artifacts.require("./EtherDividendCheckpoint.sol"); +const ERC20DividendCheckpointLogic = artifacts.require("./ERC20DividendCheckpoint.sol"); +const EtherDividendCheckpointFactory = artifacts.require("./EtherDividendCheckpointFactory.sol"); +const ERC20DividendCheckpointFactory = artifacts.require("./ERC20DividendCheckpointFactory.sol"); +const ModuleRegistry = artifacts.require("./ModuleRegistry.sol"); +const ModuleRegistryProxy = artifacts.require("./ModuleRegistryProxy.sol"); +const ManualApprovalTransferManagerFactory = artifacts.require("./ManualApprovalTransferManagerFactory.sol"); +const ManualApprovalTransferManagerLogic = artifacts.require("./ManualApprovalTransferManager.sol"); +const CappedSTOFactory = artifacts.require("./CappedSTOFactory.sol"); const CappedSTOLogic = artifacts.require("./CappedSTO.sol"); -const USDTieredSTOFactory = artifacts.require('./USDTieredSTOFactory.sol') -const SecurityTokenRegistry = artifacts.require('./SecurityTokenRegistry.sol') -const SecurityTokenRegistryProxy = artifacts.require('./SecurityTokenRegistryProxy.sol') -const FeatureRegistry = artifacts.require('./FeatureRegistry.sol') -const STFactory = artifacts.require('./tokens/STFactory.sol') -const DevPolyToken = artifacts.require('./helpers/PolyTokenFaucet.sol') -const MockOracle = artifacts.require('./MockOracle.sol') -const TokenLib = artifacts.require('./TokenLib.sol'); -const SecurityToken = artifacts.require('./tokens/SecurityToken.sol') +const USDTieredSTOFactory = artifacts.require("./USDTieredSTOFactory.sol"); +const SecurityTokenRegistry = artifacts.require("./SecurityTokenRegistry.sol"); +const SecurityTokenRegistryProxy = artifacts.require("./SecurityTokenRegistryProxy.sol"); +const FeatureRegistry = artifacts.require("./FeatureRegistry.sol"); +const STFactory = artifacts.require("./tokens/STFactory.sol"); +const DevPolyToken = artifacts.require("./helpers/PolyTokenFaucet.sol"); +const MockOracle = artifacts.require("./MockOracle.sol"); +const TokenLib = artifacts.require("./TokenLib.sol"); +const SecurityToken = artifacts.require("./tokens/SecurityToken.sol"); const STRGetter = artifacts.require('./STRGetter.sol'); -let BigNumber = require('bignumber.js'); -const cappedSTOSetupCost = new BigNumber(20000).times(new BigNumber(10).pow(18)); // 20K POLY fee -const usdTieredSTOSetupCost = new BigNumber(100000).times(new BigNumber(10).pow(18)); // 100K POLY fee -const initRegFee = new BigNumber(250).times(new BigNumber(10).pow(18)); // 250 POLY fee for registering ticker or security token in registry + +const Web3 = require("web3"); +let BN = Web3.utils.BN; +const nullAddress = "0x0000000000000000000000000000000000000000"; +const cappedSTOSetupCost = new BN(20000).mul(new BN(10).pow(new BN(18))); // 20K POLY fee +const usdTieredSTOSetupCost = new BN(100000).mul(new BN(10).pow(new BN(18))); // 100K POLY fee +const initRegFee = new BN(250).mul(new BN(10).pow(new BN(18))); // 250 POLY fee for registering ticker or security token in registry let PolyToken; let UsdToken; let ETHOracle; let POLYOracle; -const Web3 = require('web3') - -module.exports = function (deployer, network, accounts) { - // Ethereum account address hold by the Polymath (Act as the main account which have ownable permissions) - let PolymathAccount; - let moduleRegistry; - let polymathRegistry; - let web3 - if (network === 'development') { - web3 = new Web3(new Web3.providers.HttpProvider('http://localhost:8545')) - PolymathAccount = accounts[0] - PolyToken = DevPolyToken.address // Development network polytoken address - deployer.deploy(DevPolyToken, {from: PolymathAccount}).then(() => { - DevPolyToken.deployed().then((mockedUSDToken) => { - UsdToken = mockedUSDToken.address; - }); - }); - deployer.deploy(MockOracle, PolyToken, "POLY", "USD", new BigNumber(0.5).times(new BigNumber(10).pow(18)), {from: PolymathAccount}).then(() => { - MockOracle.deployed().then((mockedOracle) => { - POLYOracle = mockedOracle.address; - }); - }); - deployer.deploy(MockOracle, 0, "ETH", "USD", new BigNumber(500).times(new BigNumber(10).pow(18)), {from: PolymathAccount}).then(() => { - MockOracle.deployed().then((mockedOracle) => { - ETHOracle = mockedOracle.address; - }); - }); - - } else if (network === 'kovan') { - web3 = new Web3(new Web3.providers.HttpProvider('https://kovan.infura.io/g5xfoQ0jFSE9S5LwM1Ei')) - PolymathAccount = accounts[0] - PolyToken = '0xb347b9f5b56b431b2cf4e1d90a5995f7519ca792' // PolyToken Kovan Faucet Address - POLYOracle = '0x461d98EF2A0c7Ac1416EF065840fF5d4C946206C' // Poly Oracle Kovan Address - ETHOracle = '0xCE5551FC9d43E9D2CC255139169FC889352405C8' // ETH Oracle Kovan Address - } else if (network === 'mainnet') { - web3 = new Web3(new Web3.providers.HttpProvider('https://mainnet.infura.io/g5xfoQ0jFSE9S5LwM1Ei')) - PolymathAccount = accounts[0] - PolyToken = '0x9992eC3cF6A55b00978cdDF2b27BC6882d88D1eC' // Mainnet PolyToken Address - POLYOracle = '0x52cb4616E191Ff664B0bff247469ce7b74579D1B' // Poly Oracle Mainnet Address - ETHOracle = '0x60055e9a93aae267da5a052e95846fa9469c0e7a' // ETH Oracle Mainnet Address - } if (network === 'coverage') { - web3 = new Web3(new Web3.providers.HttpProvider('http://localhost:8545')) - PolymathAccount = accounts[0] - PolyToken = DevPolyToken.address // Development network polytoken address - deployer.deploy(MockOracle, PolyToken, "POLY", "USD", new BigNumber(0.5).times(new BigNumber(10).pow(18)), {from: PolymathAccount}).then(() => { - MockOracle.deployed().then((mockedOracle) => { - POLYOracle = mockedOracle.address; - }); - }); - deployer.deploy(MockOracle, 0, "ETH", "USD", new BigNumber(500).times(new BigNumber(10).pow(18)), {from: PolymathAccount}).then(() => { - MockOracle.deployed().then((mockedOracle) => { - ETHOracle = mockedOracle.address; - }); - }); - } +module.exports = function(deployer, network, accounts) { + // Ethereum account address hold by the Polymath (Act as the main account which have ownable permissions) + let PolymathAccount; + let moduleRegistry; + let polymathRegistry; + let web3; + if (network === "development") { + web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545")); + PolymathAccount = accounts[0]; + PolyToken = DevPolyToken.address; // Development network polytoken address + deployer.deploy(DevPolyToken, { from: PolymathAccount }).then(() => { + DevPolyToken.deployed().then(mockedUSDToken => { + UsdToken = mockedUSDToken.address; + }); + }); + deployer + .deploy( + MockOracle, + PolyToken, + web3.utils.fromAscii("POLY"), + web3.utils.fromAscii("USD"), + new BN(5).mul(new BN(10).pow(new BN(17))), + { from: PolymathAccount } + ) + .then(() => { + MockOracle.deployed().then(mockedOracle => { + POLYOracle = mockedOracle.address; + }); + }); + deployer + .deploy( + MockOracle, + nullAddress, + web3.utils.fromAscii("ETH"), + web3.utils.fromAscii("USD"), + new BN(500).mul(new BN(10).pow(new BN(18))), + { from: PolymathAccount } + ) + .then(() => { + MockOracle.deployed().then(mockedOracle => { + ETHOracle = mockedOracle.address; + }); + }); + } else if (network === "kovan") { + web3 = new Web3(new Web3.providers.HttpProvider("https://kovan.infura.io/g5xfoQ0jFSE9S5LwM1Ei")); + PolymathAccount = accounts[0]; + PolyToken = "0xb347b9f5b56b431b2cf4e1d90a5995f7519ca792"; // PolyToken Kovan Faucet Address + POLYOracle = "0x461d98EF2A0c7Ac1416EF065840fF5d4C946206C"; // Poly Oracle Kovan Address + ETHOracle = "0xCE5551FC9d43E9D2CC255139169FC889352405C8"; // ETH Oracle Kovan Address + } else if (network === "mainnet") { + web3 = new Web3(new Web3.providers.HttpProvider("https://mainnet.infura.io/g5xfoQ0jFSE9S5LwM1Ei")); + PolymathAccount = accounts[0]; + PolyToken = "0x9992eC3cF6A55b00978cdDF2b27BC6882d88D1eC"; // Mainnet PolyToken Address + POLYOracle = "0x52cb4616E191Ff664B0bff247469ce7b74579D1B"; // Poly Oracle Mainnet Address + ETHOracle = "0x60055e9a93aae267da5a052e95846fa9469c0e7a"; // ETH Oracle Mainnet Address + } + if (network === "coverage") { + web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545")); + PolymathAccount = accounts[0]; + PolyToken = DevPolyToken.address; // Development network polytoken address + deployer + .deploy(MockOracle, PolyToken, web3.utils.fromAscii("POLY"), web3.utils.fromAscii("USD"), new BN(0.5).mul(new BN(10).pow(new BN(18))), { from: PolymathAccount }) + .then(() => { + MockOracle.deployed().then(mockedOracle => { + POLYOracle = mockedOracle.address; + }); + }); + deployer.deploy(MockOracle, nullAddress, web3.utils.fromAscii("ETH"), web3.utils.fromAscii("USD"), new BN(500).mul(new BN(10).pow(new BN(18))), { from: PolymathAccount }).then(() => { + MockOracle.deployed().then(mockedOracle => { + ETHOracle = mockedOracle.address; + }); + }); + } - const functionSignatureProxy = { - name: 'initialize', - type: 'function', - inputs: [{ - type:'address', - name: '_polymathRegistry' - },{ - type: 'address', - name: '_STFactory' - },{ - type: 'uint256', - name: '_stLaunchFee' - },{ - type: 'uint256', - name: '_tickerRegFee' - },{ - type: 'address', - name: '_owner' - },{ - type: 'address', - name: '_getterContract' - }] - }; + const functionSignatureProxy = { + name: "initialize", + type: "function", + inputs: [ + { + type: "address", + name: "_polymathRegistry" + }, + { + type: "address", + name: "_STFactory" + }, + { + type: "uint256", + name: "_stLaunchFee" + }, + { + type: "uint256", + name: "_tickerRegFee" + }, + { + type: "address", + name: "_owner" + }, + { + type: 'address', + name: '_getterContract' + } + ] + }; - const functionSignatureProxyMR = { - name: 'initialize', - type: 'function', - inputs: [{ - type:'address', - name: '_polymathRegistry' - },{ - type: 'address', - name: '_owner' - }] - }; + const functionSignatureProxyMR = { + name: "initialize", + type: "function", + inputs: [ + { + type: "address", + name: "_polymathRegistry" + }, + { + type: "address", + name: "_owner" + } + ] + }; - // POLYMATH NETWORK Configuration :: DO THIS ONLY ONCE - // A) Deploy the PolymathRegistry contract - return deployer.deploy(PolymathRegistry, {from: PolymathAccount}).then(() => { - return PolymathRegistry.deployed(); - }).then((_polymathRegistry) => { - polymathRegistry = _polymathRegistry; - return polymathRegistry.changeAddress("PolyToken", PolyToken, {from: PolymathAccount}); - }).then(() => { - // Deploy libraries - return deployer.deploy(TokenLib, {from: PolymathAccount}); - }).then(() => { - // Link libraries - deployer.link(TokenLib, SecurityToken); - deployer.link(TokenLib, STFactory); - // A) Deploy the ModuleRegistry Contract (It contains the list of verified ModuleFactory) - return deployer.deploy(ModuleRegistry, {from: PolymathAccount}); - }).then(() => { - return deployer.deploy(ModuleRegistryProxy, {from: PolymathAccount}); - }).then(() => { - let bytesProxyMR = web3.eth.abi.encodeFunctionCall(functionSignatureProxyMR, [polymathRegistry.address, PolymathAccount]); - return ModuleRegistryProxy.at(ModuleRegistryProxy.address).upgradeToAndCall("1.0.0", ModuleRegistry.address, bytesProxyMR, {from: PolymathAccount}); - }).then(() => { - moduleRegistry = ModuleRegistry.at(ModuleRegistryProxy.address); - // Add module registry to polymath registry - return polymathRegistry.changeAddress("ModuleRegistry", ModuleRegistryProxy.address, {from: PolymathAccount}); - }).then(() => { - // B) Deploy the GeneralTransferManagerLogic Contract (Factory used to generate the GeneralTransferManager contract and this - // manager attach with the securityToken contract at the time of deployment) - return deployer.deploy(GeneralTransferManagerLogic, "0x0000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000", {from: PolymathAccount}); - }).then(() => { - // B) Deploy the GeneralPermissionManagerLogic Contract (Factory used to generate the GeneralPermissionManager contract and this - // manager attach with the securityToken contract at the time of deployment) - return deployer.deploy(GeneralPermissionManagerLogic, "0x0000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000", {from: PolymathAccount}); - }).then(() => { - // B) Deploy the CountTransferManagerLogic Contract (Factory used to generate the CountTransferManager contract and this - // manager attach with the securityToken contract at the time of deployment) - return deployer.deploy(CountTransferManagerLogic, "0x0000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000", {from: PolymathAccount}); - }).then(() => { - // B) Deploy the ManualApprovalTransferManagerLogic Contract (Factory used to generate the ManualApprovalTransferManager contract and this - // manager attach with the securityToken contract at the time of deployment) - return deployer.deploy(ManualApprovalTransferManagerLogic, "0x0000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000", {from: PolymathAccount}); - }).then(() => { - // B) Deploy the PercentageTransferManagerLogic Contract (Factory used to generate the PercentageTransferManager contract and this - // manager attach with the securityToken contract at the time of deployment) - return deployer.deploy(PercentageTransferManagerLogic, "0x0000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000", {from: PolymathAccount}); - }).then(() => { - // B) Deploy the ERC20DividendCheckpointLogic Contract (Factory used to generate the ERC20DividendCheckpoint contract and this - // manager attach with the securityToken contract at the time of deployment) - return deployer.deploy(ERC20DividendCheckpointLogic, "0x0000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000", {from: PolymathAccount}); - }).then(() => { - // B) Deploy the EtherDividendCheckpointLogic Contract (Factory used to generate the EtherDividendCheckpoint contract and this - // manager attach with the securityToken contract at the time of deployment) - return deployer.deploy(EtherDividendCheckpointLogic, "0x0000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000", {from: PolymathAccount}); - }).then(() => { - // B) Deploy the USDTieredSTOLogic Contract (Factory used to generate the USDTieredSTO contract and this - // manager attach with the securityToken contract at the time of deployment) - return deployer.deploy(USDTieredSTOLogic, "0x0000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000", {from: PolymathAccount}); - }).then(() => { - // B) Deploy the CappedSTOLogic Contract (Factory used to generate the CappedSTO contract and this - // manager attach with the securityToken contract at the time of deployment) - return deployer.deploy(CappedSTOLogic, "0x0000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000", {from: PolymathAccount}); - }).then(() => { - // B) Deploy the GeneralTransferManagerFactory Contract (Factory used to generate the GeneralTransferManager contract and this - // manager attach with the securityToken contract at the time of deployment) - return deployer.deploy(GeneralTransferManagerFactory, 0, 0, 0, GeneralTransferManagerLogic.address, {from: PolymathAccount}); - }).then(() => { - // C) Deploy the GeneralPermissionManagerFactory Contract (Factory used to generate the GeneralPermissionManager contract and - // this manager attach with the securityToken contract at the time of deployment) - return deployer.deploy(GeneralPermissionManagerFactory, 0, 0, 0, GeneralPermissionManagerLogic.address, {from: PolymathAccount}); - }).then(() => { - // D) Deploy the CountTransferManagerFactory Contract (Factory used to generate the CountTransferManager contract use - // to track the counts of the investors of the security token) - return deployer.deploy(CountTransferManagerFactory, 0, 0, 0, CountTransferManagerLogic.address, {from: PolymathAccount}); - }).then(() => { - // D) Deploy the PercentageTransferManagerFactory Contract (Factory used to generate the PercentageTransferManager contract use - // to track the percentage of investment the investors could do for a particular security token) - return deployer.deploy(PercentageTransferManagerFactory, 0, 0, 0, PercentageTransferManagerLogic.address, {from: PolymathAccount}); - }).then(() => { - // D) Deploy the EtherDividendCheckpointFactory Contract (Factory used to generate the EtherDividendCheckpoint contract use - // to provide the functionality of the dividend in terms of ETH) - return deployer.deploy(EtherDividendCheckpointFactory, 0, 0, 0, EtherDividendCheckpointLogic.address, {from: PolymathAccount}); - }).then(() => { - // D) Deploy the ERC20DividendCheckpointFactory Contract (Factory used to generate the ERC20DividendCheckpoint contract use - // to provide the functionality of the dividend in terms of ERC20 token) - return deployer.deploy(ERC20DividendCheckpointFactory, 0, 0, 0, ERC20DividendCheckpointLogic.address, {from: PolymathAccount}); - }).then(() => { - // D) Deploy the ManualApprovalTransferManagerFactory Contract (Factory used to generate the ManualApprovalTransferManager contract use - // to manual approve the transfer that will overcome the other transfer restrictions) - return deployer.deploy(ManualApprovalTransferManagerFactory, 0, 0, 0, ManualApprovalTransferManagerLogic.address, {from: PolymathAccount}); - }).then(() => { - // H) Deploy the STVersionProxy001 Contract which contains the logic of deployment of securityToken. - return deployer.deploy(STFactory, GeneralTransferManagerFactory.address, {from: PolymathAccount}); - }).then(() => { - // K) Deploy the FeatureRegistry contract to control feature switches - return deployer.deploy(FeatureRegistry, PolymathRegistry.address, {from: PolymathAccount}); - }).then(() => { - // Assign the address into the FeatureRegistry key - return polymathRegistry.changeAddress("FeatureRegistry", FeatureRegistry.address, {from: PolymathAccount}); - }).then(() => { - // J) Deploy the SecurityTokenRegistry contract (Used to hold the deployed secuirtyToken details. It also act as the interface to deploy the SecurityToken) - return deployer.deploy(SecurityTokenRegistry, {from: PolymathAccount}) - }).then(()=> { - return deployer.deploy(SecurityTokenRegistryProxy, {from: PolymathAccount}); - }).then(() => { - return deployer.deploy(STRGetter, {from: PolymathAccount}); - }).then(() => { - let bytesProxy = web3.eth.abi.encodeFunctionCall(functionSignatureProxy, [PolymathRegistry.address, STFactory.address, initRegFee, initRegFee, PolymathAccount, STRGetter.address]); - return SecurityTokenRegistryProxy.at(SecurityTokenRegistryProxy.address).upgradeToAndCall("1.0.0", SecurityTokenRegistry.address, bytesProxy, {from: PolymathAccount}); - }).then(() => { - // Assign the address into the SecurityTokenRegistry key - return polymathRegistry.changeAddress("SecurityTokenRegistry", SecurityTokenRegistryProxy.address, {from: PolymathAccount}); - }).then(() => { - // Update all addresses into the registry contract by calling the function updateFromregistry - return moduleRegistry.updateFromRegistry({from: PolymathAccount}); - }).then(() => { - // D) Register the PercentageTransferManagerFactory in the ModuleRegistry to make the factory available at the protocol level. - // So any securityToken can use that factory to generate the PercentageTransferManager contract. - return moduleRegistry.registerModule(PercentageTransferManagerFactory.address, {from: PolymathAccount}); - }).then(() => { - // D) Register the CountTransferManagerFactory in the ModuleRegistry to make the factory available at the protocol level. - // So any securityToken can use that factory to generate the CountTransferManager contract. - return moduleRegistry.registerModule(CountTransferManagerFactory.address, {from: PolymathAccount}); - }).then(() => { - // D) Register the GeneralTransferManagerFactory in the ModuleRegistry to make the factory available at the protocol level. - // So any securityToken can use that factory to generate the GeneralTransferManager contract. - return moduleRegistry.registerModule(GeneralTransferManagerFactory.address, {from: PolymathAccount}); - }).then(() => { - // E) Register the GeneralPermissionManagerFactory in the ModuleRegistry to make the factory available at the protocol level. - // So any securityToken can use that factory to generate the GeneralPermissionManager contract. - return moduleRegistry.registerModule(GeneralPermissionManagerFactory.address, {from: PolymathAccount}); - }).then(() => { - // E) Register the GeneralPermissionManagerFactory in the ModuleRegistry to make the factory available at the protocol level. - // So any securityToken can use that factory to generate the GeneralPermissionManager contract. - return moduleRegistry.registerModule(EtherDividendCheckpointFactory.address, {from: PolymathAccount}); - }).then(() => { - // D) Register the ManualApprovalTransferManagerFactory in the ModuleRegistry to make the factory available at the protocol level. - // So any securityToken can use that factory to generate the ManualApprovalTransferManager contract. - return moduleRegistry.registerModule(ManualApprovalTransferManagerFactory.address, {from: PolymathAccount}); - }).then(() => { - // E) Register the ERC20DividendCheckpointFactory in the ModuleRegistry to make the factory available at the protocol level. - // So any securityToken can use that factory to generate the ERC20DividendCheckpoint contract. - return moduleRegistry.registerModule(ERC20DividendCheckpointFactory.address, {from: PolymathAccount}); - }).then(() => { - // F) Once the GeneralTransferManagerFactory registered with the ModuleRegistry contract then for making them accessble to the securityToken - // contract, Factory should comes under the verified list of factories or those factories deployed by the securityToken issuers only. - // Here it gets verified because it is deployed by the third party account (Polymath Account) not with the issuer accounts. - return moduleRegistry.verifyModule(GeneralTransferManagerFactory.address, true, {from: PolymathAccount}); - }).then(() => { - // G) Once the CountTransferManagerFactory registered with the ModuleRegistry contract then for making them accessble to the securityToken - // contract, Factory should comes under the verified list of factories or those factories deployed by the securityToken issuers only. - // Here it gets verified because it is deployed by the third party account (Polymath Account) not with the issuer accounts. - return moduleRegistry.verifyModule(CountTransferManagerFactory.address, true, {from: PolymathAccount}); - }).then(() => { - // G) Once the PercentageTransferManagerFactory registered with the ModuleRegistry contract then for making them accessble to the securityToken - // contract, Factory should comes under the verified list of factories or those factories deployed by the securityToken issuers only. - // Here it gets verified because it is deployed by the third party account (Polymath Account) not with the issuer accounts. - return moduleRegistry.verifyModule(PercentageTransferManagerFactory.address, true, {from: PolymathAccount}); - }).then(() => { - // G) Once the GeneralPermissionManagerFactory registered with the ModuleRegistry contract then for making them accessble to the securityToken - // contract, Factory should comes under the verified list of factories or those factories deployed by the securityToken issuers only. - // Here it gets verified because it is deployed by the third party account (Polymath Account) not with the issuer accounts. - return moduleRegistry.verifyModule(GeneralPermissionManagerFactory.address, true, {from: PolymathAccount}) - }).then(() => { - // G) Once the EtherDividendCheckpointFactory registered with the ModuleRegistry contract then for making them accessble to the securityToken - // contract, Factory should comes under the verified list of factories or those factories deployed by the securityToken issuers only. - // Here it gets verified because it is deployed by the third party account (Polymath Account) not with the issuer accounts. - return moduleRegistry.verifyModule(EtherDividendCheckpointFactory.address, true, {from: PolymathAccount}); - }).then(() => { - // G) Once the ERC20DividendCheckpointFactory registered with the ModuleRegistry contract then for making them accessble to the securityToken - // contract, Factory should comes under the verified list of factories or those factories deployed by the securityToken issuers only. - // Here it gets verified because it is deployed by the third party account (Polymath Account) not with the issuer accounts. - return moduleRegistry.verifyModule(ERC20DividendCheckpointFactory.address, true, {from: PolymathAccount}); - }).then(() => { - // G) Once the ManualApprovalTransferManagerFactory registered with the ModuleRegistry contract then for making them accessble to the securityToken - // contract, Factory should comes under the verified list of factories or those factories deployed by the securityToken issuers only. - // Here it gets verified because it is deployed by the third party account (Polymath Account) not with the issuer accounts. - return moduleRegistry.verifyModule(ManualApprovalTransferManagerFactory.address, true, {from: PolymathAccount}); - }).then(() => { - // M) Deploy the CappedSTOFactory (Use to generate the CappedSTO contract which will used to collect the funds ). - return deployer.deploy(CappedSTOFactory, cappedSTOSetupCost, 0, 0, CappedSTOLogic.address, {from: PolymathAccount}) - }).then(() => { - // N) Register the CappedSTOFactory in the ModuleRegistry to make the factory available at the protocol level. - // So any securityToken can use that factory to generate the CappedSTOFactory contract. - return moduleRegistry.registerModule(CappedSTOFactory.address, {from: PolymathAccount}) - }).then(()=>{ - // G) Once the CappedSTOFactory registered with the ModuleRegistry contract then for making them accessble to the securityToken - // contract, Factory should comes under the verified list of factories or those factories deployed by the securityToken issuers only. - // Here it gets verified because it is deployed by the third party account (Polymath Account) not with the issuer accounts. - return moduleRegistry.verifyModule(CappedSTOFactory.address, true, {from: PolymathAccount}) - }).then(() => { - // H) Deploy the USDTieredSTOFactory (Use to generate the USDTieredSTOFactory contract which will used to collect the funds ). - return deployer.deploy(USDTieredSTOFactory, usdTieredSTOSetupCost, 0, 0, USDTieredSTOLogic.address, {from: PolymathAccount}) - }).then(() => { - // I) Register the USDTieredSTOFactory in the ModuleRegistry to make the factory available at the protocol level. - // So any securityToken can use that factory to generate the USDTieredSTOFactory contract. - return moduleRegistry.registerModule(USDTieredSTOFactory.address, {from: PolymathAccount}) - }).then(()=>{ - // J) Once the USDTieredSTOFactory registered with the ModuleRegistry contract then for making them accessble to the securityToken - // contract, Factory should comes under the verified list of factories or those factories deployed by the securityToken issuers only. - // Here it gets verified because it is deployed by the third party account (Polymath Account) not with the issuer accounts. - return moduleRegistry.verifyModule(USDTieredSTOFactory.address, true, {from: PolymathAccount}) - }).then(() => { - return polymathRegistry.changeAddress("PolyUsdOracle", POLYOracle, {from: PolymathAccount}); - }).then(() => { - return polymathRegistry.changeAddress("EthUsdOracle", ETHOracle, {from: PolymathAccount}); - }).then(() => { - return deployer.deploy(SecurityToken, 'a', 'a', 18, 1, 'a', polymathRegistry.address, {from: PolymathAccount}); - }).then(() => { - console.log('\n'); - console.log(` + // POLYMATH NETWORK Configuration :: DO THIS ONLY ONCE + // A) Deploy the PolymathRegistry contract + return deployer + .deploy(PolymathRegistry, { from: PolymathAccount }) + .then(() => { + return PolymathRegistry.deployed(); + }) + .then(_polymathRegistry => { + polymathRegistry = _polymathRegistry; + return polymathRegistry.changeAddress("PolyToken", PolyToken, { from: PolymathAccount }); + }) + .then(() => { + // Deploy libraries + return deployer.deploy(TokenLib, { from: PolymathAccount }); + }) + .then(() => { + // Link libraries + deployer.link(TokenLib, SecurityToken); + deployer.link(TokenLib, STFactory); + // A) Deploy the ModuleRegistry Contract (It contains the list of verified ModuleFactory) + return deployer.deploy(ModuleRegistry, { from: PolymathAccount }); + }) + .then(() => { + return deployer.deploy(ModuleRegistryProxy, { from: PolymathAccount }); + }) + .then(() => { + return ModuleRegistryProxy.at(ModuleRegistryProxy.address); + }) + .then(moduleRegistryProxy => { + let bytesProxyMR = web3.eth.abi.encodeFunctionCall(functionSignatureProxyMR, [polymathRegistry.address, PolymathAccount]); + return moduleRegistryProxy.upgradeToAndCall("1.0.0", ModuleRegistry.address, bytesProxyMR, { from: PolymathAccount }); + }) + .then(() => { + return ModuleRegistry.at(ModuleRegistryProxy.address); + }) + .then(moduleRegistryInstance => { + moduleRegistry = moduleRegistryInstance; + // Add module registry to polymath registry + return polymathRegistry.changeAddress("ModuleRegistry", ModuleRegistryProxy.address, { from: PolymathAccount }); + }) + .then(() => { + // B) Deploy the GeneralTransferManagerLogic Contract (Factory used to generate the GeneralTransferManager contract and this + // manager attach with the securityToken contract at the time of deployment) + return deployer.deploy(GeneralTransferManagerLogic, nullAddress, nullAddress, { from: PolymathAccount }); + }) + .then(() => { + // B) Deploy the GeneralPermissionManagerLogic Contract (Factory used to generate the GeneralPermissionManager contract and this + // manager attach with the securityToken contract at the time of deployment) + return deployer.deploy(GeneralPermissionManagerLogic, nullAddress, nullAddress, { from: PolymathAccount }); + }) + .then(() => { + // B) Deploy the CountTransferManagerLogic Contract (Factory used to generate the CountTransferManager contract and this + // manager attach with the securityToken contract at the time of deployment) + return deployer.deploy(CountTransferManagerLogic, nullAddress, nullAddress, { from: PolymathAccount }); + }) + .then(() => { + // B) Deploy the ManualApprovalTransferManagerLogic Contract (Factory used to generate the ManualApprovalTransferManager contract and this + // manager attach with the securityToken contract at the time of deployment) + return deployer.deploy(ManualApprovalTransferManagerLogic, nullAddress, nullAddress, { from: PolymathAccount }); + }) + .then(() => { + // B) Deploy the PercentageTransferManagerLogic Contract (Factory used to generate the PercentageTransferManager contract and this + // manager attach with the securityToken contract at the time of deployment) + return deployer.deploy(PercentageTransferManagerLogic, nullAddress, nullAddress, { from: PolymathAccount }); + }) + .then(() => { + // B) Deploy the ERC20DividendCheckpointLogic Contract (Factory used to generate the ERC20DividendCheckpoint contract and this + // manager attach with the securityToken contract at the time of deployment) + return deployer.deploy(ERC20DividendCheckpointLogic, nullAddress, nullAddress, { from: PolymathAccount }); + }) + .then(() => { + // B) Deploy the EtherDividendCheckpointLogic Contract (Factory used to generate the EtherDividendCheckpoint contract and this + // manager attach with the securityToken contract at the time of deployment) + return deployer.deploy(EtherDividendCheckpointLogic, nullAddress, nullAddress, { from: PolymathAccount }); + }) + .then(() => { + // B) Deploy the USDTieredSTOLogic Contract (Factory used to generate the USDTieredSTO contract and this + // manager attach with the securityToken contract at the time of deployment) + return deployer.deploy(USDTieredSTOLogic, nullAddress, nullAddress, { from: PolymathAccount }); + }) + .then(() => { + // B) Deploy the CappedSTOLogic Contract (Factory used to generate the CappedSTO contract and this + // manager attach with the securityToken contract at the time of deployment) + return deployer.deploy(CappedSTOLogic, nullAddress, nullAddress, { from: PolymathAccount }); + }) + .then(() => { + // B) Deploy the GeneralTransferManagerFactory Contract (Factory used to generate the GeneralTransferManager contract and this + // manager attach with the securityToken contract at the time of deployment) + return deployer.deploy(GeneralTransferManagerFactory, new BN(0), new BN(0), new BN(0), GeneralTransferManagerLogic.address, { + from: PolymathAccount + }); + }) + .then(() => { + // C) Deploy the GeneralPermissionManagerFactory Contract (Factory used to generate the GeneralPermissionManager contract and + // this manager attach with the securityToken contract at the time of deployment) + return deployer.deploy(GeneralPermissionManagerFactory, new BN(0), new BN(0), new BN(0), GeneralPermissionManagerLogic.address, { + from: PolymathAccount + }); + }) + .then(() => { + // D) Deploy the CountTransferManagerFactory Contract (Factory used to generate the CountTransferManager contract use + // to track the counts of the investors of the security token) + return deployer.deploy(CountTransferManagerFactory, new BN(0), new BN(0), new BN(0), CountTransferManagerLogic.address, { + from: PolymathAccount + }); + }) + .then(() => { + // D) Deploy the PercentageTransferManagerFactory Contract (Factory used to generate the PercentageTransferManager contract use + // to track the percentage of investment the investors could do for a particular security token) + return deployer.deploy(PercentageTransferManagerFactory, new BN(0), new BN(0), new BN(0), PercentageTransferManagerLogic.address, { + from: PolymathAccount + }); + }) + .then(() => { + // D) Deploy the EtherDividendCheckpointFactory Contract (Factory used to generate the EtherDividendCheckpoint contract use + // to provide the functionality of the dividend in terms of ETH) + return deployer.deploy(EtherDividendCheckpointFactory, new BN(0), new BN(0), new BN(0), EtherDividendCheckpointLogic.address, { + from: PolymathAccount + }); + }) + .then(() => { + // D) Deploy the ERC20DividendCheckpointFactory Contract (Factory used to generate the ERC20DividendCheckpoint contract use + // to provide the functionality of the dividend in terms of ERC20 token) + return deployer.deploy(ERC20DividendCheckpointFactory, new BN(0), new BN(0), new BN(0), ERC20DividendCheckpointLogic.address, { + from: PolymathAccount + }); + }) + .then(() => { + // D) Deploy the ManualApprovalTransferManagerFactory Contract (Factory used to generate the ManualApprovalTransferManager contract use + // to manual approve the transfer that will overcome the other transfer restrictions) + return deployer.deploy(ManualApprovalTransferManagerFactory, new BN(0), new BN(0), new BN(0), ManualApprovalTransferManagerLogic.address, { + from: PolymathAccount + }); + }) + .then(() => { + // H) Deploy the STVersionProxy001 Contract which contains the logic of deployment of securityToken. + return deployer.deploy(STFactory, GeneralTransferManagerFactory.address, { from: PolymathAccount }); + }) + .then(() => { + // K) Deploy the FeatureRegistry contract to control feature switches + return deployer.deploy(FeatureRegistry, PolymathRegistry.address, { from: PolymathAccount }); + }) + .then(() => { + // Assign the address into the FeatureRegistry key + return polymathRegistry.changeAddress("FeatureRegistry", FeatureRegistry.address, { from: PolymathAccount }); + }) + .then(() => { + // J) Deploy the SecurityTokenRegistry contract (Used to hold the deployed secuirtyToken details. It also act as the interface to deploy the SecurityToken) + return deployer.deploy(SecurityTokenRegistry, { from: PolymathAccount }); + }) + .then(() => { + return deployer.deploy(SecurityTokenRegistryProxy, { from: PolymathAccount }); + }) + .then(() => { + return deployer.deploy(STRGetter, {from: PolymathAccount}); + }) + .then(() => { + return SecurityTokenRegistryProxy.at(SecurityTokenRegistryProxy.address); + }) + .then((securityTokenRegistryProxy) => { + let bytesProxy = web3.eth.abi.encodeFunctionCall(functionSignatureProxy, [ + PolymathRegistry.address, + STFactory.address, + initRegFee, + initRegFee, + PolymathAccount, + STRGetter.address + ]); + return securityTokenRegistryProxy.upgradeToAndCall("1.0.0", SecurityTokenRegistry.address, bytesProxy, { + from: PolymathAccount + }); + }) + .then(() => { + // Assign the address into the SecurityTokenRegistry key + return polymathRegistry.changeAddress("SecurityTokenRegistry", SecurityTokenRegistryProxy.address, { from: PolymathAccount }); + }) + .then(() => { + // Update all addresses into the registry contract by calling the function updateFromregistry + return moduleRegistry.updateFromRegistry({ from: PolymathAccount }); + }) + .then(() => { + // D) Register the PercentageTransferManagerFactory in the ModuleRegistry to make the factory available at the protocol level. + // So any securityToken can use that factory to generate the PercentageTransferManager contract. + return moduleRegistry.registerModule(PercentageTransferManagerFactory.address, { from: PolymathAccount }); + }) + .then(() => { + // D) Register the CountTransferManagerFactory in the ModuleRegistry to make the factory available at the protocol level. + // So any securityToken can use that factory to generate the CountTransferManager contract. + return moduleRegistry.registerModule(CountTransferManagerFactory.address, { from: PolymathAccount }); + }) + .then(() => { + // D) Register the GeneralTransferManagerFactory in the ModuleRegistry to make the factory available at the protocol level. + // So any securityToken can use that factory to generate the GeneralTransferManager contract. + return moduleRegistry.registerModule(GeneralTransferManagerFactory.address, { from: PolymathAccount }); + }) + .then(() => { + // E) Register the GeneralPermissionManagerFactory in the ModuleRegistry to make the factory available at the protocol level. + // So any securityToken can use that factory to generate the GeneralPermissionManager contract. + return moduleRegistry.registerModule(GeneralPermissionManagerFactory.address, { from: PolymathAccount }); + }) + .then(() => { + // E) Register the GeneralPermissionManagerFactory in the ModuleRegistry to make the factory available at the protocol level. + // So any securityToken can use that factory to generate the GeneralPermissionManager contract. + return moduleRegistry.registerModule(EtherDividendCheckpointFactory.address, { from: PolymathAccount }); + }) + .then(() => { + // D) Register the ManualApprovalTransferManagerFactory in the ModuleRegistry to make the factory available at the protocol level. + // So any securityToken can use that factory to generate the ManualApprovalTransferManager contract. + return moduleRegistry.registerModule(ManualApprovalTransferManagerFactory.address, { from: PolymathAccount }); + }) + .then(() => { + // E) Register the ERC20DividendCheckpointFactory in the ModuleRegistry to make the factory available at the protocol level. + // So any securityToken can use that factory to generate the ERC20DividendCheckpoint contract. + return moduleRegistry.registerModule(ERC20DividendCheckpointFactory.address, { from: PolymathAccount }); + }) + .then(() => { + // F) Once the GeneralTransferManagerFactory registered with the ModuleRegistry contract then for making them accessble to the securityToken + // contract, Factory should comes under the verified list of factories or those factories deployed by the securityToken issuers only. + // Here it gets verified because it is deployed by the third party account (Polymath Account) not with the issuer accounts. + return moduleRegistry.verifyModule(GeneralTransferManagerFactory.address, true, { from: PolymathAccount }); + }) + .then(() => { + // G) Once the CountTransferManagerFactory registered with the ModuleRegistry contract then for making them accessble to the securityToken + // contract, Factory should comes under the verified list of factories or those factories deployed by the securityToken issuers only. + // Here it gets verified because it is deployed by the third party account (Polymath Account) not with the issuer accounts. + return moduleRegistry.verifyModule(CountTransferManagerFactory.address, true, { from: PolymathAccount }); + }) + .then(() => { + // G) Once the PercentageTransferManagerFactory registered with the ModuleRegistry contract then for making them accessble to the securityToken + // contract, Factory should comes under the verified list of factories or those factories deployed by the securityToken issuers only. + // Here it gets verified because it is deployed by the third party account (Polymath Account) not with the issuer accounts. + return moduleRegistry.verifyModule(PercentageTransferManagerFactory.address, true, { from: PolymathAccount }); + }) + .then(() => { + // G) Once the GeneralPermissionManagerFactory registered with the ModuleRegistry contract then for making them accessble to the securityToken + // contract, Factory should comes under the verified list of factories or those factories deployed by the securityToken issuers only. + // Here it gets verified because it is deployed by the third party account (Polymath Account) not with the issuer accounts. + return moduleRegistry.verifyModule(GeneralPermissionManagerFactory.address, true, { from: PolymathAccount }); + }) + .then(() => { + // G) Once the EtherDividendCheckpointFactory registered with the ModuleRegistry contract then for making them accessble to the securityToken + // contract, Factory should comes under the verified list of factories or those factories deployed by the securityToken issuers only. + // Here it gets verified because it is deployed by the third party account (Polymath Account) not with the issuer accounts. + return moduleRegistry.verifyModule(EtherDividendCheckpointFactory.address, true, { from: PolymathAccount }); + }) + .then(() => { + // G) Once the ERC20DividendCheckpointFactory registered with the ModuleRegistry contract then for making them accessble to the securityToken + // contract, Factory should comes under the verified list of factories or those factories deployed by the securityToken issuers only. + // Here it gets verified because it is deployed by the third party account (Polymath Account) not with the issuer accounts. + return moduleRegistry.verifyModule(ERC20DividendCheckpointFactory.address, true, { from: PolymathAccount }); + }) + .then(() => { + // G) Once the ManualApprovalTransferManagerFactory registered with the ModuleRegistry contract then for making them accessble to the securityToken + // contract, Factory should comes under the verified list of factories or those factories deployed by the securityToken issuers only. + // Here it gets verified because it is deployed by the third party account (Polymath Account) not with the issuer accounts. + return moduleRegistry.verifyModule(ManualApprovalTransferManagerFactory.address, true, { from: PolymathAccount }); + }) + .then(() => { + // M) Deploy the CappedSTOFactory (Use to generate the CappedSTO contract which will used to collect the funds ). + return deployer.deploy(CappedSTOFactory, cappedSTOSetupCost, new BN(0), new BN(0), CappedSTOLogic.address, { from: PolymathAccount }); + }) + .then(() => { + // N) Register the CappedSTOFactory in the ModuleRegistry to make the factory available at the protocol level. + // So any securityToken can use that factory to generate the CappedSTOFactory contract. + return moduleRegistry.registerModule(CappedSTOFactory.address, { from: PolymathAccount }); + }) + .then(() => { + // G) Once the CappedSTOFactory registered with the ModuleRegistry contract then for making them accessble to the securityToken + // contract, Factory should comes under the verified list of factories or those factories deployed by the securityToken issuers only. + // Here it gets verified because it is deployed by the third party account (Polymath Account) not with the issuer accounts. + return moduleRegistry.verifyModule(CappedSTOFactory.address, true, { from: PolymathAccount }); + }) + .then(() => { + // H) Deploy the USDTieredSTOFactory (Use to generate the USDTieredSTOFactory contract which will used to collect the funds ). + return deployer.deploy(USDTieredSTOFactory, usdTieredSTOSetupCost, new BN(0), new BN(0), USDTieredSTOLogic.address, { from: PolymathAccount }); + }) + .then(() => { + // I) Register the USDTieredSTOFactory in the ModuleRegistry to make the factory available at the protocol level. + // So any securityToken can use that factory to generate the USDTieredSTOFactory contract. + return moduleRegistry.registerModule(USDTieredSTOFactory.address, { from: PolymathAccount }); + }) + .then(() => { + // J) Once the USDTieredSTOFactory registered with the ModuleRegistry contract then for making them accessble to the securityToken + // contract, Factory should comes under the verified list of factories or those factories deployed by the securityToken issuers only. + // Here it gets verified because it is deployed by the third party account (Polymath Account) not with the issuer accounts. + return moduleRegistry.verifyModule(USDTieredSTOFactory.address, true, { from: PolymathAccount }); + }) + .then(() => { + return polymathRegistry.changeAddress("PolyUsdOracle", POLYOracle, { from: PolymathAccount }); + }) + .then(() => { + return polymathRegistry.changeAddress("EthUsdOracle", ETHOracle, { from: PolymathAccount }); + }) + .then(() => { + return deployer.deploy(SecurityToken, "a", "a", 18, 1, "a", polymathRegistry.address, { from: PolymathAccount }); + }) + .then(() => { + console.log("\n"); + console.log(` ----------------------- Polymath Network Smart Contracts: ----------------------- PolymathRegistry: ${PolymathRegistry.address} SecurityTokenRegistry (Proxy): ${SecurityTokenRegistryProxy.address} @@ -373,7 +493,7 @@ module.exports = function (deployer, network, accounts) { ERC20DividendCheckpointFactory: ${ERC20DividendCheckpointFactory.address} --------------------------------------------------------------------------------- `); - console.log('\n'); - // -------- END OF POLYMATH NETWORK Configuration -------// - }); -} + console.log("\n"); + // -------- END OF POLYMATH NETWORK Configuration -------// + }); +}; diff --git a/package.json b/package.json index 239f73f43..809f9148e 100644 --- a/package.json +++ b/package.json @@ -67,12 +67,12 @@ "ethereumjs-testrpc": "^6.0.3", "ethers": "^4.0.7", "fs": "0.0.2", - "openzeppelin-solidity": "2.0.0", + "openzeppelin-solidity": "^2.1.0-rc.2", + "pify": "^4.0.1", "prompt": "^1.0.0", "readline-sync": "^1.4.9", "request": "^2.88.0", "request-promise": "^4.2.2", - "solc": "^0.4.24", "truffle-contract": "^3.0.4", "truffle-hdwallet-provider-privkey": "0.2.0", "web3": "1.0.0-beta.34" @@ -87,14 +87,15 @@ "eslint-plugin-standard": "^4.0.0", "ethereum-bridge": "^0.6.1", "ethereumjs-abi": "^0.6.5", - "ganache-cli": "^6.1.8", + "ganache-cli": "^6.2.4", "mocha-junit-reporter": "^1.18.0", - "prettier": "^1.14.3", + "prettier": "^1.15.3", + "prettier-plugin-solidity-refactor": "^1.0.0-alpha.10", "sol-merger": "^0.1.2", "solidity-coverage": "^0.5.11", "solidity-docgen": "^0.1.0", "solium": "^1.1.6", - "truffle": "4.1.14", + "truffle": "^5.0.0", "truffle-wallet-provider": "0.0.5" }, "greenkeeper": { diff --git a/scripts/calculateSize.js b/scripts/calculateSize.js index 46cf238db..997c34547 100644 --- a/scripts/calculateSize.js +++ b/scripts/calculateSize.js @@ -1,12 +1,10 @@ -const fs = require('fs'); -const path = require('path'); +const fs = require("fs"); +const path = require("path"); var size = new Array(); - - function readFiles() { - if (fs.existsSync('./build/contracts/')) { - let files = fs.readdirSync('./build/contracts/'); + if (fs.existsSync("./build/contracts/")) { + let files = fs.readdirSync("./build/contracts/"); return files; } else { console.log("Directory doesn't exists"); @@ -15,16 +13,16 @@ function readFiles() { async function printSize() { let files = readFiles(); - files.forEach((item) => { + files.forEach(item => { let content = JSON.parse(fs.readFileSync(`./build/contracts/${item}`).toString()).deployedBytecode; - let sizeInKB = ((content.toString()).length / 2) / 1024; + let sizeInKB = content.toString().length / 2 / 1024; size.push(sizeInKB); }); console.log(`NOTE- Maximum size of contracts allowed to deloyed on the Ethereum mainnet is 24 KB(EIP170)`); console.log(`---- Size of the contracts ----`); - for(let i = 0; i < files.length; i++) { - console.log(`${path.basename(files[i], '.json')} - ${size[i]} KB`); + for (let i = 0; i < files.length; i++) { + console.log(`${path.basename(files[i], ".json")} - ${size[i]} KB`); } } -printSize(); \ No newline at end of file +printSize(); diff --git a/scripts/compareStorageLayout.js b/scripts/compareStorageLayout.js index c339bf095..92d43a56f 100644 --- a/scripts/compareStorageLayout.js +++ b/scripts/compareStorageLayout.js @@ -1,139 +1,140 @@ -const fs = require('fs'); -const _ = require('underscore'); -const solc = require('solc'); -const prompt = require('prompt'); -const path = require('path'); -const util = require('util'); -const exec = util.promisify(require('child_process').exec); +const fs = require("fs"); +const _ = require("underscore"); +const solc = require("solc"); +const prompt = require("prompt"); +const path = require("path"); +const util = require("util"); +const exec = util.promisify(require("child_process").exec); prompt.start(); -prompt.get(['LogicContract', 'ProxyContract'], async(err, result) => { - - let logicContract; - let proxyContract; +prompt.get(["LogicContract", "ProxyContract"], async (err, result) => { + let logicContract; + let proxyContract; - const fileList = walkSync('./contracts', []); + const fileList = walkSync("./contracts", []); - let paths = findPath(result.LogicContract, result.ProxyContract, fileList); + let paths = findPath(result.LogicContract, result.ProxyContract, fileList); - if (paths.length == 2) { - - console.log("Contracts exists \n"); - - await flatContracts(paths); + if (paths.length == 2) { + console.log("Contracts exists \n"); - if (path.basename(paths[0]) === result.LogicContract) { - logicContract = fs.readFileSync(`./flat/${path.basename(paths[0])}`, 'utf8'); - } else { - logicContract = fs.readFileSync(`./flat/${path.basename(paths[1])}`, 'utf8'); - } - if (path.basename(paths[0]) === result.ProxyContract) { - proxyContract = fs.readFileSync(`./flat/${path.basename(paths[0])}`, 'utf8'); - } else { - proxyContract = fs.readFileSync(`./flat/${path.basename(paths[1])}`, 'utf8'); - } + await flatContracts(paths); - let logicInput = { - 'contracts': logicContract - } - let proxyInput = { - 'contracts': proxyContract - } + if (path.basename(paths[0]) === result.LogicContract) { + logicContract = fs.readFileSync(`./flat/${path.basename(paths[0])}`, "utf8"); + } else { + logicContract = fs.readFileSync(`./flat/${path.basename(paths[1])}`, "utf8"); + } + if (path.basename(paths[0]) === result.ProxyContract) { + proxyContract = fs.readFileSync(`./flat/${path.basename(paths[0])}`, "utf8"); + } else { + proxyContract = fs.readFileSync(`./flat/${path.basename(paths[1])}`, "utf8"); + } - console.log(compareStorageLayouts(parseContract(logicInput), parseContract(proxyInput))); + let logicInput = { + contracts: logicContract + }; + let proxyInput = { + contracts: proxyContract + }; - } else { - console.log("Contracts doesn't exists"); - } + console.log(compareStorageLayouts(parseContract(logicInput), parseContract(proxyInput))); + } else { + console.log("Contracts doesn't exists"); + } }); function traverseAST(_input, _elements) { - if(_input.children) { - for(var i=0;i<_input.children.length;i++) { - traverseAST(_input.children[i], _elements); + if (_input.children) { + for (var i = 0; i < _input.children.length; i++) { + traverseAST(_input.children[i], _elements); + } } - } - _elements.push(_input); + _elements.push(_input); } function compareStorageLayouts(logicLayout, proxyLayout) { - function makeComp(x) { - return [x.constant, x.name, x.stateVariable, x.storageLocation, x.type, x.value, x.visibility].join(':'); - } - // if(newLayout.length < oldLayout.length) return false; - for(var i=0; i < logicLayout.length; i++) { - const a = logicLayout[i].attributes; - const comp1 = makeComp(a) - console.log(comp1); - const b = proxyLayout[i].attributes; - const comp2 = makeComp(b); - console.log(comp2); - if(comp1 != comp2) { - return false; + function makeComp(x) { + return [x.constant, x.name, x.stateVariable, x.storageLocation, x.type, x.value, x.visibility].join(":"); + } + // if(newLayout.length < oldLayout.length) return false; + for (var i = 0; i < logicLayout.length; i++) { + const a = logicLayout[i].attributes; + const comp1 = makeComp(a); + console.log(comp1); + const b = proxyLayout[i].attributes; + const comp2 = makeComp(b); + console.log(comp2); + if (comp1 != comp2) { + return false; + } } - } - return true; + return true; } function parseContract(input) { - - var output = solc.compile({ sources: input }, 1, _.noop); - const elements = []; - const AST = output.sources.contracts.AST; - // console.log(AST); - traverseAST(AST, elements); - // console.log(elements); - - // filter out all Contract Definitions - const contractDefinitions = _.filter(elements, (e,i) => e.name == 'ContractDefinition'); - - // filter out all linearizedBaseContracts - // pick the last one as the last contract always has the full inheritance - const linearizedBaseContracts = _.last(_.map(contractDefinitions, e => e.attributes.linearizedBaseContracts)); - - // get all stateVariables - const stateVariables = _.filter(elements, e => e.attributes && e.attributes.stateVariable ) - - // group them by scope - const stateVariableMap = _.groupBy(stateVariables, e => e.attributes.scope); - - orderedStateVariables = _.reduceRight(linearizedBaseContracts, (a, b) => { - return a.concat(stateVariableMap[b] || []) - }, []); - return orderedStateVariables; + var output = solc.compile({ sources: input }, 1, _.noop); + const elements = []; + const AST = output.sources.contracts.AST; + // console.log(AST); + traverseAST(AST, elements); + // console.log(elements); + + // filter out all Contract Definitions + const contractDefinitions = _.filter(elements, (e, i) => e.name == "ContractDefinition"); + + // filter out all linearizedBaseContracts + // pick the last one as the last contract always has the full inheritance + const linearizedBaseContracts = _.last(_.map(contractDefinitions, e => e.attributes.linearizedBaseContracts)); + + // get all stateVariables + const stateVariables = _.filter(elements, e => e.attributes && e.attributes.stateVariable); + + // group them by scope + const stateVariableMap = _.groupBy(stateVariables, e => e.attributes.scope); + + orderedStateVariables = _.reduceRight( + linearizedBaseContracts, + (a, b) => { + return a.concat(stateVariableMap[b] || []); + }, + [] + ); + return orderedStateVariables; } var walkSync = function(dir, filelist) { - files = fs.readdirSync(dir); - filelist = filelist || []; - files.forEach(function(file) { - if (fs.statSync(path.join(dir, file)).isDirectory()) { - filelist = walkSync(path.join(dir, file), filelist); - } - else { - filelist.push(path.join(dir, file)); - } - }); - return filelist; + files = fs.readdirSync(dir); + filelist = filelist || []; + files.forEach(function(file) { + if (fs.statSync(path.join(dir, file)).isDirectory()) { + filelist = walkSync(path.join(dir, file), filelist); + } else { + filelist.push(path.join(dir, file)); + } + }); + return filelist; }; var findPath = function(logicContractName, proxyContractName, fileList) { - let paths = new Array(); - for (let i =0; i < fileList.length; i++) { - if ((logicContractName === path.basename(fileList[i]) || logicContractName === (path.basename(fileList[i])).split(".")[0]) || - (proxyContractName === path.basename(fileList[i]) || proxyContractName === (path.basename(fileList[i])).split(".")[0])) { - paths.push(fileList[i]); + let paths = new Array(); + for (let i = 0; i < fileList.length; i++) { + if ( + logicContractName === path.basename(fileList[i]) || + logicContractName === path.basename(fileList[i]).split(".")[0] || + (proxyContractName === path.basename(fileList[i]) || proxyContractName === path.basename(fileList[i]).split(".")[0]) + ) { + paths.push(fileList[i]); + } } - } - return paths; -} + return paths; +}; async function flatContracts(_paths, _logic) { let promises = new Array(); - for (let i = 0; i< _paths.length; i++) { - promises.push(await exec(`./node_modules/.bin/sol-merger ${_paths[i]} ./flat`)); + for (let i = 0; i < _paths.length; i++) { + promises.push(await exec(`./node_modules/.bin/sol-merger ${_paths[i]} ./flat`)); } await Promise.all(promises); } - diff --git a/scripts/encoders/encode_CappedSTO.js b/scripts/encoders/encode_CappedSTO.js index 12527a1e1..dc9d054c2 100644 --- a/scripts/encoders/encode_CappedSTO.js +++ b/scripts/encoders/encode_CappedSTO.js @@ -1,10 +1,10 @@ -const Web3 = require('web3'); +const Web3 = require("web3"); -if (typeof web3 !== 'undefined') { - web3 = new Web3(web3.currentProvider); +if (typeof web3 !== "undefined") { + web3 = new Web3(web3.currentProvider); } else { - // set the provider you want from Web3.providers - web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545")); + // set the provider you want from Web3.providers + web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545")); } let startTime = process.argv.slice(2)[0]; @@ -13,33 +13,42 @@ let cap = process.argv.slice(2)[2]; let rate = process.argv.slice(2)[3]; let wallet = process.argv.slice(2)[4]; - -let bytesSTO = web3.eth.abi.encodeFunctionCall({ - name: 'configure', - type: 'function', - inputs: [{ - type: 'uint256', - name: '_startTime' - },{ - type: 'uint256', - name: '_endTime' - },{ - type: 'uint256', - name: '_cap' - },{ - type: 'uint256', - name: '_rate' - },{ - type: 'uint8', - name: '_fundRaiseType' - },{ - type: 'address', - name: '_polyToken' - },{ - type: 'address', - name: '_fundsReceiver' - } +let bytesSTO = web3.eth.abi.encodeFunctionCall( + { + name: "configure", + type: "function", + inputs: [ + { + type: "uint256", + name: "_startTime" + }, + { + type: "uint256", + name: "_endTime" + }, + { + type: "uint256", + name: "_cap" + }, + { + type: "uint256", + name: "_rate" + }, + { + type: "uint8", + name: "_fundRaiseType" + }, + { + type: "address", + name: "_polyToken" + }, + { + type: "address", + name: "_fundsReceiver" + } ] - }, [startTime, endTime, web3.utils.toWei(cap, 'ether'), rate,0,0,wallet]); + }, + [startTime, endTime, web3.utils.toWei(cap, "ether"), rate, 0, 0, wallet] +); - console.log(bytesSTO); +console.log(bytesSTO); diff --git a/scripts/patch.js b/scripts/patch.js index b1bbbcb3f..bf006d160 100644 --- a/scripts/patch.js +++ b/scripts/patch.js @@ -1,25 +1,26 @@ -const fs = require('fs'); -const request = require('request'); -const regex = /node ..\/n(.)*,/gmi; -const regex2 = /truffle test(.)*,/gmi; +const fs = require("fs"); +const request = require("request"); +const regex = /node ..\/n(.)*,/gim; +const regex2 = /truffle test(.)*,/gim; -request('https://raw.githubusercontent.com/maxsam4/solidity-coverage/relative-path/lib/app.js').pipe(fs.createWriteStream('node_modules\\solidity-coverage\\lib\\app.js')); +request("https://raw.githubusercontent.com/maxsam4/solidity-coverage/relative-path/lib/app.js").pipe( + fs.createWriteStream("node_modules\\solidity-coverage\\lib\\app.js") +); -fs.readFile('.solcover.js', 'utf8', function (err,data) { - if (err) { - return console.log(err); - } +fs.readFile(".solcover.js", "utf8", function(err, data) { + if (err) { + return console.log(err); + } - let testCommand = 'truffle test --network coverage'; - fs.readdirSync('./test').forEach(file => { - if(file != 'a_poly_oracle.js' && file != 's_v130_to_v140_upgrade.js') - testCommand = testCommand + ' test\\\\' + file; - }); - testCommand = testCommand + '\','; - let result = data.replace(regex2, testCommand); - result = result.replace(regex, testCommand); + let testCommand = "truffle test --network coverage"; + fs.readdirSync("./test").forEach(file => { + if (file != "a_poly_oracle.js" && file != "s_v130_to_v140_upgrade.js") testCommand = testCommand + " test\\\\" + file; + }); + testCommand = testCommand + "',"; + let result = data.replace(regex2, testCommand); + result = result.replace(regex, testCommand); - fs.writeFile('.solcover.js', result, 'utf8', function (err) { - if (err) return console.log(err); - }); -}); \ No newline at end of file + fs.writeFile(".solcover.js", result, "utf8", function(err) { + if (err) return console.log(err); + }); +}); diff --git a/scripts/test.sh b/scripts/test.sh index 9f595d0ba..f44a7af89 100755 --- a/scripts/test.sh +++ b/scripts/test.sh @@ -57,7 +57,7 @@ start_testrpc() { ) if [ "$COVERAGE" = true ]; then - node_modules/.bin/testrpc-sc --gasLimit 0xfffffffffff --port "$testrpc_port" "${accounts[@]}" > /dev/null & + node_modules/.bin/testrpc-sc --gasLimit 0xfffffffff --port "$testrpc_port" "${accounts[@]}" > /dev/null & else node_modules/.bin/ganache-cli --gasLimit 8000000 "${accounts[@]}" > /dev/null & fi @@ -90,6 +90,7 @@ fi if [ "$COVERAGE" = true ]; then curl -o node_modules/solidity-coverage/lib/app.js https://raw.githubusercontent.com/maxsam4/solidity-coverage/relative-path/lib/app.js + curl -o node_modules/solidity-parser-sc/build/parser.js https://raw.githubusercontent.com/maxsam4/solidity-parser/solidity-0.5/build/parser.js node_modules/.bin/solidity-coverage if [ "$CIRCLECI" = true ]; then cat coverage/lcov.info | node_modules/.bin/coveralls diff --git a/scripts/tokenInfo-v1.js b/scripts/tokenInfo-v1.js index ea14a7efe..490fccfee 100644 --- a/scripts/tokenInfo-v1.js +++ b/scripts/tokenInfo-v1.js @@ -1,18 +1,31 @@ const Web3 = require("web3"); const web3 = new Web3(new Web3.providers.HttpProvider("https://mainnet.infura.io/")); -var request = require('request-promise') +var request = require("request-promise"); -const securityTokenABI = JSON.parse(require('fs').readFileSync('../CLI/data/SecurityToken1-4-0.json').toString()).abi; -const generalTransferManagerABI = JSON.parse(require('fs').readFileSync('../CLI/data/GeneralTransferManager1-4-0.json').toString()).abi; +const securityTokenABI = JSON.parse( + require("fs") + .readFileSync("../CLI/data/SecurityToken1-4-0.json") + .toString() +).abi; +const generalTransferManagerABI = JSON.parse( + require("fs") + .readFileSync("../CLI/data/GeneralTransferManager1-4-0.json") + .toString() +).abi; async function getTokens() { const securityTokenRegistryAddress = "0xEf58491224958d978fACF55D2120c55A24516B98"; const securityTokenRegistryABI = await getABIfromEtherscan(securityTokenRegistryAddress); const securityTokenRegistry = new web3.eth.Contract(securityTokenRegistryABI, securityTokenRegistryAddress); - let logs = await getLogsFromEtherscan(securityTokenRegistry.options.address, web3.utils.hexToNumber('0x5C5C18'), 'latest', 'LogNewSecurityToken(string,address,address)'); + let logs = await getLogsFromEtherscan( + securityTokenRegistry.options.address, + web3.utils.hexToNumber("0x5C5C18"), + "latest", + "LogNewSecurityToken(string,address,address)" + ); for (let i = 0; i < logs.length; i++) { - let tokenAddress = '0x' + logs[i].topics[1].slice(26, 66) + let tokenAddress = "0x" + logs[i].topics[1].slice(26, 66); await getInfo(tokenAddress); } } @@ -21,17 +34,22 @@ async function getInfo(tokenAddress) { let token = new web3.eth.Contract(securityTokenABI, tokenAddress); console.log("Token - " + tokenAddress); console.log("----------------------"); - console.log("Owner: " + await token.methods.owner().call()); - console.log("Name: " + await token.methods.name().call()); - console.log("Symbol: " + await token.methods.symbol().call()); - console.log("Total Supply: " + await token.methods.totalSupply().call()); - console.log("Frozen: " + await token.methods.freeze().call()); - console.log("Investors: " + await token.methods.investorCount().call()); - console.log("Latest Checkpoint: " + await token.methods.currentCheckpointId().call()); - console.log("Finished Issuer Minting: " + await token.methods.finishedIssuerMinting().call()); - console.log("Finished STO Minting: " + await token.methods.finishedSTOMinting().call()); + console.log("Owner: " + (await token.methods.owner().call())); + console.log("Name: " + (await token.methods.name().call())); + console.log("Symbol: " + (await token.methods.symbol().call())); + console.log("Total Supply: " + (await token.methods.totalSupply().call())); + console.log("Frozen: " + (await token.methods.freeze().call())); + console.log("Investors: " + (await token.methods.investorCount().call())); + console.log("Latest Checkpoint: " + (await token.methods.currentCheckpointId().call())); + console.log("Finished Issuer Minting: " + (await token.methods.finishedIssuerMinting().call())); + console.log("Finished STO Minting: " + (await token.methods.finishedSTOMinting().call())); let gtmRes = await token.methods.modules(2, 0).call(); - let gtmEvents = await getLogsFromEtherscan(gtmRes.moduleAddress, web3.utils.hexToNumber('0x5C5C18'), 'latest', 'LogModifyWhitelist(address,uint256,address,uint256,uint256,uint256,bool)'); + let gtmEvents = await getLogsFromEtherscan( + gtmRes.moduleAddress, + web3.utils.hexToNumber("0x5C5C18"), + "latest", + "LogModifyWhitelist(address,uint256,address,uint256,uint256,uint256,bool)" + ); console.log("Count of GeneralTransferManager Events: " + gtmEvents.length); console.log("Modules Attached (TransferManager):"); await getModules(2, token); @@ -41,7 +59,7 @@ async function getInfo(tokenAddress) { await getModules(3, token); console.log("Modules Attached (Checkpoint):"); await getModules(4, token); - console.log("") + console.log(""); console.log(); console.log(); } @@ -65,19 +83,19 @@ async function getModules(type, token) { } async function getLogsFromEtherscan(_address, _fromBlock, _toBlock, _eventSignature) { - let urlDomain = 'api'; + let urlDomain = "api"; const options = { url: `https://${urlDomain}.etherscan.io/api`, qs: { - module: 'logs', - action: 'getLogs', + module: "logs", + action: "getLogs", fromBlock: _fromBlock, toBlock: _toBlock, address: _address, topic0: web3.utils.sha3(_eventSignature), - apikey: 'THM9IUVC2DJJ6J5MTICDE6H1HGQK14X559' + apikey: "THM9IUVC2DJJ6J5MTICDE6H1HGQK14X559" }, - method: 'GET', + method: "GET", json: true }; let data = await request(options); @@ -85,20 +103,20 @@ async function getLogsFromEtherscan(_address, _fromBlock, _toBlock, _eventSignat } async function getABIfromEtherscan(_address) { - let urlDomain = 'api'; + let urlDomain = "api"; const options = { url: `https://${urlDomain}.etherscan.io/api`, qs: { - module: 'contract', - action: 'getabi', + module: "contract", + action: "getabi", address: _address, - apikey: 'THM9IUVC2DJJ6J5MTICDE6H1HGQK14X559' + apikey: "THM9IUVC2DJJ6J5MTICDE6H1HGQK14X559" }, - method: 'GET', + method: "GET", json: true }; let data = await request(options); return JSON.parse(data.result); } -getTokens(); \ No newline at end of file +getTokens(); diff --git a/scripts/tokenInfo-v2.js b/scripts/tokenInfo-v2.js index 1d0f9236f..749bb299d 100644 --- a/scripts/tokenInfo-v2.js +++ b/scripts/tokenInfo-v2.js @@ -1,19 +1,32 @@ const Web3 = require("web3"); const web3 = new Web3(new Web3.providers.HttpProvider("https://mainnet.infura.io/")); -var request = require('request-promise') +var request = require("request-promise"); -const securityTokenABI = JSON.parse(require('fs').readFileSync('../build/contracts/SecurityToken.json').toString()).abi; -const generalTransferManagerABI = JSON.parse(require('fs').readFileSync('../build/contracts/GeneralTransferManager.json').toString()).abi; +const securityTokenABI = JSON.parse( + require("fs") + .readFileSync("../build/contracts/SecurityToken.json") + .toString() +).abi; +const generalTransferManagerABI = JSON.parse( + require("fs") + .readFileSync("../build/contracts/GeneralTransferManager.json") + .toString() +).abi; async function getTokens() { const securityTokenRegistryAddress = "0x240f9f86b1465bf1b8eb29bc88cbf65573dfdd97"; const securityTokenRegistryABI = await getABIfromEtherscan(securityTokenRegistryAddress); const securityTokenRegistry = new web3.eth.Contract(securityTokenRegistryABI, securityTokenRegistryAddress); - let logs = await getLogsFromEtherscan(securityTokenRegistry.options.address, 0, 'latest', 'NewSecurityToken(string,string,address,address,uint256,address,bool,uint256)'); + let logs = await getLogsFromEtherscan( + securityTokenRegistry.options.address, + 0, + "latest", + "NewSecurityToken(string,string,address,address,uint256,address,bool,uint256)" + ); console.log(logs.length); for (let i = 0; i < logs.length; i++) { - let tokenAddress = '0x' + logs[i].topics[1].slice(26, 66) + let tokenAddress = "0x" + logs[i].topics[1].slice(26, 66); await getInfo(tokenAddress); } } @@ -23,25 +36,30 @@ async function getInfo(tokenAddress) { console.log("Token - " + tokenAddress); console.log("----------------------"); //console.log("Owner: " + await token.methods.owner().call()); - console.log("Name: " + await token.methods.name().call()); - console.log("Details: " + await token.methods.tokenDetails().call()); - console.log("Symbol: " + await token.methods.symbol().call()); - console.log("Granularity: " + await token.methods.granularity().call()); - console.log("Total Supply: " + await token.methods.totalSupply().call()); - console.log("Transfers Frozen: " + await token.methods.transfersFrozen().call()); - console.log("Minting Frozen: " + await token.methods.mintingFrozen().call()); + console.log("Name: " + (await token.methods.name().call())); + console.log("Details: " + (await token.methods.tokenDetails().call())); + console.log("Symbol: " + (await token.methods.symbol().call())); + console.log("Granularity: " + (await token.methods.granularity().call())); + console.log("Total Supply: " + (await token.methods.totalSupply().call())); + console.log("Transfers Frozen: " + (await token.methods.transfersFrozen().call())); + console.log("Minting Frozen: " + (await token.methods.mintingFrozen().call())); let controllerDisabled = await token.methods.controllerDisabled().call(); if (controllerDisabled) { console.log("Controller disabled: YES"); } else { - console.log("Controller: " + await token.methods.controller().call()); + console.log("Controller: " + (await token.methods.controller().call())); } - console.log("Investors: " + await token.methods.getInvestorCount().call()); - console.log("Latest Checkpoint: " + await token.methods.currentCheckpointId().call()); + console.log("Investors: " + (await token.methods.getInvestorCount().call())); + console.log("Latest Checkpoint: " + (await token.methods.currentCheckpointId().call())); let gtmEventsCount = 0; - let gtmModules = await token.methods.getModulesByName(web3.utils.toHex('GeneralTransferManager')).call(); + let gtmModules = await token.methods.getModulesByName(web3.utils.toHex("GeneralTransferManager")).call(); for (const m of gtmModules) { - let gtmEvents = await getLogsFromEtherscan(m, 9299699, 'latest', 'ModifyWhitelist(address,uint256,address,uint256,uint256,uint256,bool)'); + let gtmEvents = await getLogsFromEtherscan( + m, + 9299699, + "latest", + "ModifyWhitelist(address,uint256,address,uint256,uint256,uint256,bool)" + ); gtmEventsCount += gtmEvents.length; } console.log("Count of GeneralTransferManager Events: " + gtmEventsCount); @@ -69,19 +87,19 @@ async function getModules(type, token) { } async function getLogsFromEtherscan(_address, _fromBlock, _toBlock, _eventSignature) { - let urlDomain = 'api'; + let urlDomain = "api"; const options = { url: `https://${urlDomain}.etherscan.io/api`, qs: { - module: 'logs', - action: 'getLogs', + module: "logs", + action: "getLogs", fromBlock: _fromBlock, toBlock: _toBlock, address: _address, topic0: web3.utils.sha3(_eventSignature), - apikey: 'THM9IUVC2DJJ6J5MTICDE6H1HGQK14X559' + apikey: "THM9IUVC2DJJ6J5MTICDE6H1HGQK14X559" }, - method: 'GET', + method: "GET", json: true }; let data = await request(options); @@ -89,20 +107,20 @@ async function getLogsFromEtherscan(_address, _fromBlock, _toBlock, _eventSignat } async function getABIfromEtherscan(_address) { - let urlDomain = 'api'; + let urlDomain = "api"; const options = { url: `https://${urlDomain}.etherscan.io/api`, qs: { - module: 'contract', - action: 'getabi', + module: "contract", + action: "getabi", address: _address, - apikey: 'THM9IUVC2DJJ6J5MTICDE6H1HGQK14X559' + apikey: "THM9IUVC2DJJ6J5MTICDE6H1HGQK14X559" }, - method: 'GET', + method: "GET", json: true }; let data = await request(options); return JSON.parse(data.result); } -getTokens(); \ No newline at end of file +getTokens(); diff --git a/test/a_poly_oracle.js b/test/a_poly_oracle.js index 6363fe151..025b6ec72 100644 --- a/test/a_poly_oracle.js +++ b/test/a_poly_oracle.js @@ -5,10 +5,10 @@ import { increaseTime } from "./helpers/time"; import { catchRevert } from "./helpers/exceptions"; const Web3 = require("web3"); -const BigNumber = require("bignumber.js"); +let BN = Web3.utils.BN; const web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545")); // Hardcoded development port -contract("PolyOracle", accounts => { +contract("PolyOracle", async (accounts) => { let I_PolyOracle; let owner; const URL = @@ -52,41 +52,43 @@ contract("PolyOracle", accounts => { describe("Scheduling test cases", async () => { it("Should schedule the timing of the call - fails - non owner", async () => { let timeScheduling = [ - latestTime() + duration.minutes(1), - latestTime() + duration.minutes(2), - latestTime() + duration.minutes(3) + await latestTime() + duration.minutes(1), + await latestTime() + duration.minutes(2), + await latestTime() + duration.minutes(3) ]; - await catchRevert(I_PolyOracle.schedulePriceUpdatesFixed(timeScheduling, { from: accounts[1], value: web3.utils.toWei("2") })); + await catchRevert(I_PolyOracle.schedulePriceUpdatesFixed(timeScheduling, { from: accounts[1], value: new BN(web3.utils.toWei("2")) })); }); it("Should schedule the timing of the call - fails - no value", async () => { let timeScheduling = [ - latestTime() + duration.minutes(1), - latestTime() + duration.minutes(2), - latestTime() + duration.minutes(3) + await latestTime() + duration.minutes(1), + await latestTime() + duration.minutes(2), + await latestTime() + duration.minutes(3) ]; await catchRevert(I_PolyOracle.schedulePriceUpdatesFixed(timeScheduling, { from: owner })); }); it("Should schedule the timing of the call - single call", async () => { - let blockNo = latestBlock(); - let tx = await I_PolyOracle.schedulePriceUpdatesFixed([], { from: owner, value: web3.utils.toWei("1") }); - assert.isAtMost(tx.logs[0].args._time.toNumber(), latestTime()); + let blockNo = await latestBlock(); + let tx = await I_PolyOracle.schedulePriceUpdatesFixed([], { from: owner, value: new BN(web3.utils.toWei("1")) }); + assert.isAtMost(tx.logs[0].args._time.toNumber(), await latestTime()); // await increaseTime(50); - const logNewPriceWatcher = await promisifyLogWatch(I_PolyOracle.PriceUpdated({ fromBlock: blockNo }), 1); + const logNewPriceWatcher = (await I_PolyOracle.getPastEvents('PriceUpdated', {filter: {from: blockNo}}))[0]; // const log = await logNewPriceWatcher; assert.equal(logNewPriceWatcher.event, "PriceUpdated", "PriceUpdated not emitted."); assert.isNotNull(logNewPriceWatcher.args._price, "Price returned was null."); assert.equal(logNewPriceWatcher.args._oldPrice.toNumber(), 0); console.log( - "Success! Current price is: " + logNewPriceWatcher.args._price.dividedBy(new BigNumber(10).pow(18)).toNumber() + " USD/POLY" + "Success! Current price is: " + + logNewPriceWatcher.args._price.div(new BN(10).pow(new BN(18))).toNumber() + + " USD/POLY" ); }); it("Should schedule the timing of the call - multiple calls", async () => { - let blockNo = latestBlock(); - let timeScheduling = [latestTime() + duration.seconds(10), latestTime() + duration.seconds(20)]; - let tx = await I_PolyOracle.schedulePriceUpdatesFixed(timeScheduling, { from: owner, value: web3.utils.toWei("1.5") }); + let blockNo = await latestBlock(); + let timeScheduling = [await latestTime() + duration.seconds(10), await latestTime() + duration.seconds(20)]; + let tx = await I_PolyOracle.schedulePriceUpdatesFixed(timeScheduling, { from: owner, value: new BN(web3.utils.toWei("1.5")) }); let event_data = tx.logs; @@ -97,34 +99,34 @@ contract("PolyOracle", accounts => { } // Wait for the callback to be invoked by oraclize and the event to be emitted - const logNewPriceWatcher = promisifyLogWatch(I_PolyOracle.PriceUpdated({ fromBlock: blockNo }), 2); + const logNewPriceWatcher = (await I_PolyOracle.getPastEvents('PriceUpdated', {filter: {from: blockNo}}))[1]; const log = await logNewPriceWatcher; assert.equal(log.event, "PriceUpdated", "PriceUpdated not emitted."); assert.isNotNull(log.args._price, "Price returned was null."); - console.log("Success! Current price is: " + log.args._price.dividedBy(new BigNumber(10).pow(18)).toNumber() + " USD/POLY"); + console.log("Success! Current price is: " + log.args._price.div(new BN(10).pow(new BN(18))).toNumber() + " USD/POLY"); }); it("Should schedule to call using iters - fails", async () => { - await catchRevert(I_PolyOracle.schedulePriceUpdatesRolling(latestTime() + 10, 30, 2, { from: accounts[6] })); + await catchRevert(I_PolyOracle.schedulePriceUpdatesRolling(await latestTime() + 10, 30, 2, { from: accounts[6] })); }); it("Should schedule to call using iters", async () => { - let blockNo = latestBlock(); + let blockNo = await latestBlock(); console.log(`Latest Block number of the local chain:${blockNo}`); - let tx = await I_PolyOracle.schedulePriceUpdatesRolling(latestTime() + 10, 10, 2, { from: owner }); + let tx = await I_PolyOracle.schedulePriceUpdatesRolling(await latestTime() + 10, 10, 2, { from: owner }); let event_data = tx.logs; for (var i = 0; i < event_data.length; i++) { let time = event_data[i].args._time; requestIds.push(event_data[i].args._queryId); console.log(` checking the time for the ${i} index and the scheduling time is ${time}`); - assert.isAtMost(time.toNumber(), latestTime() + (i + 1) * 30); + assert.isAtMost(time.toNumber(), await latestTime() + (i + 1) * 30); } // Wait for the callback to be invoked by oraclize and the event to be emitted - const logNewPriceWatcher = promisifyLogWatch(I_PolyOracle.PriceUpdated({ fromBlock: blockNo }), 2); + const logNewPriceWatcher = (await I_PolyOracle.getPastEvents('PriceUpdated', {filter: {from: blockNo}}))[1]; const log = await logNewPriceWatcher; assert.equal(log.event, "PriceUpdated", "PriceUpdated not emitted."); assert.isNotNull(log.args._price, "Price returned was null."); - console.log("Success! Current price is: " + log.args._price.dividedBy(new BigNumber(10).pow(18)).toNumber() + " USD/POLY"); + console.log("Success! Current price is: " + log.args._price.div(new BN(10).pow(new BN(18))).toNumber() + " USD/POLY"); latestPrice = log.args._price; }); }); @@ -154,26 +156,26 @@ contract("PolyOracle", accounts => { }); it("Should change the sanity bounds manually - fails - bad owner", async () => { - await catchRevert(I_PolyOracle.setSanityBounds(new BigNumber(25).times(new BigNumber(10).pow(16)), { from: accounts[6] })); + await catchRevert(I_PolyOracle.setSanityBounds(new BN(25).mul(new BN(10).pow(16)), { from: accounts[6] })); }); it("Should change the sanity bounds manually", async () => { console.log(JSON.stringify(await I_PolyOracle.sanityBounds.call())); - await I_PolyOracle.setSanityBounds(new BigNumber(25).times(new BigNumber(10).pow(16)), { from: owner }); + await I_PolyOracle.setSanityBounds(new BN(25).mul(new BN(10).pow(16)), { from: owner }); let sanityBounds = await I_PolyOracle.sanityBounds.call(); console.log(JSON.stringify(await I_PolyOracle.sanityBounds.call())); - assert.equal(sanityBounds.toNumber(), new BigNumber(25).times(new BigNumber(10).pow(16)).toNumber()); + assert.equal(sanityBounds.toNumber(), new BN(25).mul(new BN(10).pow(16)).toNumber()); }); it("Should change the gas price manually - fails - bad owner", async () => { - await catchRevert(I_PolyOracle.setGasPrice(new BigNumber(60).times(new BigNumber(10).pow(9)), { from: accounts[6] })); + await catchRevert(I_PolyOracle.setGasPrice(new BN(60).mul(new BN(10).pow(9)), { from: accounts[6] })); }); it("Should change the gas price manually", async () => { - await I_PolyOracle.setGasPrice(new BigNumber(60).times(new BigNumber(10).pow(9)), { from: owner }); - let blockNo = latestBlock(); - let timeScheduling = [latestTime() + duration.seconds(10), latestTime() + duration.seconds(20)]; - let tx = await I_PolyOracle.schedulePriceUpdatesFixed(timeScheduling, { from: owner, value: web3.utils.toWei("2") }); + await I_PolyOracle.setGasPrice(new BN(60).mul(new BN(10).pow(9)), { from: owner }); + let blockNo = await latestBlock(); + let timeScheduling = [await latestTime() + duration.seconds(10), await latestTime() + duration.seconds(20)]; + let tx = await I_PolyOracle.schedulePriceUpdatesFixed(timeScheduling, { from: owner, value: new BN(web3.utils.toWei("2")) }); let event_data = tx.logs; @@ -182,13 +184,14 @@ contract("PolyOracle", accounts => { console.log(` checking the time for the ${i} index and the scheduling time is ${time}`); assert.isAtMost(time.toNumber(), timeScheduling[i]); } - - const logNewPriceWatcher = await promisifyLogWatch(I_PolyOracle.PriceUpdated({ fromBlock: blockNo }), 2); + const logNewPriceWatcher = (await I_PolyOracle.getPastEvents('PriceUpdated', {filter: {from: blockNo}}))[1]; assert.equal(logNewPriceWatcher.event, "PriceUpdated", "PriceUpdated not emitted."); assert.isNotNull(logNewPriceWatcher.args._price, "Price returned was null."); console.log( - "Success! Current price is: " + logNewPriceWatcher.args._price.dividedBy(new BigNumber(10).pow(18)).toNumber() + " USD/POLY" + "Success! Current price is: " + + logNewPriceWatcher.args._price.div(new BN(10).pow(new BN(18))).toNumber() + + " USD/POLY" ); // assert.isTrue(false); }); @@ -243,14 +246,16 @@ contract("PolyOracle", accounts => { }); it("Should schedule the timing of the call - after changes", async () => { - let blockNo = latestBlock(); - let tx = await I_PolyOracle.schedulePriceUpdatesFixed([], { from: owner, value: web3.utils.toWei("1") }); - assert.isAtMost(tx.logs[0].args._time.toNumber(), latestTime()); - const logNewPriceWatcher = await promisifyLogWatch(I_PolyOracle.PriceUpdated({ fromBlock: blockNo }), 1); + let blockNo = await latestBlock(); + let tx = await I_PolyOracle.schedulePriceUpdatesFixed([], { from: owner, value: new BN(web3.utils.toWei("1")) }); + assert.isAtMost(tx.logs[0].args._time.toNumber(), await latestTime()); + const logNewPriceWatcher = (await I_PolyOracle.getPastEvents('PriceUpdated', {filter: {from: blockNo}}))[0]; assert.equal(logNewPriceWatcher.event, "PriceUpdated", "PriceUpdated not emitted."); assert.isNotNull(logNewPriceWatcher.args._price, "Price returned was null."); console.log( - "Success! Current price is: " + logNewPriceWatcher.args._price.dividedBy(new BigNumber(10).pow(18)).toNumber() + " USD/POLY" + "Success! Current price is: " + + logNewPriceWatcher.args._price.div(new BN(10).pow(new BN(18))).toNumber() + + " USD/POLY" ); // assert.isTrue(false); }); diff --git a/test/b_capped_sto.js b/test/b_capped_sto.js index ab8f32688..94d0d4368 100644 --- a/test/b_capped_sto.js +++ b/test/b_capped_sto.js @@ -1,5 +1,5 @@ import latestTime from "./helpers/latestTime"; -import { duration, ensureException, promisifyLogWatch, latestBlock } from "./helpers/utils"; +import { duration, ensureException, latestBlock } from "./helpers/utils"; import { takeSnapshot, increaseTime, revertToSnapshot } from "./helpers/time"; import { encodeModuleCall } from "./helpers/encodeCall"; import { setUpPolymathNetwork, deployGPMAndVerifyed, deployCappedSTOAndVerifyed } from "./helpers/createInstances"; @@ -12,13 +12,14 @@ const GeneralTransferManager = artifacts.require("./GeneralTransferManager"); const GeneralPermissionManager = artifacts.require("./GeneralPermissionManager"); const Web3 = require("web3"); -const BigNumber = require("bignumber.js"); +let BN = Web3.utils.BN; +let toBN = Web3.utils.toBN; const web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545")); // Hardcoded development port let ETH = 0; let POLY = 1; let DAI = 2; -contract("CappedSTO", accounts => { +contract("CappedSTO", async (accounts) => { // Accounts Variable declaration let account_polymath; let account_investor1; @@ -79,15 +80,15 @@ contract("CappedSTO", accounts => { const budget = 0; // Initial fee for ticker registry and security token registry - const initRegFee = web3.utils.toWei("250"); + const initRegFee = new BN(web3.utils.toWei("250")); // Capped STO details let startTime_ETH1; let endTime_ETH1; let startTime_ETH2; let endTime_ETH2; - const cap = web3.utils.toWei("10000"); - const rate = web3.utils.toWei("1000"); + const cap = new BN(web3.utils.toWei("10000")); + const rate = new BN(web3.utils.toWei("1000")); const E_fundRaiseType = 0; const address_zero = "0x0000000000000000000000000000000000000000"; @@ -96,15 +97,17 @@ contract("CappedSTO", accounts => { let startTime_POLY2; let endTime_POLY2; let blockNo; - const P_cap = web3.utils.toWei("50000"); + const P_cap = new BN(web3.utils.toWei("50000")); const P_fundRaiseType = 1; - const P_rate = web3.utils.toWei("5"); - const cappedSTOSetupCost = web3.utils.toWei("20000", "ether"); + const P_rate = new BN(web3.utils.toWei("5")); + const cappedSTOSetupCost = new BN(web3.utils.toWei("20000", "ether")); const maxCost = cappedSTOSetupCost; const STOParameters = ["uint256", "uint256", "uint256", "uint256", "uint8[]", "address"]; + let currentTime; + before(async () => { - // Accounts setup + currentTime = new BN(await latestTime()); account_polymath = accounts[0]; account_issuer = accounts[1]; account_investor1 = accounts[4]; @@ -114,7 +117,6 @@ contract("CappedSTO", accounts => { token_owner = account_issuer; let instances = await setUpPolymathNetwork(account_polymath, token_owner); - [ I_PolymathRegistry, I_PolyToken, @@ -131,7 +133,7 @@ contract("CappedSTO", accounts => { ] = instances; // STEP 5: Deploy the GeneralDelegateManagerFactory - [I_GeneralPermissionManagerFactory] = await deployGPMAndVerifyed(account_polymath, I_MRProxied, 0); + [I_GeneralPermissionManagerFactory] = await deployGPMAndVerifyed(account_polymath, I_MRProxied, new BN(0)); // STEP 6: Deploy the CappedSTOFactory @@ -166,16 +168,15 @@ contract("CappedSTO", accounts => { it("Should generate the new security token with the same symbol as registered above", async () => { await I_PolyToken.approve(I_STRProxied.address, initRegFee, { from: token_owner }); - let _blockNo = latestBlock(); + let tx = await I_STRProxied.generateSecurityToken(name, symbol, tokenDetails, false, { from: token_owner }); // Verify the successful generation of the security token assert.equal(tx.logs[2].args._ticker, symbol, "SecurityToken doesn't get deployed"); - I_SecurityToken_ETH = SecurityToken.at(tx.logs[2].args._securityTokenAddress); - - const log = await promisifyLogWatch(I_SecurityToken_ETH.ModuleAdded({ from: _blockNo }), 1); + I_SecurityToken_ETH = await SecurityToken.at(tx.logs[2].args._securityTokenAddress); + const log = (await I_SecurityToken_ETH.getPastEvents('ModuleAdded', {filter: {transactionHash: tx.transactionHash}}))[0]; // Verify that GeneralTransferManager module get added successfully or not assert.equal(log.args._types[0].toNumber(), transferManagerKey); assert.equal(web3.utils.hexToString(log.args._name), "GeneralTransferManager"); @@ -183,51 +184,49 @@ contract("CappedSTO", accounts => { it("Should intialize the auto attached modules", async () => { let moduleData = (await I_SecurityToken_ETH.getModulesByType(transferManagerKey))[0]; - I_GeneralTransferManager = GeneralTransferManager.at(moduleData); + I_GeneralTransferManager = await GeneralTransferManager.at(moduleData); }); it("Should mint the tokens before attaching the STO", async () => { - await catchRevert( - I_SecurityToken_ETH.mint(address_zero, web3.utils.toWei("1"), { from: token_owner }) - ); + await catchRevert(I_SecurityToken_ETH.mint(address_zero, new BN(new BN(web3.utils.toWei("1"))), { from: token_owner })); }); it("Should fail to launch the STO due to security token doesn't have the sufficient POLY", async () => { - let startTime = latestTime() + duration.days(1); + let startTime = await latestTime() + duration.days(1); let endTime = startTime + duration.days(30); await I_PolyToken.getTokens(cappedSTOSetupCost, token_owner); - let bytesSTO = encodeModuleCall(STOParameters, [startTime, endTime, cap, 0, [E_fundRaiseType], account_fundsReceiver]); + let bytesSTO = encodeModuleCall(STOParameters, [startTime, endTime, cap, new BN(0), [E_fundRaiseType], account_fundsReceiver]); - await catchRevert(I_SecurityToken_ETH.addModule(I_CappedSTOFactory.address, bytesSTO, maxCost, 0, { from: token_owner })); + await catchRevert(I_SecurityToken_ETH.addModule(I_CappedSTOFactory.address, bytesSTO, maxCost, new BN(0), { from: token_owner })); }); it("Should fail to launch the STO due to rate is 0", async () => { - let startTime = latestTime() + duration.days(1); + let startTime = await latestTime() + duration.days(1); let endTime = startTime + duration.days(30); await I_PolyToken.transfer(I_SecurityToken_ETH.address, cappedSTOSetupCost, { from: token_owner }); - let bytesSTO = encodeModuleCall(STOParameters, [startTime, endTime, cap, 0, [E_fundRaiseType], account_fundsReceiver]); + let bytesSTO = encodeModuleCall(STOParameters, [startTime, endTime, cap, new BN(0), [E_fundRaiseType], account_fundsReceiver]); - await catchRevert(I_SecurityToken_ETH.addModule(I_CappedSTOFactory.address, bytesSTO, maxCost, 0, { from: token_owner })); + await catchRevert(I_SecurityToken_ETH.addModule(I_CappedSTOFactory.address, bytesSTO, maxCost, new BN(0), { from: token_owner })); }); it("Should fail to launch the STO due funds reciever account 0x", async () => { - let startTime = latestTime() + duration.days(1); + let startTime = await latestTime() + duration.days(1); let endTime = startTime + duration.days(30); let bytesSTO = encodeModuleCall(STOParameters, [startTime, endTime, cap, rate, [E_fundRaiseType], address_zero]); - await catchRevert(I_SecurityToken_ETH.addModule(I_CappedSTOFactory.address, bytesSTO, maxCost, 0, { from: token_owner })); + await catchRevert(I_SecurityToken_ETH.addModule(I_CappedSTOFactory.address, bytesSTO, maxCost, new BN(0), { from: token_owner })); }); it("Should fail to launch the STO due to raise type of 0 length", async () => { - let startTime = latestTime() + duration.days(1); + let startTime = await latestTime() + duration.days(1); let endTime = startTime + duration.days(30); let bytesSTO = encodeModuleCall(STOParameters, [startTime, endTime, cap, rate, [], account_fundsReceiver]); - await catchRevert(I_SecurityToken_ETH.addModule(I_CappedSTOFactory.address, bytesSTO, maxCost, 0, { from: token_owner })); + await catchRevert(I_SecurityToken_ETH.addModule(I_CappedSTOFactory.address, bytesSTO, maxCost, new BN(0), { from: token_owner })); }); it("Should fail to launch the STO due to startTime > endTime", async () => { @@ -240,26 +239,26 @@ contract("CappedSTO", accounts => { account_fundsReceiver ]); - await catchRevert(I_SecurityToken_ETH.addModule(I_CappedSTOFactory.address, bytesSTO, maxCost, 0, { from: token_owner })); + await catchRevert(I_SecurityToken_ETH.addModule(I_CappedSTOFactory.address, bytesSTO, maxCost, new BN(0), { from: token_owner })); }); it("Should fail to launch the STO due to cap is of 0 securityToken", async () => { - let startTime = latestTime() + duration.days(1); + let startTime = await latestTime() + duration.days(1); let endTime = startTime + duration.days(30); - let bytesSTO = encodeModuleCall(STOParameters, [startTime, endTime, 0, rate, [E_fundRaiseType], account_fundsReceiver]); + let bytesSTO = encodeModuleCall(STOParameters, [startTime, endTime, new BN(0), rate, [E_fundRaiseType], account_fundsReceiver]); - await catchRevert(I_SecurityToken_ETH.addModule(I_CappedSTOFactory.address, bytesSTO, maxCost, 0, { from: token_owner })); + await catchRevert(I_SecurityToken_ETH.addModule(I_CappedSTOFactory.address, bytesSTO, maxCost, new BN(0), { from: token_owner })); }); - it("Should fail to launch the STO due to different value incompare to getInitFunction", async() => { - let startTime = latestTime() + duration.days(1); + it("Should fail to launch the STO due to different value incompare to getInitFunction", async () => { + let startTime = await latestTime() + duration.days(1); let endTime = startTime + duration.days(30); - let bytesSTO = encodeModuleCall(['uint256', 'uint256', 'uint256'], [startTime, endTime, 0, ]); - await catchRevert(I_SecurityToken_ETH.addModule(I_CappedSTOFactory.address, bytesSTO, maxCost, 0, { from: token_owner })); + let bytesSTO = encodeModuleCall(["uint256", "uint256", "uint256"], [startTime, endTime, 0]); + await catchRevert(I_SecurityToken_ETH.addModule(I_CappedSTOFactory.address, bytesSTO, maxCost, new BN(0), { from: token_owner })); }); it("Should successfully attach the STO module to the security token", async () => { - startTime_ETH1 = latestTime() + duration.days(1); + startTime_ETH1 = await latestTime() + duration.days(1); endTime_ETH1 = startTime_ETH1 + duration.days(30); let bytesSTO = encodeModuleCall(STOParameters, [ startTime_ETH1, @@ -269,26 +268,28 @@ contract("CappedSTO", accounts => { [E_fundRaiseType], account_fundsReceiver ]); - const tx = await I_SecurityToken_ETH.addModule(I_CappedSTOFactory.address, bytesSTO, maxCost, 0, { from: token_owner }); + const tx = await I_SecurityToken_ETH.addModule(I_CappedSTOFactory.address, bytesSTO, maxCost, new BN(0), { from: token_owner }); assert.equal(tx.logs[3].args._types[0], stoKey, "CappedSTO doesn't get deployed"); assert.equal(web3.utils.hexToString(tx.logs[3].args._name), "CappedSTO", "CappedSTOFactory module was not added"); - I_CappedSTO_Array_ETH.push(CappedSTO.at(tx.logs[3].args._module)); + I_CappedSTO_Array_ETH.push(await CappedSTO.at(tx.logs[3].args._module)); }); - it("Should call the configure function -- fail because of the bad owner", async()=> { + it("Should call the configure function -- fail because of the bad owner", async () => { await catchRevert( - I_CappedSTO_Array_ETH[0].configure(startTime_ETH1, endTime_ETH1, cap, rate, [E_fundRaiseType], account_fundsReceiver, {from: account_polymath }) + I_CappedSTO_Array_ETH[0].configure(startTime_ETH1, endTime_ETH1, cap, rate, [E_fundRaiseType], account_fundsReceiver, { + from: account_polymath + }) ); - }) + }); }); describe("verify the data of STO", async () => { it("Should verify the configuration of the STO", async () => { - assert.equal(await I_CappedSTO_Array_ETH[0].startTime.call(), startTime_ETH1, "STO Configuration doesn't set as expected"); - assert.equal(await I_CappedSTO_Array_ETH[0].endTime.call(), endTime_ETH1, "STO Configuration doesn't set as expected"); - assert.equal((await I_CappedSTO_Array_ETH[0].cap.call()).toNumber(), cap, "STO Configuration doesn't set as expected"); - assert.equal((await I_CappedSTO_Array_ETH[0].rate.call()).toNumber(), rate, "STO Configuration doesn't set as expected"); + assert.equal(await I_CappedSTO_Array_ETH[0].startTime(), startTime_ETH1, "1STO Configuration doesn't set as expected"); + assert.equal(await I_CappedSTO_Array_ETH[0].endTime(), endTime_ETH1, "2STO Configuration doesn't set as expected"); + assert.equal((await I_CappedSTO_Array_ETH[0].cap()).toString(), cap.toString(), "3STO Configuration doesn't set as expected"); + assert.equal((await I_CappedSTO_Array_ETH[0].rate()).toString(), rate.toString(), "4STO Configuration doesn't set as expected"); assert.equal( await I_CappedSTO_Array_ETH[0].fundRaiseTypes.call(E_fundRaiseType), true, @@ -299,90 +300,66 @@ contract("CappedSTO", accounts => { describe("Buy tokens", async () => { it("Should buy the tokens -- failed due to startTime is greater than Current time", async () => { - await catchRevert( - web3.eth.sendTransaction({ - from: account_investor1, - to: I_CappedSTO_Array_ETH[0].address, - value: web3.utils.toWei("1", "ether") - }) - ); - }); - - it("Should buy the tokens -- failed due to invested amount is zero", async () => { - await catchRevert( - web3.eth.sendTransaction({ - from: account_investor1, - to: I_CappedSTO_Array_ETH[0].address, - value: web3.utils.toWei("0", "ether") - }) - ); + await catchRevert(I_CappedSTO_Array_ETH[0].buyTokens(account_investor1, { from: account_investor1, value: new BN(web3.utils.toWei("1", "ether")) })); + await increaseTime(duration.days(1)); }); it("Should buy the tokens -- Failed due to investor is not in the whitelist", async () => { - await catchRevert( - web3.eth.sendTransaction({ - from: account_investor1, - to: I_CappedSTO_Array_ETH[0].address, - value: web3.utils.toWei("1", "ether") - }) - ); - }); + await catchRevert(I_CappedSTO_Array_ETH[0].buyTokens(account_investor1, { from: account_investor1, value: new BN(web3.utils.toWei("1", "ether")) })); - it("Should Buy the tokens", async () => { - blockNo = latestBlock(); - fromTime = latestTime(); - toTime = latestTime() + duration.days(15); + blockNo = await latestBlock(); + fromTime = await latestTime(); + toTime = await latestTime() + duration.days(15); expiryTime = toTime + duration.days(100); P_fromTime = fromTime + duration.days(1); P_toTime = P_fromTime + duration.days(50); P_expiryTime = toTime + duration.days(100); - balanceOfReceiver = await web3.eth.getBalance(account_fundsReceiver); // Add the Investor in to the whitelist - let tx = await I_GeneralTransferManager.modifyWhitelist(account_investor1, fromTime, toTime, expiryTime, true, { from: account_issuer }); assert.equal(tx.logs[0].args._investor, account_investor1, "Failed in adding the investor in whitelist"); + }); - // Jump time - await increaseTime(duration.days(1)); - // Fallback transaction - await web3.eth.sendTransaction({ + it("Should buy the tokens -- failed due to invested amount is zero", async () => { + await catchRevert(I_CappedSTO_Array_ETH[0].buyTokens(account_investor1, { from: account_investor1, value: new BN(web3.utils.toWei("0", "ether")) })); + }); + + it("Should Buy the tokens", async () => { + + balanceOfReceiver = new BN(await web3.eth.getBalance(account_fundsReceiver)); + + await I_CappedSTO_Array_ETH[0].buyTokens(account_investor1, { from: account_investor1, - to: I_CappedSTO_Array_ETH[0].address, - gas: 2100000, value: web3.utils.toWei("1", "ether") }); - assert.equal((await I_CappedSTO_Array_ETH[0].getRaised.call(ETH)).dividedBy(new BigNumber(10).pow(18)).toNumber(), 1); + assert.equal((await I_CappedSTO_Array_ETH[0].getRaised.call(ETH)).div(new BN(10).pow(new BN(18))).toNumber(), 1); assert.equal(await I_CappedSTO_Array_ETH[0].investorCount.call(), 1); - assert.equal((await I_SecurityToken_ETH.balanceOf(account_investor1)).dividedBy(new BigNumber(10).pow(18)).toNumber(), 1000); - assert.equal((await I_CappedSTO_Array_ETH[0].getTokensSold.call()).dividedBy(new BigNumber(10).pow(18)).toNumber(), 1000); + assert.equal((await I_SecurityToken_ETH.balanceOf(account_investor1)).div(new BN(10).pow(new BN(18))).toNumber(), 1000); + assert.equal((await I_CappedSTO_Array_ETH[0].getTokensSold.call()).div(new BN(10).pow(new BN(18))).toNumber(), 1000); }); it("Verification of the event Token Purchase", async () => { - const log = await promisifyLogWatch(I_CappedSTO_Array_ETH[0].TokenPurchase({ from: blockNo }), 1); - + const log = (await I_CappedSTO_Array_ETH[0].getPastEvents('TokenPurchase', {filter: {from: blockNo}}))[0]; assert.equal(log.args.purchaser, account_investor1, "Wrong address of the investor"); - assert.equal(log.args.amount.dividedBy(new BigNumber(10).pow(18)).toNumber(), 1000, "Wrong No. token get dilivered"); + assert.equal(log.args.amount.div(new BN(10).pow(new BN(18))).toNumber(), 1000, "Wrong No. token get dilivered"); }); - it("Should fail to buy the tokens -- Because fundRaiseType is ETH not POLY", async ()=> { - await I_PolyToken.getTokens(web3.utils.toWei("500"), account_investor1); - await I_PolyToken.approve(I_CappedSTO_Array_ETH[0].address, web3.utils.toWei("500"), {from: account_investor1}); - await catchRevert( - I_CappedSTO_Array_ETH[0].buyTokensWithPoly(web3.utils.toWei("500"), {from: account_investor1}) - ); - }) + it("Should fail to buy the tokens -- Because fundRaiseType is ETH not POLY", async () => { + await I_PolyToken.getTokens(new BN(new BN(web3.utils.toWei("500"))), account_investor1); + await I_PolyToken.approve(I_CappedSTO_Array_ETH[0].address, new BN(new BN(web3.utils.toWei("500"))), { from: account_investor1 }); + await catchRevert(I_CappedSTO_Array_ETH[0].buyTokensWithPoly(new BN(new BN(web3.utils.toWei("500"))), { from: account_investor1 })); + }); it("Should pause the STO -- Failed due to wrong msg.sender", async () => { await catchRevert(I_CappedSTO_Array_ETH[0].pause({ from: account_investor1 })); }); it("Should pause the STO", async () => { - pauseTime = latestTime(); + pauseTime = await latestTime(); let tx = await I_CappedSTO_Array_ETH[0].pause({ from: account_issuer }); assert.isTrue(await I_CappedSTO_Array_ETH[0].paused.call()); }); @@ -393,7 +370,7 @@ contract("CappedSTO", accounts => { from: account_investor1, to: I_CappedSTO_Array_ETH[0].address, gas: 2100000, - value: web3.utils.toWei("1", "ether") + value: new BN(web3.utils.toWei("1", "ether")) }) ); }); @@ -408,7 +385,7 @@ contract("CappedSTO", accounts => { }); it("Should buy the granular unit tokens and refund pending amount", async () => { - await I_SecurityToken_ETH.changeGranularity(10 ** 21, {from: token_owner}); + await I_SecurityToken_ETH.changeGranularity(new BN(10).pow(new BN(21)), { from: token_owner }); let tx = await I_GeneralTransferManager.modifyWhitelist( account_investor2, fromTime, @@ -420,60 +397,66 @@ contract("CappedSTO", accounts => { } ); assert.equal(tx.logs[0].args._investor, account_investor2, "Failed in adding the investor in whitelist"); - const initBalance = BigNumber(await web3.eth.getBalance(account_investor2)); - tx = await I_CappedSTO_Array_ETH[0].buyTokens(account_investor2, {from: account_investor2, value: web3.utils.toWei("1.5", "ether"), gasPrice: 1}); - const finalBalance = BigNumber(await web3.eth.getBalance(account_investor2)); - assert.equal(finalBalance.add(BigNumber(tx.receipt.gasUsed)).add(web3.utils.toWei("1", "ether")).toNumber(), initBalance.toNumber()); - await I_SecurityToken_ETH.changeGranularity(1, {from: token_owner}); - assert.equal((await I_CappedSTO_Array_ETH[0].getRaised.call(ETH)).dividedBy(new BigNumber(10).pow(18)).toNumber(), 2); + let initBalance = new BN(await web3.eth.getBalance(account_investor2)); + tx = await I_CappedSTO_Array_ETH[0].buyTokens(account_investor2, { + from: account_investor2, + value: new BN(web3.utils.toWei("1.5", "ether")), + gasPrice: 1 + }); + let finalBalance = new BN(await web3.eth.getBalance(account_investor2)); + assert.equal( + finalBalance + .add(new BN(tx.receipt.gasUsed)) + .add(new BN(web3.utils.toWei("1", "ether"))) + .toString(), + initBalance.toString() + ); + await I_SecurityToken_ETH.changeGranularity(1, { from: token_owner }); + assert.equal((await I_CappedSTO_Array_ETH[0].getRaised.call(ETH)).div(new BN(10).pow(new BN(18))).toNumber(), 2); - assert.equal((await I_SecurityToken_ETH.balanceOf(account_investor2)).dividedBy(new BigNumber(10).pow(18)).toNumber(), 1000); + assert.equal((await I_SecurityToken_ETH.balanceOf(account_investor2)).div(new BN(10).pow(new BN(18))).toNumber(), 1000); }); it("Should restrict to buy tokens after hiting the cap in second tx first tx pass", async () => { - - // Fallback transaction await web3.eth.sendTransaction({ from: account_investor2, to: I_CappedSTO_Array_ETH[0].address, gas: 2100000, - value: web3.utils.toWei("8", "ether") + value: new BN(web3.utils.toWei("8", "ether")) }); - assert.equal((await I_CappedSTO_Array_ETH[0].getRaised.call(ETH)).dividedBy(new BigNumber(10).pow(18)).toNumber(), 10); + assert.equal((await I_CappedSTO_Array_ETH[0].getRaised.call(ETH)).div(new BN(10).pow(new BN(18))).toNumber(), 10); assert.equal(await I_CappedSTO_Array_ETH[0].investorCount.call(), 2); - assert.equal((await I_SecurityToken_ETH.balanceOf(account_investor2)).dividedBy(new BigNumber(10).pow(18)).toNumber(), 9000); - await catchRevert(I_CappedSTO_Array_ETH[0].buyTokens(account_investor2, { value: web3.utils.toWei("81") })); + assert.equal((await I_SecurityToken_ETH.balanceOf(account_investor2)).div(new BN(10).pow(new BN(18))).toNumber(), 9000); + await catchRevert(I_CappedSTO_Array_ETH[0].buyTokens(account_investor2, { value: new BN(web3.utils.toWei("81")) })); }); it("Should fundRaised value equal to the raised value in the funds receiver wallet", async () => { const newBalance = await web3.eth.getBalance(account_fundsReceiver); //console.log("WWWW",newBalance,await I_CappedSTO.fundsRaised.call(),balanceOfReceiver); - let op = new BigNumber(newBalance) - .minus(balanceOfReceiver) - .toNumber(); + let op = new BN(newBalance).sub(balanceOfReceiver); assert.equal( - (await I_CappedSTO_Array_ETH[0].getRaised.call(ETH)).toNumber(), - op, + (await I_CappedSTO_Array_ETH[0].getRaised.call(ETH)).toString(), + op.toString(), "Somewhere raised money get stolen or sent to wrong wallet" ); }); it("Should get the raised amount of ether", async () => { - assert.equal(await I_CappedSTO_Array_ETH[0].getRaised.call(ETH), web3.utils.toWei("10", "ether")); + assert.equal((await I_CappedSTO_Array_ETH[0].getRaised.call(ETH)).toString(), new BN(web3.utils.toWei("10", "ether")).toString()); }); it("Should get the raised amount of poly", async () => { - assert.equal((await I_CappedSTO_Array_ETH[0].getRaised.call(POLY)).toNumber(), web3.utils.toWei("0", "ether")); + assert.equal((await I_CappedSTO_Array_ETH[0].getRaised.call(POLY)).toString(), new BN(web3.utils.toWei("0", "ether")).toString()); }); }); describe("Reclaim poly sent to STO by mistake", async () => { it("Should fail to reclaim POLY because token contract address is 0 address", async () => { - let value = web3.utils.toWei("100", "ether"); + let value = new BN(web3.utils.toWei("100", "ether")); await I_PolyToken.getTokens(value, account_investor1); await I_PolyToken.transfer(I_CappedSTO_Array_ETH[0].address, value, { from: account_investor1 }); @@ -481,30 +464,30 @@ contract("CappedSTO", accounts => { }); it("Should successfully reclaim POLY", async () => { - let initInvestorBalance = await I_PolyToken.balanceOf(account_investor1); - let initOwnerBalance = await I_PolyToken.balanceOf(token_owner); - let initContractBalance = await I_PolyToken.balanceOf(I_CappedSTO_Array_ETH[0].address); - let value = web3.utils.toWei("100", "ether"); + let initInvestorBalance = new BN(await I_PolyToken.balanceOf(account_investor1)); + let initOwnerBalance = new BN(await I_PolyToken.balanceOf(token_owner)); + let initContractBalance = new BN(await I_PolyToken.balanceOf(I_CappedSTO_Array_ETH[0].address)); + let value = new BN(web3.utils.toWei("100", "ether")); await I_PolyToken.getTokens(value, account_investor1); await I_PolyToken.transfer(I_CappedSTO_Array_ETH[0].address, value, { from: account_investor1 }); await I_CappedSTO_Array_ETH[0].reclaimERC20(I_PolyToken.address, { from: token_owner }); assert.equal( - (await I_PolyToken.balanceOf(account_investor1)).toNumber(), - initInvestorBalance.toNumber(), + (await I_PolyToken.balanceOf(account_investor1)).toString(), + initInvestorBalance.toString(), "tokens are not transferred out from investor account" ); assert.equal( - (await I_PolyToken.balanceOf(token_owner)).toNumber(), + (await I_PolyToken.balanceOf(token_owner)).toString(), initOwnerBalance .add(value) .add(initContractBalance) - .toNumber(), + .toString(), "tokens are not added to the owner account" ); assert.equal( - (await I_PolyToken.balanceOf(I_CappedSTO_Array_ETH[0].address)).toNumber(), - 0, + (await I_PolyToken.balanceOf(I_CappedSTO_Array_ETH[0].address)).toString(), + new BN(0).toString(), "tokens are not trandfered out from STO contract" ); }); @@ -512,7 +495,7 @@ contract("CappedSTO", accounts => { describe("Attach second ETH STO module", async () => { it("Should successfully attach the second STO module to the security token", async () => { - startTime_ETH2 = latestTime() + duration.days(1); + startTime_ETH2 = await latestTime() + duration.days(1); endTime_ETH2 = startTime_ETH2 + duration.days(30); await I_PolyToken.getTokens(cappedSTOSetupCost, token_owner); @@ -525,18 +508,18 @@ contract("CappedSTO", accounts => { [E_fundRaiseType], account_fundsReceiver ]); - const tx = await I_SecurityToken_ETH.addModule(I_CappedSTOFactory.address, bytesSTO, maxCost, 0, { from: token_owner }); + const tx = await I_SecurityToken_ETH.addModule(I_CappedSTOFactory.address, bytesSTO, maxCost, new BN(0), { from: token_owner }); assert.equal(tx.logs[3].args._types[0], stoKey, "CappedSTO doesn't get deployed"); assert.equal(web3.utils.hexToString(tx.logs[3].args._name), "CappedSTO", "CappedSTOFactory module was not added"); - I_CappedSTO_Array_ETH.push(CappedSTO.at(tx.logs[3].args._module)); + I_CappedSTO_Array_ETH.push(await CappedSTO.at(tx.logs[3].args._module)); }); it("Should verify the configuration of the STO", async () => { assert.equal(await I_CappedSTO_Array_ETH[1].startTime.call(), startTime_ETH2, "STO Configuration doesn't set as expected"); assert.equal(await I_CappedSTO_Array_ETH[1].endTime.call(), endTime_ETH2, "STO Configuration doesn't set as expected"); - assert.equal((await I_CappedSTO_Array_ETH[1].cap.call()).toNumber(), cap, "STO Configuration doesn't set as expected"); - assert.equal((await I_CappedSTO_Array_ETH[1].rate.call()).toNumber(), rate, "STO Configuration doesn't set as expected"); + assert.equal((await I_CappedSTO_Array_ETH[1].cap.call()).toString(), cap.toString(), "STO Configuration doesn't set as expected"); + assert.equal((await I_CappedSTO_Array_ETH[1].rate.call()).toString(), rate.toString(), "STO Configuration doesn't set as expected"); assert.equal( await I_CappedSTO_Array_ETH[1].fundRaiseTypes.call(E_fundRaiseType), true, @@ -545,7 +528,7 @@ contract("CappedSTO", accounts => { }); it("Should successfully whitelist investor 3", async () => { - balanceOfReceiver = await web3.eth.getBalance(account_fundsReceiver); + balanceOfReceiver = new BN(await web3.eth.getBalance(account_fundsReceiver)); let tx = await I_GeneralTransferManager.modifyWhitelist(account_investor3, fromTime, toTime, expiryTime, true, { from: account_issuer, @@ -562,7 +545,7 @@ contract("CappedSTO", accounts => { // Buying on behalf of another user should fail await catchRevert( - I_CappedSTO_Array_ETH[1].buyTokens(account_investor3, { from: account_issuer, value: web3.utils.toWei("1", "ether") }) + I_CappedSTO_Array_ETH[1].buyTokens(account_investor3, { from: account_issuer, value: new BN(web3.utils.toWei("1", "ether")) }) ); }); @@ -573,37 +556,35 @@ contract("CappedSTO", accounts => { }); it("Should allow non-matching beneficiary -- failed because it is already active", async () => { - await catchRevert( - I_CappedSTO_Array_ETH[1].changeAllowBeneficialInvestments(true, { from: account_issuer }) - ); + await catchRevert(I_CappedSTO_Array_ETH[1].changeAllowBeneficialInvestments(true, { from: account_issuer })); }); it("Should invest in second STO", async () => { - await I_CappedSTO_Array_ETH[1].buyTokens(account_investor3, { from: account_issuer, value: web3.utils.toWei("1", "ether") }); + await I_CappedSTO_Array_ETH[1].buyTokens(account_investor3, { from: account_issuer, value: new BN(web3.utils.toWei("1", "ether")) }); - assert.equal((await I_CappedSTO_Array_ETH[1].getRaised.call(ETH)).dividedBy(new BigNumber(10).pow(18)).toNumber(), 1); + assert.equal((await I_CappedSTO_Array_ETH[1].getRaised.call(ETH)).div(new BN(10).pow(new BN(18))).toNumber(), 1); assert.equal(await I_CappedSTO_Array_ETH[1].investorCount.call(), 1); - assert.equal((await I_SecurityToken_ETH.balanceOf(account_investor3)).dividedBy(new BigNumber(10).pow(18)).toNumber(), 1000); + assert.equal((await I_SecurityToken_ETH.balanceOf(account_investor3)).div(new BN(10).pow(new BN(18))).toNumber(), 1000); }); }); describe("Test cases for reaching limit number of STO modules", async () => { it("Should successfully attach 10 STO modules", async () => { const MAX_MODULES = 10; - let startTime = latestTime() + duration.days(1); + let startTime = await latestTime() + duration.days(1); let endTime = startTime + duration.days(30); - await I_PolyToken.getTokens(cappedSTOSetupCost * 19, token_owner); - await I_PolyToken.transfer(I_SecurityToken_ETH.address, cappedSTOSetupCost * 19, { from: token_owner }); + await I_PolyToken.getTokens(new BN(cappedSTOSetupCost.mul(new BN(19))), token_owner); + await I_PolyToken.transfer(I_SecurityToken_ETH.address, new BN(cappedSTOSetupCost.mul(new BN(19))), { from: token_owner }); let bytesSTO = encodeModuleCall(STOParameters, [startTime, endTime, cap, rate, [E_fundRaiseType], account_fundsReceiver]); for (var STOIndex = 2; STOIndex < MAX_MODULES; STOIndex++) { - const tx = await I_SecurityToken_ETH.addModule(I_CappedSTOFactory.address, bytesSTO, maxCost, 0, { from: token_owner }); + const tx = await I_SecurityToken_ETH.addModule(I_CappedSTOFactory.address, bytesSTO, maxCost, new BN(0), { from: token_owner }); assert.equal(tx.logs[3].args._types[0], stoKey, `Wrong module type added at index ${STOIndex}`); assert.equal(web3.utils.hexToString(tx.logs[3].args._name), "CappedSTO", `Wrong STO module added at index ${STOIndex}`); - I_CappedSTO_Array_ETH.push(CappedSTO.at(tx.logs[3].args._module)); + I_CappedSTO_Array_ETH.push(await CappedSTO.at(tx.logs[3].args._module)); } }); @@ -613,10 +594,10 @@ contract("CappedSTO", accounts => { for (var STOIndex = 2; STOIndex < MAX_MODULES; STOIndex++) { await I_CappedSTO_Array_ETH[STOIndex].buyTokens(account_investor3, { from: account_investor3, - value: web3.utils.toWei("1", "ether") + value: new BN(web3.utils.toWei("1", "ether")) }); assert.equal( - (await I_CappedSTO_Array_ETH[STOIndex].getRaised.call(ETH)).dividedBy(new BigNumber(10).pow(18)).toNumber(), + (await I_CappedSTO_Array_ETH[STOIndex].getRaised.call(ETH)).div(new BN(10).pow(new BN(18))).toNumber(), 1 ); assert.equal(await I_CappedSTO_Array_ETH[STOIndex].investorCount.call(), 1); @@ -635,15 +616,15 @@ contract("CappedSTO", accounts => { it("POLY: Should generate the new security token with the same symbol as registered above", async () => { await I_PolyToken.approve(I_STRProxied.address, initRegFee, { from: token_owner }); - let _blockNo = latestBlock(); + let tx = await I_STRProxied.generateSecurityToken(P_name, P_symbol, P_tokenDetails, false, { from: token_owner }); // Verify the successful generation of the security token assert.equal(tx.logs[2].args._ticker, P_symbol, "SecurityToken doesn't get deployed"); - I_SecurityToken_POLY = SecurityToken.at(tx.logs[2].args._securityTokenAddress); - - const log = await promisifyLogWatch(I_SecurityToken_POLY.ModuleAdded({ from: _blockNo }), 1); + I_SecurityToken_POLY = await SecurityToken.at(tx.logs[2].args._securityTokenAddress); + + const log = (await I_SecurityToken_POLY.getPastEvents('ModuleAdded', {filter: {from: blockNo}}))[0]; // Verify that GeneralTransferManager module get added successfully or not assert.equal(log.args._types[0].toNumber(), transferManagerKey); @@ -652,11 +633,11 @@ contract("CappedSTO", accounts => { it("POLY: Should intialize the auto attached modules", async () => { let moduleData = (await I_SecurityToken_POLY.getModulesByType(transferManagerKey))[0]; - I_GeneralTransferManager = GeneralTransferManager.at(moduleData); + I_GeneralTransferManager = await GeneralTransferManager.at(moduleData); }); it("POLY: Should successfully attach the STO module to the security token", async () => { - startTime_POLY1 = latestTime() + duration.days(2); + startTime_POLY1 = await latestTime() + duration.days(2); endTime_POLY1 = startTime_POLY1 + duration.days(30); await I_PolyToken.getTokens(cappedSTOSetupCost, token_owner); @@ -671,11 +652,11 @@ contract("CappedSTO", accounts => { account_fundsReceiver ]); - const tx = await I_SecurityToken_POLY.addModule(I_CappedSTOFactory.address, bytesSTO, maxCost, 0, { from: token_owner }); + const tx = await I_SecurityToken_POLY.addModule(I_CappedSTOFactory.address, bytesSTO, maxCost, new BN(0), { from: token_owner }); assert.equal(tx.logs[3].args._types[0], stoKey, "CappedSTO doesn't get deployed"); assert.equal(web3.utils.hexToString(tx.logs[3].args._name), "CappedSTO", "CappedSTOFactory module was not added"); - I_CappedSTO_Array_POLY.push(CappedSTO.at(tx.logs[3].args._module)); + I_CappedSTO_Array_POLY.push(await CappedSTO.at(tx.logs[3].args._module)); }); }); @@ -684,90 +665,85 @@ contract("CappedSTO", accounts => { assert.equal( (await I_CappedSTO_Array_POLY[0].startTime.call()).toNumber(), startTime_POLY1, - "STO Configuration doesn't set as expected" + "1STO Configuration doesn't set as expected" ); assert.equal( (await I_CappedSTO_Array_POLY[0].endTime.call()).toNumber(), endTime_POLY1, - "STO Configuration doesn't set as expected" + "2STO Configuration doesn't set as expected" ); assert.equal( - (await I_CappedSTO_Array_POLY[0].cap.call()).dividedBy(new BigNumber(10).pow(18)).toNumber(), - BigNumber(P_cap).dividedBy(new BigNumber(10).pow(18)), - "STO Configuration doesn't set as expected" + (await I_CappedSTO_Array_POLY[0].cap.call()).div(new BN(10).pow(new BN(18))).toString(), + new BN(P_cap).div(new BN(10).pow(new BN(18))), + "3STO Configuration doesn't set as expected" ); - assert.equal(await I_CappedSTO_Array_POLY[0].rate.call(), P_rate, "STO Configuration doesn't set as expected"); + assert.equal((await I_CappedSTO_Array_POLY[0].rate.call()).toString(), new BN(P_rate).toString(), "STO Configuration doesn't set as expected"); assert.equal( await I_CappedSTO_Array_POLY[0].fundRaiseTypes.call(P_fundRaiseType), true, - "STO Configuration doesn't set as expected" + "4STO Configuration doesn't set as expected" ); }); }); describe("Buy tokens", async () => { it("Should Buy the tokens", async () => { - await I_PolyToken.getTokens(10000 * Math.pow(10, 18), account_investor1); - blockNo = latestBlock(); + await I_PolyToken.getTokens(new BN(10).pow(new BN(22)), account_investor1); + blockNo = await latestBlock(); assert.equal( - (await I_PolyToken.balanceOf(account_investor1)).dividedBy(new BigNumber(10).pow(18)).toNumber(), + (await I_PolyToken.balanceOf(account_investor1)).div(new BN(10).pow(new BN(18))).toNumber(), 10500, "Tokens are not transfered properly" ); - let tx = await I_GeneralTransferManager.modifyWhitelist(account_investor1, P_fromTime, P_toTime, P_expiryTime, true, { from: account_issuer, gas: 500000 }); - assert.equal(tx.logs[0].args._investor, account_investor1, "Failed in adding the investor in whitelist"); - // Jump time await increaseTime(duration.days(17)); - - await I_PolyToken.approve(I_CappedSTO_Array_POLY[0].address, 1000 * Math.pow(10, 18), { from: account_investor1 }); + await I_PolyToken.approve(I_CappedSTO_Array_POLY[0].address, new BN(10).pow(new BN(21)), { from: account_investor1 }); // buyTokensWithPoly transaction - await I_CappedSTO_Array_POLY[0].buyTokensWithPoly(1000 * Math.pow(10, 18), { + await I_CappedSTO_Array_POLY[0].buyTokensWithPoly(new BN(10).pow(new BN(21)), { from: account_investor1 }); - - assert.equal((await I_CappedSTO_Array_POLY[0].getRaised.call(POLY)).dividedBy(new BigNumber(10).pow(18)).toNumber(), 1000); + assert.equal((await I_CappedSTO_Array_POLY[0].getRaised.call(POLY)).div(new BN(10).pow(new BN(18))).toNumber(), 1000); assert.equal(await I_CappedSTO_Array_POLY[0].investorCount.call(), 1); assert.equal( - (await I_SecurityToken_POLY.balanceOf(account_investor1)).dividedBy(new BigNumber(10).pow(18)).toNumber(), + (await I_SecurityToken_POLY.balanceOf(account_investor1)).div(new BN(10).pow(new BN(18))).toNumber(), 5000 ); }); it("Verification of the event Token Purchase", async () => { - const log = await promisifyLogWatch(I_CappedSTO_Array_POLY[0].TokenPurchase({ from: blockNo }), 1); + const log = (await I_CappedSTO_Array_POLY[0].getPastEvents('TokenPurchase', {filter: {from: blockNo}}))[0]; assert.equal(log.args.purchaser, account_investor1, "Wrong address of the investor"); - assert.equal(log.args.amount.dividedBy(new BigNumber(10).pow(18)).toNumber(), 5000, "Wrong No. token get dilivered"); + assert.equal(log.args.amount.div(new BN(10).pow(new BN(18))).toNumber(), 5000, "Wrong No. token get dilivered"); }); - it("Should failed to buy tokens -- because fundraisetype is POLY not ETH", async() => { + it("Should failed to buy tokens -- because fundraisetype is POLY not ETH", async () => { await catchRevert( // Fallback transaction web3.eth.sendTransaction({ from: account_investor1, to: I_CappedSTO_Array_POLY[0].address, gas: 2100000, - value: web3.utils.toWei("2", "ether") + value: new BN(web3.utils.toWei("2", "ether")) }) ); }); - it("Should fail in buying tokens because buying is paused", async() => { + it("Should fail in buying tokens because buying is paused", async () => { await I_CappedSTO_Array_POLY[0].pause({ from: account_issuer }); - await I_PolyToken.approve(I_CappedSTO_Array_POLY[0].address, 1000 * Math.pow(10, 18), { from: account_investor1 }); + await I_PolyToken.approve(I_CappedSTO_Array_POLY[0].address, new BN(10).pow(new BN(21)), { from: account_investor1 }); // buyTokensWithPoly transaction await catchRevert( - I_CappedSTO_Array_POLY[0].buyTokensWithPoly(1000 * Math.pow(10, 18), { + I_CappedSTO_Array_POLY[0].buyTokensWithPoly(new BN(10).pow(new BN(21)), { from: account_investor1, gas: 6000000 }) @@ -776,7 +752,7 @@ contract("CappedSTO", accounts => { }); it("Should buy the granular unit tokens and charge only required POLY", async () => { - await I_SecurityToken_POLY.changeGranularity(10 ** 22, {from: token_owner}); + await I_SecurityToken_POLY.changeGranularity(new BN(10).pow(new BN(22)), { from: token_owner }); let tx = await I_GeneralTransferManager.modifyWhitelist( account_investor2, P_fromTime, @@ -788,53 +764,56 @@ contract("CappedSTO", accounts => { gas: 500000 } ); - console.log((await I_SecurityToken_POLY.balanceOf(account_investor2)).dividedBy(new BigNumber(10).pow(18)).toNumber()); + console.log((await I_SecurityToken_POLY.balanceOf(account_investor2)).div(new BN(10).pow(new BN(18))).toNumber()); assert.equal(tx.logs[0].args._investor, account_investor2, "Failed in adding the investor in whitelist"); - await I_PolyToken.getTokens(10000 * Math.pow(10, 18), account_investor2); - await I_PolyToken.approve(I_CappedSTO_Array_POLY[0].address, 9000 * Math.pow(10, 18), { from: account_investor2 }); - const initRaised = (await I_CappedSTO_Array_POLY[0].getRaised.call(POLY)).dividedBy(new BigNumber(10).pow(18)).toNumber(); - tx = await I_CappedSTO_Array_POLY[0].buyTokensWithPoly(3000 * Math.pow(10, 18), { from: account_investor2 }); - await I_SecurityToken_POLY.changeGranularity(1, {from: token_owner}); - assert.equal((await I_CappedSTO_Array_POLY[0].getRaised.call(POLY)).dividedBy(new BigNumber(10).pow(18)).toNumber(), initRaised + 2000); //2000 this call, 1000 earlier - assert.equal((await I_PolyToken.balanceOf(account_investor2)).dividedBy(new BigNumber(10).pow(18)).toNumber(), 8000); + await I_PolyToken.getTokens(new BN(10).pow(new BN(22)), account_investor2); + await I_PolyToken.approve(I_CappedSTO_Array_POLY[0].address, new BN(9000).mul(new BN(10).pow(new BN(18))), { from: account_investor2 }); + const initRaised = (await I_CappedSTO_Array_POLY[0].getRaised.call(POLY)).div(new BN(10).pow(new BN(18))).toNumber(); + tx = await I_CappedSTO_Array_POLY[0].buyTokensWithPoly(new BN(3000).mul(new BN(10).pow(new BN(18))), { from: account_investor2 }); + await I_SecurityToken_POLY.changeGranularity(1, { from: token_owner }); + assert.equal( + (await I_CappedSTO_Array_POLY[0].getRaised.call(POLY)).div(new BN(10).pow(new BN(18))).toNumber(), + initRaised + 2000 + ); //2000 this call, 1000 earlier + assert.equal((await I_PolyToken.balanceOf(account_investor2)).div(new BN(10).pow(new BN(18))).toNumber(), 8000); assert.equal( - (await I_SecurityToken_POLY.balanceOf(account_investor2)).dividedBy(new BigNumber(10).pow(18)).toNumber(), + (await I_SecurityToken_POLY.balanceOf(account_investor2)).div(new BN(10).pow(new BN(18))).toNumber(), 10000 ); }); - it("Should restrict to buy tokens after hiting the cap in second tx first tx pass", async () => { // buyTokensWithPoly transaction - await I_CappedSTO_Array_POLY[0].buyTokensWithPoly(7000 * Math.pow(10, 18), { from: account_investor2 }); + await I_CappedSTO_Array_POLY[0].buyTokensWithPoly(new BN(7000).mul(new BN(10).pow(new BN(18))), { from: account_investor2 }); - assert.equal((await I_CappedSTO_Array_POLY[0].getRaised.call(POLY)).dividedBy(new BigNumber(10).pow(18)).toNumber(), 10000); + assert.equal( + (await I_CappedSTO_Array_POLY[0].getRaised.call(POLY)).div(new BN(10).pow(new BN(18))).toNumber(), + 10000 + ); assert.equal(await I_CappedSTO_Array_POLY[0].investorCount.call(), 2); assert.equal( - (await I_SecurityToken_POLY.balanceOf(account_investor2)).dividedBy(new BigNumber(10).pow(18)).toNumber(), + (await I_SecurityToken_POLY.balanceOf(account_investor2)).div(new BN(10).pow(new BN(18))).toNumber(), 45000 ); - await I_PolyToken.approve(I_CappedSTO_Array_POLY[0].address, 1000 * Math.pow(10, 18), { from: account_investor1 }); - await catchRevert( - I_CappedSTO_Array_POLY[0].buyTokensWithPoly(1000 * Math.pow(10, 18), { from: account_investor1 }) - ); + await I_PolyToken.approve(I_CappedSTO_Array_POLY[0].address, new BN(1000).mul(new BN(10).pow(new BN(18))), { from: account_investor1 }); + await catchRevert(I_CappedSTO_Array_POLY[0].buyTokensWithPoly(new BN(1000).mul(new BN(10).pow(new BN(18))), { from: account_investor1 })); }); it("Should failed at the time of buying the tokens -- Because STO get expired", async () => { await increaseTime(duration.days(31)); // increased beyond the end time of the STO - await I_PolyToken.approve(I_CappedSTO_Array_POLY[0].address, 1000 * Math.pow(10, 18), { from: account_investor1 }); + await I_PolyToken.approve(I_CappedSTO_Array_POLY[0].address, new BN(1000).mul(new BN(10).pow(new BN(18))), { from: account_investor1 }); await catchRevert( - I_CappedSTO_Array_POLY[0].buyTokensWithPoly(1000 * Math.pow(10, 18), { from: account_investor1, gas: 6000000 }) + I_CappedSTO_Array_POLY[0].buyTokensWithPoly(new BN(1000).mul(new BN(10).pow(new BN(18))), { from: account_investor1, gas: 6000000 }) ); }); it("Should fundRaised value equal to the raised value in the funds receiver wallet", async () => { const balanceRaised = await I_PolyToken.balanceOf.call(account_fundsReceiver); assert.equal( - (await I_CappedSTO_Array_POLY[0].getRaised.call(POLY)).toNumber(), - balanceRaised, + (await I_CappedSTO_Array_POLY[0].getRaised.call(POLY)).toString(), + balanceRaised.toString(), "Somewhere raised money get stolen or sent to wrong wallet" ); }); @@ -842,7 +821,7 @@ contract("CappedSTO", accounts => { describe("Test cases for the CappedSTOFactory", async () => { it("should get the exact details of the factory", async () => { - assert.equal((await I_CappedSTOFactory.getSetupCost.call()).toNumber(), cappedSTOSetupCost); + assert.equal((await I_CappedSTOFactory.getSetupCost.call()).toString(), cappedSTOSetupCost.toString()); assert.equal((await I_CappedSTOFactory.getTypes.call())[0], 3); assert.equal(web3.utils.hexToString(await I_CappedSTOFactory.getName.call()), "CappedSTO", "Wrong Module added"); assert.equal( @@ -912,11 +891,11 @@ contract("CappedSTO", accounts => { }); it("Should get the raised amount of ether", async () => { - assert.equal(await I_CappedSTO_Array_POLY[0].getRaised.call(ETH), web3.utils.toWei("0", "ether")); + assert.equal((await I_CappedSTO_Array_POLY[0].getRaised.call(ETH)).toString(), new BN(web3.utils.toWei("0", "ether")).toString()); }); it("Should get the raised amount of poly", async () => { - assert.equal((await I_CappedSTO_Array_POLY[0].getRaised.call(POLY)).toNumber(), web3.utils.toWei("10000", "ether")); + assert.equal((await I_CappedSTO_Array_POLY[0].getRaised.call(POLY)).toString(), new BN(web3.utils.toWei("10000", "ether")).toString()); }); it("Should get the investors", async () => { @@ -937,7 +916,7 @@ contract("CappedSTO", accounts => { describe("Attach second POLY STO module", async () => { it("Should successfully attach a second STO to the security token", async () => { - startTime_POLY2 = latestTime() + duration.days(1); + startTime_POLY2 = await latestTime() + duration.days(1); endTime_POLY2 = startTime_POLY2 + duration.days(30); await I_PolyToken.getTokens(cappedSTOSetupCost, token_owner); @@ -952,42 +931,42 @@ contract("CappedSTO", accounts => { account_fundsReceiver ]); - const tx = await I_SecurityToken_POLY.addModule(I_CappedSTOFactory.address, bytesSTO, maxCost, 0, { from: token_owner }); + const tx = await I_SecurityToken_POLY.addModule(I_CappedSTOFactory.address, bytesSTO, maxCost, new BN(0), { from: token_owner }); assert.equal(tx.logs[3].args._types[0], stoKey, "CappedSTO doesn't get deployed"); assert.equal(web3.utils.hexToString(tx.logs[3].args._name), "CappedSTO", "CappedSTOFactory module was not added"); - I_CappedSTO_Array_POLY.push(CappedSTO.at(tx.logs[3].args._module)); + I_CappedSTO_Array_POLY.push(await CappedSTO.at(tx.logs[3].args._module)); }); it("Should verify the configuration of the STO", async () => { assert.equal( - (await I_CappedSTO_Array_POLY[1].startTime.call()).toNumber(), - startTime_POLY2, - "STO Configuration doesn't set as expected" + (await I_CappedSTO_Array_POLY[1].startTime.call()).toString(), + startTime_POLY2.toString(), + "1STO Configuration doesn't set as expected" ); assert.equal( - (await I_CappedSTO_Array_POLY[1].endTime.call()).toNumber(), - endTime_POLY2, - "STO Configuration doesn't set as expected" + (await I_CappedSTO_Array_POLY[1].endTime.call()).toString(), + endTime_POLY2.toString(), + "2STO Configuration doesn't set as expected" ); assert.equal( - (await I_CappedSTO_Array_POLY[1].cap.call()).dividedBy(new BigNumber(10).pow(18)).toNumber(), - BigNumber(P_cap).dividedBy(new BigNumber(10).pow(18)), - "STO Configuration doesn't set as expected" + (await I_CappedSTO_Array_POLY[1].cap.call()).div(new BN(10).pow(new BN(18))).toString(), + new BN(P_cap).div(new BN(10).pow(new BN(18))).toString(), + "3STO Configuration doesn't set as expected" ); - assert.equal(await I_CappedSTO_Array_POLY[1].rate.call(), P_rate, "STO Configuration doesn't set as expected"); + assert.equal((await I_CappedSTO_Array_POLY[1].rate.call()).toString(), new BN(P_rate).toString(), "STO Configuration doesn't set as expected"); assert.equal( await I_CappedSTO_Array_POLY[1].fundRaiseTypes.call(P_fundRaiseType), true, - "STO Configuration doesn't set as expected" + "4STO Configuration doesn't set as expected" ); }); it("Should successfully invest in second STO", async () => { - const polyToInvest = 1000; - const stToReceive = (polyToInvest * P_rate)/Math.pow(10, 18); + const polyToInvest = new BN(1000); + const stToReceive = new BN(polyToInvest.mul(new BN(P_rate).div(new BN(10).pow(new BN(18))))); - await I_PolyToken.getTokens(polyToInvest * Math.pow(10, 18), account_investor3); + await I_PolyToken.getTokens(polyToInvest.mul(new BN(10).pow(new BN(18))), account_investor3); let tx = await I_GeneralTransferManager.modifyWhitelist(account_investor3, P_fromTime, P_toTime, P_expiryTime, true, { from: account_issuer, @@ -997,25 +976,25 @@ contract("CappedSTO", accounts => { // Jump time to beyond STO start await increaseTime(duration.days(2)); - await I_PolyToken.approve(I_CappedSTO_Array_POLY[1].address, polyToInvest * Math.pow(10, 18), { from: account_investor3 }); + await I_PolyToken.approve(I_CappedSTO_Array_POLY[1].address, polyToInvest.mul(new BN(10).pow(new BN(18))), { from: account_investor3 }); // buyTokensWithPoly transaction - await I_CappedSTO_Array_POLY[1].buyTokensWithPoly(polyToInvest * Math.pow(10, 18), { + await I_CappedSTO_Array_POLY[1].buyTokensWithPoly(polyToInvest.mul(new BN(10).pow(new BN(18))), { from: account_investor3, gas: 6000000 }); assert.equal( - (await I_CappedSTO_Array_POLY[1].getRaised.call(POLY)).dividedBy(new BigNumber(10).pow(18)).toNumber(), - polyToInvest + (await I_CappedSTO_Array_POLY[1].getRaised.call(POLY)).div(new BN(10).pow(new BN(18))).toString(), + polyToInvest.toString() ); assert.equal(await I_CappedSTO_Array_POLY[1].investorCount.call(), 1); assert.equal( - (await I_SecurityToken_POLY.balanceOf(account_investor3)).dividedBy(new BigNumber(10).pow(18)).toNumber(), - stToReceive + (await I_SecurityToken_POLY.balanceOf(account_investor3)).div(new BN(10).pow(new BN(18))).toString(), + stToReceive.toString() ); - }); + }); }); }); diff --git a/test/c_checkpoints.js b/test/c_checkpoints.js index 2e7e6987f..d50620db6 100644 --- a/test/c_checkpoints.js +++ b/test/c_checkpoints.js @@ -7,10 +7,10 @@ const SecurityToken = artifacts.require("./SecurityToken.sol"); const GeneralTransferManager = artifacts.require("./GeneralTransferManager"); const Web3 = require("web3"); -const BigNumber = require("bignumber.js"); +let BN = Web3.utils.BN; const web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545")); // Hardcoded development port -contract("Checkpoints", accounts => { +contract("Checkpoints", async function(accounts) { // Accounts Variable declaration let account_polymath; let account_issuer; @@ -20,13 +20,13 @@ contract("Checkpoints", accounts => { let account_investor3; let account_investor4; - // investor Details - let fromTime = latestTime(); - let toTime = latestTime(); - let expiryTime = toTime + duration.days(15); - let message = "Transaction Should Fail!"; + // investor Details + let fromTime; + let toTime; + let expiryTime; + // Contract Instance Declaration let I_GeneralPermissionManagerFactory; let I_SecurityTokenRegistryProxy; @@ -59,9 +59,12 @@ contract("Checkpoints", accounts => { const stoKey = 3; // Initial fee for ticker registry and security token registry - const initRegFee = web3.utils.toWei("250"); + const initRegFee = new BN(web3.utils.toWei("250")); before(async () => { + fromTime = await latestTime(); + toTime = await latestTime(); + expiryTime = toTime + duration.days(15); // Accounts setup account_polymath = accounts[0]; account_issuer = accounts[1]; @@ -117,15 +120,14 @@ contract("Checkpoints", accounts => { it("Should generate the new security token with the same symbol as registered above", async () => { await I_PolyToken.approve(I_STRProxied.address, initRegFee, { from: token_owner }); - let _blockNo = latestBlock(); let tx = await I_STRProxied.generateSecurityToken(name, symbol, tokenDetails, false, { from: token_owner }); // Verify the successful generation of the security token assert.equal(tx.logs[2].args._ticker, symbol.toUpperCase(), "SecurityToken doesn't get deployed"); - I_SecurityToken = SecurityToken.at(tx.logs[2].args._securityTokenAddress); + I_SecurityToken = await SecurityToken.at(tx.logs[2].args._securityTokenAddress); - const log = await promisifyLogWatch(I_SecurityToken.ModuleAdded({ from: _blockNo }), 1); + const log = (await I_SecurityToken.getPastEvents('ModuleAdded', {filter: {transactionHash: tx.transactionHash}}))[0]; // Verify that GeneralTransferManager module get added successfully or not assert.equal(log.args._types[0].toNumber(), 2); @@ -138,26 +140,25 @@ contract("Checkpoints", accounts => { it("Should intialize the auto attached modules", async () => { let moduleData = (await I_SecurityToken.getModulesByType(2))[0]; - I_GeneralTransferManager = GeneralTransferManager.at(moduleData); + I_GeneralTransferManager = await GeneralTransferManager.at(moduleData); }); }); describe("Buy tokens using on-chain whitelist", async () => { it("Should Buy the tokens", async () => { // Add the Investor in to the whitelist - + let ltime = new BN(await latestTime()); let tx = await I_GeneralTransferManager.modifyWhitelist( account_investor1, - latestTime(), - latestTime(), - latestTime() + duration.days(10), + ltime, + ltime, + ltime.add(new BN(duration.days(10))), false, { from: account_issuer, gas: 6000000 } ); - assert.equal( tx.logs[0].args._investor.toLowerCase(), account_investor1.toLowerCase(), @@ -165,19 +166,19 @@ contract("Checkpoints", accounts => { ); // Mint some tokens - await I_SecurityToken.mint(account_investor1, web3.utils.toWei("10", "ether"), { from: token_owner }); + await I_SecurityToken.mint(account_investor1, new BN(web3.utils.toWei("10", "ether")), { from: token_owner }); - assert.equal((await I_SecurityToken.balanceOf(account_investor1)).toNumber(), web3.utils.toWei("10", "ether")); + assert.equal((await I_SecurityToken.balanceOf(account_investor1)).toString(), new BN(web3.utils.toWei("10", "ether")).toString()); }); it("Should Buy some more tokens", async () => { // Add the Investor in to the whitelist - + let ltime = new BN(await latestTime()); let tx = await I_GeneralTransferManager.modifyWhitelist( account_investor2, - latestTime(), - latestTime(), - latestTime() + duration.days(10), + ltime, + ltime, + ltime.add(new BN(duration.days(10))), false, { from: account_issuer, @@ -192,17 +193,18 @@ contract("Checkpoints", accounts => { ); // Mint some tokens - await I_SecurityToken.mint(account_investor2, web3.utils.toWei("10", "ether"), { from: token_owner }); + await I_SecurityToken.mint(account_investor2, new BN(web3.utils.toWei("10", "ether")), { from: token_owner }); - assert.equal((await I_SecurityToken.balanceOf(account_investor2)).toNumber(), web3.utils.toWei("10", "ether")); + assert.equal((await I_SecurityToken.balanceOf(account_investor2)).toString(), new BN(web3.utils.toWei("10", "ether")).toString()); }); it("Add a new token holder", async () => { + let ltime = new BN(await latestTime()); let tx = await I_GeneralTransferManager.modifyWhitelist( account_investor3, - latestTime(), - latestTime(), - latestTime() + duration.days(10), + ltime, + ltime, + ltime.add(new BN(duration.days(10))), false, { from: account_issuer, @@ -218,9 +220,9 @@ contract("Checkpoints", accounts => { // Add the Investor in to the whitelist // Mint some tokens - await I_SecurityToken.mint(account_investor3, web3.utils.toWei("10", "ether"), { from: token_owner }); + await I_SecurityToken.mint(account_investor3, new BN(web3.utils.toWei("10", "ether")), { from: token_owner }); - assert.equal((await I_SecurityToken.balanceOf(account_investor3)).toNumber(), web3.utils.toWei("10", "ether")); + assert.equal((await I_SecurityToken.balanceOf(account_investor3)).toString(), new BN(web3.utils.toWei("10", "ether")).toString()); }); it("Fuzz test balance checkpoints", async () => { @@ -228,10 +230,10 @@ contract("Checkpoints", accounts => { let cps = []; let ts = []; for (let j = 0; j < 10; j++) { - let balance1 = new BigNumber(await I_SecurityToken.balanceOf(account_investor1)); - let balance2 = new BigNumber(await I_SecurityToken.balanceOf(account_investor2)); - let balance3 = new BigNumber(await I_SecurityToken.balanceOf(account_investor3)); - let totalSupply = new BigNumber(await I_SecurityToken.totalSupply()); + let balance1 = new BN(await I_SecurityToken.balanceOf(account_investor1)); + let balance2 = new BN(await I_SecurityToken.balanceOf(account_investor2)); + let balance3 = new BN(await I_SecurityToken.balanceOf(account_investor3)); + let totalSupply = new BN(await I_SecurityToken.totalSupply()); cps.push([balance1, balance2, balance3]); ts.push(totalSupply); console.log( @@ -266,21 +268,19 @@ contract("Checkpoints", accounts => { } else { receiver = account_investor3; } - let m = Math.random(); - let amount = new BigNumber(await I_SecurityToken.balanceOf(sender)) - .mul(Math.random().toFixed(10)) - .toFixed(0); - if (m > 0.8) { + let m = Math.floor(Math.random() * 10) + 1; + let amount; + if (m > 8) { console.log("Sending full balance"); - amount = new BigNumber(await I_SecurityToken.balanceOf(sender)); + amount = new BN(await I_SecurityToken.balanceOf(sender)); + } else { + amount = new BN(await I_SecurityToken.balanceOf(sender)).mul(new BN(m)).div(new BN(10)); } console.log("Sender: " + sender + " Receiver: " + receiver + " Amount: " + JSON.stringify(amount)); await I_SecurityToken.transfer(receiver, amount, { from: sender }); } if (Math.random() > 0.5) { - let n = new BigNumber(Math.random().toFixed(10)) - .mul(10 ** 17) - .toFixed(0); + let n = new BN(Math.random().toFixed(10)).mul(new BN(10).pow(new BN(17))); let p = Math.random() * 3; let r = Math.random() * 3; let minter; @@ -295,7 +295,7 @@ contract("Checkpoints", accounts => { await I_SecurityToken.mint(minter, n, { from: token_owner }); } if (Math.random() > 0.5) { - let n = new BigNumber(Math.random().toFixed(10)).mul(10 ** 17); + let n = new BN(Math.random().toFixed(10)).mul(new BN(10).pow(new BN(17))); let p = Math.random() * 3; let r = Math.random() * 3; let burner; @@ -306,20 +306,19 @@ contract("Checkpoints", accounts => { } else { burner = account_investor3; } - let burnerBalance = new BigNumber(await I_SecurityToken.balanceOf(burner)); - if (n.gt(burnerBalance.div(2))) { - n = burnerBalance.div(2); + let burnerBalance = new BN(await I_SecurityToken.balanceOf(burner)); + if (n.gt(burnerBalance.div(new BN(2)))) { + n = burnerBalance.div(new BN(2)); } - n = n.toFixed(0); console.log("Burning: " + n.toString() + " from: " + burner); - await I_SecurityToken.forceBurn(burner, n, "", "", { from: token_owner }); + await I_SecurityToken.forceBurn(burner, n, "0x0", "0x0", { from: token_owner }); } console.log("Checking Interim..."); for (let k = 0; k < cps.length; k++) { - let balance1 = new BigNumber(await I_SecurityToken.balanceOfAt(account_investor1, k + 1)); - let balance2 = new BigNumber(await I_SecurityToken.balanceOfAt(account_investor2, k + 1)); - let balance3 = new BigNumber(await I_SecurityToken.balanceOfAt(account_investor3, k + 1)); - let totalSupply = new BigNumber(await I_SecurityToken.totalSupplyAt(k + 1)); + let balance1 = new BN(await I_SecurityToken.balanceOfAt(account_investor1, k + 1)); + let balance2 = new BN(await I_SecurityToken.balanceOfAt(account_investor2, k + 1)); + let balance3 = new BN(await I_SecurityToken.balanceOfAt(account_investor3, k + 1)); + let totalSupply = new BN(await I_SecurityToken.totalSupplyAt(k + 1)); let balances = [balance1, balance2, balance3]; console.log("Checking TotalSupply: " + totalSupply + " is " + ts[k] + " at checkpoint: " + (k + 1)); assert.isTrue(totalSupply.eq(ts[k])); @@ -332,10 +331,10 @@ contract("Checkpoints", accounts => { } console.log("Checking..."); for (let k = 0; k < cps.length; k++) { - let balance1 = new BigNumber(await I_SecurityToken.balanceOfAt(account_investor1, k + 1)); - let balance2 = new BigNumber(await I_SecurityToken.balanceOfAt(account_investor2, k + 1)); - let balance3 = new BigNumber(await I_SecurityToken.balanceOfAt(account_investor3, k + 1)); - let totalSupply = new BigNumber(await I_SecurityToken.totalSupplyAt(k + 1)); + let balance1 = new BN(await I_SecurityToken.balanceOfAt(account_investor1, k + 1)); + let balance2 = new BN(await I_SecurityToken.balanceOfAt(account_investor2, k + 1)); + let balance3 = new BN(await I_SecurityToken.balanceOfAt(account_investor3, k + 1)); + let totalSupply = new BN(await I_SecurityToken.totalSupplyAt(k + 1)); let balances = [balance1, balance2, balance3]; console.log("Checking TotalSupply: " + totalSupply + " is " + ts[k] + " at checkpoint: " + (k + 1)); assert.isTrue(totalSupply.eq(ts[k])); diff --git a/test/d_count_transfer_manager.js b/test/d_count_transfer_manager.js index 2e42fb093..18594249d 100644 --- a/test/d_count_transfer_manager.js +++ b/test/d_count_transfer_manager.js @@ -11,10 +11,10 @@ const CountTransferManagerFactory = artifacts.require("./CountTransferManagerFac const CountTransferManager = artifacts.require("./CountTransferManager"); const Web3 = require("web3"); -const BigNumber = require("bignumber.js"); +let BN = Web3.utils.BN; const web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545")); // Hardcoded development port -contract("CountTransferManager", accounts => { +contract("CountTransferManager", async (accounts) => { // Accounts Variable declaration let account_polymath; let account_issuer; @@ -24,11 +24,6 @@ contract("CountTransferManager", accounts => { let account_investor3; let account_investor4; - // investor Details - let fromTime = latestTime(); - let toTime = latestTime(); - let expiryTime = toTime + duration.days(15); - let message = "Transaction Should Fail!"; // Contract Instance Declaration @@ -70,13 +65,16 @@ contract("CountTransferManager", accounts => { const stoKey = 3; // Initial fee for ticker registry and security token registry - const initRegFee = web3.utils.toWei("250"); + const initRegFee = new BN(web3.utils.toWei("250")); // CountTransferManager details const holderCount = 2; // Maximum number of token holders let bytesSTO = encodeModuleCall(["uint256"], [holderCount]); + let currentTime; + before(async () => { + currentTime = new BN(await latestTime()); // Accounts setup account_polymath = accounts[0]; account_issuer = accounts[1]; @@ -109,7 +107,7 @@ contract("CountTransferManager", accounts => { // STEP 2: Deploy the CountTransferManager [I_CountTransferManagerFactory] = await deployCountTMAndVerifyed(account_polymath, I_MRProxied, 0); // STEP 3: Deploy Paid the CountTransferManager - [P_CountTransferManagerFactory] = await deployCountTMAndVerifyed(account_polymath, I_MRProxied, web3.utils.toWei("500", "ether")); + [P_CountTransferManagerFactory] = await deployCountTMAndVerifyed(account_polymath, I_MRProxied, new BN(web3.utils.toWei("500", "ether"))); // Printing all the contract addresses console.log(` @@ -138,14 +136,14 @@ contract("CountTransferManager", accounts => { it("Should generate the new security token with the same symbol as registered above", async () => { await I_PolyToken.approve(I_STRProxied.address, initRegFee, { from: token_owner }); - let _blockNo = latestBlock(); + let tx = await I_STRProxied.generateSecurityToken(name, symbol, tokenDetails, false, { from: token_owner }); // Verify the successful generation of the security token assert.equal(tx.logs[2].args._ticker, symbol.toUpperCase(), "SecurityToken doesn't get deployed"); - I_SecurityToken = SecurityToken.at(tx.logs[2].args._securityTokenAddress); + I_SecurityToken = await SecurityToken.at(tx.logs[2].args._securityTokenAddress); - const log = await promisifyLogWatch(I_SecurityToken.ModuleAdded({ from: _blockNo }), 1); + const log = (await I_SecurityToken.getPastEvents('ModuleAdded', {filter: {transactionHash: tx.transactionHash}}))[0]; // Verify that GeneralTransferManager module get added successfully or not assert.equal(log.args._types[0].toNumber(), 2); @@ -154,13 +152,13 @@ contract("CountTransferManager", accounts => { it("Should intialize the auto attached modules", async () => { let moduleData = (await I_SecurityToken.getModulesByType(2))[0]; - I_GeneralTransferManager = GeneralTransferManager.at(moduleData); + I_GeneralTransferManager = await GeneralTransferManager.at(moduleData); }); it("Should successfully attach the CountTransferManager factory with the security token", async () => { - await I_PolyToken.getTokens(web3.utils.toWei("500", "ether"), token_owner); + await I_PolyToken.getTokens(new BN(web3.utils.toWei("500", "ether")), token_owner); await catchRevert( - I_SecurityToken.addModule(P_CountTransferManagerFactory.address, bytesSTO, web3.utils.toWei("500", "ether"), 0, { + I_SecurityToken.addModule(P_CountTransferManagerFactory.address, bytesSTO, new BN(web3.utils.toWei("500", "ether")), new BN(0), { from: token_owner }) ); @@ -168,12 +166,12 @@ contract("CountTransferManager", accounts => { it("Should successfully attach the CountTransferManager factory with the security token", async () => { let snapId = await takeSnapshot(); - await I_PolyToken.transfer(I_SecurityToken.address, web3.utils.toWei("500", "ether"), { from: token_owner }); + await I_PolyToken.transfer(I_SecurityToken.address, new BN(web3.utils.toWei("500", "ether")), { from: token_owner }); const tx = await I_SecurityToken.addModule( P_CountTransferManagerFactory.address, bytesSTO, - web3.utils.toWei("500", "ether"), - 0, + new BN(web3.utils.toWei("500", "ether")), + new BN(0), { from: token_owner } ); assert.equal(tx.logs[3].args._types[0].toNumber(), transferManagerKey, "CountTransferManagerFactory doesn't get deployed"); @@ -182,19 +180,19 @@ contract("CountTransferManager", accounts => { "CountTransferManager", "CountTransferManagerFactory module was not added" ); - P_CountTransferManager = CountTransferManager.at(tx.logs[3].args._module); + P_CountTransferManager = await CountTransferManager.at(tx.logs[3].args._module); await revertToSnapshot(snapId); }); it("Should successfully attach the CountTransferManager with the security token", async () => { - const tx = await I_SecurityToken.addModule(I_CountTransferManagerFactory.address, bytesSTO, 0, 0, { from: token_owner }); + const tx = await I_SecurityToken.addModule(I_CountTransferManagerFactory.address, bytesSTO, new BN(0), new BN(0), { from: token_owner }); assert.equal(tx.logs[2].args._types[0].toNumber(), transferManagerKey, "CountTransferManager doesn't get deployed"); assert.equal( web3.utils.toAscii(tx.logs[2].args._name).replace(/\u0000/g, ""), "CountTransferManager", "CountTransferManager module was not added" ); - I_CountTransferManager = CountTransferManager.at(tx.logs[2].args._module); + I_CountTransferManager = await CountTransferManager.at(tx.logs[2].args._module); }); }); @@ -204,9 +202,9 @@ contract("CountTransferManager", accounts => { let tx = await I_GeneralTransferManager.modifyWhitelist( account_investor1, - latestTime(), - latestTime(), - latestTime() + duration.days(10), + currentTime, + currentTime, + currentTime.add(new BN(duration.days(10))), true, { from: account_issuer, @@ -224,9 +222,9 @@ contract("CountTransferManager", accounts => { await increaseTime(5000); // Mint some tokens - await I_SecurityToken.mint(account_investor1, web3.utils.toWei("1", "ether"), { from: token_owner }); + await I_SecurityToken.mint(account_investor1, new BN(web3.utils.toWei("1", "ether")), { from: token_owner }); - assert.equal((await I_SecurityToken.balanceOf(account_investor1)).toNumber(), web3.utils.toWei("1", "ether")); + assert.equal((await I_SecurityToken.balanceOf(account_investor1)).toString(), new BN(web3.utils.toWei("1", "ether")).toString()); }); it("Should Buy some more tokens", async () => { @@ -234,9 +232,9 @@ contract("CountTransferManager", accounts => { let tx = await I_GeneralTransferManager.modifyWhitelist( account_investor2, - latestTime(), - latestTime(), - latestTime() + duration.days(10), + currentTime, + currentTime, + currentTime.add(new BN(duration.days(10))), true, { from: account_issuer, @@ -251,19 +249,19 @@ contract("CountTransferManager", accounts => { ); // Mint some tokens - await I_SecurityToken.mint(account_investor2, web3.utils.toWei("2", "ether"), { from: token_owner }); + await I_SecurityToken.mint(account_investor2, new BN(web3.utils.toWei("2", "ether")), { from: token_owner }); - assert.equal((await I_SecurityToken.balanceOf(account_investor2)).toNumber(), web3.utils.toWei("2", "ether")); + assert.equal((await I_SecurityToken.balanceOf(account_investor2)).toString(), new BN(web3.utils.toWei("2", "ether")).toString()); }); - it("Should able to buy some more tokens (more than 2 hoders) -- because CountTransferManager is paused", async() => { - await I_CountTransferManager.pause({from: account_issuer }); + it("Should able to buy some more tokens (more than 2 hoders) -- because CountTransferManager is paused", async () => { + await I_CountTransferManager.pause({ from: account_issuer }); let snapId = await takeSnapshot(); let tx = await I_GeneralTransferManager.modifyWhitelist( account_investor3, - latestTime(), - latestTime(), - latestTime() + duration.days(10), + currentTime, + currentTime, + currentTime.add(new BN(duration.days(10))), true, { from: account_issuer, @@ -277,18 +275,18 @@ contract("CountTransferManager", accounts => { "Failed in adding the investor in whitelist" ); - await I_SecurityToken.mint(account_investor3, web3.utils.toWei("3", "ether"), { from: token_owner }) + await I_SecurityToken.mint(account_investor3, new BN(web3.utils.toWei("3", "ether")), { from: token_owner }); await revertToSnapshot(snapId); - }) + }); it("Should fail to buy some more tokens (more than 2 holders)", async () => { - await I_CountTransferManager.unpause({from: account_issuer }); + await I_CountTransferManager.unpause({ from: account_issuer }); // Add the Investor in to the whitelist let tx = await I_GeneralTransferManager.modifyWhitelist( account_investor3, - latestTime(), - latestTime(), - latestTime() + duration.days(10), + currentTime, + currentTime, + currentTime.add(new BN(duration.days(10))), true, { from: account_issuer, @@ -302,23 +300,23 @@ contract("CountTransferManager", accounts => { "Failed in adding the investor in whitelist" ); - await catchRevert(I_SecurityToken.mint(account_investor3, web3.utils.toWei("3", "ether"), { from: token_owner })); + await catchRevert(I_SecurityToken.mint(account_investor3, new BN(web3.utils.toWei("3", "ether")), { from: token_owner })); }); it("Should still be able to add to original token holders", async () => { // Add the Investor in to the whitelist // Mint some tokens - await I_SecurityToken.mint(account_investor2, web3.utils.toWei("2", "ether"), { from: token_owner }); + await I_SecurityToken.mint(account_investor2, new BN(web3.utils.toWei("2", "ether")), { from: token_owner }); - assert.equal((await I_SecurityToken.balanceOf(account_investor2)).toNumber(), web3.utils.toWei("4", "ether")); + assert.equal((await I_SecurityToken.balanceOf(account_investor2)).toString(), new BN(web3.utils.toWei("4", "ether")).toString()); }); it("Should still be able to transfer between existing token holders before count change", async () => { // Add the Investor in to the whitelist // Mint some tokens - await I_SecurityToken.transfer(account_investor1, web3.utils.toWei("2", "ether"), { from: account_investor2 }); + await I_SecurityToken.transfer(account_investor1, new BN(web3.utils.toWei("2", "ether")), { from: account_investor2 }); - assert.equal((await I_SecurityToken.balanceOf(account_investor2)).toNumber(), web3.utils.toWei("2", "ether")); + assert.equal((await I_SecurityToken.balanceOf(account_investor2)).toString(), new BN(web3.utils.toWei("2", "ether")).toString()); }); it("Should fail in modifying the holder count", async () => { @@ -336,18 +334,18 @@ contract("CountTransferManager", accounts => { it("Should still be able to transfer between existing token holders after count change", async () => { // Add the Investor in to the whitelist // Mint some tokens - await I_SecurityToken.transfer(account_investor2, web3.utils.toWei("2", "ether"), { from: account_investor1 }); + await I_SecurityToken.transfer(account_investor2, new BN(web3.utils.toWei("2", "ether")), { from: account_investor1 }); - assert.equal((await I_SecurityToken.balanceOf(account_investor2)).toNumber(), web3.utils.toWei("4", "ether")); + assert.equal((await I_SecurityToken.balanceOf(account_investor2)).toString(), new BN(web3.utils.toWei("4", "ether")).toString()); }); it("Should not be able to transfer to a new token holder", async () => { // await I_CountTransferManager.unpause({from: token_owner}); - await catchRevert(I_SecurityToken.transfer(account_investor3, web3.utils.toWei("2", "ether"), { from: account_investor2 })); + await catchRevert(I_SecurityToken.transfer(account_investor3, new BN(web3.utils.toWei("2", "ether")), { from: account_investor2 })); }); it("Should be able to consolidate balances", async () => { - await I_SecurityToken.transfer(account_investor2, web3.utils.toWei("1", "ether"), { from: account_investor1 }); + await I_SecurityToken.transfer(account_investor2, new BN(web3.utils.toWei("1", "ether")), { from: account_investor1 }); }); it("Should get the permission list", async () => { @@ -357,27 +355,26 @@ contract("CountTransferManager", accounts => { describe("Test cases for adding and removing acc holder at the same time", async () => { it("deploy a new token & auto attach modules", async () => { - //register ticker and deploy token await I_PolyToken.approve(I_STRProxied.address, initRegFee, { from: token_owner }); let tx = await I_STRProxied.registerTicker(token_owner, symbol2, contact, { from: token_owner }); await I_PolyToken.approve(I_STRProxied.address, initRegFee, { from: token_owner }); - let _blockNo = latestBlock(); + let tx2 = await I_STRProxied.generateSecurityToken(name, symbol2, tokenDetails, false, { from: token_owner }); - I_SecurityToken2 = SecurityToken.at(tx2.logs[2].args._securityTokenAddress); + I_SecurityToken2 = await SecurityToken.at(tx2.logs[2].args._securityTokenAddress); let moduleData = (await I_SecurityToken2.getModulesByType(2))[0]; - I_GeneralTransferManager2 = GeneralTransferManager.at(moduleData); + I_GeneralTransferManager2 = await GeneralTransferManager.at(moduleData); }); it("add 3 holders to the token", async () => { - await I_GeneralTransferManager2.modifyWhitelist( + await I_GeneralTransferManager2.modifyWhitelist( account_investor1, - latestTime(), - latestTime(), - latestTime() + duration.days(10), + currentTime, + currentTime, + currentTime.add(new BN(duration.days(10))), true, { from: account_issuer, @@ -387,9 +384,9 @@ contract("CountTransferManager", accounts => { await I_GeneralTransferManager2.modifyWhitelist( account_investor2, - latestTime(), - latestTime(), - latestTime() + duration.days(10), + currentTime, + currentTime, + currentTime.add(new BN(duration.days(10))), true, { from: account_issuer, @@ -399,9 +396,9 @@ contract("CountTransferManager", accounts => { await I_GeneralTransferManager2.modifyWhitelist( account_investor3, - latestTime(), - latestTime(), - latestTime() + duration.days(10), + currentTime, + currentTime, + currentTime.add(new BN(duration.days(10))), true, { from: account_issuer, @@ -411,9 +408,9 @@ contract("CountTransferManager", accounts => { await I_GeneralTransferManager2.modifyWhitelist( account_investor4, - latestTime(), - latestTime(), - latestTime() + duration.days(10), + currentTime, + currentTime, + currentTime.add(new BN(duration.days(10))), true, { from: account_issuer, @@ -425,46 +422,46 @@ contract("CountTransferManager", accounts => { await increaseTime(5000); // Add 3 holders to the token - await I_SecurityToken2.mint(account_investor1, web3.utils.toWei("1", "ether"), { from: token_owner }); - await I_SecurityToken2.mint(account_investor2, web3.utils.toWei("1", "ether"), { from: token_owner }); - await I_SecurityToken2.mint(account_investor3, web3.utils.toWei("1", "ether"), { from: token_owner }); - assert.equal((await I_SecurityToken2.balanceOf(account_investor1)).toNumber(), web3.utils.toWei("1", "ether")); + await I_SecurityToken2.mint(account_investor1, new BN(web3.utils.toWei("1", "ether")), { from: token_owner }); + await I_SecurityToken2.mint(account_investor2, new BN(web3.utils.toWei("1", "ether")), { from: token_owner }); + await I_SecurityToken2.mint(account_investor3, new BN(web3.utils.toWei("1", "ether")), { from: token_owner }); + assert.equal((await I_SecurityToken2.balanceOf(account_investor1)).toString(), new BN(web3.utils.toWei("1", "ether")).toString()); }); it("Should intialize the auto attached modules", async () => { let moduleData = (await I_SecurityToken2.getModulesByType(2))[0]; - I_GeneralTransferManager2 = GeneralTransferManager.at(moduleData); + I_GeneralTransferManager2 = await GeneralTransferManager.at(moduleData); }); it("Should successfully attach the CountTransferManager factory with the security token", async () => { - await I_PolyToken.getTokens(web3.utils.toWei("500", "ether"), token_owner); + await I_PolyToken.getTokens(new BN(web3.utils.toWei("500", "ether")), token_owner); await catchRevert( - I_SecurityToken2.addModule(P_CountTransferManagerFactory.address, bytesSTO, web3.utils.toWei("500", "ether"), 0, { + I_SecurityToken2.addModule(P_CountTransferManagerFactory.address, bytesSTO, new BN(web3.utils.toWei("500", "ether")), new BN(0), { from: token_owner }) ); }); it("Should successfully attach the CountTransferManager with the security token and set max holder to 2", async () => { - const tx = await I_SecurityToken2.addModule(I_CountTransferManagerFactory.address, bytesSTO, 0, 0, { from: token_owner }); + const tx = await I_SecurityToken2.addModule(I_CountTransferManagerFactory.address, bytesSTO, new BN(0), new BN(0), { from: token_owner }); assert.equal(tx.logs[2].args._types[0].toNumber(), transferManagerKey, "CountTransferManager doesn't get deployed"); assert.equal( web3.utils.toAscii(tx.logs[2].args._name).replace(/\u0000/g, ""), "CountTransferManager", "CountTransferManager module was not added" ); - I_CountTransferManager2 = CountTransferManager.at(tx.logs[2].args._module); - await I_CountTransferManager2.changeHolderCount(2, {from: token_owner}); - console.log('current max holder number is '+ await I_CountTransferManager2.maxHolderCount({from: token_owner})); + I_CountTransferManager2 = await CountTransferManager.at(tx.logs[2].args._module); + await I_CountTransferManager2.changeHolderCount(2, { from: token_owner }); + console.log("current max holder number is " + (await I_CountTransferManager2.maxHolderCount({ from: token_owner }))); }); it("Should allow add a new token holder while transfer all the tokens at one go", async () => { - let amount = (await I_SecurityToken2.balanceOf(account_investor2)).toNumber(); - let investorCount = await I_SecurityToken2.getInvestorCount({from: account_investor2 }); + let amount = await I_SecurityToken2.balanceOf(account_investor2); + let investorCount = await I_SecurityToken2.getInvestorCount({ from: account_investor2 }); console.log("current investor count is " + investorCount); await I_SecurityToken2.transfer(account_investor4, amount, { from: account_investor2 }); - assert((await I_SecurityToken2.balanceOf(account_investor4)).toNumber(), amount, {from: account_investor2 }); - assert(await I_SecurityToken2.getInvestorCount({from: account_investor2 }), investorCount); + assert((await I_SecurityToken2.balanceOf(account_investor4)).toString(), amount.toString(), { from: account_investor2 }); + assert(await I_SecurityToken2.getInvestorCount({ from: account_investor2 }), investorCount); }); }); @@ -496,78 +493,68 @@ contract("CountTransferManager", accounts => { }); }); - describe("Test cases for the ModuleFactory", async() => { - it("Should successfully change the SetupCost -- fail beacuse of bad owner", async() => { + describe("Test cases for the ModuleFactory", async () => { + it("Should successfully change the SetupCost -- fail beacuse of bad owner", async () => { await catchRevert( - I_CountTransferManagerFactory.changeFactorySetupFee(web3.utils.toWei("500"), {from: account_investor3}) + I_CountTransferManagerFactory.changeFactorySetupFee(new BN(web3.utils.toWei("500")), { from: account_investor3 }) ); }); - it("Should successfully change the setupCost", async() => { - await I_CountTransferManagerFactory.changeFactorySetupFee(web3.utils.toWei("800"), { from: account_polymath }); - assert.equal(await I_CountTransferManagerFactory.getSetupCost.call(), web3.utils.toWei("800")); - }) + it("Should successfully change the setupCost", async () => { + await I_CountTransferManagerFactory.changeFactorySetupFee(new BN(web3.utils.toWei("800")), { from: account_polymath }); + assert.equal((await I_CountTransferManagerFactory.getSetupCost.call()).toString(), new BN(web3.utils.toWei("800")).toString()); + }); - it("Should successfully change the usage fee -- fail beacuse of bad owner", async() => { + it("Should successfully change the usage fee -- fail beacuse of bad owner", async () => { await catchRevert( - I_CountTransferManagerFactory.changeFactoryUsageFee(web3.utils.toWei("500"), {from: account_investor3}) + I_CountTransferManagerFactory.changeFactoryUsageFee(new BN(web3.utils.toWei("500")), { from: account_investor3 }) ); }); - it("Should successfully change the usage fee", async() => { - await I_CountTransferManagerFactory.changeFactoryUsageFee(web3.utils.toWei("800"), { from: account_polymath }); - assert.equal(await I_CountTransferManagerFactory.usageCost.call(), web3.utils.toWei("800")); + it("Should successfully change the usage fee", async () => { + await I_CountTransferManagerFactory.changeFactoryUsageFee(new BN(web3.utils.toWei("800")), { from: account_polymath }); + assert.equal((await I_CountTransferManagerFactory.usageCost.call()).toString(), new BN(web3.utils.toWei("800")).toString()); }); - it("Should successfully change the subscription fee -- fail beacuse of bad owner", async() => { + it("Should successfully change the subscription fee -- fail beacuse of bad owner", async () => { await catchRevert( - I_CountTransferManagerFactory.changeFactorySubscriptionFee(web3.utils.toWei("500"), {from: account_investor3}) + I_CountTransferManagerFactory.changeFactorySubscriptionFee(new BN(web3.utils.toWei("500")), { from: account_investor3 }) ); }); - it("Should successfully change the subscription fee", async() => { - await I_CountTransferManagerFactory.changeFactorySubscriptionFee(web3.utils.toWei("800"), { from: account_polymath }); - assert.equal(await I_CountTransferManagerFactory.monthlySubscriptionCost.call(), web3.utils.toWei("800")); + it("Should successfully change the subscription fee", async () => { + await I_CountTransferManagerFactory.changeFactorySubscriptionFee(new BN(web3.utils.toWei("800")), { from: account_polymath }); + assert.equal((await I_CountTransferManagerFactory.monthlySubscriptionCost.call()), new BN(web3.utils.toWei("800")).toString()); }); - it("Should successfully change the version of the factory -- failed because of bad owner", async() => { - await catchRevert( - I_CountTransferManagerFactory.changeVersion("5.0.0", {from: account_investor3}) - ); + it("Should successfully change the version of the factory -- failed because of bad owner", async () => { + await catchRevert(I_CountTransferManagerFactory.changeVersion("5.0.0", { from: account_investor3 })); }); - it("Should successfully change the version of the fatory -- failed because of the 0 string", async() => { - await catchRevert( - I_CountTransferManagerFactory.changeVersion("", {from: account_polymath}) - ); + it("Should successfully change the version of the fatory -- failed because of the 0 string", async () => { + await catchRevert(I_CountTransferManagerFactory.changeVersion("", { from: account_polymath })); }); - it("Should successfully change the version of the fatory", async() => { - await I_CountTransferManagerFactory.changeVersion("5.0.0", {from: account_polymath}); + it("Should successfully change the version of the fatory", async () => { + await I_CountTransferManagerFactory.changeVersion("5.0.0", { from: account_polymath }); assert.equal(await I_CountTransferManagerFactory.version.call(), "5.0.0"); }); - }) + }); - describe("Test case for the changeSTVersionBounds", async() => { - it("Should successfully change the version bounds -- failed because of the non permitted bound type", async() => { - await catchRevert( - I_CountTransferManagerFactory.changeSTVersionBounds("middleType", [1,2,3], {from: account_polymath}) - ); - }) + describe("Test case for the changeSTVersionBounds", async () => { + it("Should successfully change the version bounds -- failed because of the non permitted bound type", async () => { + await catchRevert(I_CountTransferManagerFactory.changeSTVersionBounds("middleType", [1, 2, 3], { from: account_polymath })); + }); - it("Should successfully change the version bound --failed because the new version length < 3", async()=> { - await catchRevert( - I_CountTransferManagerFactory.changeSTVersionBounds("lowerBound", [1,2], {from: account_polymath}) - ); - }) + it("Should successfully change the version bound --failed because the new version length < 3", async () => { + await catchRevert(I_CountTransferManagerFactory.changeSTVersionBounds("lowerBound", [1, 2], { from: account_polymath })); + }); - it("Should successfully change the version bound", async()=> { - await I_CountTransferManagerFactory.changeSTVersionBounds("lowerBound", [1,2,1], {from: account_polymath}); - await I_CountTransferManagerFactory.changeSTVersionBounds("lowerBound", [1,4,9], {from: account_polymath}); - await catchRevert( - I_CountTransferManagerFactory.changeSTVersionBounds("lowerBound", [1,0,0], {from: account_polymath}) - ); - }) - }) + it("Should successfully change the version bound", async () => { + await I_CountTransferManagerFactory.changeSTVersionBounds("lowerBound", [1, 2, 1], { from: account_polymath }); + await I_CountTransferManagerFactory.changeSTVersionBounds("lowerBound", [1, 4, 9], { from: account_polymath }); + await catchRevert(I_CountTransferManagerFactory.changeSTVersionBounds("lowerBound", [1, new BN(0), 0], { from: account_polymath })); + }); + }); }); }); diff --git a/test/e_erc20_dividends.js b/test/e_erc20_dividends.js index 7c9836d42..49472fc7a 100644 --- a/test/e_erc20_dividends.js +++ b/test/e_erc20_dividends.js @@ -10,10 +10,10 @@ const ERC20DividendCheckpoint = artifacts.require("./ERC20DividendCheckpoint"); const GeneralPermissionManager = artifacts.require("GeneralPermissionManager"); const Web3 = require("web3"); -const BigNumber = require("bignumber.js"); +let BN = Web3.utils.BN; const web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545")); // Hardcoded development port -contract("ERC20DividendCheckpoint", accounts => { +contract("ERC20DividendCheckpoint", async (accounts) => { // Accounts Variable declaration let account_polymath; let account_issuer; @@ -25,11 +25,6 @@ contract("ERC20DividendCheckpoint", accounts => { let account_manager; let account_temp; - // investor Details - let fromTime = latestTime(); - let toTime = latestTime(); - let expiryTime = toTime + duration.days(15); - let message = "Transaction Should Fail!"; let dividendName = "0x546573744469766964656e640000000000000000000000000000000000000000"; @@ -70,15 +65,18 @@ contract("ERC20DividendCheckpoint", accounts => { const checkpointKey = 4; //Manager details - const managerDetails = "Hello, I am a legit manager"; + const managerDetails = web3.utils.fromAscii("Hello"); // Initial fee for ticker registry and security token registry - const initRegFee = web3.utils.toWei("250"); + const initRegFee = new BN(web3.utils.toWei("250")); + + const one_address = "0x0000000000000000000000000000000000000001"; + const address_zero = "0x0000000000000000000000000000000000000000"; - const one_address = '0x0000000000000000000000000000000000000001'; + let currentTime; before(async () => { - // Accounts setup + currentTime = new BN(await latestTime()); account_polymath = accounts[0]; account_issuer = accounts[1]; @@ -109,7 +107,11 @@ contract("ERC20DividendCheckpoint", accounts => { I_STRGetter ] = instances; - [P_ERC20DividendCheckpointFactory] = await deployERC20DividendAndVerifyed(account_polymath, I_MRProxied, web3.utils.toWei("500", "ether")); + [P_ERC20DividendCheckpointFactory] = await deployERC20DividendAndVerifyed( + account_polymath, + I_MRProxied, + new BN(web3.utils.toWei("500", "ether")) + ); [I_ERC20DividendCheckpointFactory] = await deployERC20DividendAndVerifyed(account_polymath, I_MRProxied, 0); // Printing all the contract addresses @@ -139,15 +141,15 @@ contract("ERC20DividendCheckpoint", accounts => { it("Should generate the new security token with the same symbol as registered above", async () => { await I_PolyToken.approve(I_STRProxied.address, initRegFee, { from: token_owner }); - let _blockNo = latestBlock(); + let tx = await I_STRProxied.generateSecurityToken(name, symbol, tokenDetails, false, { from: token_owner }); // Verify the successful generation of the security token assert.equal(tx.logs[2].args._ticker, symbol.toUpperCase(), "SecurityToken doesn't get deployed"); - I_SecurityToken = SecurityToken.at(tx.logs[2].args._securityTokenAddress); + I_SecurityToken = await SecurityToken.at(tx.logs[2].args._securityTokenAddress); - const log = await promisifyLogWatch(I_SecurityToken.ModuleAdded({ from: _blockNo }), 1); + const log = (await I_SecurityToken.getPastEvents('ModuleAdded', {filter: {transactionHash: tx.transactionHash}}))[0]; // Verify that GeneralTransferManager module get added successfully or not assert.equal(log.args._types[0].toNumber(), 2); assert.equal(web3.utils.toAscii(log.args._name).replace(/\u0000/g, ""), "GeneralTransferManager"); @@ -155,12 +157,12 @@ contract("ERC20DividendCheckpoint", accounts => { it("Should intialize the auto attached modules", async () => { let moduleData = (await I_SecurityToken.getModulesByType(2))[0]; - I_GeneralTransferManager = GeneralTransferManager.at(moduleData); + I_GeneralTransferManager = await GeneralTransferManager.at(moduleData); }); it("Should successfully attach the ERC20DividendCheckpoint with the security token - fail insufficient payment", async () => { await catchRevert( - I_SecurityToken.addModule(P_ERC20DividendCheckpointFactory.address, "", web3.utils.toWei("500", "ether"), 0, { + I_SecurityToken.addModule(P_ERC20DividendCheckpointFactory.address, "0x0", new BN(web3.utils.toWei("500", "ether")), new BN(0), { from: token_owner }) ); @@ -168,9 +170,9 @@ contract("ERC20DividendCheckpoint", accounts => { it("Should successfully attach the ERC20DividendCheckpoint with the security token with budget", async () => { let snapId = await takeSnapshot(); - await I_PolyToken.getTokens(web3.utils.toWei("500", "ether"), token_owner); - await I_PolyToken.transfer(I_SecurityToken.address, web3.utils.toWei("500", "ether"), { from: token_owner }); - const tx = await I_SecurityToken.addModule(P_ERC20DividendCheckpointFactory.address, "", web3.utils.toWei("500", "ether"), 0, { + await I_PolyToken.getTokens(new BN(web3.utils.toWei("500", "ether")), token_owner); + await I_PolyToken.transfer(I_SecurityToken.address, new BN(web3.utils.toWei("500", "ether")), { from: token_owner }); + const tx = await I_SecurityToken.addModule(P_ERC20DividendCheckpointFactory.address, "0x0", new BN(web3.utils.toWei("500", "ether")), new BN(0), { from: token_owner }); assert.equal(tx.logs[3].args._types[0].toNumber(), checkpointKey, "ERC20DividendCheckpoint doesn't get deployed"); @@ -179,19 +181,19 @@ contract("ERC20DividendCheckpoint", accounts => { "ERC20DividendCheckpoint", "ERC20DividendCheckpoint module was not added" ); - P_ERC20DividendCheckpoint = ERC20DividendCheckpoint.at(tx.logs[3].args._module); + P_ERC20DividendCheckpoint = await ERC20DividendCheckpoint.at(tx.logs[3].args._module); await revertToSnapshot(snapId); }); it("Should successfully attach the ERC20DividendCheckpoint with the security token", async () => { - const tx = await I_SecurityToken.addModule(I_ERC20DividendCheckpointFactory.address, "", 0, 0, { from: token_owner }); + const tx = await I_SecurityToken.addModule(I_ERC20DividendCheckpointFactory.address, "0x0", new BN(0), new BN(0), { from: token_owner }); assert.equal(tx.logs[2].args._types[0].toNumber(), checkpointKey, "ERC20DividendCheckpoint doesn't get deployed"); assert.equal( web3.utils.toAscii(tx.logs[2].args._name).replace(/\u0000/g, ""), "ERC20DividendCheckpoint", "ERC20DividendCheckpoint module was not added" ); - I_ERC20DividendCheckpoint = ERC20DividendCheckpoint.at(tx.logs[2].args._module); + I_ERC20DividendCheckpoint = await ERC20DividendCheckpoint.at(tx.logs[2].args._module); }); }); @@ -201,9 +203,9 @@ contract("ERC20DividendCheckpoint", accounts => { let tx = await I_GeneralTransferManager.modifyWhitelist( account_investor1, - latestTime(), - latestTime(), - latestTime() + duration.days(30), + currentTime, + currentTime, + currentTime.add(new BN(duration.days(30))), true, { from: account_issuer, @@ -221,9 +223,9 @@ contract("ERC20DividendCheckpoint", accounts => { await increaseTime(5000); // Mint some tokens - await I_SecurityToken.mint(account_investor1, web3.utils.toWei("1", "ether"), { from: token_owner }); + await I_SecurityToken.mint(account_investor1, new BN(web3.utils.toWei("1", "ether")), { from: token_owner }); - assert.equal((await I_SecurityToken.balanceOf(account_investor1)).toNumber(), web3.utils.toWei("1", "ether")); + assert.equal((await I_SecurityToken.balanceOf(account_investor1)).toString(), new BN(web3.utils.toWei("1", "ether")).toString()); }); it("Buy some tokens for account_investor2 (2 ETH)", async () => { @@ -231,9 +233,9 @@ contract("ERC20DividendCheckpoint", accounts => { let tx = await I_GeneralTransferManager.modifyWhitelist( account_investor2, - latestTime(), - latestTime(), - latestTime() + duration.days(30), + currentTime, + currentTime, + currentTime.add(new BN(duration.days(30))), true, { from: account_issuer, @@ -248,21 +250,21 @@ contract("ERC20DividendCheckpoint", accounts => { ); // Mint some tokens - await I_SecurityToken.mint(account_investor2, web3.utils.toWei("2", "ether"), { from: token_owner }); + await I_SecurityToken.mint(account_investor2, new BN(web3.utils.toWei("2", "ether")), { from: token_owner }); - assert.equal((await I_SecurityToken.balanceOf(account_investor2)).toNumber(), web3.utils.toWei("2", "ether")); + assert.equal((await I_SecurityToken.balanceOf(account_investor2)).toString(), new BN(web3.utils.toWei("2", "ether")).toString()); }); it("Should fail in creating the dividend - incorrect allowance", async () => { - let maturity = latestTime(); - let expiry = latestTime() + duration.days(10); - await I_PolyToken.getTokens(web3.utils.toWei("1.5", "ether"), token_owner); + let maturity = await latestTime(); + let expiry = await latestTime() + duration.days(10); + await I_PolyToken.getTokens(new BN(web3.utils.toWei("1.5", "ether")), token_owner); await catchRevert( I_ERC20DividendCheckpoint.createDividend( maturity, expiry, I_PolyToken.address, - web3.utils.toWei("1.5", "ether"), + new BN(web3.utils.toWei("1.5", "ether")), dividendName, { from: token_owner } ) @@ -270,15 +272,15 @@ contract("ERC20DividendCheckpoint", accounts => { }); it("Should fail in creating the dividend - maturity > expiry", async () => { - let maturity = latestTime(); - let expiry = latestTime() - duration.days(10); - await I_PolyToken.approve(I_ERC20DividendCheckpoint.address, web3.utils.toWei("1.5", "ether"), { from: token_owner }); + let maturity = await latestTime(); + let expiry = await latestTime() - duration.days(10); + await I_PolyToken.approve(I_ERC20DividendCheckpoint.address, new BN(web3.utils.toWei("1.5", "ether")), { from: token_owner }); await catchRevert( I_ERC20DividendCheckpoint.createDividend( maturity, expiry, I_PolyToken.address, - web3.utils.toWei("1.5", "ether"), + new BN(web3.utils.toWei("1.5", "ether")), dividendName, { from: token_owner } ) @@ -286,14 +288,14 @@ contract("ERC20DividendCheckpoint", accounts => { }); it("Should fail in creating the dividend - now > expiry", async () => { - let maturity = latestTime() - duration.days(2); - let expiry = latestTime() - duration.days(1); + let maturity = await latestTime() - duration.days(2); + let expiry = await latestTime() - duration.days(1); await catchRevert( I_ERC20DividendCheckpoint.createDividend( maturity, expiry, I_PolyToken.address, - web3.utils.toWei("1.5", "ether"), + new BN(web3.utils.toWei("1.5", "ether")), dividendName, { from: token_owner } ) @@ -301,32 +303,32 @@ contract("ERC20DividendCheckpoint", accounts => { }); it("Should fail in creating the dividend - bad token", async () => { - let maturity = latestTime(); - let expiry = latestTime() + duration.days(10); + let maturity = await latestTime(); + let expiry = await latestTime() + duration.days(10); await catchRevert( - I_ERC20DividendCheckpoint.createDividend(maturity, expiry, 0, web3.utils.toWei("1.5", "ether"), dividendName, { + I_ERC20DividendCheckpoint.createDividend(maturity, expiry, address_zero, new BN(web3.utils.toWei("1.5", "ether")), dividendName, { from: token_owner }) ); }); it("Should fail in creating the dividend - amount is 0", async () => { - let maturity = latestTime(); - let expiry = latestTime() + duration.days(10); + let maturity = await latestTime(); + let expiry = await latestTime() + duration.days(10); await catchRevert( - I_ERC20DividendCheckpoint.createDividend(maturity, expiry, I_PolyToken.address, 0, dividendName, { from: token_owner }) + I_ERC20DividendCheckpoint.createDividend(maturity, expiry, I_PolyToken.address, new BN(0), dividendName, { from: token_owner }) ); }); it("Create new dividend of POLY tokens", async () => { - let maturity = latestTime() + duration.days(1); - let expiry = latestTime() + duration.days(10); + let maturity = await latestTime() + duration.days(1); + let expiry = await latestTime() + duration.days(10); let tx = await I_ERC20DividendCheckpoint.createDividend( maturity, expiry, I_PolyToken.address, - web3.utils.toWei("1.5", "ether"), + new BN(web3.utils.toWei("1.5", "ether")), dividendName, { from: token_owner } ); @@ -335,35 +337,35 @@ contract("ERC20DividendCheckpoint", accounts => { }); it("Investor 1 transfers his token balance to investor 2", async () => { - await I_SecurityToken.transfer(account_investor2, web3.utils.toWei("1", "ether"), { from: account_investor1 }); + await I_SecurityToken.transfer(account_investor2, new BN(web3.utils.toWei("1", "ether")), { from: account_investor1 }); assert.equal(await I_SecurityToken.balanceOf(account_investor1), 0); - assert.equal(await I_SecurityToken.balanceOf(account_investor2), web3.utils.toWei("3", "ether")); + assert.equal((await I_SecurityToken.balanceOf(account_investor2)).toString(), new BN(web3.utils.toWei("3", "ether")).toString()); }); it("Issuer pushes dividends iterating over account holders - dividends proportional to checkpoint - fails maturity in the future", async () => { - await catchRevert(I_ERC20DividendCheckpoint.pushDividendPayment(0, 0, 10, { from: token_owner })); + await catchRevert(I_ERC20DividendCheckpoint.pushDividendPayment(0, new BN(0), 10, { from: token_owner })); }); it("Issuer pushes dividends iterating over account holders - dividends proportional to checkpoint - fails not owner", async () => { // Increase time by 2 day await increaseTime(duration.days(2)); - await catchRevert(I_ERC20DividendCheckpoint.pushDividendPayment(0, 0, 10, { from: account_temp })); + await catchRevert(I_ERC20DividendCheckpoint.pushDividendPayment(0, new BN(0), 10, { from: account_temp })); }); it("Issuer pushes dividends iterating over account holders - dividends proportional to checkpoint - fails wrong index", async () => { - await catchRevert(I_ERC20DividendCheckpoint.pushDividendPayment(2, 0, 10, { from: token_owner })); + await catchRevert(I_ERC20DividendCheckpoint.pushDividendPayment(2, new BN(0), 10, { from: token_owner })); }); it("Issuer pushes dividends iterating over account holders - dividends proportional to checkpoint", async () => { - let investor1Balance = new BigNumber(await I_PolyToken.balanceOf(account_investor1)); - let investor2Balance = new BigNumber(await I_PolyToken.balanceOf(account_investor2)); - await I_ERC20DividendCheckpoint.pushDividendPayment(0, 0, 10, { from: token_owner, gas: 5000000 }); - let investor1BalanceAfter = new BigNumber(await I_PolyToken.balanceOf(account_investor1)); - let investor2BalanceAfter = new BigNumber(await I_PolyToken.balanceOf(account_investor2)); - assert.equal(investor1BalanceAfter.sub(investor1Balance).toNumber(), web3.utils.toWei("0.5", "ether")); - assert.equal(investor2BalanceAfter.sub(investor2Balance).toNumber(), web3.utils.toWei("1", "ether")); + let investor1Balance = new BN(await I_PolyToken.balanceOf(account_investor1)); + let investor2Balance = new BN(await I_PolyToken.balanceOf(account_investor2)); + await I_ERC20DividendCheckpoint.pushDividendPayment(0, new BN(0), 10, { from: token_owner, gas: 5000000 }); + let investor1BalanceAfter = new BN(await I_PolyToken.balanceOf(account_investor1)); + let investor2BalanceAfter = new BN(await I_PolyToken.balanceOf(account_investor2)); + assert.equal(investor1BalanceAfter.sub(investor1Balance).toString(), new BN(web3.utils.toWei("0.5", "ether")).toString()); + assert.equal(investor2BalanceAfter.sub(investor2Balance).toString(), new BN(web3.utils.toWei("1", "ether")).toString()); //Check fully claimed - assert.equal((await I_ERC20DividendCheckpoint.dividends(0))[5].toNumber(), web3.utils.toWei("1.5", "ether")); + assert.equal((await I_ERC20DividendCheckpoint.dividends(0))[5].toString(), new BN(web3.utils.toWei("1.5", "ether")).toString()); }); it("Buy some tokens for account_temp (1 ETH)", async () => { @@ -371,9 +373,9 @@ contract("ERC20DividendCheckpoint", accounts => { let tx = await I_GeneralTransferManager.modifyWhitelist( account_temp, - latestTime(), - latestTime(), - latestTime() + duration.days(20), + currentTime, + currentTime, + currentTime.add(new BN(duration.days(20))), true, { from: account_issuer, @@ -384,33 +386,33 @@ contract("ERC20DividendCheckpoint", accounts => { assert.equal(tx.logs[0].args._investor.toLowerCase(), account_temp.toLowerCase(), "Failed in adding the investor in whitelist"); // Mint some tokens - await I_SecurityToken.mint(account_temp, web3.utils.toWei("1", "ether"), { from: token_owner }); + await I_SecurityToken.mint(account_temp, new BN(web3.utils.toWei("1", "ether")), { from: token_owner }); - assert.equal((await I_SecurityToken.balanceOf(account_temp)).toNumber(), web3.utils.toWei("1", "ether")); + assert.equal((await I_SecurityToken.balanceOf(account_temp)).toString(), new BN(web3.utils.toWei("1", "ether")).toString()); }); it("Should not allow to create dividend without name", async () => { - let maturity = latestTime() + duration.days(1); - let expiry = latestTime() + duration.days(10); - await I_PolyToken.getTokens(web3.utils.toWei("1.5", "ether"), token_owner); - await I_PolyToken.approve(I_ERC20DividendCheckpoint.address, web3.utils.toWei("1.5", "ether"), { from: token_owner }); + let maturity = await latestTime() + duration.days(1); + let expiry = await latestTime() + duration.days(10); + await I_PolyToken.getTokens(new BN(web3.utils.toWei("1.5", "ether")), token_owner); + await I_PolyToken.approve(I_ERC20DividendCheckpoint.address, new BN(web3.utils.toWei("1.5", "ether")), { from: token_owner }); await catchRevert( - I_ERC20DividendCheckpoint.createDividend(maturity, expiry, I_PolyToken.address, web3.utils.toWei("1.5", "ether"), "", { + I_ERC20DividendCheckpoint.createDividend(maturity, expiry, I_PolyToken.address, new BN(web3.utils.toWei("1.5", "ether")), "0x0", { from: token_owner }) ); }); it("Create new dividend", async () => { - let maturity = latestTime() + duration.days(1); - let expiry = latestTime() + duration.days(10); - await I_PolyToken.getTokens(web3.utils.toWei("1.5", "ether"), token_owner); + let maturity = await latestTime() + duration.days(1); + let expiry = await latestTime() + duration.days(10); + await I_PolyToken.getTokens(new BN(web3.utils.toWei("1.5", "ether")), token_owner); // transfer approved in above test let tx = await I_ERC20DividendCheckpoint.createDividend( maturity, expiry, I_PolyToken.address, - web3.utils.toWei("1.5", "ether"), + new BN(web3.utils.toWei("1.5", "ether")), dividendName, { from: token_owner } ); @@ -419,12 +421,12 @@ contract("ERC20DividendCheckpoint", accounts => { it("Issuer pushes dividends iterating over account holders - dividends proportional to checkpoint - fails past expiry", async () => { await increaseTime(duration.days(12)); - await catchRevert(I_ERC20DividendCheckpoint.pushDividendPayment(1, 0, 10, { from: token_owner })); + await catchRevert(I_ERC20DividendCheckpoint.pushDividendPayment(1, new BN(0), 10, { from: token_owner })); }); it("Issuer pushes dividends iterating over account holders - dividends proportional to checkpoin - fails already reclaimed", async () => { let tx = await I_ERC20DividendCheckpoint.reclaimDividend(1, { from: token_owner, gas: 500000 }); - assert.equal(tx.logs[0].args._claimedAmount.toNumber(), web3.utils.toWei("1.5", "ether")); + assert.equal(tx.logs[0].args._claimedAmount.toString(), new BN(web3.utils.toWei("1.5", "ether")).toString()); await catchRevert(I_ERC20DividendCheckpoint.reclaimDividend(1, { from: token_owner, gas: 500000 })); }); @@ -433,9 +435,9 @@ contract("ERC20DividendCheckpoint", accounts => { let tx = await I_GeneralTransferManager.modifyWhitelist( account_investor3, - latestTime(), - latestTime(), - latestTime() + duration.days(10), + currentTime, + currentTime, + currentTime.add(new BN(duration.days(100000))), true, { from: account_issuer, @@ -450,17 +452,17 @@ contract("ERC20DividendCheckpoint", accounts => { ); // Mint some tokens - await I_SecurityToken.mint(account_investor3, web3.utils.toWei("7", "ether"), { from: token_owner }); + await I_SecurityToken.mint(account_investor3, new BN(web3.utils.toWei("7", "ether")), { from: token_owner }); - assert.equal((await I_SecurityToken.balanceOf(account_investor3)).toNumber(), web3.utils.toWei("7", "ether")); + assert.equal((await I_SecurityToken.balanceOf(account_investor3)).toString(), new BN(web3.utils.toWei("7", "ether")).toString()); }); it("Should allow to exclude same number of address as EXCLUDED_ADDRESS_LIMIT", async () => { let limit = await I_ERC20DividendCheckpoint.EXCLUDED_ADDRESS_LIMIT(); - limit = limit.toNumber(); + limit = limit.toNumber() + 42; let addresses = []; addresses.push(account_temp); - while (--limit) addresses.push(limit); + while (--limit > 42) addresses.push(web3.utils.toChecksumAddress('0x00000000000000000000000000000000000000' + limit)); await I_ERC20DividendCheckpoint.setDefaultExcluded(addresses, { from: token_owner }); let excluded = await I_ERC20DividendCheckpoint.getDefaultExcluded(); assert.equal(excluded[0], account_temp); @@ -476,7 +478,7 @@ contract("ERC20DividendCheckpoint", accounts => { it("Should not allow to exclude 0x0 address", async () => { let addresses = []; addresses.push(account_investor3); - addresses.push(0); + addresses.push(address_zero); await catchRevert(I_ERC20DividendCheckpoint.setDefaultExcluded(addresses, { from: token_owner })); }); @@ -488,23 +490,23 @@ contract("ERC20DividendCheckpoint", accounts => { it("Should not allow to exclude more address than EXCLUDED_ADDRESS_LIMIT", async () => { let limit = await I_ERC20DividendCheckpoint.EXCLUDED_ADDRESS_LIMIT(); - limit = limit.toNumber(); + limit = limit.toNumber() + 42; let addresses = []; addresses.push(account_temp); - while (limit--) addresses.push(limit); + while (limit-- > 42) addresses.push(web3.utils.toChecksumAddress('0x00000000000000000000000000000000000000' + limit)); await catchRevert(I_ERC20DividendCheckpoint.setDefaultExcluded(addresses, { from: token_owner })); }); it("Create another new dividend", async () => { - let maturity = latestTime(); - let expiry = latestTime() + duration.days(10); - await I_PolyToken.getTokens(web3.utils.toWei("11", "ether"), token_owner); - await I_PolyToken.approve(I_ERC20DividendCheckpoint.address, web3.utils.toWei("11", "ether"), { from: token_owner }); + let maturity = await latestTime(); + let expiry = await latestTime() + duration.days(10); + await I_PolyToken.getTokens(new BN(web3.utils.toWei("11", "ether")), token_owner); + await I_PolyToken.approve(I_ERC20DividendCheckpoint.address, new BN(web3.utils.toWei("11", "ether")), { from: token_owner }); let tx = await I_ERC20DividendCheckpoint.createDividend( maturity, expiry, I_PolyToken.address, - web3.utils.toWei("10", "ether"), + new BN(web3.utils.toWei("10", "ether")), dividendName, { from: token_owner } ); @@ -517,16 +519,16 @@ contract("ERC20DividendCheckpoint", accounts => { it("should investor 3 claims dividend", async () => { console.log((await I_ERC20DividendCheckpoint.dividends(2))[5].toNumber()); - let investor1Balance = new BigNumber(await I_PolyToken.balanceOf(account_investor1)); - let investor2Balance = new BigNumber(await I_PolyToken.balanceOf(account_investor2)); - let investor3Balance = new BigNumber(await I_PolyToken.balanceOf(account_investor3)); + let investor1Balance = new BN(await I_PolyToken.balanceOf(account_investor1)); + let investor2Balance = new BN(await I_PolyToken.balanceOf(account_investor2)); + let investor3Balance = new BN(await I_PolyToken.balanceOf(account_investor3)); await I_ERC20DividendCheckpoint.pullDividendPayment(2, { from: account_investor3, gasPrice: 0 }); - let investor1BalanceAfter1 = new BigNumber(await I_PolyToken.balanceOf(account_investor1)); - let investor2BalanceAfter1 = new BigNumber(await I_PolyToken.balanceOf(account_investor2)); - let investor3BalanceAfter1 = new BigNumber(await I_PolyToken.balanceOf(account_investor3)); + let investor1BalanceAfter1 = new BN(await I_PolyToken.balanceOf(account_investor1)); + let investor2BalanceAfter1 = new BN(await I_PolyToken.balanceOf(account_investor2)); + let investor3BalanceAfter1 = new BN(await I_PolyToken.balanceOf(account_investor3)); assert.equal(investor1BalanceAfter1.sub(investor1Balance).toNumber(), 0); assert.equal(investor2BalanceAfter1.sub(investor2Balance).toNumber(), 0); - assert.equal(investor3BalanceAfter1.sub(investor3Balance).toNumber(), web3.utils.toWei("7", "ether")); + assert.equal(investor3BalanceAfter1.sub(investor3Balance).toString(), new BN(web3.utils.toWei("7", "ether")).toString()); }); it("should investor 3 claims dividend - fails already claimed", async () => { @@ -534,22 +536,21 @@ contract("ERC20DividendCheckpoint", accounts => { }); it("should issuer pushes remain", async () => { - console.log((await I_ERC20DividendCheckpoint.dividends(2))[5].toNumber()); - let investor1BalanceAfter1 = new BigNumber(await I_PolyToken.balanceOf(account_investor1)); - let investor2BalanceAfter1 = new BigNumber(await I_PolyToken.balanceOf(account_investor2)); - let investor3BalanceAfter1 = new BigNumber(await I_PolyToken.balanceOf(account_investor3)); - let investorTempBalanceAfter1 = new BigNumber(await I_PolyToken.balanceOf(account_temp)); - await I_ERC20DividendCheckpoint.pushDividendPayment(2, 0, 10, { from: token_owner }); - let investor1BalanceAfter2 = new BigNumber(await I_PolyToken.balanceOf(account_investor1)); - let investor2BalanceAfter2 = new BigNumber(await I_PolyToken.balanceOf(account_investor2)); - let investor3BalanceAfter2 = new BigNumber(await I_PolyToken.balanceOf(account_investor3)); - let investorTempBalanceAfter2 = new BigNumber(await I_PolyToken.balanceOf(account_temp)); + let investor1BalanceAfter1 = new BN(await I_PolyToken.balanceOf(account_investor1)); + let investor2BalanceAfter1 = new BN(await I_PolyToken.balanceOf(account_investor2)); + let investor3BalanceAfter1 = new BN(await I_PolyToken.balanceOf(account_investor3)); + let investorTempBalanceAfter1 = new BN(await I_PolyToken.balanceOf(account_temp)); + await I_ERC20DividendCheckpoint.pushDividendPayment(2, new BN(0), 10, { from: token_owner }); + let investor1BalanceAfter2 = new BN(await I_PolyToken.balanceOf(account_investor1)); + let investor2BalanceAfter2 = new BN(await I_PolyToken.balanceOf(account_investor2)); + let investor3BalanceAfter2 = new BN(await I_PolyToken.balanceOf(account_investor3)); + let investorTempBalanceAfter2 = new BN(await I_PolyToken.balanceOf(account_temp)); assert.equal(investor1BalanceAfter2.sub(investor1BalanceAfter1).toNumber(), 0); - assert.equal(investor2BalanceAfter2.sub(investor2BalanceAfter1).toNumber(), web3.utils.toWei("3", "ether")); + assert.equal(investor2BalanceAfter2.sub(investor2BalanceAfter1).toString(), new BN(web3.utils.toWei("3", "ether")).toString()); assert.equal(investor3BalanceAfter2.sub(investor3BalanceAfter1).toNumber(), 0); assert.equal(investorTempBalanceAfter2.sub(investorTempBalanceAfter1).toNumber(), 0); //Check fully claimed - assert.equal((await I_ERC20DividendCheckpoint.dividends(2))[5].toNumber(), web3.utils.toWei("10", "ether")); + assert.equal((await I_ERC20DividendCheckpoint.dividends(2))[5].toString(), new BN(web3.utils.toWei("10", "ether")).toString()); }); it("Delete global exclusion list", async () => { @@ -557,26 +558,26 @@ contract("ERC20DividendCheckpoint", accounts => { }); it("Investor 2 transfers 1 ETH of his token balance to investor 1", async () => { - await I_SecurityToken.transfer(account_investor1, web3.utils.toWei("1", "ether"), { from: account_investor2 }); - assert.equal(await I_SecurityToken.balanceOf(account_investor1), web3.utils.toWei("1", "ether")); - assert.equal(await I_SecurityToken.balanceOf(account_investor2), web3.utils.toWei("2", "ether")); - assert.equal(await I_SecurityToken.balanceOf(account_investor3), web3.utils.toWei("7", "ether")); - assert.equal(await I_SecurityToken.balanceOf(account_temp), web3.utils.toWei("1", "ether")); + await I_SecurityToken.transfer(account_investor1, new BN(web3.utils.toWei("1", "ether")), { from: account_investor2 }); + assert.equal((await I_SecurityToken.balanceOf(account_investor1)).toString(), new BN(web3.utils.toWei("1", "ether")).toString()); + assert.equal((await I_SecurityToken.balanceOf(account_investor2)).toString(), new BN(web3.utils.toWei("2", "ether")).toString()); + assert.equal((await I_SecurityToken.balanceOf(account_investor3)).toString(), new BN(web3.utils.toWei("7", "ether")).toString()); + assert.equal((await I_SecurityToken.balanceOf(account_temp)).toString(), new BN(web3.utils.toWei("1", "ether")).toString()); }); it("Create another new dividend with explicit checkpoint - fails bad allowance", async () => { - let maturity = latestTime(); - let expiry = latestTime() + duration.days(2); + let maturity = await latestTime(); + let expiry = await latestTime() + duration.days(2); let tx = await I_SecurityToken.createCheckpoint({ from: token_owner }); console.log(JSON.stringify(tx.logs[0].args)); console.log((await I_SecurityToken.currentCheckpointId()).toNumber()); - await I_PolyToken.getTokens(web3.utils.toWei("20", "ether"), token_owner); + await I_PolyToken.getTokens(new BN(web3.utils.toWei("20", "ether")), token_owner); await catchRevert( I_ERC20DividendCheckpoint.createDividendWithCheckpoint( maturity, expiry, I_PolyToken.address, - web3.utils.toWei("20", "ether"), + new BN(web3.utils.toWei("20", "ether")), 4, dividendName, { from: token_owner } @@ -587,15 +588,15 @@ contract("ERC20DividendCheckpoint", accounts => { it("Create another new dividend with explicit - fails maturity > expiry", async () => { console.log((await I_SecurityToken.currentCheckpointId()).toNumber()); - let maturity = latestTime(); - let expiry = latestTime() - duration.days(10); - await I_PolyToken.approve(I_ERC20DividendCheckpoint.address, web3.utils.toWei("20", "ether"), { from: token_owner }); + let maturity = await latestTime(); + let expiry = await latestTime() - duration.days(10); + await I_PolyToken.approve(I_ERC20DividendCheckpoint.address, new BN(web3.utils.toWei("20", "ether")), { from: token_owner }); await catchRevert( I_ERC20DividendCheckpoint.createDividendWithCheckpoint( maturity, expiry, I_PolyToken.address, - web3.utils.toWei("20", "ether"), + new BN(web3.utils.toWei("20", "ether")), 4, dividendName, { from: token_owner } @@ -606,14 +607,14 @@ contract("ERC20DividendCheckpoint", accounts => { it("Create another new dividend with explicit - fails now > expiry", async () => { console.log((await I_SecurityToken.currentCheckpointId()).toNumber()); - let maturity = latestTime() - duration.days(5); - let expiry = latestTime() - duration.days(2); + let maturity = await latestTime() - duration.days(5); + let expiry = await latestTime() - duration.days(2); await catchRevert( I_ERC20DividendCheckpoint.createDividendWithCheckpoint( maturity, expiry, I_PolyToken.address, - web3.utils.toWei("20", "ether"), + new BN(web3.utils.toWei("20", "ether")), 4, dividendName, { from: token_owner } @@ -622,14 +623,14 @@ contract("ERC20DividendCheckpoint", accounts => { }); it("Create another new dividend with explicit - fails bad checkpoint", async () => { - let maturity = latestTime(); - let expiry = latestTime() + duration.days(2); + let maturity = await latestTime(); + let expiry = await latestTime() + duration.days(2); await catchRevert( I_ERC20DividendCheckpoint.createDividendWithCheckpoint( maturity, expiry, I_PolyToken.address, - web3.utils.toWei("20", "ether"), + new BN(web3.utils.toWei("20", "ether")), 5, dividendName, { from: token_owner } @@ -638,46 +639,41 @@ contract("ERC20DividendCheckpoint", accounts => { }); it("Set withholding tax of 20% on account_temp and 10% on investor2", async () => { - await I_ERC20DividendCheckpoint.setWithholding( - [account_temp, account_investor2], - [BigNumber(20 * 10 ** 16), BigNumber(10 * 10 ** 16)], - { from: token_owner } - ); + await I_ERC20DividendCheckpoint.setWithholding([account_temp, account_investor2], [new BN(20).mul(new BN(10).pow(new BN(16))), new BN(10).mul(new BN(10).pow(new BN(16)))], { + from: token_owner + }); }); it("Should not allow mismatching input lengths", async () => { await catchRevert( - I_ERC20DividendCheckpoint.setWithholding([account_temp], [BigNumber(20 * 10 ** 16), BigNumber(10 * 10 ** 16)], { + I_ERC20DividendCheckpoint.setWithholding([account_temp], [new BN(20).mul(new BN(10).pow(new BN(16))), new BN(10).mul(new BN(10).pow(new BN(16)))], { from: token_owner }) ); }); it("Should not allow withholding greater than limit", async () => { - await catchRevert(I_ERC20DividendCheckpoint.setWithholding([account_temp], [BigNumber(20 * 10 ** 26)], { from: token_owner })); - await catchRevert( - I_ERC20DividendCheckpoint.setWithholdingFixed([account_temp], BigNumber(20 * 10 ** 26), { from: token_owner }), - "" - ); + await catchRevert(I_ERC20DividendCheckpoint.setWithholding([account_temp], [new BN(20).mul(new BN(10).pow(new BN(26)))], { from: token_owner })); + await catchRevert(I_ERC20DividendCheckpoint.setWithholdingFixed([account_temp], new BN(20).mul(new BN(10).pow(new BN(26))), { from: token_owner }), ""); }); it("Should not create dividend with more exclusions than limit", async () => { - let maturity = latestTime(); - let expiry = latestTime() + duration.days(10); - await I_PolyToken.getTokens(web3.utils.toWei("11", "ether"), token_owner); - await I_PolyToken.approve(I_ERC20DividendCheckpoint.address, web3.utils.toWei("11", "ether"), { from: token_owner }); + let maturity = await latestTime(); + let expiry = await latestTime() + duration.days(10); + await I_PolyToken.getTokens(new BN(web3.utils.toWei("11", "ether")), token_owner); + await I_PolyToken.approve(I_ERC20DividendCheckpoint.address, new BN(web3.utils.toWei("11", "ether")), { from: token_owner }); let limit = await I_ERC20DividendCheckpoint.EXCLUDED_ADDRESS_LIMIT(); - limit = limit.toNumber(); + limit = limit.toNumber() + 42; let addresses = []; addresses.push(account_temp); addresses.push(token_owner); - while (--limit) addresses.push(limit); + while (--limit > 42) addresses.push(web3.utils.toChecksumAddress('0x00000000000000000000000000000000000000' + limit)); await catchRevert( I_ERC20DividendCheckpoint.createDividendWithCheckpointAndExclusions( maturity, expiry, I_PolyToken.address, - web3.utils.toWei("10", "ether"), + new BN(web3.utils.toWei("10", "ether")), 4, addresses, dividendName, @@ -687,15 +683,15 @@ contract("ERC20DividendCheckpoint", accounts => { }); it("Create another new dividend with explicit checkpoint and exclusion", async () => { - let maturity = latestTime(); - let expiry = latestTime() + duration.days(10); - await I_PolyToken.getTokens(web3.utils.toWei("11", "ether"), token_owner); + let maturity = await latestTime(); + let expiry = await latestTime() + duration.days(10); + await I_PolyToken.getTokens(new BN(web3.utils.toWei("11", "ether")), token_owner); //token transfer approved in above test let tx = await I_ERC20DividendCheckpoint.createDividendWithCheckpointAndExclusions( maturity, expiry, I_PolyToken.address, - web3.utils.toWei("10", "ether"), + new BN(web3.utils.toWei("10", "ether")), 4, [account_investor1], dividendName, @@ -705,37 +701,41 @@ contract("ERC20DividendCheckpoint", accounts => { }); it("Should not create new dividend with duplicate exclusion", async () => { - let maturity = latestTime(); - let expiry = latestTime() + duration.days(10); - await I_PolyToken.getTokens(web3.utils.toWei("11", "ether"), token_owner); + let maturity = await latestTime(); + let expiry = await latestTime() + duration.days(10); + await I_PolyToken.getTokens(new BN(web3.utils.toWei("11", "ether")), token_owner); //token transfer approved in above test - await catchRevert(I_ERC20DividendCheckpoint.createDividendWithCheckpointAndExclusions( - maturity, - expiry, - I_PolyToken.address, - web3.utils.toWei("10", "ether"), - 4, - [account_investor1, account_investor1], - dividendName, - { from: token_owner } - )); + await catchRevert( + I_ERC20DividendCheckpoint.createDividendWithCheckpointAndExclusions( + maturity, + expiry, + I_PolyToken.address, + new BN(web3.utils.toWei("10", "ether")), + 4, + [account_investor1, account_investor1], + dividendName, + { from: token_owner } + ) + ); }); it("Should not create new dividend with 0x0 address in exclusion", async () => { - let maturity = latestTime(); - let expiry = latestTime() + duration.days(10); - await I_PolyToken.getTokens(web3.utils.toWei("11", "ether"), token_owner); + let maturity = await latestTime(); + let expiry = await latestTime() + duration.days(10); + await I_PolyToken.getTokens(new BN(web3.utils.toWei("11", "ether")), token_owner); //token transfer approved in above test - await catchRevert(I_ERC20DividendCheckpoint.createDividendWithCheckpointAndExclusions( - maturity, - expiry, - I_PolyToken.address, - web3.utils.toWei("10", "ether"), - 4, - [0], - dividendName, - { from: token_owner } - )); + await catchRevert( + I_ERC20DividendCheckpoint.createDividendWithCheckpointAndExclusions( + maturity, + expiry, + I_PolyToken.address, + new BN(web3.utils.toWei("10", "ether")), + 4, + [address_zero], + dividendName, + { from: token_owner } + ) + ); }); it("Should not allow excluded to pull Dividend Payment", async () => { @@ -769,48 +769,48 @@ contract("ERC20DividendCheckpoint", accounts => { let dividendAmount2 = await I_ERC20DividendCheckpoint.calculateDividend.call(3, account_investor2); let dividendAmount3 = await I_ERC20DividendCheckpoint.calculateDividend.call(3, account_investor3); let dividendAmount_temp = await I_ERC20DividendCheckpoint.calculateDividend.call(3, account_temp); - assert.equal(dividendAmount1[0].toNumber(), web3.utils.toWei("0", "ether")); - assert.equal(dividendAmount2[0].toNumber(), web3.utils.toWei("2", "ether")); - assert.equal(dividendAmount3[0].toNumber(), web3.utils.toWei("7", "ether")); - assert.equal(dividendAmount_temp[0].toNumber(), web3.utils.toWei("1", "ether")); - assert.equal(dividendAmount1[1].toNumber(), web3.utils.toWei("0", "ether")); - assert.equal(dividendAmount2[1].toNumber(), web3.utils.toWei("0.2", "ether")); - assert.equal(dividendAmount3[1].toNumber(), web3.utils.toWei("0", "ether")); - assert.equal(dividendAmount_temp[1].toNumber(), web3.utils.toWei("0.2", "ether")); + assert.equal(dividendAmount1[0].toString(), new BN(web3.utils.toWei("0", "ether")).toString()); + assert.equal(dividendAmount2[0].toString(), new BN(web3.utils.toWei("2", "ether")).toString()); + assert.equal(dividendAmount3[0].toString(), new BN(web3.utils.toWei("7", "ether")).toString()); + assert.equal(dividendAmount_temp[0].toString(), new BN(web3.utils.toWei("1", "ether")).toString()); + assert.equal(dividendAmount1[1].toString(), new BN(web3.utils.toWei("0", "ether")).toString()); + assert.equal(dividendAmount2[1].toString(), new BN(web3.utils.toWei("0.2", "ether")).toString()); + assert.equal(dividendAmount3[1].toString(), new BN(web3.utils.toWei("0", "ether")).toString()); + assert.equal(dividendAmount_temp[1].toString(), new BN(web3.utils.toWei("0.2", "ether")).toString()); }); it("Investor 2 claims dividend", async () => { - let investor1Balance = new BigNumber(await I_PolyToken.balanceOf(account_investor1)); - let investor2Balance = new BigNumber(await I_PolyToken.balanceOf(account_investor2)); - let investor3Balance = new BigNumber(await I_PolyToken.balanceOf(account_investor3)); - let tempBalance = new BigNumber(await web3.eth.getBalance(account_temp)); + let investor1Balance = new BN(await I_PolyToken.balanceOf(account_investor1)); + let investor2Balance = new BN(await I_PolyToken.balanceOf(account_investor2)); + let investor3Balance = new BN(await I_PolyToken.balanceOf(account_investor3)); + let tempBalance = new BN(await web3.eth.getBalance(account_temp)); await I_ERC20DividendCheckpoint.pullDividendPayment(3, { from: account_investor2, gasPrice: 0 }); - let investor1BalanceAfter1 = new BigNumber(await I_PolyToken.balanceOf(account_investor1)); - let investor2BalanceAfter1 = new BigNumber(await I_PolyToken.balanceOf(account_investor2)); - let investor3BalanceAfter1 = new BigNumber(await I_PolyToken.balanceOf(account_investor3)); - let tempBalanceAfter1 = new BigNumber(await web3.eth.getBalance(account_temp)); + let investor1BalanceAfter1 = new BN(await I_PolyToken.balanceOf(account_investor1)); + let investor2BalanceAfter1 = new BN(await I_PolyToken.balanceOf(account_investor2)); + let investor3BalanceAfter1 = new BN(await I_PolyToken.balanceOf(account_investor3)); + let tempBalanceAfter1 = new BN(await web3.eth.getBalance(account_temp)); assert.equal(investor1BalanceAfter1.sub(investor1Balance).toNumber(), 0); - assert.equal(investor2BalanceAfter1.sub(investor2Balance).toNumber(), web3.utils.toWei("1.8", "ether")); + assert.equal(investor2BalanceAfter1.sub(investor2Balance).toString(), new BN(web3.utils.toWei("1.8", "ether")).toString()); assert.equal(investor3BalanceAfter1.sub(investor3Balance).toNumber(), 0); assert.equal(tempBalanceAfter1.sub(tempBalance).toNumber(), 0); }); it("Should issuer pushes temp investor - investor1 excluded", async () => { - let investor1BalanceAfter1 = new BigNumber(await I_PolyToken.balanceOf(account_investor1)); - let investor2BalanceAfter1 = new BigNumber(await I_PolyToken.balanceOf(account_investor2)); - let investor3BalanceAfter1 = new BigNumber(await I_PolyToken.balanceOf(account_investor3)); - let tempBalanceAfter1 = new BigNumber(await I_PolyToken.balanceOf(account_temp)); + let investor1BalanceAfter1 = new BN(await I_PolyToken.balanceOf(account_investor1)); + let investor2BalanceAfter1 = new BN(await I_PolyToken.balanceOf(account_investor2)); + let investor3BalanceAfter1 = new BN(await I_PolyToken.balanceOf(account_investor3)); + let tempBalanceAfter1 = new BN(await I_PolyToken.balanceOf(account_temp)); await I_ERC20DividendCheckpoint.pushDividendPaymentToAddresses(3, [account_temp, account_investor1], { from: token_owner }); - let investor1BalanceAfter2 = new BigNumber(await I_PolyToken.balanceOf(account_investor1)); - let investor2BalanceAfter2 = new BigNumber(await I_PolyToken.balanceOf(account_investor2)); - let investor3BalanceAfter2 = new BigNumber(await I_PolyToken.balanceOf(account_investor3)); - let tempBalanceAfter2 = new BigNumber(await I_PolyToken.balanceOf(account_temp)); + let investor1BalanceAfter2 = new BN(await I_PolyToken.balanceOf(account_investor1)); + let investor2BalanceAfter2 = new BN(await I_PolyToken.balanceOf(account_investor2)); + let investor3BalanceAfter2 = new BN(await I_PolyToken.balanceOf(account_investor3)); + let tempBalanceAfter2 = new BN(await I_PolyToken.balanceOf(account_temp)); assert.equal(investor1BalanceAfter2.sub(investor1BalanceAfter1).toNumber(), 0); assert.equal(investor2BalanceAfter2.sub(investor2BalanceAfter1).toNumber(), 0); assert.equal(investor3BalanceAfter2.sub(investor3BalanceAfter1).toNumber(), 0); - assert.equal(tempBalanceAfter2.sub(tempBalanceAfter1).toNumber(), web3.utils.toWei("0.8", "ether")); + assert.equal(tempBalanceAfter2.sub(tempBalanceAfter1).toString(), new BN(web3.utils.toWei("0.8", "ether")).toString()); //Check fully claimed - assert.equal((await I_ERC20DividendCheckpoint.dividends(3))[5].toNumber(), web3.utils.toWei("3", "ether")); + assert.equal((await I_ERC20DividendCheckpoint.dividends(3))[5].toString(), new BN(web3.utils.toWei("3", "ether")).toString()); }); it("should calculate dividend after the push dividend payment", async () => { @@ -825,10 +825,10 @@ contract("ERC20DividendCheckpoint", accounts => { }); it("Issuer reclaims withholding tax", async () => { - let issuerBalance = new BigNumber(await I_PolyToken.balanceOf(token_owner)); + let issuerBalance = new BN(await I_PolyToken.balanceOf(token_owner)); await I_ERC20DividendCheckpoint.withdrawWithholding(3, { from: token_owner, gasPrice: 0 }); - let issuerBalanceAfter = new BigNumber(await I_PolyToken.balanceOf(token_owner)); - assert.equal(issuerBalanceAfter.sub(issuerBalance).toNumber(), web3.utils.toWei("0.4", "ether")); + let issuerBalanceAfter = new BN(await I_PolyToken.balanceOf(token_owner)); + assert.equal(issuerBalanceAfter.sub(issuerBalance).toString(), new BN(web3.utils.toWei("0.4", "ether")).toString()); }); it("Issuer unable to reclaim dividend (expiry not passed)", async () => { @@ -845,10 +845,10 @@ contract("ERC20DividendCheckpoint", accounts => { }); it("Issuer is able to reclaim dividend after expiry", async () => { - let tokenOwnerBalance = new BigNumber(await I_PolyToken.balanceOf(token_owner)); + let tokenOwnerBalance = new BN(await I_PolyToken.balanceOf(token_owner)); await I_ERC20DividendCheckpoint.reclaimDividend(3, { from: token_owner, gasPrice: 0 }); - let tokenOwnerAfter = new BigNumber(await I_PolyToken.balanceOf(token_owner)); - assert.equal(tokenOwnerAfter.sub(tokenOwnerBalance).toNumber(), web3.utils.toWei("7", "ether")); + let tokenOwnerAfter = new BN(await I_PolyToken.balanceOf(token_owner)); + assert.equal(tokenOwnerAfter.sub(tokenOwnerBalance).toString(), new BN(web3.utils.toWei("7", "ether")).toString()); }); it("Issuer is unable to reclaim already reclaimed dividend", async () => { @@ -881,7 +881,7 @@ contract("ERC20DividendCheckpoint", accounts => { it("should registr a delegate", async () => { [I_GeneralPermissionManagerFactory] = await deployGPMAndVerifyed(account_polymath, I_MRProxied, 0); - let tx = await I_SecurityToken.addModule(I_GeneralPermissionManagerFactory.address, "0x", 0, 0, { from: token_owner }); + let tx = await I_SecurityToken.addModule(I_GeneralPermissionManagerFactory.address, "0x", new BN(0), new BN(0), { from: token_owner }); assert.equal(tx.logs[2].args._types[0].toNumber(), delegateManagerKey, "General Permission Manager doesn't get deployed"); assert.equal( web3.utils.toAscii(tx.logs[2].args._name).replace(/\u0000/g, ""), @@ -889,78 +889,73 @@ contract("ERC20DividendCheckpoint", accounts => { "GeneralPermissionManagerFactory module was not added" ); I_GeneralPermissionManager = await GeneralPermissionManager.at(tx.logs[2].args._module); - tx = await I_GeneralPermissionManager.addDelegate(account_manager, managerDetails, { from: token_owner}); + tx = await I_GeneralPermissionManager.addDelegate(account_manager, managerDetails, { from: token_owner }); assert.equal(tx.logs[0].args._delegate, account_manager); }); it("should not allow manager without permission to set default excluded", async () => { - await catchRevert(I_ERC20DividendCheckpoint.setDefaultExcluded( - [0], - { from: account_manager } - )); + await catchRevert(I_ERC20DividendCheckpoint.setDefaultExcluded([address_zero], { from: account_manager })); }); it("should not allow manager without permission to set withholding", async () => { - await catchRevert(I_ERC20DividendCheckpoint.setWithholding( - [0], - [0], - { from: account_manager } - )); + await catchRevert(I_ERC20DividendCheckpoint.setWithholding([address_zero], [new BN(0)], { from: account_manager })); }); it("should not allow manager without permission to set withholding fixed", async () => { - await catchRevert(I_ERC20DividendCheckpoint.setWithholdingFixed( - [0], - 0, - { from: account_manager } - )); + await catchRevert(I_ERC20DividendCheckpoint.setWithholdingFixed([address_zero], new BN(0), { from: account_manager })); }); it("should not allow manager without permission to create dividend", async () => { - await I_PolyToken.transfer(account_manager, web3.utils.toWei("100", "ether"), { from: token_owner }); - await I_PolyToken.approve(I_ERC20DividendCheckpoint.address, web3.utils.toWei("100", "ether"), { from: account_manager }); - let maturity = latestTime() + duration.days(1); - let expiry = latestTime() + duration.days(10); + await I_PolyToken.transfer(account_manager, new BN(web3.utils.toWei("100", "ether")), { from: token_owner }); + await I_PolyToken.approve(I_ERC20DividendCheckpoint.address, new BN(web3.utils.toWei("100", "ether")), { from: account_manager }); + let maturity = await latestTime() + duration.days(1); + let expiry = await latestTime() + duration.days(10); - await catchRevert(I_ERC20DividendCheckpoint.createDividend( - maturity, - expiry, - I_PolyToken.address, - web3.utils.toWei("1.5", "ether"), - dividendName, - { from: account_manager } - )); + await catchRevert( + I_ERC20DividendCheckpoint.createDividend( + maturity, + expiry, + I_PolyToken.address, + new BN(web3.utils.toWei("1.5", "ether")), + dividendName, + { from: account_manager } + ) + ); }); it("should not allow manager without permission to create dividend with checkpoint", async () => { - let maturity = latestTime() + duration.days(1); - let expiry = latestTime() + duration.days(10); + let maturity = await latestTime() + duration.days(1); + let expiry = await latestTime() + duration.days(10); let checkpointID = await I_SecurityToken.createCheckpoint.call({ from: token_owner }); await I_SecurityToken.createCheckpoint({ from: token_owner }); - await catchRevert(I_ERC20DividendCheckpoint.createDividendWithCheckpoint( - maturity, - expiry, - I_PolyToken.address, - web3.utils.toWei("1.5", "ether"), - checkpointID.toNumber(), - dividendName, - { from: account_manager } - )); + await catchRevert( + I_ERC20DividendCheckpoint.createDividendWithCheckpoint( + maturity, + expiry, + I_PolyToken.address, + new BN(web3.utils.toWei("1.5", "ether")), + checkpointID.toNumber(), + dividendName, + { from: account_manager } + ) + ); }); it("should not allow manager without permission to create dividend with exclusion", async () => { - let maturity = latestTime() + duration.days(1); - let expiry = latestTime() + duration.days(10); - let exclusions = [1]; - await catchRevert(I_ERC20DividendCheckpoint.createDividendWithExclusions( - maturity, - expiry, - I_PolyToken.address, - web3.utils.toWei("1.5", "ether"), - exclusions, - dividendName, - { from: account_manager } - )); + let maturity = await latestTime() + duration.days(1); + let expiry = await latestTime() + duration.days(10); + let exclusions = [one_address]; + await catchRevert( + I_ERC20DividendCheckpoint.createDividendWithExclusions( + maturity, + expiry, + I_PolyToken.address, + new BN(web3.utils.toWei("1.5", "ether")), + exclusions, + dividendName, + { from: account_manager } + ) + ); }); it("should not allow manager without permission to create checkpoint", async () => { @@ -968,76 +963,59 @@ contract("ERC20DividendCheckpoint", accounts => { }); it("should not allow manager without permission to create dividend with checkpoint and exclusion", async () => { - let maturity = latestTime() + duration.days(1); - let expiry = latestTime() + duration.days(10); - let exclusions = [1]; + let maturity = await latestTime() + duration.days(1); + let expiry = await latestTime() + duration.days(10); + let exclusions = [one_address]; let checkpointID = await I_SecurityToken.createCheckpoint.call({ from: token_owner }); await I_SecurityToken.createCheckpoint({ from: token_owner }); - await catchRevert(I_ERC20DividendCheckpoint.createDividendWithCheckpointAndExclusions( - maturity, - expiry, - I_PolyToken.address, - web3.utils.toWei("1.5", "ether"), - checkpointID.toNumber(), - exclusions, - dividendName, - { from: account_manager } - )); + await catchRevert( + I_ERC20DividendCheckpoint.createDividendWithCheckpointAndExclusions( + maturity, + expiry, + I_PolyToken.address, + new BN(web3.utils.toWei("1.5", "ether")), + checkpointID.toNumber(), + exclusions, + dividendName, + { from: account_manager } + ) + ); }); it("should give permission to manager", async () => { - await I_GeneralPermissionManager.changePermission( - account_manager, - I_ERC20DividendCheckpoint.address, - "CHECKPOINT", - true, - { from: token_owner } - ); - let tx = await I_GeneralPermissionManager.changePermission( - account_manager, - I_ERC20DividendCheckpoint.address, - "MANAGE", - true, - { from: token_owner } - ); + await I_GeneralPermissionManager.changePermission(account_manager, I_ERC20DividendCheckpoint.address, web3.utils.fromAscii("CHECKPOINT"), true, { + from: token_owner + }); + let tx = await I_GeneralPermissionManager.changePermission(account_manager, I_ERC20DividendCheckpoint.address, web3.utils.fromAscii("MANAGE"), true, { + from: token_owner + }); assert.equal(tx.logs[0].args._delegate, account_manager); }); it("should allow manager with permission to set default excluded", async () => { - let tx = await I_ERC20DividendCheckpoint.setDefaultExcluded( - [1], - { from: account_manager } - ); + let tx = await I_ERC20DividendCheckpoint.setDefaultExcluded([one_address], { from: account_manager }); assert.equal(tx.logs[0].args._excluded[0], one_address); }); it("should allow manager with permission to set withholding", async () => { - let tx = await I_ERC20DividendCheckpoint.setWithholding( - [0], - [0], - { from: account_manager } - ); + let tx = await I_ERC20DividendCheckpoint.setWithholding([one_address], [new BN(0)], { from: account_manager }); assert.equal(tx.logs[0].args._withholding[0], 0); }); it("should allow manager withpermission to set withholding fixed", async () => { - let tx = await I_ERC20DividendCheckpoint.setWithholdingFixed( - [0], - 0, - { from: account_manager } - ); + let tx = await I_ERC20DividendCheckpoint.setWithholdingFixed([one_address], new BN(0), { from: account_manager }); assert.equal(tx.logs[0].args._withholding, 0); }); it("should allow manager with permission to create dividend", async () => { - let maturity = latestTime() + duration.days(1); - let expiry = latestTime() + duration.days(10); + let maturity = await latestTime() + duration.days(1); + let expiry = await latestTime() + duration.days(10); let tx = await I_ERC20DividendCheckpoint.createDividend( maturity, expiry, I_PolyToken.address, - web3.utils.toWei("1.5", "ether"), + new BN(web3.utils.toWei("1.5", "ether")), dividendName, { from: account_manager } ); @@ -1045,15 +1023,15 @@ contract("ERC20DividendCheckpoint", accounts => { }); it("should allow manager with permission to create dividend with checkpoint", async () => { - let maturity = latestTime() + duration.days(1); - let expiry = latestTime() + duration.days(10); + let maturity = await latestTime() + duration.days(1); + let expiry = await latestTime() + duration.days(10); let checkpointID = await I_SecurityToken.createCheckpoint.call({ from: token_owner }); await I_SecurityToken.createCheckpoint({ from: token_owner }); let tx = await I_ERC20DividendCheckpoint.createDividendWithCheckpoint( maturity, expiry, I_PolyToken.address, - web3.utils.toWei("1.5", "ether"), + new BN(web3.utils.toWei("1.5", "ether")), checkpointID.toNumber(), dividendName, { from: account_manager } @@ -1062,14 +1040,14 @@ contract("ERC20DividendCheckpoint", accounts => { }); it("should allow manager with permission to create dividend with exclusion", async () => { - let maturity = latestTime() + duration.days(1); - let expiry = latestTime() + duration.days(10); - let exclusions = [1]; + let maturity = await latestTime() + duration.days(1); + let expiry = await latestTime() + duration.days(10); + let exclusions = [one_address]; let tx = await I_ERC20DividendCheckpoint.createDividendWithExclusions( maturity, expiry, I_PolyToken.address, - web3.utils.toWei("1.5", "ether"), + new BN(web3.utils.toWei("1.5", "ether")), exclusions, dividendName, { from: account_manager } @@ -1078,16 +1056,16 @@ contract("ERC20DividendCheckpoint", accounts => { }); it("should allow manager with permission to create dividend with checkpoint and exclusion", async () => { - let maturity = latestTime() + duration.days(1); - let expiry = latestTime() + duration.days(10); - let exclusions = [1]; + let maturity = await latestTime() + duration.days(1); + let expiry = await latestTime() + duration.days(10); + let exclusions = [one_address]; let checkpointID = await I_SecurityToken.createCheckpoint.call({ from: token_owner }); await I_SecurityToken.createCheckpoint({ from: token_owner }); let tx = await I_ERC20DividendCheckpoint.createDividendWithCheckpointAndExclusions( maturity, expiry, I_PolyToken.address, - web3.utils.toWei("1.5", "ether"), + new BN(web3.utils.toWei("1.5", "ether")), checkpointID.toNumber(), exclusions, dividendName, diff --git a/test/f_ether_dividends.js b/test/f_ether_dividends.js index 25bacb792..8d9582283 100644 --- a/test/f_ether_dividends.js +++ b/test/f_ether_dividends.js @@ -11,10 +11,10 @@ const EtherDividendCheckpoint = artifacts.require("./EtherDividendCheckpoint"); const GeneralPermissionManager = artifacts.require("GeneralPermissionManager"); const Web3 = require("web3"); -const BigNumber = require("bignumber.js"); +let BN = Web3.utils.BN; const web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545")); // Hardcoded development port -contract("EtherDividendCheckpoint", accounts => { +contract("EtherDividendCheckpoint", async (accounts) => { // Accounts Variable declaration let account_polymath; let account_issuer; @@ -26,13 +26,10 @@ contract("EtherDividendCheckpoint", accounts => { let account_manager; let account_temp; - // investor Details - let fromTime = latestTime(); - let toTime = latestTime(); - let expiryTime = toTime + duration.days(15); - let message = "Transaction Should Fail!"; let dividendName = "0x546573744469766964656e640000000000000000000000000000000000000000"; + const address_zero = "0x0000000000000000000000000000000000000000"; + const one_address = "0x0000000000000000000000000000000000000001"; // Contract Instance Declaration let I_SecurityTokenRegistryProxy; @@ -62,7 +59,7 @@ contract("EtherDividendCheckpoint", accounts => { const tokenDetails = "This is equity type of issuance"; const decimals = 18; const contact = "team@polymath.network"; - const managerDetails = "Hello, I am a legit manager"; + const managerDetails = web3.utils.fromAscii("Hello"); let snapId; // Module key const delegateManagerKey = 1; @@ -71,10 +68,12 @@ contract("EtherDividendCheckpoint", accounts => { const checkpointKey = 4; // Initial fee for ticker registry and security token registry - const initRegFee = web3.utils.toWei("250"); + const initRegFee = new BN(web3.utils.toWei("250")); + + let currentTime; before(async () => { - // Accounts setup + currentTime = new BN(await latestTime()); account_polymath = accounts[0]; account_issuer = accounts[1]; @@ -136,15 +135,15 @@ contract("EtherDividendCheckpoint", accounts => { it("Should generate the new security token with the same symbol as registered above", async () => { await I_PolyToken.approve(I_STRProxied.address, initRegFee, { from: token_owner }); - let _blockNo = latestBlock(); + let tx = await I_STRProxied.generateSecurityToken(name, symbol, tokenDetails, false, { from: token_owner }); // Verify the successful generation of the security token assert.equal(tx.logs[2].args._ticker, symbol.toUpperCase(), "SecurityToken doesn't get deployed"); - I_SecurityToken = SecurityToken.at(tx.logs[2].args._securityTokenAddress); + I_SecurityToken = await SecurityToken.at(tx.logs[2].args._securityTokenAddress); - const log = await promisifyLogWatch(I_SecurityToken.ModuleAdded({ from: _blockNo }), 1); + const log = (await I_SecurityToken.getPastEvents('ModuleAdded', {filter: {transactionHash: tx.transactionHash}}))[0]; // Verify that GeneralTransferManager module get added successfully or not assert.equal(log.args._types[0].toNumber(), 2); @@ -153,13 +152,13 @@ contract("EtherDividendCheckpoint", accounts => { it("Should intialize the auto attached modules", async () => { let moduleData = (await I_SecurityToken.getModulesByType(2))[0]; - I_GeneralTransferManager = GeneralTransferManager.at(moduleData); + I_GeneralTransferManager = await GeneralTransferManager.at(moduleData); }); it("Should successfully attach the ERC20DividendCheckpoint with the security token", async () => { - await I_PolyToken.getTokens(web3.utils.toWei("500", "ether"), token_owner); + await I_PolyToken.getTokens(new BN(web3.utils.toWei("500", "ether")), token_owner); await catchRevert( - I_SecurityToken.addModule(P_EtherDividendCheckpointFactory.address, "", web3.utils.toWei("500", "ether"), 0, { + I_SecurityToken.addModule(P_EtherDividendCheckpointFactory.address, "0x0", new BN(web3.utils.toWei("500", "ether")), new BN(0), { from: token_owner }) ); @@ -167,8 +166,8 @@ contract("EtherDividendCheckpoint", accounts => { it("Should successfully attach the EtherDividendCheckpoint with the security token", async () => { let snapId = await takeSnapshot(); - await I_PolyToken.transfer(I_SecurityToken.address, web3.utils.toWei("500", "ether"), { from: token_owner }); - const tx = await I_SecurityToken.addModule(P_EtherDividendCheckpointFactory.address, "", web3.utils.toWei("500", "ether"), 0, { + await I_PolyToken.transfer(I_SecurityToken.address, new BN(web3.utils.toWei("500", "ether")), { from: token_owner }); + const tx = await I_SecurityToken.addModule(P_EtherDividendCheckpointFactory.address, "0x0", new BN(web3.utils.toWei("500", "ether")), new BN(0), { from: token_owner }); assert.equal(tx.logs[3].args._types[0].toNumber(), checkpointKey, "EtherDividendCheckpoint doesn't get deployed"); @@ -177,19 +176,19 @@ contract("EtherDividendCheckpoint", accounts => { "EtherDividendCheckpoint", "EtherDividendCheckpoint module was not added" ); - P_EtherDividendCheckpoint = EtherDividendCheckpoint.at(tx.logs[3].args._module); + P_EtherDividendCheckpoint = await EtherDividendCheckpoint.at(tx.logs[3].args._module); await revertToSnapshot(snapId); }); it("Should successfully attach the EtherDividendCheckpoint with the security token", async () => { - const tx = await I_SecurityToken.addModule(I_EtherDividendCheckpointFactory.address, "", 0, 0, { from: token_owner }); + const tx = await I_SecurityToken.addModule(I_EtherDividendCheckpointFactory.address, "0x0", new BN(0), new BN(0), { from: token_owner }); assert.equal(tx.logs[2].args._types[0].toNumber(), checkpointKey, "EtherDividendCheckpoint doesn't get deployed"); assert.equal( web3.utils.toAscii(tx.logs[2].args._name).replace(/\u0000/g, ""), "EtherDividendCheckpoint", "EtherDividendCheckpoint module was not added" ); - I_EtherDividendCheckpoint = EtherDividendCheckpoint.at(tx.logs[2].args._module); + I_EtherDividendCheckpoint = await EtherDividendCheckpoint.at(tx.logs[2].args._module); }); }); @@ -199,9 +198,9 @@ contract("EtherDividendCheckpoint", accounts => { let tx = await I_GeneralTransferManager.modifyWhitelist( account_investor1, - latestTime(), - latestTime(), - latestTime() + duration.days(30), + currentTime, + currentTime, + currentTime.add(new BN(duration.days(300000))), true, { from: account_issuer, @@ -219,9 +218,9 @@ contract("EtherDividendCheckpoint", accounts => { await increaseTime(5000); // Mint some tokens - await I_SecurityToken.mint(account_investor1, web3.utils.toWei("1", "ether"), { from: token_owner }); + await I_SecurityToken.mint(account_investor1, new BN(web3.utils.toWei("1", "ether")), { from: token_owner }); - assert.equal((await I_SecurityToken.balanceOf(account_investor1)).toNumber(), web3.utils.toWei("1", "ether")); + assert.equal((await I_SecurityToken.balanceOf(account_investor1)).toString(), new BN(web3.utils.toWei("1", "ether")).toString()); }); it("Buy some tokens for account_investor2 (2 ETH)", async () => { @@ -229,9 +228,9 @@ contract("EtherDividendCheckpoint", accounts => { let tx = await I_GeneralTransferManager.modifyWhitelist( account_investor2, - latestTime(), - latestTime(), - latestTime() + duration.days(30), + currentTime, + currentTime, + currentTime.add(new BN(duration.days(3000000))), true, { from: account_issuer, @@ -246,95 +245,95 @@ contract("EtherDividendCheckpoint", accounts => { ); // Mint some tokens - await I_SecurityToken.mint(account_investor2, web3.utils.toWei("2", "ether"), { from: token_owner }); + await I_SecurityToken.mint(account_investor2, new BN(web3.utils.toWei("2", "ether")), { from: token_owner }); - assert.equal((await I_SecurityToken.balanceOf(account_investor2)).toNumber(), web3.utils.toWei("2", "ether")); + assert.equal((await I_SecurityToken.balanceOf(account_investor2)).toString(), new BN(web3.utils.toWei("2", "ether")).toString()); }); it("Should fail in creating the dividend", async () => { - let maturity = latestTime(); - let expiry = latestTime() + duration.days(10); + let maturity = await latestTime(); + let expiry = await latestTime() + duration.days(10); await catchRevert(I_EtherDividendCheckpoint.createDividend(maturity, expiry, dividendName, { from: token_owner })); }); it("Should fail in creating the dividend", async () => { - let maturity = latestTime(); - let expiry = latestTime() - duration.days(10); + let maturity = await latestTime(); + let expiry = await latestTime() - duration.days(10); await catchRevert( I_EtherDividendCheckpoint.createDividend(maturity, expiry, dividendName, { from: token_owner, - value: web3.utils.toWei("1.5", "ether") + value: new BN(web3.utils.toWei("1.5", "ether")) }) ); }); it("Should fail in creating the dividend", async () => { - let maturity = latestTime() - duration.days(2); - let expiry = latestTime() - duration.days(1); + let maturity = await latestTime() - duration.days(2); + let expiry = await latestTime() - duration.days(1); await catchRevert( I_EtherDividendCheckpoint.createDividend(maturity, expiry, dividendName, { from: token_owner, - value: web3.utils.toWei("1.5", "ether") + value: new BN(web3.utils.toWei("1.5", "ether")) }) ); }); it("Set withholding tax of 20% on investor 2", async () => { - await I_EtherDividendCheckpoint.setWithholdingFixed([account_investor2], BigNumber(20 * 10 ** 16), { from: token_owner }); + await I_EtherDividendCheckpoint.setWithholdingFixed([account_investor2], new BN(web3.utils.toWei("0.2", "ether")), { from: token_owner }); }); it("Should fail in creating the dividend", async () => { - let maturity = latestTime() + duration.days(1); - let expiry = latestTime() + duration.days(10); + let maturity = await latestTime() + duration.days(1); + let expiry = await latestTime() + duration.days(10); await catchRevert( - I_EtherDividendCheckpoint.createDividend(maturity, expiry, "", { + I_EtherDividendCheckpoint.createDividend(maturity, expiry, "0x0", { from: token_owner, - value: web3.utils.toWei("1.5", "ether") + value: new BN(web3.utils.toWei("1.5", "ether")) }) ); }); it("Create new dividend", async () => { - let maturity = latestTime() + duration.days(1); - let expiry = latestTime() + duration.days(10); + let maturity = await latestTime() + duration.days(1); + let expiry = await latestTime() + duration.days(10); let tx = await I_EtherDividendCheckpoint.createDividend(maturity, expiry, dividendName, { from: token_owner, - value: web3.utils.toWei("1.5", "ether") + value: new BN(web3.utils.toWei("1.5", "ether")) }); assert.equal(tx.logs[0].args._checkpointId.toNumber(), 1, "Dividend should be created at checkpoint 1"); assert.equal(tx.logs[0].args._name.toString(), dividendName, "Dividend name incorrect in event"); }); it("Investor 1 transfers his token balance to investor 2", async () => { - await I_SecurityToken.transfer(account_investor2, web3.utils.toWei("1", "ether"), { from: account_investor1 }); + await I_SecurityToken.transfer(account_investor2, new BN(web3.utils.toWei("1", "ether")), { from: account_investor1 }); assert.equal(await I_SecurityToken.balanceOf(account_investor1), 0); - assert.equal(await I_SecurityToken.balanceOf(account_investor2), web3.utils.toWei("3", "ether")); + assert.equal((await I_SecurityToken.balanceOf(account_investor2)).toString(), new BN(web3.utils.toWei("3", "ether")).toString()); }); it("Issuer pushes dividends iterating over account holders - dividends proportional to checkpoint", async () => { - await catchRevert(I_EtherDividendCheckpoint.pushDividendPayment(0, 0, 10, { from: token_owner })); + await catchRevert(I_EtherDividendCheckpoint.pushDividendPayment(0, new BN(0), 10, { from: token_owner })); }); it("Issuer pushes dividends iterating over account holders - dividends proportional to checkpoint", async () => { // Increase time by 2 day await increaseTime(duration.days(2)); - await catchRevert(I_EtherDividendCheckpoint.pushDividendPayment(0, 0, 10, { from: account_temp })); + await catchRevert(I_EtherDividendCheckpoint.pushDividendPayment(0, new BN(0), 10, { from: account_temp })); }); it("Issuer pushes dividends iterating over account holders - dividends proportional to checkpoint", async () => { - await catchRevert(I_EtherDividendCheckpoint.pushDividendPayment(2, 0, 10, { from: token_owner })); + await catchRevert(I_EtherDividendCheckpoint.pushDividendPayment(2, new BN(0), 10, { from: token_owner })); }); it("Issuer pushes dividends iterating over account holders - dividends proportional to checkpoint", async () => { - let investor1Balance = new BigNumber(await web3.eth.getBalance(account_investor1)); - let investor2Balance = new BigNumber(await web3.eth.getBalance(account_investor2)); - await I_EtherDividendCheckpoint.pushDividendPayment(0, 0, 10, { from: token_owner }); - let investor1BalanceAfter = new BigNumber(await web3.eth.getBalance(account_investor1)); - let investor2BalanceAfter = new BigNumber(await web3.eth.getBalance(account_investor2)); - assert.equal(investor1BalanceAfter.sub(investor1Balance).toNumber(), web3.utils.toWei("0.5", "ether")); - assert.equal(investor2BalanceAfter.sub(investor2Balance).toNumber(), web3.utils.toWei("0.8", "ether")); + let investor1Balance = new BN(await web3.eth.getBalance(account_investor1)); + let investor2Balance = new BN(await web3.eth.getBalance(account_investor2)); + await I_EtherDividendCheckpoint.pushDividendPayment(0, new BN(0), 10, { from: token_owner }); + let investor1BalanceAfter = new BN(await web3.eth.getBalance(account_investor1)); + let investor2BalanceAfter = new BN(await web3.eth.getBalance(account_investor2)); + assert.equal(investor1BalanceAfter.sub(investor1Balance).toString(), new BN(web3.utils.toWei("0.5", "ether")).toString()); + assert.equal(investor2BalanceAfter.sub(investor2Balance).toString(), new BN(web3.utils.toWei("0.8", "ether")).toString()); //Check fully claimed - assert.equal((await I_EtherDividendCheckpoint.dividends(0))[5].toNumber(), web3.utils.toWei("1.5", "ether")); + assert.equal((await I_EtherDividendCheckpoint.dividends(0))[5].toString(), new BN(web3.utils.toWei("1.5", "ether")).toString()); }); it("Should not allow reclaiming withholding tax with incorrect index", async () => { @@ -345,17 +344,17 @@ contract("EtherDividendCheckpoint", accounts => { }); it("Issuer reclaims withholding tax", async () => { - let issuerBalance = new BigNumber(await web3.eth.getBalance(token_owner)); + let issuerBalance = new BN(await web3.eth.getBalance(token_owner)); await I_EtherDividendCheckpoint.withdrawWithholding(0, { from: token_owner, gasPrice: 0 }); - let issuerBalanceAfter = new BigNumber(await web3.eth.getBalance(token_owner)); - assert.equal(issuerBalanceAfter.sub(issuerBalance).toNumber(), web3.utils.toWei("0.2", "ether")); + let issuerBalanceAfter = new BN(await web3.eth.getBalance(token_owner)); + assert.equal(issuerBalanceAfter.sub(issuerBalance).toString(), new BN(web3.utils.toWei("0.2", "ether")).toString()); }); it("No more withholding tax to withdraw", async () => { - let issuerBalance = new BigNumber(await web3.eth.getBalance(token_owner)); + let issuerBalance = new BN(await web3.eth.getBalance(token_owner)); await I_EtherDividendCheckpoint.withdrawWithholding(0, { from: token_owner, gasPrice: 0 }); - let issuerBalanceAfter = new BigNumber(await web3.eth.getBalance(token_owner)); - assert.equal(issuerBalanceAfter.sub(issuerBalance).toNumber(), web3.utils.toWei("0", "ether")); + let issuerBalanceAfter = new BN(await web3.eth.getBalance(token_owner)); + assert.equal(issuerBalanceAfter.sub(issuerBalance).toString(), new BN(web3.utils.toWei("0", "ether")).toString()); }); it("Buy some tokens for account_temp (1 ETH)", async () => { @@ -363,9 +362,9 @@ contract("EtherDividendCheckpoint", accounts => { let tx = await I_GeneralTransferManager.modifyWhitelist( account_temp, - latestTime(), - latestTime(), - latestTime() + duration.days(20), + currentTime, + currentTime, + currentTime.add(new BN(duration.days(200000))), true, { from: account_issuer, @@ -376,37 +375,37 @@ contract("EtherDividendCheckpoint", accounts => { assert.equal(tx.logs[0].args._investor.toLowerCase(), account_temp.toLowerCase(), "Failed in adding the investor in whitelist"); // Mint some tokens - await I_SecurityToken.mint(account_temp, web3.utils.toWei("1", "ether"), { from: token_owner }); + await I_SecurityToken.mint(account_temp, new BN(web3.utils.toWei("1", "ether")), { from: token_owner }); - assert.equal((await I_SecurityToken.balanceOf(account_temp)).toNumber(), web3.utils.toWei("1", "ether")); + assert.equal((await I_SecurityToken.balanceOf(account_temp)).toString(), new BN(web3.utils.toWei("1", "ether")).toString()); }); it("Create new dividend", async () => { - let maturity = latestTime() + duration.days(1); - let expiry = latestTime() + duration.days(10); + let maturity = await latestTime() + duration.days(1); + let expiry = await latestTime() + duration.days(10); let tx = await I_EtherDividendCheckpoint.createDividend(maturity, expiry, dividendName, { from: token_owner, - value: web3.utils.toWei("1.5", "ether") + value: new BN(web3.utils.toWei("1.5", "ether")) }); assert.equal(tx.logs[0].args._checkpointId.toNumber(), 2, "Dividend should be created at checkpoint 2"); }); it("Issuer pushes dividends fails due to passed expiry", async () => { await increaseTime(duration.days(12)); - await catchRevert(I_EtherDividendCheckpoint.pushDividendPayment(0, 0, 10, { from: token_owner })); + await catchRevert(I_EtherDividendCheckpoint.pushDividendPayment(0, new BN(0), 10, { from: token_owner })); }); it("Issuer reclaims dividend", async () => { let tx = await I_EtherDividendCheckpoint.reclaimDividend(1, { from: token_owner, gas: 500000 }); - assert.equal(tx.logs[0].args._claimedAmount.toNumber(), web3.utils.toWei("1.5", "ether")); + assert.equal(tx.logs[0].args._claimedAmount.toString(), new BN(web3.utils.toWei("1.5", "ether")).toString()); await catchRevert(I_EtherDividendCheckpoint.reclaimDividend(1, { from: token_owner, gas: 500000 })); }); it("Still no more withholding tax to withdraw", async () => { - let issuerBalance = new BigNumber(await web3.eth.getBalance(token_owner)); + let issuerBalance = new BN(await web3.eth.getBalance(token_owner)); await I_EtherDividendCheckpoint.withdrawWithholding(0, { from: token_owner, gasPrice: 0 }); - let issuerBalanceAfter = new BigNumber(await web3.eth.getBalance(token_owner)); - assert.equal(issuerBalanceAfter.sub(issuerBalance).toNumber(), web3.utils.toWei("0", "ether")); + let issuerBalanceAfter = new BN(await web3.eth.getBalance(token_owner)); + assert.equal(issuerBalanceAfter.sub(issuerBalance).toString(), new BN(web3.utils.toWei("0", "ether")).toString()); }); it("Buy some tokens for account_investor3 (7 ETH)", async () => { @@ -414,9 +413,9 @@ contract("EtherDividendCheckpoint", accounts => { let tx = await I_GeneralTransferManager.modifyWhitelist( account_investor3, - latestTime(), - latestTime(), - latestTime() + duration.days(10), + currentTime, + currentTime, + currentTime.add(new BN(duration.days(10000))), true, { from: account_issuer, @@ -431,46 +430,46 @@ contract("EtherDividendCheckpoint", accounts => { ); // Mint some tokens - await I_SecurityToken.mint(account_investor3, web3.utils.toWei("7", "ether"), { from: token_owner }); + await I_SecurityToken.mint(account_investor3, new BN(web3.utils.toWei("7", "ether")), { from: token_owner }); - assert.equal((await I_SecurityToken.balanceOf(account_investor3)).toNumber(), web3.utils.toWei("7", "ether")); + assert.equal((await I_SecurityToken.balanceOf(account_investor3)).toString(), new BN(web3.utils.toWei("7", "ether")).toString()); }); it("Create another new dividend", async () => { - let maturity = latestTime(); - let expiry = latestTime() + duration.days(10); + let maturity = await latestTime(); + let expiry = await latestTime() + duration.days(10); let tx = await I_EtherDividendCheckpoint.createDividend(maturity, expiry, dividendName, { from: token_owner, - value: web3.utils.toWei("11", "ether") + value: new BN(web3.utils.toWei("11", "ether")) }); assert.equal(tx.logs[0].args._checkpointId.toNumber(), 3, "Dividend should be created at checkpoint 3"); }); it("should investor 3 claims dividend - fails bad index", async () => { - let investor1Balance = new BigNumber(await I_PolyToken.balanceOf(account_investor1)); - let investor2Balance = new BigNumber(await I_PolyToken.balanceOf(account_investor2)); - let investor3Balance = new BigNumber(await I_PolyToken.balanceOf(account_investor3)); + let investor1Balance = new BN(await I_PolyToken.balanceOf(account_investor1)); + let investor2Balance = new BN(await I_PolyToken.balanceOf(account_investor2)); + let investor3Balance = new BN(await I_PolyToken.balanceOf(account_investor3)); await catchRevert(I_EtherDividendCheckpoint.pullDividendPayment(5, { from: account_investor3, gasPrice: 0 })); }); it("Should investor 3 claims dividend", async () => { - let investor1Balance = new BigNumber(await web3.eth.getBalance(account_investor1)); - let investor2Balance = new BigNumber(await web3.eth.getBalance(account_investor2)); - let investor3Balance = new BigNumber(await web3.eth.getBalance(account_investor3)); + let investor1Balance = new BN(await web3.eth.getBalance(account_investor1)); + let investor2Balance = new BN(await web3.eth.getBalance(account_investor2)); + let investor3Balance = new BN(await web3.eth.getBalance(account_investor3)); await I_EtherDividendCheckpoint.pullDividendPayment(2, { from: account_investor3, gasPrice: 0 }); - let investor1BalanceAfter1 = new BigNumber(await web3.eth.getBalance(account_investor1)); - let investor2BalanceAfter1 = new BigNumber(await web3.eth.getBalance(account_investor2)); - let investor3BalanceAfter1 = new BigNumber(await web3.eth.getBalance(account_investor3)); + let investor1BalanceAfter1 = new BN(await web3.eth.getBalance(account_investor1)); + let investor2BalanceAfter1 = new BN(await web3.eth.getBalance(account_investor2)); + let investor3BalanceAfter1 = new BN(await web3.eth.getBalance(account_investor3)); assert.equal(investor1BalanceAfter1.sub(investor1Balance).toNumber(), 0); assert.equal(investor2BalanceAfter1.sub(investor2Balance).toNumber(), 0); - assert.equal(investor3BalanceAfter1.sub(investor3Balance).toNumber(), web3.utils.toWei("7", "ether")); + assert.equal(investor3BalanceAfter1.sub(investor3Balance).toString(), new BN(web3.utils.toWei("7", "ether")).toString()); }); it("Still no more withholding tax to withdraw", async () => { - let issuerBalance = new BigNumber(await web3.eth.getBalance(token_owner)); + let issuerBalance = new BN(await web3.eth.getBalance(token_owner)); await I_EtherDividendCheckpoint.withdrawWithholding(0, { from: token_owner, gasPrice: 0 }); - let issuerBalanceAfter = new BigNumber(await web3.eth.getBalance(token_owner)); - assert.equal(issuerBalanceAfter.sub(issuerBalance).toNumber(), web3.utils.toWei("0", "ether")); + let issuerBalanceAfter = new BN(await web3.eth.getBalance(token_owner)); + assert.equal(issuerBalanceAfter.sub(issuerBalance).toString(), new BN(web3.utils.toWei("0", "ether")).toString()); }); it("should investor 3 claims dividend", async () => { @@ -478,37 +477,37 @@ contract("EtherDividendCheckpoint", accounts => { }); it("Issuer pushes remainder", async () => { - let investor1BalanceAfter1 = new BigNumber(await web3.eth.getBalance(account_investor1)); - let investor2BalanceAfter1 = new BigNumber(await web3.eth.getBalance(account_investor2)); - let investor3BalanceAfter1 = new BigNumber(await web3.eth.getBalance(account_investor3)); - await I_EtherDividendCheckpoint.pushDividendPayment(2, 0, 10, { from: token_owner }); - let investor1BalanceAfter2 = new BigNumber(await web3.eth.getBalance(account_investor1)); - let investor2BalanceAfter2 = new BigNumber(await web3.eth.getBalance(account_investor2)); - let investor3BalanceAfter2 = new BigNumber(await web3.eth.getBalance(account_investor3)); + let investor1BalanceAfter1 = new BN(await web3.eth.getBalance(account_investor1)); + let investor2BalanceAfter1 = new BN(await web3.eth.getBalance(account_investor2)); + let investor3BalanceAfter1 = new BN(await web3.eth.getBalance(account_investor3)); + await I_EtherDividendCheckpoint.pushDividendPayment(2, new BN(0), 10, { from: token_owner }); + let investor1BalanceAfter2 = new BN(await web3.eth.getBalance(account_investor1)); + let investor2BalanceAfter2 = new BN(await web3.eth.getBalance(account_investor2)); + let investor3BalanceAfter2 = new BN(await web3.eth.getBalance(account_investor3)); assert.equal(investor1BalanceAfter2.sub(investor1BalanceAfter1).toNumber(), 0); - assert.equal(investor2BalanceAfter2.sub(investor2BalanceAfter1).toNumber(), web3.utils.toWei("2.4", "ether")); + assert.equal(investor2BalanceAfter2.sub(investor2BalanceAfter1).toString(), new BN(web3.utils.toWei("2.4", "ether")).toString()); assert.equal(investor3BalanceAfter2.sub(investor3BalanceAfter1).toNumber(), 0); //Check fully claimed - assert.equal((await I_EtherDividendCheckpoint.dividends(2))[5].toNumber(), web3.utils.toWei("11", "ether")); + assert.equal((await I_EtherDividendCheckpoint.dividends(2))[5].toString(), new BN(web3.utils.toWei("11", "ether")).toString()); }); it("Issuer withdraws new withholding tax", async () => { - let issuerBalance = new BigNumber(await web3.eth.getBalance(token_owner)); + let issuerBalance = new BN(await web3.eth.getBalance(token_owner)); await I_EtherDividendCheckpoint.withdrawWithholding(2, { from: token_owner, gasPrice: 0 }); - let issuerBalanceAfter = new BigNumber(await web3.eth.getBalance(token_owner)); - assert.equal(issuerBalanceAfter.sub(issuerBalance).toNumber(), web3.utils.toWei("0.6", "ether")); + let issuerBalanceAfter = new BN(await web3.eth.getBalance(token_owner)); + assert.equal(issuerBalanceAfter.sub(issuerBalance).toString(), new BN(web3.utils.toWei("0.6", "ether")).toString()); }); it("Investor 2 transfers 1 ETH of his token balance to investor 1", async () => { - await I_SecurityToken.transfer(account_investor1, web3.utils.toWei("1", "ether"), { from: account_investor2 }); - assert.equal(await I_SecurityToken.balanceOf(account_investor1), web3.utils.toWei("1", "ether")); - assert.equal(await I_SecurityToken.balanceOf(account_investor2), web3.utils.toWei("2", "ether")); - assert.equal(await I_SecurityToken.balanceOf(account_investor3), web3.utils.toWei("7", "ether")); + await I_SecurityToken.transfer(account_investor1, new BN(web3.utils.toWei("1", "ether")), { from: account_investor2 }); + assert.equal((await I_SecurityToken.balanceOf(account_investor1)).toString(), new BN(web3.utils.toWei("1", "ether")).toString()); + assert.equal((await I_SecurityToken.balanceOf(account_investor2)).toString(), new BN(web3.utils.toWei("2", "ether")).toString()); + assert.equal((await I_SecurityToken.balanceOf(account_investor3)).toString(), new BN(web3.utils.toWei("7", "ether")).toString()); }); it("Create another new dividend with no value - fails", async () => { - let maturity = latestTime(); - let expiry = latestTime() + duration.days(2); + let maturity = await latestTime(); + let expiry = await latestTime() + duration.days(2); let tx = await I_SecurityToken.createCheckpoint({ from: token_owner }); await catchRevert( I_EtherDividendCheckpoint.createDividendWithCheckpoint(maturity, expiry, 4, dividendName, { from: token_owner, value: 0 }) @@ -516,60 +515,60 @@ contract("EtherDividendCheckpoint", accounts => { }); it("Create another new dividend with explicit", async () => { - let maturity = latestTime(); - let expiry = latestTime() - duration.days(10); + let maturity = await latestTime(); + let expiry = await latestTime() - duration.days(10); await catchRevert( I_EtherDividendCheckpoint.createDividendWithCheckpoint(maturity, expiry, 4, dividendName, { from: token_owner, - value: web3.utils.toWei("11", "ether") + value: new BN(web3.utils.toWei("11", "ether")) }) ); }); it("Create another new dividend with bad expirty - fails", async () => { - let maturity = latestTime() - duration.days(5); - let expiry = latestTime() - duration.days(2); + let maturity = await latestTime() - duration.days(5); + let expiry = await latestTime() - duration.days(2); await catchRevert( I_EtherDividendCheckpoint.createDividendWithCheckpoint(maturity, expiry, 4, dividendName, { from: token_owner, - value: web3.utils.toWei("11", "ether") + value: new BN(web3.utils.toWei("11", "ether")) }) ); }); it("Create another new dividend with bad checkpoint in the future - fails", async () => { - let maturity = latestTime(); - let expiry = latestTime() + duration.days(2); + let maturity = await latestTime(); + let expiry = await latestTime() + duration.days(2); await catchRevert( I_EtherDividendCheckpoint.createDividendWithCheckpoint(maturity, expiry, 5, dividendName, { from: token_owner, - value: web3.utils.toWei("11", "ether") + value: new BN(web3.utils.toWei("11", "ether")) }) ); }); it("Should not create dividend with more exclusions than limit", async () => { - let maturity = latestTime(); - let expiry = latestTime() + duration.days(10); + let maturity = await latestTime(); + let expiry = await latestTime() + duration.days(10); await I_SecurityToken.createCheckpoint({ from: token_owner }); let limit = await I_EtherDividendCheckpoint.EXCLUDED_ADDRESS_LIMIT(); - limit = limit.toNumber(); + limit = limit.toNumber() + 42; let addresses = []; addresses.push(account_temp); addresses.push(token_owner); - while (--limit) addresses.push(limit); + while (--limit > 42) addresses.push(web3.utils.toChecksumAddress('0x00000000000000000000000000000000000000' + limit)); await catchRevert( I_EtherDividendCheckpoint.createDividendWithCheckpointAndExclusions(maturity, expiry, 4, addresses, dividendName, { from: token_owner, - value: web3.utils.toWei("10", "ether") + value: new BN(web3.utils.toWei("10", "ether")) }), "tx -> failed because too many address excluded" ); }); it("Create another new dividend with explicit checkpoint and excluding account_investor1", async () => { - let maturity = latestTime(); - let expiry = latestTime() + duration.days(10); + let maturity = await latestTime(); + let expiry = await latestTime() + duration.days(10); //checkpoint created in above test let tx = await I_EtherDividendCheckpoint.createDividendWithCheckpointAndExclusions( maturity, @@ -577,43 +576,43 @@ contract("EtherDividendCheckpoint", accounts => { 4, [account_investor1], dividendName, - { from: token_owner, value: web3.utils.toWei("10", "ether") } + { from: token_owner, value: new BN(web3.utils.toWei("10", "ether")) } ); assert.equal(tx.logs[0].args._checkpointId.toNumber(), 4, "Dividend should be created at checkpoint 4"); }); it("Should not create new dividend with duplicate exclusion", async () => { - let maturity = latestTime(); - let expiry = latestTime() + duration.days(10); + let maturity = await latestTime(); + let expiry = await latestTime() + duration.days(10); //checkpoint created in above test - await catchRevert(I_EtherDividendCheckpoint.createDividendWithCheckpointAndExclusions( - maturity, - expiry, - 4, - [account_investor1, account_investor1], - dividendName, - { from: token_owner, value: web3.utils.toWei("10", "ether") } - )); + await catchRevert( + I_EtherDividendCheckpoint.createDividendWithCheckpointAndExclusions( + maturity, + expiry, + 4, + [account_investor1, account_investor1], + dividendName, + { from: token_owner, value: new BN(web3.utils.toWei("10", "ether")) } + ) + ); }); it("Should not create new dividend with 0x0 address in exclusion", async () => { - let maturity = latestTime(); - let expiry = latestTime() + duration.days(10); + let maturity = await latestTime(); + let expiry = await latestTime() + duration.days(10); //checkpoint created in above test - await catchRevert(I_EtherDividendCheckpoint.createDividendWithCheckpointAndExclusions( - maturity, - expiry, - 4, - [0], - dividendName, - { from: token_owner, value: web3.utils.toWei("10", "ether") } - )); + await catchRevert( + I_EtherDividendCheckpoint.createDividendWithCheckpointAndExclusions(maturity, expiry, 4, [address_zero], dividendName, { + from: token_owner, + value: new BN(web3.utils.toWei("10", "ether")) + }) + ); }); it("Non-owner pushes investor 1 - fails", async () => { - let investor1Balance = new BigNumber(await I_PolyToken.balanceOf(account_investor1)); - let investor2Balance = new BigNumber(await I_PolyToken.balanceOf(account_investor2)); - let investor3Balance = new BigNumber(await I_PolyToken.balanceOf(account_investor3)); + let investor1Balance = new BN(await I_PolyToken.balanceOf(account_investor1)); + let investor2Balance = new BN(await I_PolyToken.balanceOf(account_investor2)); + let investor3Balance = new BN(await I_PolyToken.balanceOf(account_investor3)); await catchRevert( I_EtherDividendCheckpoint.pushDividendPaymentToAddresses(3, [account_investor2, account_investor1], { from: account_investor2, @@ -623,9 +622,9 @@ contract("EtherDividendCheckpoint", accounts => { }); it("issuer pushes investor 1 with bad dividend index - fails", async () => { - let investor1Balance = new BigNumber(await I_PolyToken.balanceOf(account_investor1)); - let investor2Balance = new BigNumber(await I_PolyToken.balanceOf(account_investor2)); - let investor3Balance = new BigNumber(await I_PolyToken.balanceOf(account_investor3)); + let investor1Balance = new BN(await I_PolyToken.balanceOf(account_investor1)); + let investor2Balance = new BN(await I_PolyToken.balanceOf(account_investor2)); + let investor3Balance = new BN(await I_PolyToken.balanceOf(account_investor3)); await catchRevert( I_EtherDividendCheckpoint.pushDividendPaymentToAddresses(6, [account_investor2, account_investor1], { from: token_owner, @@ -640,48 +639,48 @@ contract("EtherDividendCheckpoint", accounts => { let dividendAmount3 = await I_EtherDividendCheckpoint.calculateDividend.call(3, account_investor3); let dividendAmount_temp = await I_EtherDividendCheckpoint.calculateDividend.call(3, account_temp); //1 has 1/11th, 2 has 2/11th, 3 has 7/11th, temp has 1/11th, but 1 is excluded - assert.equal(dividendAmount1[0].toNumber(), web3.utils.toWei("0", "ether")); - assert.equal(dividendAmount1[1].toNumber(), web3.utils.toWei("0", "ether")); - assert.equal(dividendAmount2[0].toNumber(), web3.utils.toWei("2", "ether")); - assert.equal(dividendAmount2[1].toNumber(), web3.utils.toWei("0.4", "ether")); - assert.equal(dividendAmount3[0].toNumber(), web3.utils.toWei("7", "ether")); - assert.equal(dividendAmount3[1].toNumber(), web3.utils.toWei("0", "ether")); - assert.equal(dividendAmount_temp[0].toNumber(), web3.utils.toWei("1", "ether")); - assert.equal(dividendAmount_temp[1].toNumber(), web3.utils.toWei("0", "ether")); + assert.equal(dividendAmount1[0].toString(), new BN(web3.utils.toWei("0", "ether")).toString()); + assert.equal(dividendAmount1[1].toString(), new BN(web3.utils.toWei("0", "ether")).toString()); + assert.equal(dividendAmount2[0].toString(), new BN(web3.utils.toWei("2", "ether")).toString()); + assert.equal(dividendAmount2[1].toString(), new BN(web3.utils.toWei("0.4", "ether")).toString()); + assert.equal(dividendAmount3[0].toString(), new BN(web3.utils.toWei("7", "ether")).toString()); + assert.equal(dividendAmount3[1].toString(), new BN(web3.utils.toWei("0", "ether")).toString()); + assert.equal(dividendAmount_temp[0].toString(), new BN(web3.utils.toWei("1", "ether")).toString()); + assert.equal(dividendAmount_temp[1].toString(), new BN(web3.utils.toWei("0", "ether")).toString()); }); it("Investor 2 claims dividend", async () => { - let investor1Balance = new BigNumber(await web3.eth.getBalance(account_investor1)); - let investor2Balance = new BigNumber(await web3.eth.getBalance(account_investor2)); - let investor3Balance = new BigNumber(await web3.eth.getBalance(account_investor3)); - let tempBalance = new BigNumber(await web3.eth.getBalance(account_temp)); + let investor1Balance = new BN(await web3.eth.getBalance(account_investor1)); + let investor2Balance = new BN(await web3.eth.getBalance(account_investor2)); + let investor3Balance = new BN(await web3.eth.getBalance(account_investor3)); + let tempBalance = new BN(await web3.eth.getBalance(account_temp)); await I_EtherDividendCheckpoint.pullDividendPayment(3, { from: account_investor2, gasPrice: 0 }); - let investor1BalanceAfter1 = new BigNumber(await web3.eth.getBalance(account_investor1)); - let investor2BalanceAfter1 = new BigNumber(await web3.eth.getBalance(account_investor2)); - let investor3BalanceAfter1 = new BigNumber(await web3.eth.getBalance(account_investor3)); - let tempBalanceAfter1 = new BigNumber(await web3.eth.getBalance(account_temp)); + let investor1BalanceAfter1 = new BN(await web3.eth.getBalance(account_investor1)); + let investor2BalanceAfter1 = new BN(await web3.eth.getBalance(account_investor2)); + let investor3BalanceAfter1 = new BN(await web3.eth.getBalance(account_investor3)); + let tempBalanceAfter1 = new BN(await web3.eth.getBalance(account_temp)); assert.equal(investor1BalanceAfter1.sub(investor1Balance).toNumber(), 0); - assert.equal(investor2BalanceAfter1.sub(investor2Balance).toNumber(), web3.utils.toWei("1.6", "ether")); + assert.equal(investor2BalanceAfter1.sub(investor2Balance).toString(), new BN(web3.utils.toWei("1.6", "ether")).toString()); assert.equal(investor3BalanceAfter1.sub(investor3Balance).toNumber(), 0); assert.equal(tempBalanceAfter1.sub(tempBalance).toNumber(), 0); }); it("Should issuer pushes investor 1 and temp investor", async () => { - let investor1BalanceAfter1 = new BigNumber(await web3.eth.getBalance(account_investor1)); - let investor2BalanceAfter1 = new BigNumber(await web3.eth.getBalance(account_investor2)); - let investor3BalanceAfter1 = new BigNumber(await web3.eth.getBalance(account_investor3)); - let tempBalanceAfter1 = new BigNumber(await web3.eth.getBalance(account_temp)); + let investor1BalanceAfter1 = new BN(await web3.eth.getBalance(account_investor1)); + let investor2BalanceAfter1 = new BN(await web3.eth.getBalance(account_investor2)); + let investor3BalanceAfter1 = new BN(await web3.eth.getBalance(account_investor3)); + let tempBalanceAfter1 = new BN(await web3.eth.getBalance(account_temp)); await I_EtherDividendCheckpoint.pushDividendPaymentToAddresses(3, [account_investor1, account_temp], { from: token_owner }); - let investor1BalanceAfter2 = new BigNumber(await web3.eth.getBalance(account_investor1)); - let investor2BalanceAfter2 = new BigNumber(await web3.eth.getBalance(account_investor2)); - let investor3BalanceAfter2 = new BigNumber(await web3.eth.getBalance(account_investor3)); - let tempBalanceAfter2 = new BigNumber(await web3.eth.getBalance(account_temp)); + let investor1BalanceAfter2 = new BN(await web3.eth.getBalance(account_investor1)); + let investor2BalanceAfter2 = new BN(await web3.eth.getBalance(account_investor2)); + let investor3BalanceAfter2 = new BN(await web3.eth.getBalance(account_investor3)); + let tempBalanceAfter2 = new BN(await web3.eth.getBalance(account_temp)); assert.equal(investor1BalanceAfter2.sub(investor1BalanceAfter1).toNumber(), 0); assert.equal(investor2BalanceAfter2.sub(investor2BalanceAfter1).toNumber(), 0); assert.equal(investor3BalanceAfter2.sub(investor3BalanceAfter1).toNumber(), 0); - assert.equal(tempBalanceAfter2.sub(tempBalanceAfter1).toNumber(), web3.utils.toWei("1", "ether")); + assert.equal(tempBalanceAfter2.sub(tempBalanceAfter1).toString(), new BN(web3.utils.toWei("1", "ether")).toString()); //Check fully claimed - assert.equal((await I_EtherDividendCheckpoint.dividends(3))[5].toNumber(), web3.utils.toWei("3", "ether")); + assert.equal((await I_EtherDividendCheckpoint.dividends(3))[5].toString(), new BN(web3.utils.toWei("3", "ether")).toString()); }); it("should calculate dividend after the push dividend payment", async () => { @@ -701,10 +700,10 @@ contract("EtherDividendCheckpoint", accounts => { }); it("Issuer is able to reclaim dividend after expiry", async () => { - let tokenOwnerBalance = new BigNumber(await web3.eth.getBalance(token_owner)); + let tokenOwnerBalance = new BN(await web3.eth.getBalance(token_owner)); await I_EtherDividendCheckpoint.reclaimDividend(3, { from: token_owner, gasPrice: 0 }); - let tokenOwnerAfter = new BigNumber(await web3.eth.getBalance(token_owner)); - assert.equal(tokenOwnerAfter.sub(tokenOwnerBalance).toNumber(), web3.utils.toWei("7", "ether")); + let tokenOwnerAfter = new BN(await web3.eth.getBalance(token_owner)); + assert.equal(tokenOwnerAfter.sub(tokenOwnerBalance).toString(), new BN(web3.utils.toWei("7", "ether")).toString()); }); it("Issuer is able to reclaim dividend after expiry", async () => { @@ -718,9 +717,9 @@ contract("EtherDividendCheckpoint", accounts => { it("Assign token balance to an address that can't receive funds", async () => { let tx = await I_GeneralTransferManager.modifyWhitelist( I_PolyToken.address, - latestTime(), - latestTime(), - latestTime() + duration.days(10), + currentTime, + currentTime, + currentTime.add(new BN(duration.days(1000000))), true, { from: account_issuer, @@ -730,47 +729,47 @@ contract("EtherDividendCheckpoint", accounts => { // Jump time await increaseTime(5000); // Mint some tokens - await I_SecurityToken.mint(I_PolyToken.address, web3.utils.toWei("1", "ether"), { from: token_owner }); - assert.equal(await I_SecurityToken.balanceOf(account_investor1), web3.utils.toWei("1", "ether")); - assert.equal(await I_SecurityToken.balanceOf(account_investor2), web3.utils.toWei("2", "ether")); - assert.equal(await I_SecurityToken.balanceOf(account_investor3), web3.utils.toWei("7", "ether")); - assert.equal(await I_SecurityToken.balanceOf(account_temp), web3.utils.toWei("1", "ether")); - assert.equal(await I_SecurityToken.balanceOf(I_PolyToken.address), web3.utils.toWei("1", "ether")); + await I_SecurityToken.mint(I_PolyToken.address, new BN(web3.utils.toWei("1", "ether")), { from: token_owner }); + assert.equal((await I_SecurityToken.balanceOf(account_investor1)).toString(), new BN(web3.utils.toWei("1", "ether")).toString()); + assert.equal((await I_SecurityToken.balanceOf(account_investor2)).toString(), new BN(web3.utils.toWei("2", "ether")).toString()); + assert.equal((await I_SecurityToken.balanceOf(account_investor3)).toString(), new BN(web3.utils.toWei("7", "ether")).toString()); + assert.equal((await I_SecurityToken.balanceOf(account_temp)).toString(), new BN(web3.utils.toWei("1", "ether")).toString()); + assert.equal((await I_SecurityToken.balanceOf(I_PolyToken.address)).toString(), new BN(web3.utils.toWei("1", "ether")).toString()); }); it("Create another new dividend", async () => { - let maturity = latestTime(); - let expiry = latestTime() + duration.days(10); + let maturity = await latestTime(); + let expiry = await latestTime() + duration.days(10); let tx = await I_EtherDividendCheckpoint.createDividendWithExclusions(maturity, expiry, [], dividendName, { from: token_owner, - value: web3.utils.toWei("12", "ether") + value: new BN(web3.utils.toWei("12", "ether")) }); assert.equal(tx.logs[0].args._checkpointId.toNumber(), 6, "Dividend should be created at checkpoint 6"); }); it("Should issuer pushes all dividends", async () => { - let investor1BalanceBefore = new BigNumber(await web3.eth.getBalance(account_investor1)); - let investor2BalanceBefore = new BigNumber(await web3.eth.getBalance(account_investor2)); - let investor3BalanceBefore = new BigNumber(await web3.eth.getBalance(account_investor3)); - let tempBalanceBefore = new BigNumber(await web3.eth.getBalance(account_temp)); - let tokenBalanceBefore = new BigNumber(await web3.eth.getBalance(I_PolyToken.address)); - - await I_EtherDividendCheckpoint.pushDividendPayment(4, 0, 10, { from: token_owner }); - - let investor1BalanceAfter = new BigNumber(await web3.eth.getBalance(account_investor1)); - let investor2BalanceAfter = new BigNumber(await web3.eth.getBalance(account_investor2)); - let investor3BalanceAfter = new BigNumber(await web3.eth.getBalance(account_investor3)); - let tempBalanceAfter = new BigNumber(await web3.eth.getBalance(account_temp)); - let tokenBalanceAfter = new BigNumber(await web3.eth.getBalance(I_PolyToken.address)); - - assert.equal(investor1BalanceAfter.sub(investor1BalanceBefore).toNumber(), web3.utils.toWei("1", "ether")); - assert.equal(investor2BalanceAfter.sub(investor2BalanceBefore).toNumber(), web3.utils.toWei("1.6", "ether")); - assert.equal(investor3BalanceAfter.sub(investor3BalanceBefore).toNumber(), web3.utils.toWei("7", "ether")); - assert.equal(tempBalanceAfter.sub(tempBalanceBefore).toNumber(), web3.utils.toWei("1", "ether")); - assert.equal(tokenBalanceAfter.sub(tokenBalanceBefore).toNumber(), web3.utils.toWei("0", "ether")); + let investor1BalanceBefore = new BN(await web3.eth.getBalance(account_investor1)); + let investor2BalanceBefore = new BN(await web3.eth.getBalance(account_investor2)); + let investor3BalanceBefore = new BN(await web3.eth.getBalance(account_investor3)); + let tempBalanceBefore = new BN(await web3.eth.getBalance(account_temp)); + let tokenBalanceBefore = new BN(await web3.eth.getBalance(I_PolyToken.address)); + + await I_EtherDividendCheckpoint.pushDividendPayment(4, new BN(0), 10, { from: token_owner }); + + let investor1BalanceAfter = new BN(await web3.eth.getBalance(account_investor1)); + let investor2BalanceAfter = new BN(await web3.eth.getBalance(account_investor2)); + let investor3BalanceAfter = new BN(await web3.eth.getBalance(account_investor3)); + let tempBalanceAfter = new BN(await web3.eth.getBalance(account_temp)); + let tokenBalanceAfter = new BN(await web3.eth.getBalance(I_PolyToken.address)); + + assert.equal(investor1BalanceAfter.sub(investor1BalanceBefore).toString(), new BN(web3.utils.toWei("1", "ether")).toString()); + assert.equal(investor2BalanceAfter.sub(investor2BalanceBefore).toString(), new BN(web3.utils.toWei("1.6", "ether")).toString()); + assert.equal(investor3BalanceAfter.sub(investor3BalanceBefore).toString(), new BN(web3.utils.toWei("7", "ether")).toString()); + assert.equal(tempBalanceAfter.sub(tempBalanceBefore).toString(), new BN(web3.utils.toWei("1", "ether")).toString()); + assert.equal(tokenBalanceAfter.sub(tokenBalanceBefore).toString(), new BN(web3.utils.toWei("0", "ether")).toString()); //Check partially claimed - assert.equal((await I_EtherDividendCheckpoint.dividends(4))[5].toNumber(), web3.utils.toWei("11", "ether")); + assert.equal((await I_EtherDividendCheckpoint.dividends(4))[5].toString(), new BN(web3.utils.toWei("11", "ether")).toString()); }); it("Should give the right dividend index", async () => { @@ -795,7 +794,7 @@ contract("EtherDividendCheckpoint", accounts => { it("should registr a delegate", async () => { [I_GeneralPermissionManagerFactory] = await deployGPMAndVerifyed(account_polymath, I_MRProxied, 0); - let tx = await I_SecurityToken.addModule(I_GeneralPermissionManagerFactory.address, "0x", 0, 0, { from: token_owner }); + let tx = await I_SecurityToken.addModule(I_GeneralPermissionManagerFactory.address, "0x", new BN(0), new BN(0), { from: token_owner }); assert.equal(tx.logs[2].args._types[0].toNumber(), delegateManagerKey, "General Permission Manager doesn't get deployed"); assert.equal( web3.utils.toAscii(tx.logs[2].args._name).replace(/\u0000/g, ""), @@ -803,65 +802,65 @@ contract("EtherDividendCheckpoint", accounts => { "GeneralPermissionManagerFactory module was not added" ); I_GeneralPermissionManager = await GeneralPermissionManager.at(tx.logs[2].args._module); - tx = await I_GeneralPermissionManager.addDelegate(account_manager, managerDetails, { from: token_owner}); + tx = await I_GeneralPermissionManager.addDelegate(account_manager, managerDetails, { from: token_owner }); assert.equal(tx.logs[0].args._delegate, account_manager); }); it("should not allow manager without permission to create dividend", async () => { - await I_PolyToken.transfer(account_manager, web3.utils.toWei("2", "ether"), { from: token_owner }); - await I_PolyToken.approve(I_EtherDividendCheckpoint.address, web3.utils.toWei("1.5", "ether"), { from: account_manager }); - let maturity = latestTime() + duration.days(1); - let expiry = latestTime() + duration.days(10); + await I_PolyToken.transfer(account_manager, new BN(web3.utils.toWei("2", "ether")), { from: token_owner }); + await I_PolyToken.approve(I_EtherDividendCheckpoint.address, new BN(web3.utils.toWei("1.5", "ether")), { from: account_manager }); + let maturity = await latestTime() + duration.days(1); + let expiry = await latestTime() + duration.days(10); - await catchRevert(I_EtherDividendCheckpoint.createDividend( - maturity, - expiry, - dividendName, - { from: account_manager, value: web3.utils.toWei("12", "ether") } - )); + await catchRevert( + I_EtherDividendCheckpoint.createDividend(maturity, expiry, dividendName, { + from: account_manager, + value: new BN(web3.utils.toWei("12", "ether")) + }) + ); }); it("should not allow manager without permission to create dividend with checkpoint", async () => { - let maturity = latestTime() + duration.days(1); - let expiry = latestTime() + duration.days(10); + let maturity = await latestTime() + duration.days(1); + let expiry = await latestTime() + duration.days(10); let checkpointID = await I_SecurityToken.createCheckpoint.call({ from: token_owner }); await I_SecurityToken.createCheckpoint({ from: token_owner }); - await catchRevert(I_EtherDividendCheckpoint.createDividendWithCheckpoint( - maturity, - expiry, - checkpointID.toNumber(), - dividendName, - { from: account_manager, value: web3.utils.toWei("12", "ether") } - )); + await catchRevert( + I_EtherDividendCheckpoint.createDividendWithCheckpoint(maturity, expiry, checkpointID.toNumber(), dividendName, { + from: account_manager, + value: new BN(web3.utils.toWei("12", "ether")) + }) + ); }); it("should not allow manager without permission to create dividend with exclusion", async () => { - let maturity = latestTime() + duration.days(1); - let expiry = latestTime() + duration.days(10); - let exclusions = [1]; - await catchRevert(I_EtherDividendCheckpoint.createDividendWithExclusions( - maturity, - expiry, - exclusions, - dividendName, - { from: account_manager, value: web3.utils.toWei("12", "ether") } - )); + let maturity = await latestTime() + duration.days(1); + let expiry = await latestTime() + duration.days(10); + let exclusions = [one_address]; + await catchRevert( + I_EtherDividendCheckpoint.createDividendWithExclusions(maturity, expiry, exclusions, dividendName, { + from: account_manager, + value: new BN(web3.utils.toWei("12", "ether")) + }) + ); }); it("should not allow manager without permission to create dividend with checkpoint and exclusion", async () => { - let maturity = latestTime() + duration.days(1); - let expiry = latestTime() + duration.days(10); - let exclusions = [1]; + let maturity = await latestTime() + duration.days(1); + let expiry = await latestTime() + duration.days(10); + let exclusions = [one_address]; let checkpointID = await I_SecurityToken.createCheckpoint.call({ from: token_owner }); await I_SecurityToken.createCheckpoint({ from: token_owner }); - await catchRevert(I_EtherDividendCheckpoint.createDividendWithCheckpointAndExclusions( - maturity, - expiry, - checkpointID.toNumber(), - exclusions, - dividendName, - { from: account_manager, value: web3.utils.toWei("12", "ether") } - )); + await catchRevert( + I_EtherDividendCheckpoint.createDividendWithCheckpointAndExclusions( + maturity, + expiry, + checkpointID.toNumber(), + exclusions, + dividendName, + { from: account_manager, value: new BN(web3.utils.toWei("12", "ether")) } + ) + ); }); it("should not allow manager without permission to create checkpoint", async () => { @@ -869,69 +868,53 @@ contract("EtherDividendCheckpoint", accounts => { }); it("should give permission to manager", async () => { - await I_GeneralPermissionManager.changePermission( - account_manager, - I_EtherDividendCheckpoint.address, - "CHECKPOINT", - true, - { from: token_owner } - ); - let tx = await I_GeneralPermissionManager.changePermission( - account_manager, - I_EtherDividendCheckpoint.address, - "MANAGE", - true, - { from: token_owner } - ); + await I_GeneralPermissionManager.changePermission(account_manager, I_EtherDividendCheckpoint.address, web3.utils.fromAscii("CHECKPOINT"), true, { + from: token_owner + }); + let tx = await I_GeneralPermissionManager.changePermission(account_manager, I_EtherDividendCheckpoint.address, web3.utils.fromAscii("MANAGE"), true, { + from: token_owner + }); assert.equal(tx.logs[0].args._delegate, account_manager); }); it("should allow manager with permission to create dividend", async () => { - let maturity = latestTime() + duration.days(1); - let expiry = latestTime() + duration.days(10); + let maturity = await latestTime() + duration.days(1); + let expiry = await latestTime() + duration.days(10); - let tx = await I_EtherDividendCheckpoint.createDividend( - maturity, - expiry, - dividendName, - { from: account_manager, value: web3.utils.toWei("12", "ether") } - ); + let tx = await I_EtherDividendCheckpoint.createDividend(maturity, expiry, dividendName, { + from: account_manager, + value: new BN(web3.utils.toWei("12", "ether")) + }); assert.equal(tx.logs[0].args._checkpointId.toNumber(), 9); }); it("should allow manager with permission to create dividend with checkpoint", async () => { - let maturity = latestTime() + duration.days(1); - let expiry = latestTime() + duration.days(10); + let maturity = await latestTime() + duration.days(1); + let expiry = await latestTime() + duration.days(10); let checkpointID = await I_SecurityToken.createCheckpoint.call({ from: token_owner }); await I_SecurityToken.createCheckpoint({ from: token_owner }); - let tx = await I_EtherDividendCheckpoint.createDividendWithCheckpoint( - maturity, - expiry, - checkpointID.toNumber(), - dividendName, - { from: account_manager, value: web3.utils.toWei("12", "ether") } - ); + let tx = await I_EtherDividendCheckpoint.createDividendWithCheckpoint(maturity, expiry, checkpointID.toNumber(), dividendName, { + from: account_manager, + value: new BN(web3.utils.toWei("12", "ether")) + }); assert.equal(tx.logs[0].args._checkpointId.toNumber(), 10); }); it("should allow manager with permission to create dividend with exclusion", async () => { - let maturity = latestTime() + duration.days(1); - let expiry = latestTime() + duration.days(10); - let exclusions = [1]; - let tx = await I_EtherDividendCheckpoint.createDividendWithExclusions( - maturity, - expiry, - exclusions, - dividendName, - { from: account_manager, value: web3.utils.toWei("12", "ether") } - ); + let maturity = await latestTime() + duration.days(1); + let expiry = await latestTime() + duration.days(10); + let exclusions = [one_address]; + let tx = await I_EtherDividendCheckpoint.createDividendWithExclusions(maturity, expiry, exclusions, dividendName, { + from: account_manager, + value: new BN(web3.utils.toWei("12", "ether")) + }); assert.equal(tx.logs[0].args._checkpointId.toNumber(), 11); }); it("should allow manager with permission to create dividend with checkpoint and exclusion", async () => { - let maturity = latestTime() + duration.days(1); - let expiry = latestTime() + duration.days(10); - let exclusions = [1]; + let maturity = await latestTime() + duration.days(1); + let expiry = await latestTime() + duration.days(10); + let exclusions = [one_address]; let checkpointID = await I_SecurityToken.createCheckpoint.call({ from: token_owner }); await I_SecurityToken.createCheckpoint({ from: token_owner }); let tx = await I_EtherDividendCheckpoint.createDividendWithCheckpointAndExclusions( @@ -940,7 +923,7 @@ contract("EtherDividendCheckpoint", accounts => { checkpointID.toNumber(), exclusions, dividendName, - { from: account_manager, value: web3.utils.toWei("12", "ether") } + { from: account_manager, value: new BN(web3.utils.toWei("12", "ether")) } ); assert.equal(tx.logs[0].args._checkpointId.toNumber(), 12); }); diff --git a/test/g_general_permission_manager.js b/test/g_general_permission_manager.js index c1081ddbc..6792d6d17 100644 --- a/test/g_general_permission_manager.js +++ b/test/g_general_permission_manager.js @@ -1,21 +1,20 @@ -import latestTime from './helpers/latestTime'; -import {signData} from './helpers/signData'; -import { pk } from './helpers/testprivateKey'; -import { duration, promisifyLogWatch, latestBlock } from './helpers/utils'; -import { takeSnapshot, increaseTime, revertToSnapshot } from './helpers/time'; +import latestTime from "./helpers/latestTime"; +import { signData } from "./helpers/signData"; +import { pk } from "./helpers/testprivateKey"; +import { duration, promisifyLogWatch, latestBlock } from "./helpers/utils"; +import { takeSnapshot, increaseTime, revertToSnapshot } from "./helpers/time"; import { catchRevert } from "./helpers/exceptions"; import { setUpPolymathNetwork, deployGPMAndVerifyed } from "./helpers/createInstances"; -const SecurityToken = artifacts.require('./SecurityToken.sol'); -const GeneralTransferManager = artifacts.require('./GeneralTransferManager'); -const GeneralPermissionManager = artifacts.require('./GeneralPermissionManager'); +const SecurityToken = artifacts.require("./SecurityToken.sol"); +const GeneralTransferManager = artifacts.require("./GeneralTransferManager"); +const GeneralPermissionManager = artifacts.require("./GeneralPermissionManager"); -const Web3 = require('web3'); -const BigNumber = require('bignumber.js'); -const web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545")) // Hardcoded development port - -contract('GeneralPermissionManager', accounts => { +const Web3 = require("web3"); +const BN = Web3.utils.BN; +const web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545")); // Hardcoded development port +contract("GeneralPermissionManager", async (accounts) => { // Accounts Variable declaration let account_polymath; let account_issuer; @@ -28,10 +27,7 @@ contract('GeneralPermissionManager', accounts => { let account_delegate; let account_delegate2; let account_delegate3; - // investor Details - let fromTime = latestTime(); - let toTime = latestTime(); - let expiryTime = toTime + duration.days(15); + const delegateDetails = web3.utils.fromAscii("I am delegate"); let message = "Transaction Should Fail!"; @@ -62,7 +58,7 @@ contract('GeneralPermissionManager', accounts => { const tokenDetails = "This is equity type of issuance"; const decimals = 18; const contact = "team@polymath.network"; - const delegateDetails = "Hello I am legit delegate"; + const managerDetails = web3.utils.fromAscii("Hello"); // Module key const delegateManagerKey = 1; @@ -70,10 +66,14 @@ contract('GeneralPermissionManager', accounts => { const stoKey = 3; // Initial fee for ticker registry and security token registry - const initRegFee = web3.utils.toWei("250"); + const initRegFee = new BN(web3.utils.toWei("250")); + + let currentTime; + const address_zero = "0x0000000000000000000000000000000000000000"; + const one_address = "0x0000000000000000000000000000000000000001"; - before(async() => { - // Accounts setup + before(async () => { + currentTime = new BN(await latestTime()); account_polymath = accounts[0]; account_issuer = accounts[1]; @@ -107,7 +107,7 @@ contract('GeneralPermissionManager', accounts => { // STEP 5: Deploy the GeneralDelegateManagerFactory [I_GeneralPermissionManagerFactory] = await deployGPMAndVerifyed(account_polymath, I_MRProxied, 0); // STEP 6: Deploy the GeneralDelegateManagerFactory - [P_GeneralPermissionManagerFactory] = await deployGPMAndVerifyed(account_polymath, I_MRProxied, web3.utils.toWei("500")); + [P_GeneralPermissionManagerFactory] = await deployGPMAndVerifyed(account_polymath, I_MRProxied, new BN(web3.utils.toWei("500"))); // Printing all the contract addresses console.log(` @@ -136,15 +136,15 @@ contract('GeneralPermissionManager', accounts => { it("Should generate the new security token with the same symbol as registered above", async () => { await I_PolyToken.approve(I_STRProxied.address, initRegFee, { from: token_owner }); - let _blockNo = latestBlock(); + let tx = await I_STRProxied.generateSecurityToken(name, symbol, tokenDetails, false, { from: token_owner }); // Verify the successful generation of the security token assert.equal(tx.logs[2].args._ticker, symbol.toUpperCase(), "SecurityToken doesn't get deployed"); - I_SecurityToken = SecurityToken.at(tx.logs[2].args._securityTokenAddress); + I_SecurityToken = await SecurityToken.at(tx.logs[2].args._securityTokenAddress); - const log = await promisifyLogWatch(I_SecurityToken.ModuleAdded({ from: _blockNo }), 1); + const log = (await I_SecurityToken.getPastEvents('ModuleAdded', {filter: {transactionHash: tx.transactionHash}}))[0]; // Verify that GeneralTransferManager module get added successfully or not assert.equal(log.args._types[0].toNumber(), 2); @@ -153,25 +153,27 @@ contract('GeneralPermissionManager', accounts => { it("Should intialize the auto attached modules", async () => { let moduleData = (await I_SecurityToken.getModulesByType(2))[0]; - I_GeneralTransferManager = GeneralTransferManager.at(moduleData); + I_GeneralTransferManager = await GeneralTransferManager.at(moduleData); }); it("Should successfully attach the General permission manager factory with the security token -- failed because Token is not paid", async () => { let errorThrown = false; - await I_PolyToken.getTokens(web3.utils.toWei("500", "ether"), token_owner); + await I_PolyToken.getTokens(new BN(web3.utils.toWei("500", "ether")), token_owner); await catchRevert( - I_SecurityToken.addModule(P_GeneralPermissionManagerFactory.address, "0x", web3.utils.toWei("500", "ether"), 0, { from: token_owner }) + I_SecurityToken.addModule(P_GeneralPermissionManagerFactory.address, "0x", new BN(web3.utils.toWei("500", "ether")), new BN(0), { + from: token_owner + }) ); }); it("Should successfully attach the General permission manager factory with the security token", async () => { let snapId = await takeSnapshot(); - await I_PolyToken.transfer(I_SecurityToken.address, web3.utils.toWei("500", "ether"), { from: token_owner }); + await I_PolyToken.transfer(I_SecurityToken.address, new BN(web3.utils.toWei("500", "ether")), { from: token_owner }); const tx = await I_SecurityToken.addModule( P_GeneralPermissionManagerFactory.address, "0x", - web3.utils.toWei("500", "ether"), - 0, + new BN(web3.utils.toWei("500", "ether")), + new BN(0), { from: token_owner } ); assert.equal(tx.logs[3].args._types[0].toNumber(), delegateManagerKey, "General Permission Manager doesn't get deployed"); @@ -180,21 +182,20 @@ contract('GeneralPermissionManager', accounts => { "GeneralPermissionManager", "GeneralPermissionManagerFactory module was not added" ); - P_GeneralPermissionManager = GeneralPermissionManager.at(tx.logs[3].args._module); + P_GeneralPermissionManager = await GeneralPermissionManager.at(tx.logs[3].args._module); await revertToSnapshot(snapId); }); it("Should successfully attach the General permission manager factory with the security token", async () => { - const tx = await I_SecurityToken.addModule(I_GeneralPermissionManagerFactory.address, "0x", 0, 0, { from: token_owner }); + const tx = await I_SecurityToken.addModule(I_GeneralPermissionManagerFactory.address, "0x", new BN(0), new BN(0), { from: token_owner }); assert.equal(tx.logs[2].args._types[0].toNumber(), delegateManagerKey, "General Permission Manager doesn't get deployed"); assert.equal( web3.utils.toAscii(tx.logs[2].args._name).replace(/\u0000/g, ""), "GeneralPermissionManager", "GeneralPermissionManagerFactory module was not added" ); - I_GeneralPermissionManager = GeneralPermissionManager.at(tx.logs[2].args._module); + I_GeneralPermissionManager = await GeneralPermissionManager.at(tx.logs[2].args._module); }); - }); describe("General Permission Manager test cases", async () => { @@ -203,51 +204,43 @@ contract('GeneralPermissionManager', accounts => { assert.equal(web3.utils.toAscii(tx).replace(/\u0000/g, ""), 0); }); - it("Should fail in adding the delegate -- msg.sender doesn't have permission", async() => { + it("Should fail in adding the delegate -- msg.sender doesn't have permission", async () => { let errorThrown = false; - await catchRevert( - I_GeneralPermissionManager.addDelegate(account_delegate, delegateDetails, { from: account_investor1}) - ); + await catchRevert(I_GeneralPermissionManager.addDelegate(account_delegate, delegateDetails, { from: account_investor1 })); }); - it("Should fail in adding the delegate -- no delegate details provided", async() => { - await catchRevert( - I_GeneralPermissionManager.addDelegate(account_delegate, '', { from: token_owner }) - ); + it("Should fail in adding the delegate -- no delegate details provided", async () => { + await catchRevert(I_GeneralPermissionManager.addDelegate(account_delegate, "0x0", { from: token_owner })); }); - it("Should fail in adding the delegate -- no delegate address provided", async() => { - await catchRevert( - I_GeneralPermissionManager.addDelegate('', delegateDetails, { from: token_owner }) - ); + it("Should fail in adding the delegate -- no delegate address provided", async () => { + await catchRevert(I_GeneralPermissionManager.addDelegate(address_zero, delegateDetails, { from: token_owner })); }); - it("Should fail to remove the delegate -- failed because delegate does not exisit", async() => { - await catchRevert( - I_GeneralPermissionManager.deleteDelegate(account_delegate, { from: token_owner}) - ); + it("Should fail to remove the delegate -- failed because delegate does not exisit", async () => { + await catchRevert(I_GeneralPermissionManager.deleteDelegate(account_delegate, { from: token_owner })); }); - it("Should successfully add the delegate", async() => { - let tx = await I_GeneralPermissionManager.addDelegate(account_delegate, delegateDetails, { from: token_owner}); + it("Should successfully add the delegate", async () => { + let tx = await I_GeneralPermissionManager.addDelegate(account_delegate, delegateDetails, { from: token_owner }); assert.equal(tx.logs[0].args._delegate, account_delegate); }); - it("Should successfully add the delegate -- failed because trying to add the already present delegate", async() => { + it("Should successfully add the delegate -- failed because trying to add the already present delegate", async () => { + await catchRevert(I_GeneralPermissionManager.addDelegate(account_delegate, delegateDetails, { from: token_owner })); + }); + + it("Should fail to provide the permission -- because msg.sender doesn't have permission", async () => { await catchRevert( - I_GeneralPermissionManager.addDelegate(account_delegate, delegateDetails, { from: token_owner}) + I_GeneralPermissionManager.changePermission(account_delegate, I_GeneralTransferManager.address, web3.utils.fromAscii("WHITELIST"), true, { + from: account_investor1 + }) ); - }) - - it("Should fail to provide the permission -- because msg.sender doesn't have permission", async() => { - await catchRevert( - I_GeneralPermissionManager.changePermission(account_delegate, I_GeneralTransferManager.address, "WHITELIST", true, {from: account_investor1}) - ); }); it("Should check the permission", async () => { assert.isFalse( - await I_GeneralPermissionManager.checkPermission.call(account_delegate, I_GeneralTransferManager.address, "WHITELIST") + await I_GeneralPermissionManager.checkPermission.call(account_delegate, I_GeneralTransferManager.address, web3.utils.fromAscii("WHITELIST")) ); }); @@ -255,7 +248,7 @@ contract('GeneralPermissionManager', accounts => { let tx = await I_GeneralPermissionManager.changePermission( account_delegate, I_GeneralTransferManager.address, - "WHITELIST", + web3.utils.fromAscii("WHITELIST"), true, { from: token_owner } ); @@ -264,47 +257,42 @@ contract('GeneralPermissionManager', accounts => { it("Should check the permission", async () => { assert.isTrue( - await I_GeneralPermissionManager.checkPermission.call(account_delegate, I_GeneralTransferManager.address, "WHITELIST") + await I_GeneralPermissionManager.checkPermission.call(account_delegate, I_GeneralTransferManager.address, web3.utils.fromAscii("WHITELIST")) ); }); it("Security token should deny all permission if all permission managers are disabled", async () => { await I_SecurityToken.archiveModule(I_GeneralPermissionManager.address, { from: token_owner }); - assert.isFalse( - await I_SecurityToken.checkPermission.call(account_delegate, I_GeneralTransferManager.address, "WHITELIST") - ); + assert.isFalse(await I_SecurityToken.checkPermission.call(account_delegate, I_GeneralTransferManager.address, web3.utils.fromAscii("WHITELIST"))); await I_SecurityToken.unarchiveModule(I_GeneralPermissionManager.address, { from: token_owner }); - assert.isTrue( - await I_SecurityToken.checkPermission.call(account_delegate, I_GeneralTransferManager.address, "WHITELIST") - ); + assert.isTrue(await I_SecurityToken.checkPermission.call(account_delegate, I_GeneralTransferManager.address, web3.utils.fromAscii("WHITELIST"))); }); - it("Should fail to remove the delegate -- failed because unauthorized msg.sender", async() => { - await catchRevert( - I_GeneralPermissionManager.deleteDelegate(account_delegate, { from: account_delegate}) - ); + it("Should fail to remove the delegate -- failed because unauthorized msg.sender", async () => { + await catchRevert(I_GeneralPermissionManager.deleteDelegate(account_delegate, { from: account_delegate })); }); - it("Should remove the delegate", async() => { - await I_GeneralPermissionManager.deleteDelegate(account_delegate, { from: token_owner}) + it("Should remove the delegate", async () => { + await I_GeneralPermissionManager.deleteDelegate(account_delegate, { from: token_owner }); }); it("Should check the permission", async () => { assert.isFalse( - await I_GeneralPermissionManager.checkPermission.call(account_delegate, I_GeneralTransferManager.address, "WHITELIST") + await I_GeneralPermissionManager.checkPermission.call(account_delegate, I_GeneralTransferManager.address, web3.utils.fromAscii("WHITELIST")) ); }); - it("Should successfully add the delegate", async() => { - let tx = await I_GeneralPermissionManager.addDelegate(account_delegate, delegateDetails, { from: token_owner}); + it("Should successfully add the delegate", async () => { + let tx = await I_GeneralPermissionManager.addDelegate(account_delegate, delegateDetails, { from: token_owner }); assert.equal(tx.logs[0].args._delegate, account_delegate); }); - it("Should check the delegate details", async() => { - assert.equal(web3.utils.toAscii(await I_GeneralPermissionManager.delegateDetails.call(account_delegate)) - .replace(/\u0000/g, ''), - delegateDetails, - "Wrong delegate address get checked"); + it("Should check the delegate details", async () => { + assert.equal( + web3.utils.toAscii(await I_GeneralPermissionManager.delegateDetails.call(account_delegate)).replace(/\u0000/g, ""), + web3.utils.toAscii(delegateDetails), + "Wrong delegate address get checked" + ); }); it("Should get the permission of the general permission manager contract", async () => { @@ -312,84 +300,116 @@ contract('GeneralPermissionManager', accounts => { assert.equal(web3.utils.toAscii(tx[0]).replace(/\u0000/g, ""), "CHANGE_PERMISSION", "Wrong permissions"); }); - it("Should return all delegates", async() => { - await I_GeneralPermissionManager.addDelegate(account_delegate2, delegateDetails, { from: token_owner}); + it("Should return all delegates", async () => { + await I_GeneralPermissionManager.addDelegate(account_delegate2, delegateDetails, { from: token_owner }); let tx = await I_GeneralPermissionManager.getAllDelegates.call(); assert.equal(tx.length, 2); - assert.equal(tx[0], account_delegate); + assert.equal(tx[0], account_delegate); assert.equal(tx[1], account_delegate2); }); - it("Should check is delegate for 0x address - failed 0x address is not allowed", async() => { - await catchRevert( - I_GeneralPermissionManager.checkDelegate.call("0x0000000000000000000000000000000000000000000000000") - ); + it("Should check is delegate for 0x address - failed 0x address is not allowed", async () => { + await catchRevert(I_GeneralPermissionManager.checkDelegate.call(address_zero)); }); - it("Should return false when check is delegate - because user is not a delegate", async() => { + it("Should return false when check is delegate - because user is not a delegate", async () => { assert.equal(await I_GeneralPermissionManager.checkDelegate.call(account_investor1), false); }); - it("Should return true when check is delegate - because user is a delegate", async() => { + it("Should return true when check is delegate - because user is a delegate", async () => { assert.equal(await I_GeneralPermissionManager.checkDelegate.call(account_delegate), true); }); - - it("Should successfully provide the permissions in batch -- failed because of array length is 0", async() => { - await I_GeneralPermissionManager.addDelegate(account_delegate3, delegateDetails, { from: token_owner}); + it("Should successfully provide the permissions in batch -- failed because of array length is 0", async () => { + await I_GeneralPermissionManager.addDelegate(account_delegate3, delegateDetails, { from: token_owner }); await catchRevert( - I_GeneralPermissionManager.changePermissionMulti(account_delegate3, [], ["WHITELIST","CHANGE_PERMISSION"], [true, true], {from: token_owner}) + I_GeneralPermissionManager.changePermissionMulti(account_delegate3, [], [web3.utils.fromAscii("WHITELIST"), web3.utils.fromAscii("CHANGE_PERMISSION")], [true, true], { + from: token_owner + }) ); }); - it("Should successfully provide the permissions in batch -- failed because of perm array length is 0", async() => { + it("Should successfully provide the permissions in batch -- failed because of perm array length is 0", async () => { await catchRevert( - I_GeneralPermissionManager.changePermissionMulti(account_delegate3, [I_GeneralTransferManager.address, I_GeneralPermissionManager.address], [], [true, true], {from: token_owner}) + I_GeneralPermissionManager.changePermissionMulti( + account_delegate3, + [I_GeneralTransferManager.address, I_GeneralPermissionManager.address], + [], + [true, true], + { from: token_owner } + ) ); }); - it("Should successfully provide the permissions in batch -- failed because mismatch in arrays length", async() => { + it("Should successfully provide the permissions in batch -- failed because mismatch in arrays length", async () => { await catchRevert( - I_GeneralPermissionManager.changePermissionMulti(account_delegate3, [I_GeneralTransferManager.address], ["WHITELIST","CHANGE_PERMISSION"], [true, true], {from: token_owner}) + I_GeneralPermissionManager.changePermissionMulti( + account_delegate3, + [I_GeneralTransferManager.address], + [web3.utils.fromAscii("WHITELIST"), web3.utils.fromAscii("CHANGE_PERMISSION")], + [true, true], + { from: token_owner } + ) ); }); - it("Should successfully provide the permissions in batch -- failed because mismatch in arrays length", async() => { + it("Should successfully provide the permissions in batch -- failed because mismatch in arrays length", async () => { await catchRevert( - I_GeneralPermissionManager.changePermissionMulti(account_delegate3, [I_GeneralTransferManager.address, I_GeneralPermissionManager.address], ["WHITELIST","CHANGE_PERMISSION"], [true], {from: token_owner}) + I_GeneralPermissionManager.changePermissionMulti( + account_delegate3, + [I_GeneralTransferManager.address, I_GeneralPermissionManager.address], + [web3.utils.fromAscii("WHITELIST"), web3.utils.fromAscii("CHANGE_PERMISSION")], + [true], + { from: token_owner } + ) ); }); - it("Should successfully provide the permissions in batch", async() => { - let tx = await I_GeneralPermissionManager.changePermissionMulti(account_delegate3, [I_GeneralTransferManager.address, I_GeneralPermissionManager.address], ["WHITELIST","CHANGE_PERMISSION"], [true, true], {from: token_owner}); + it("Should successfully provide the permissions in batch", async () => { + let tx = await I_GeneralPermissionManager.changePermissionMulti( + account_delegate3, + [I_GeneralTransferManager.address, I_GeneralPermissionManager.address], + [web3.utils.fromAscii("WHITELIST"), web3.utils.fromAscii("CHANGE_PERMISSION")], + [true, true], + { from: token_owner } + ); assert.equal(tx.logs[0].args._delegate, account_delegate3); - assert.isTrue(await I_GeneralPermissionManager.checkPermission.call(account_delegate3, I_GeneralTransferManager.address, "WHITELIST")); - assert.isTrue(await I_GeneralPermissionManager.checkPermission.call(account_delegate3, I_GeneralPermissionManager.address, "CHANGE_PERMISSION")); + assert.isTrue( + await I_GeneralPermissionManager.checkPermission.call(account_delegate3, I_GeneralTransferManager.address, web3.utils.fromAscii("WHITELIST")) + ); + assert.isTrue( + await I_GeneralPermissionManager.checkPermission.call( + account_delegate3, + I_GeneralPermissionManager.address, + web3.utils.fromAscii("CHANGE_PERMISSION") + ) + ); }); - it("Should provide all delegates with specified permission", async() => { - await I_GeneralPermissionManager.changePermission(account_delegate2, I_GeneralTransferManager.address, "WHITELIST", true, {from: token_owner}); - let tx = await I_GeneralPermissionManager.getAllDelegatesWithPerm.call(I_GeneralTransferManager.address, "WHITELIST"); + it("Should provide all delegates with specified permission", async () => { + await I_GeneralPermissionManager.changePermission(account_delegate2, I_GeneralTransferManager.address, web3.utils.fromAscii("WHITELIST"), true, { + from: token_owner + }); + let tx = await I_GeneralPermissionManager.getAllDelegatesWithPerm.call(I_GeneralTransferManager.address, web3.utils.fromAscii("WHITELIST")); assert.equal(tx.length, 3); assert.equal(tx[0], account_delegate); assert.equal(tx[1], account_delegate2); }); - it("Should get all delegates for the permission manager", async() => { - let tx = await I_GeneralPermissionManager.getAllDelegatesWithPerm.call(I_GeneralPermissionManager.address, "CHANGE_PERMISSION"); + it("Should get all delegates for the permission manager", async () => { + let tx = await I_GeneralPermissionManager.getAllDelegatesWithPerm.call(I_GeneralPermissionManager.address, web3.utils.fromAscii("CHANGE_PERMISSION")); assert.equal(tx.length, 1); assert.equal(tx[0], account_delegate3); - }) + }); - it("Should return all modules and all permission", async() => { - let tx = await I_GeneralPermissionManager.getAllModulesAndPermsFromTypes.call(account_delegate3, [2,1]); + it("Should return all modules and all permission", async () => { + let tx = await I_GeneralPermissionManager.getAllModulesAndPermsFromTypes.call(account_delegate3, [2, 1]); assert.equal(tx[0][0], I_GeneralTransferManager.address); assert.equal(tx[1][0], "0x57484954454c4953540000000000000000000000000000000000000000000000"); assert.equal(tx[0][1], I_GeneralPermissionManager.address); assert.equal(tx[1][1], "0x4348414e47455f5045524d495353494f4e000000000000000000000000000000"); }); - }); describe("General Permission Manager Factory test cases", async () => { @@ -420,9 +440,9 @@ contract('GeneralPermissionManager', accounts => { assert.equal(tags.length, 0); }); - it("Should ge the version of the factory", async() => { + it("Should ge the version of the factory", async () => { let version = await I_GeneralPermissionManagerFactory.version.call(); assert.equal(version, "1.0.0"); - }) + }); }); }); diff --git a/test/h_general_transfer_manager.js b/test/h_general_transfer_manager.js index 457898b58..4876765fc 100644 --- a/test/h_general_transfer_manager.js +++ b/test/h_general_transfer_manager.js @@ -7,17 +7,16 @@ import { encodeProxyCall, encodeModuleCall } from "./helpers/encodeCall"; import { catchRevert } from "./helpers/exceptions"; import { setUpPolymathNetwork, deployGPMAndVerifyed, deployDummySTOAndVerifyed, deployGTMAndVerifyed } from "./helpers/createInstances"; - const DummySTO = artifacts.require("./DummySTO.sol"); const SecurityToken = artifacts.require("./SecurityToken.sol"); const GeneralTransferManager = artifacts.require("./GeneralTransferManager"); const GeneralPermissionManager = artifacts.require("./GeneralPermissionManager"); const Web3 = require("web3"); -const BigNumber = require("bignumber.js"); +let BN = Web3.utils.BN; const web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545")); // Hardcoded development port -contract("GeneralTransferManager", accounts => { +contract("GeneralTransferManager", async (accounts) => { // Accounts Variable declaration let account_polymath; let account_issuer; @@ -32,9 +31,9 @@ contract("GeneralTransferManager", accounts => { let account_affiliates2; // investor Details - let fromTime = latestTime(); - let toTime = latestTime(); - let expiryTime = toTime + duration.days(15); + let fromTime; + let toTime; + let expiryTime; let message = "Transaction Should Fail!"; @@ -73,17 +72,27 @@ contract("GeneralTransferManager", accounts => { const stoKey = 3; // Initial fee for ticker registry and security token registry - const initRegFee = web3.utils.toWei("250"); + const initRegFee = new BN(web3.utils.toWei("250")); // Dummy STO details - const startTime = latestTime() + duration.seconds(5000); // Start time will be 5000 seconds more than the latest time - const endTime = startTime + duration.days(80); // Add 80 days more - const cap = web3.utils.toWei("10", "ether"); + let startTime; + let endTime; + const cap = new BN(web3.utils.toWei("10", "ether")); const someString = "A string which is not used"; const STOParameters = ["uint256", "uint256", "uint256", "string"]; + let currentTime; + const address_zero = "0x0000000000000000000000000000000000000000"; + const one_address = "0x0000000000000000000000000000000000000001"; + before(async () => { - // Accounts setup + currentTime = new BN(await latestTime()); + fromTime = await latestTime(); + toTime = await latestTime(); + expiryTime = toTime + duration.days(15); + startTime = await latestTime() + duration.seconds(5000); // Start time will be 5000 seconds more than the latest time + endTime = startTime + duration.days(80); // Add 80 days more + account_polymath = accounts[0]; account_issuer = accounts[1]; @@ -118,9 +127,9 @@ contract("GeneralTransferManager", accounts => { ] = instances; [I_GeneralPermissionManagerFactory] = await deployGPMAndVerifyed(account_polymath, I_MRProxied, 0); - [P_GeneralTransferManagerFactory] = await deployGTMAndVerifyed(account_polymath, I_MRProxied, web3.utils.toWei("500")); + [P_GeneralTransferManagerFactory] = await deployGTMAndVerifyed(account_polymath, I_MRProxied, new BN(web3.utils.toWei("500"))); [I_DummySTOFactory] = await deployDummySTOAndVerifyed(account_polymath, I_MRProxied, 0); - [P_DummySTOFactory] = await deployDummySTOAndVerifyed(account_polymath, I_MRProxied, web3.utils.toWei("500")); + [P_DummySTOFactory] = await deployDummySTOAndVerifyed(account_polymath, I_MRProxied, new BN(web3.utils.toWei("500"))); // Printing all the contract addresses console.log(` @@ -151,15 +160,15 @@ contract("GeneralTransferManager", accounts => { it("Should generate the new security token with the same symbol as registered above", async () => { await I_PolyToken.approve(I_STRProxied.address, initRegFee, { from: token_owner }); - let _blockNo = latestBlock(); + let tx = await I_STRProxied.generateSecurityToken(name, symbol, tokenDetails, false, { from: token_owner }); // Verify the successful generation of the security token assert.equal(tx.logs[2].args._ticker, symbol.toUpperCase(), "SecurityToken doesn't get deployed"); - I_SecurityToken = SecurityToken.at(tx.logs[2].args._securityTokenAddress); + I_SecurityToken = await SecurityToken.at(tx.logs[2].args._securityTokenAddress); - const log = await promisifyLogWatch(I_SecurityToken.ModuleAdded({ from: _blockNo }), 1); + const log = (await I_SecurityToken.getPastEvents('ModuleAdded', {filter: {transactionHash: tx.transactionHash}}))[0]; // Verify that GeneralTransferManager module get added successfully or not assert.equal(log.args._types[0].toNumber(), 2); @@ -168,28 +177,30 @@ contract("GeneralTransferManager", accounts => { it("Should intialize the auto attached modules", async () => { let moduleData = (await I_SecurityToken.getModulesByType(2))[0]; - I_GeneralTransferManager = GeneralTransferManager.at(moduleData); + I_GeneralTransferManager = await GeneralTransferManager.at(moduleData); }); - it("Should attach the paid GTM -- failed because of no tokens", async() => { + it("Should attach the paid GTM -- failed because of no tokens", async () => { await catchRevert( - I_SecurityToken.addModule(P_GeneralTransferManagerFactory.address, "", web3.utils.toWei("500"), 0, {from: account_issuer}) + I_SecurityToken.addModule(P_GeneralTransferManagerFactory.address, "0x0", new BN(web3.utils.toWei("500")), new BN(0), { from: account_issuer }) ); }); - it("Should attach the paid GTM", async() => { + it("Should attach the paid GTM", async () => { let snap_id = await takeSnapshot(); - await I_PolyToken.getTokens(web3.utils.toWei("500"), I_SecurityToken.address); - await I_SecurityToken.addModule(P_GeneralTransferManagerFactory.address, "", web3.utils.toWei("500"), 0, {from: account_issuer}); + await I_PolyToken.getTokens(new BN(web3.utils.toWei("500")), I_SecurityToken.address); + await I_SecurityToken.addModule(P_GeneralTransferManagerFactory.address, "0x0", new BN(web3.utils.toWei("500")), new BN(0), { + from: account_issuer + }); await revertToSnapshot(snap_id); }); it("Should whitelist the affiliates before the STO attached", async () => { let tx = await I_GeneralTransferManager.modifyWhitelistMulti( [account_affiliates1, account_affiliates2], - [latestTime() + duration.days(30), latestTime() + duration.days(30)], - [latestTime() + duration.days(90), latestTime() + duration.days(90)], - [latestTime() + duration.years(1), latestTime() + duration.years(1)], + [currentTime + currentTime.add(new BN(duration.days(30))), currentTime.add(new BN(duration.days(30)))], + [currentTime + currentTime.add(new BN(duration.days(90))), currentTime.add(new BN(duration.days(90)))], + [currentTime + currentTime.add(new BN(duration.days(965))), currentTime.add(new BN(duration.days(365)))], [false, false], { from: account_issuer, @@ -206,110 +217,102 @@ contract("GeneralTransferManager", accounts => { it("Should whitelist lots of addresses and check gas", async () => { let mockInvestors = []; for (let i = 0; i < 50; i++) { - mockInvestors.push("0x1000000000000000000000000000000000000000".substring(0,42-i.toString().length) + i.toString()); + mockInvestors.push("0x1000000000000000000000000000000000000000".substring(0, 42 - i.toString().length) + i.toString()); } let times = range1(50); let bools = rangeB(50); - let tx = await I_GeneralTransferManager.modifyWhitelistMulti( - mockInvestors, - times, - times, - times, - bools, - { - from: account_issuer, - gas: 7900000 - } - ); + let tx = await I_GeneralTransferManager.modifyWhitelistMulti(mockInvestors, times, times, times, bools, { + from: account_issuer, + gas: 7900000 + }); console.log("Multi Whitelist x 50: " + tx.receipt.gasUsed); - assert.deepEqual(await I_GeneralTransferManager.getInvestors.call(), [account_affiliates1, account_affiliates2].concat(mockInvestors)); + assert.deepEqual( + await I_GeneralTransferManager.getInvestors.call(), + [account_affiliates1, account_affiliates2].concat(mockInvestors) + ); }); it("Should mint the tokens to the affiliates", async () => { - await I_SecurityToken.mintMulti([account_affiliates1, account_affiliates2], [100 * Math.pow(10, 18), 100 * Math.pow(10, 18)], { + await I_SecurityToken.mintMulti([account_affiliates1, account_affiliates2], [new BN(100).mul(new BN(10).pow(new BN(18))), new BN(10).pow(new BN(20))], { from: account_issuer, gas: 6000000 }); - assert.equal((await I_SecurityToken.balanceOf.call(account_affiliates1)).dividedBy(new BigNumber(10).pow(18)).toNumber(), 100); - assert.equal((await I_SecurityToken.balanceOf.call(account_affiliates2)).dividedBy(new BigNumber(10).pow(18)).toNumber(), 100); + assert.equal((await I_SecurityToken.balanceOf.call(account_affiliates1)).div(new BN(10).pow(new BN(18))).toNumber(), 100); + assert.equal((await I_SecurityToken.balanceOf.call(account_affiliates2)).div(new BN(10).pow(new BN(18))).toNumber(), 100); }); - it("Should successfully attach the STO factory with the security token -- failed because of no tokens", async () => { let bytesSTO = encodeModuleCall(STOParameters, [ - latestTime() + duration.seconds(1000), - latestTime() + duration.days(40), + await latestTime() + duration.seconds(1000), + await latestTime() + duration.days(40), cap, someString ]); await catchRevert( - I_SecurityToken.addModule(P_DummySTOFactory.address, bytesSTO, web3.utils.toWei("500"), 0, { from: token_owner }) + I_SecurityToken.addModule(P_DummySTOFactory.address, bytesSTO, new BN(web3.utils.toWei("500")), new BN(0), { from: token_owner }) ); }); it("Should successfully attach the STO factory with the security token", async () => { let snap_id = await takeSnapshot(); let bytesSTO = encodeModuleCall(STOParameters, [ - latestTime() + duration.seconds(1000), - latestTime() + duration.days(40), + await latestTime() + duration.seconds(1000), + await latestTime() + duration.days(40), cap, someString ]); - await I_PolyToken.getTokens(web3.utils.toWei("500"), I_SecurityToken.address); - const tx = await I_SecurityToken.addModule(P_DummySTOFactory.address, bytesSTO, web3.utils.toWei("500"), 0, { from: token_owner }); + await I_PolyToken.getTokens(new BN(web3.utils.toWei("500")), I_SecurityToken.address); + const tx = await I_SecurityToken.addModule(P_DummySTOFactory.address, bytesSTO, new BN(web3.utils.toWei("500")), new BN(0), { + from: token_owner + }); assert.equal(tx.logs[3].args._types[0].toNumber(), stoKey, "DummySTO doesn't get deployed"); assert.equal( web3.utils.toAscii(tx.logs[3].args._name).replace(/\u0000/g, ""), "DummySTO", "DummySTOFactory module was not added" ); - I_DummySTO = DummySTO.at(tx.logs[3].args._module); + I_DummySTO = await DummySTO.at(tx.logs[3].args._module); await revertToSnapshot(snap_id); }); it("Should successfully attach the STO factory with the security token - invalid data", async () => { - let bytesSTO = encodeModuleCall(['uint256', 'string'], [ - latestTime() + duration.seconds(1000), - someString - ]); - await catchRevert( - I_SecurityToken.addModule(P_DummySTOFactory.address, bytesSTO, 0, 0, { from: token_owner }) - ); + let bytesSTO = encodeModuleCall(["uint256", "string"], [await latestTime() + duration.seconds(1000), someString]); + await catchRevert(I_SecurityToken.addModule(P_DummySTOFactory.address, bytesSTO, new BN(0), new BN(0), { from: token_owner })); }); it("Should successfully attach the STO factory with the security token", async () => { let bytesSTO = encodeModuleCall(STOParameters, [ - latestTime() + duration.seconds(1000), - latestTime() + duration.days(40), + await latestTime() + duration.seconds(1000), + await latestTime() + duration.days(40), cap, someString ]); - const tx = await I_SecurityToken.addModule(I_DummySTOFactory.address, bytesSTO, 0, 0, { from: token_owner }); + const tx = await I_SecurityToken.addModule(I_DummySTOFactory.address, bytesSTO, new BN(0), new BN(0), { from: token_owner }); assert.equal(tx.logs[2].args._types[0].toNumber(), stoKey, "DummySTO doesn't get deployed"); assert.equal( web3.utils.toAscii(tx.logs[2].args._name).replace(/\u0000/g, ""), "DummySTO", "DummySTOFactory module was not added" ); - I_DummySTO = DummySTO.at(tx.logs[2].args._module); + I_DummySTO = await DummySTO.at(tx.logs[2].args._module); }); it("Should successfully attach the permission manager factory with the security token", async () => { - const tx = await I_SecurityToken.addModule(I_GeneralPermissionManagerFactory.address, 0, 0, 0, { from: token_owner }); + const tx = await I_SecurityToken.addModule(I_GeneralPermissionManagerFactory.address, new BN(0), new BN(0), new BN(0), { from: token_owner }); assert.equal(tx.logs[2].args._types[0].toNumber(), delegateManagerKey, "GeneralPermissionManager doesn't get deployed"); assert.equal( web3.utils.toAscii(tx.logs[2].args._name).replace(/\u0000/g, ""), "GeneralPermissionManager", "GeneralPermissionManager module was not added" ); - I_GeneralPermissionManager = GeneralPermissionManager.at(tx.logs[2].args._module); + I_GeneralPermissionManager = await GeneralPermissionManager.at(tx.logs[2].args._module); }); }); describe("Buy tokens using on-chain whitelist", async () => { it("Should buy the tokens -- Failed due to investor is not in the whitelist", async () => { - await catchRevert(I_DummySTO.generateTokens(account_investor1, web3.utils.toWei("1", "ether"), { from: token_owner })); + await catchRevert(I_DummySTO.generateTokens(account_investor1, new BN(web3.utils.toWei("1", "ether")), { from: token_owner })); }); it("Should Buy the tokens", async () => { @@ -317,9 +320,9 @@ contract("GeneralTransferManager", accounts => { let tx = await I_GeneralTransferManager.modifyWhitelist( account_investor1, - latestTime(), - latestTime(), - latestTime() + duration.days(10), + currentTime, + currentTime, + currentTime.add(new BN(duration.days(10))), true, { from: account_issuer, @@ -337,37 +340,35 @@ contract("GeneralTransferManager", accounts => { await increaseTime(5000); // Mint some tokens - await I_DummySTO.generateTokens(account_investor1, web3.utils.toWei("1", "ether"), { from: token_owner }); + await I_DummySTO.generateTokens(account_investor1, new BN(web3.utils.toWei("1", "ether")), { from: token_owner }); - assert.equal((await I_SecurityToken.balanceOf(account_investor1)).toNumber(), web3.utils.toWei("1", "ether")); + assert.equal((await I_SecurityToken.balanceOf(account_investor1)).toString(), new BN(web3.utils.toWei("1", "ether")).toString()); }); it("Should fail in buying the token from the STO", async () => { - await catchRevert(I_DummySTO.generateTokens(account_affiliates1, web3.utils.toWei("1", "ether"), { from: token_owner })); + await catchRevert(I_DummySTO.generateTokens(account_affiliates1, new BN(web3.utils.toWei("1", "ether")), { from: token_owner })); }); - it("Should fail in buying the tokens from the STO -- because amount is 0", async() => { - await catchRevert( - I_DummySTO.generateTokens(account_investor1, 0, { from: token_owner }) - ); + it("Should fail in buying the tokens from the STO -- because amount is 0", async () => { + await catchRevert(I_DummySTO.generateTokens(account_investor1, new BN(0), { from: token_owner })); }); - it("Should fail in buying the tokens from the STO -- because STO is paused", async() => { - await I_DummySTO.pause({from: account_issuer }); - await catchRevert(I_DummySTO.generateTokens(account_investor1, web3.utils.toWei("1", "ether"), { from: token_owner })); + it("Should fail in buying the tokens from the STO -- because STO is paused", async () => { + await I_DummySTO.pause({ from: account_issuer }); + await catchRevert(I_DummySTO.generateTokens(account_investor1, new BN(web3.utils.toWei("1", "ether")), { from: token_owner })); // Reverting the changes releated to pause - await I_DummySTO.unpause({from: account_issuer }); + await I_DummySTO.unpause({ from: account_issuer }); }); - it("Should buy more tokens from the STO to investor1", async() => { - await I_DummySTO.generateTokens(account_investor1, web3.utils.toWei("1", "ether"), { from: token_owner }); - assert.equal((await I_SecurityToken.balanceOf(account_investor1)).toNumber(), web3.utils.toWei("2", "ether")); + it("Should buy more tokens from the STO to investor1", async () => { + await I_DummySTO.generateTokens(account_investor1, new BN(web3.utils.toWei("1", "ether")), { from: token_owner }); + assert.equal((await I_SecurityToken.balanceOf(account_investor1)).toString(), new BN(web3.utils.toWei("2", "ether")).toString()); }); it("Should fail in investing the money in STO -- expiry limit reached", async () => { await increaseTime(duration.days(10)); - await catchRevert(I_DummySTO.generateTokens(account_investor1, web3.utils.toWei("1", "ether"), { from: token_owner })); + await catchRevert(I_DummySTO.generateTokens(account_investor1, new BN(web3.utils.toWei("1", "ether")), { from: token_owner })); }); }); @@ -377,17 +378,10 @@ contract("GeneralTransferManager", accounts => { it("Should Buy the tokens", async () => { // Add the Investor in to the whitelist // snap_id = await takeSnapshot(); - let tx = await I_GeneralTransferManager.modifyWhitelist( - account_investor1, - 0, - 0, - latestTime() + duration.days(20), - true, - { - from: account_issuer, - gas: 6000000 - } - ); + let tx = await I_GeneralTransferManager.modifyWhitelist(account_investor1, new BN(0), new BN(0), currentTime.add(new BN(duration.days(20))), true, { + from: account_issuer, + gas: 6000000 + }); assert.equal( tx.logs[0].args._investor.toLowerCase(), @@ -397,9 +391,9 @@ contract("GeneralTransferManager", accounts => { tx = await I_GeneralTransferManager.modifyWhitelist( account_investor2, - latestTime(), - latestTime(), - latestTime() + duration.days(20), + currentTime, + currentTime, + currentTime.add(new BN(duration.days(20))), true, { from: account_issuer, @@ -417,54 +411,44 @@ contract("GeneralTransferManager", accounts => { await increaseTime(5000); // Can transfer tokens - await I_SecurityToken.transfer(account_investor2, web3.utils.toWei("1", "ether"), {from: account_investor1}); - assert.equal((await I_SecurityToken.balanceOf(account_investor1)).toNumber(), web3.utils.toWei("1", "ether")); - assert.equal((await I_SecurityToken.balanceOf(account_investor1)).toNumber(), web3.utils.toWei("1", "ether")); + await I_SecurityToken.transfer(account_investor2, new BN(web3.utils.toWei("1", "ether")), { from: account_investor1 }); + assert.equal((await I_SecurityToken.balanceOf(account_investor1)).toString(), new BN(web3.utils.toWei("1", "ether")).toString()); + assert.equal((await I_SecurityToken.balanceOf(account_investor1)).toString(), new BN(web3.utils.toWei("1", "ether")).toString()); }); it("Add a from default and check transfers are disabled then enabled in the future", async () => { - let tx = await I_GeneralTransferManager.changeDefaults(latestTime() + duration.days(5), 0, {from: token_owner}); - await I_SecurityToken.transfer(account_investor1, web3.utils.toWei("1", "ether"), {from: account_investor2}); - await catchRevert(I_SecurityToken.transfer(account_investor2, web3.utils.toWei("1", "ether"), {from: account_investor1})); + let tx = await I_GeneralTransferManager.changeDefaults(currentTime.add(new BN(duration.days(12))), new BN(0), { from: token_owner }); + await I_SecurityToken.transfer(account_investor1, new BN(web3.utils.toWei("1", "ether")), { from: account_investor2 }); + await catchRevert(I_SecurityToken.transfer(account_investor2, new BN(web3.utils.toWei("1", "ether")), { from: account_investor1 })); await increaseTime(duration.days(5)); - await I_SecurityToken.transfer(account_investor2, web3.utils.toWei("1", "ether"), {from: account_investor1}); + await I_SecurityToken.transfer(account_investor2, new BN(web3.utils.toWei("1", "ether")), { from: account_investor1 }); }); it("Add a to default and check transfers are disabled then enabled in the future", async () => { - let tx = await I_GeneralTransferManager.changeDefaults(0, latestTime() + duration.days(5), {from: token_owner}); - await catchRevert(I_SecurityToken.transfer(account_investor1, web3.utils.toWei("1", "ether"), {from: account_investor2})); - await I_SecurityToken.transfer(account_investor2, web3.utils.toWei("1", "ether"), {from: account_investor1}); - await increaseTime(duration.days(5)); - await I_SecurityToken.transfer(account_investor1, web3.utils.toWei("2", "ether"), {from: account_investor2}); + let tx = await I_GeneralTransferManager.changeDefaults(0, currentTime.add(new BN(duration.days(16))), { from: token_owner }); + await catchRevert(I_SecurityToken.transfer(account_investor1, new BN(web3.utils.toWei("1", "ether")), { from: account_investor2 })); + await I_SecurityToken.transfer(account_investor2, new BN(web3.utils.toWei("1", "ether")), { from: account_investor1 }); + await increaseTime(duration.days(2)); + await I_SecurityToken.transfer(account_investor1, new BN(web3.utils.toWei("2", "ether")), { from: account_investor2 }); // revert changes - await I_GeneralTransferManager.modifyWhitelist( - account_investor2, - 0, - 0, - 0, - false, - { - from: account_issuer, - gas: 6000000 - } - ); - await I_GeneralTransferManager.changeDefaults(0, 0, {from: token_owner}); + await I_GeneralTransferManager.modifyWhitelist(account_investor2, new BN(0), new BN(0), new BN(0), false, { + from: account_issuer, + gas: 6000000 + }); + await I_GeneralTransferManager.changeDefaults(0, new BN(0), { from: token_owner }); }); - - - }); describe("Buy tokens using off-chain whitelist", async () => { it("Should buy the tokens -- Failed due to investor is not in the whitelist", async () => { - await catchRevert(I_DummySTO.generateTokens(account_investor2, web3.utils.toWei("1", "ether"), { from: token_owner })); + await catchRevert(I_DummySTO.generateTokens(account_investor2, new BN(web3.utils.toWei("1", "ether")), { from: token_owner })); }); it("Should buy the tokens -- Failed due to incorrect signature input", async () => { // Add the Investor in to the whitelist //tmAddress, investorAddress, fromTime, toTime, validFrom, validTo, pk - let validFrom = latestTime(); - let validTo = latestTime() + duration.days(5); + let validFrom = await latestTime(); + let validTo = await latestTime() + duration.days(5); let nonce = 5; const sig = signData( account_investor2, @@ -507,8 +491,8 @@ contract("GeneralTransferManager", accounts => { it("Should buy the tokens -- Failed due to incorrect signature timing", async () => { // Add the Investor in to the whitelist //tmAddress, investorAddress, fromTime, toTime, validFrom, validTo, pk - let validFrom = latestTime() - 100; - let validTo = latestTime() - 1; + let validFrom = await latestTime() - 100; + let validTo = await latestTime() - 1; let nonce = 5; const sig = signData( I_GeneralTransferManager.address, @@ -551,8 +535,8 @@ contract("GeneralTransferManager", accounts => { it("Should buy the tokens -- Failed due to incorrect signature signer", async () => { // Add the Investor in to the whitelist //tmAddress, investorAddress, fromTime, toTime, validFrom, validTo, pk - let validFrom = latestTime(); - let validTo = latestTime() + 60 * 60; + let validFrom = await latestTime(); + let validTo = await latestTime() + 60 * 60; let nonce = 5; const sig = signData( account_investor2, @@ -595,14 +579,14 @@ contract("GeneralTransferManager", accounts => { it("Should Buy the tokens", async () => { // Add the Investor in to the whitelist //tmAddress, investorAddress, fromTime, toTime, validFrom, validTo, pk - let validFrom = latestTime(); - let validTo = latestTime() + duration.days(5); + let validFrom = await latestTime(); + let validTo = await latestTime() + duration.days(5); let nonce = 5; const sig = signData( I_GeneralTransferManager.address, account_investor2, - latestTime(), - latestTime() + duration.days(80), + currentTime.toNumber(), + currentTime.add(new BN(duration.days(100))).toNumber(), expiryTime + duration.days(200), true, validFrom, @@ -617,8 +601,8 @@ contract("GeneralTransferManager", accounts => { let tx = await I_GeneralTransferManager.modifyWhitelistSigned( account_investor2, - latestTime(), - latestTime() + duration.days(80), + currentTime.toNumber(), + currentTime.add(new BN(duration.days(100))).toNumber(), expiryTime + duration.days(200), true, validFrom, @@ -643,22 +627,22 @@ contract("GeneralTransferManager", accounts => { await increaseTime(10000); // Mint some tokens - await I_DummySTO.generateTokens(account_investor2, web3.utils.toWei("1", "ether"), { from: token_owner }); + await I_DummySTO.generateTokens(account_investor2, new BN(web3.utils.toWei("1", "ether")), { from: token_owner }); - assert.equal((await I_SecurityToken.balanceOf(account_investor2)).toNumber(), web3.utils.toWei("1", "ether")); + assert.equal((await I_SecurityToken.balanceOf(account_investor2)).toString(), new BN(web3.utils.toWei("1", "ether")).toString()); }); - it("Should fail if the txn is generated with same nonce", async() => { + it("Should fail if the txn is generated with same nonce", async () => { // Add the Investor in to the whitelist //tmAddress, investorAddress, fromTime, toTime, validFrom, validTo, pk - let validFrom = latestTime(); - let validTo = latestTime() + duration.days(5); + let validFrom = await latestTime(); + let validTo = await latestTime() + duration.days(5); let nonce = 5; const sig = signData( I_GeneralTransferManager.address, account_investor2, - latestTime(), - latestTime() + duration.days(80), + currentTime.toNumber(), + currentTime.add(new BN(duration.days(100))).toNumber(), expiryTime + duration.days(200), true, validFrom, @@ -671,25 +655,26 @@ contract("GeneralTransferManager", accounts => { const s = `0x${sig.s.toString("hex")}`; const v = sig.v; - await catchRevert(I_GeneralTransferManager.modifyWhitelistSigned( - account_investor2, - latestTime(), - latestTime() + duration.days(80), - expiryTime + duration.days(200), - true, - validFrom, - validTo, - nonce, - v, - r, - s, - { - from: account_investor2, - gas: 6000000 - } - ) + await catchRevert( + I_GeneralTransferManager.modifyWhitelistSigned( + account_investor2, + currentTime.toNumber(), + currentTime.add(new BN(duration.days(100))).toNumber(), + expiryTime + duration.days(200), + true, + validFrom, + validTo, + nonce, + v, + r, + s, + { + from: account_investor2, + gas: 6000000 + } + ) ); - }) + }); it("Should fail in changing the signing address", async () => { await catchRevert(I_GeneralTransferManager.changeSigningAddress(account_polymath, { from: account_investor4 })); @@ -701,16 +686,16 @@ contract("GeneralTransferManager", accounts => { assert.equal(web3.utils.toAscii(perm[1]).replace(/\u0000/g, ""), "FLAGS"); }); - it("Should provide the permission and change the signing address", async() => { - let log = await I_GeneralPermissionManager.addDelegate(account_delegate, "My details", {from: token_owner}); + it("Should provide the permission and change the signing address", async () => { + let log = await I_GeneralPermissionManager.addDelegate(account_delegate, web3.utils.fromAscii("My details"), { from: token_owner }); assert.equal(log.logs[0].args._delegate, account_delegate); - await I_GeneralPermissionManager.changePermission(account_delegate, I_GeneralTransferManager.address, "FLAGS", true, { + await I_GeneralPermissionManager.changePermission(account_delegate, I_GeneralTransferManager.address, web3.utils.fromAscii("FLAGS"), true, { from: token_owner }); assert.isTrue( - await I_GeneralPermissionManager.checkPermission.call(account_delegate, I_GeneralTransferManager.address, "FLAGS") + await I_GeneralPermissionManager.checkPermission.call(account_delegate, I_GeneralTransferManager.address, web3.utils.fromAscii("FLAGS")) ); let tx = await I_GeneralTransferManager.changeSigningAddress(account_polymath, { from: account_delegate }); @@ -718,29 +703,29 @@ contract("GeneralTransferManager", accounts => { }); it("Should fail to pull fees as no budget set", async () => { - await catchRevert(I_GeneralTransferManager.takeFee(web3.utils.toWei("1", "ether"), { from: account_polymath })); + await catchRevert(I_GeneralTransferManager.takeFee(new BN(web3.utils.toWei("1", "ether")), { from: account_polymath })); }); it("Should set a budget for the GeneralTransferManager", async () => { - await I_SecurityToken.changeModuleBudget(I_GeneralTransferManager.address, 10 * Math.pow(10, 18), true, { from: token_owner }); + await I_SecurityToken.changeModuleBudget(I_GeneralTransferManager.address, new BN(10).pow(new BN(19)), true, { from: token_owner }); - await catchRevert(I_GeneralTransferManager.takeFee(web3.utils.toWei("1", "ether"), { from: token_owner })); - await I_PolyToken.getTokens(10 * Math.pow(10, 18), token_owner); - await I_PolyToken.transfer(I_SecurityToken.address, 10 * Math.pow(10, 18), { from: token_owner }); + await catchRevert(I_GeneralTransferManager.takeFee(new BN(web3.utils.toWei("1", "ether")), { from: token_owner })); + await I_PolyToken.getTokens(new BN(10).pow(new BN(19)), token_owner); + await I_PolyToken.transfer(I_SecurityToken.address, new BN(10).pow(new BN(19)), { from: token_owner }); }); it("Factory owner should pull fees - fails as not permissioned by issuer", async () => { - await catchRevert(I_GeneralTransferManager.takeFee(web3.utils.toWei("1", "ether"), { from: account_delegate })); + await catchRevert(I_GeneralTransferManager.takeFee(new BN(web3.utils.toWei("1", "ether")), { from: account_delegate })); }); it("Factory owner should pull fees", async () => { - await I_GeneralPermissionManager.changePermission(account_delegate, I_GeneralTransferManager.address, "FEE_ADMIN", true, { + await I_GeneralPermissionManager.changePermission(account_delegate, I_GeneralTransferManager.address, web3.utils.fromAscii("FEE_ADMIN"), true, { from: token_owner }); let balanceBefore = await I_PolyToken.balanceOf(account_polymath); - await I_GeneralTransferManager.takeFee(web3.utils.toWei("1", "ether"), { from: account_delegate }); + await I_GeneralTransferManager.takeFee(new BN(web3.utils.toWei("1", "ether")), { from: account_delegate }); let balanceAfter = await I_PolyToken.balanceOf(account_polymath); - assert.equal(balanceBefore.add(web3.utils.toWei("1", "ether")).toNumber(), balanceAfter.toNumber(), "Fee is transferred"); + assert.equal(balanceBefore.add(new BN(web3.utils.toWei("1", "ether"))).toString(), balanceAfter.toString(), "Fee is transferred"); }); it("Should change the white list transfer variable", async () => { @@ -751,7 +736,7 @@ contract("GeneralTransferManager", accounts => { it("should failed in trasfering the tokens", async () => { let tx = await I_GeneralTransferManager.changeAllowAllWhitelistTransfers(true, { from: token_owner }); await I_GeneralTransferManager.pause({ from: token_owner }); - await catchRevert(I_SecurityToken.transfer(account_investor1, web3.utils.toWei("2", "ether"), { from: account_investor2 })); + await catchRevert(I_SecurityToken.transfer(account_investor1, new BN(web3.utils.toWei("2", "ether")), { from: account_investor2 })); }); it("Should change the Issuance address", async () => { @@ -773,8 +758,8 @@ contract("GeneralTransferManager", accounts => { describe("WhiteList that addresses", async () => { it("Should fail in adding the investors in whitelist", async () => { - let fromTime = latestTime(); - let toTime = latestTime() + duration.days(20); + let fromTime = await latestTime(); + let toTime = await latestTime() + duration.days(20); let expiryTime = toTime + duration.days(10); await catchRevert( @@ -793,8 +778,8 @@ contract("GeneralTransferManager", accounts => { }); it("Should fail in adding the investors in whitelist -- array length mismatch", async () => { - let fromTime = latestTime(); - let toTime = latestTime() + duration.days(20); + let fromTime = await latestTime(); + let toTime = await latestTime() + duration.days(20); let expiryTime = toTime + duration.days(10); await catchRevert( @@ -813,8 +798,8 @@ contract("GeneralTransferManager", accounts => { }); it("Should fail in adding the investors in whitelist -- array length mismatch", async () => { - let fromTime = latestTime(); - let toTime = latestTime() + duration.days(20); + let fromTime = await latestTime(); + let toTime = await latestTime() + duration.days(20); let expiryTime = toTime + duration.days(10); await catchRevert( @@ -833,8 +818,8 @@ contract("GeneralTransferManager", accounts => { }); it("Should fail in adding the investors in whitelist -- array length mismatch", async () => { - let fromTime = latestTime(); - let toTime = latestTime() + duration.days(20); + let fromTime = await latestTime(); + let toTime = await latestTime() + duration.days(20); let expiryTime = toTime + duration.days(10); await catchRevert( @@ -853,8 +838,8 @@ contract("GeneralTransferManager", accounts => { }); it("Should successfully add the investors in whitelist", async () => { - let fromTime = latestTime(); - let toTime = latestTime() + duration.days(20); + let fromTime = await latestTime(); + let toTime = await latestTime() + duration.days(20); let expiryTime = toTime + duration.days(10); let tx = await I_GeneralTransferManager.modifyWhitelistMulti( @@ -920,7 +905,7 @@ contract("GeneralTransferManager", accounts => { assert.equal(web3.utils.toAscii(tags[0]).replace(/\u0000/g, ""), "Dummy"); }); - it("Should get the version of factory", async() => { + it("Should get the version of factory", async () => { let version = await I_DummySTOFactory.version.call(); assert.equal(version, "1.0.0"); }); @@ -928,11 +913,11 @@ contract("GeneralTransferManager", accounts => { describe("Test cases for the get functions of the dummy sto", async () => { it("Should get the raised amount of ether", async () => { - assert.equal(await I_DummySTO.getRaised.call(0), web3.utils.toWei("0", "ether")); + assert.equal((await I_DummySTO.getRaised.call(0)).toString(), new BN(web3.utils.toWei("0", "ether")).toString()); }); it("Should get the raised amount of poly", async () => { - assert.equal((await I_DummySTO.getRaised.call(1)).toNumber(), web3.utils.toWei("0", "ether")); + assert.equal((await I_DummySTO.getRaised.call(1)).toString(), new BN(web3.utils.toWei("0", "ether")).toString()); }); it("Should get the investors", async () => { @@ -944,11 +929,15 @@ contract("GeneralTransferManager", accounts => { assert.equal(web3.utils.toAscii(tx[0]).replace(/\u0000/g, ""), "ADMIN"); }); - it("Should get the amount of tokens sold", async() => { + it("Should get the amount of tokens sold", async () => { assert.equal(await I_DummySTO.getTokensSold.call(), 0); - }) + }); }); }); -function range1(i) {return i?range1(i-1).concat(i):[]} -function rangeB(i) {return i?rangeB(i-1).concat(0):[]} +function range1(i) { + return i ? range1(i - 1).concat(i) : []; +} +function rangeB(i) { + return i ? rangeB(i - 1).concat(0) : []; +} diff --git a/test/helpers/contracts/PolyToken.sol b/test/helpers/contracts/PolyToken.sol index 6f39af814..b9863b0c2 100644 --- a/test/helpers/contracts/PolyToken.sol +++ b/test/helpers/contracts/PolyToken.sol @@ -1,11 +1,9 @@ -pragma solidity ^0.4.24; +pragma solidity ^0.5.0; import "openzeppelin-solidity/contracts/token/ERC20/ERC20Mintable.sol"; - contract PolyToken is ERC20Mintable { - - constructor () public { + constructor() public { } diff --git a/test/helpers/createInstances.js b/test/helpers/createInstances.js index 9a8ada346..4c9f6090c 100644 --- a/test/helpers/createInstances.js +++ b/test/helpers/createInstances.js @@ -41,6 +41,7 @@ const STRGetter = artifacts.require("./STRGetter.sol"); const MockWrongTypeFactory = artifacts.require("./MockWrongTypeFactory.sol"); const Web3 = require("web3"); +let BN = Web3.utils.BN; const web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545")); // Hardcoded development port // Contract Instance Declaration @@ -87,7 +88,7 @@ let I_MRProxied; let I_STRGetter; // Initial fee for ticker registry and security token registry -const initRegFee = web3.utils.toWei("250"); +const initRegFee = new BN(web3.utils.toWei("250")); const STRProxyParameters = ["address", "address", "uint256", "uint256", "address", "address"]; const MRProxyParameters = ["address", "address"]; @@ -114,18 +115,30 @@ export async function setUpPolymathNetwork(account_polymath, token_owner) { await setInPolymathRegistry(account_polymath); // STEP 9: Register the Modules with the ModuleRegistry contract await registerGTM(account_polymath); - let tempArray = new Array(a, b, c, d, e, f); - return mergeReturn(tempArray); + let tempArray = new Array( + I_PolymathRegistry, + I_PolyToken, + I_FeatureRegistry, + I_ModuleRegistry, + I_ModuleRegistryProxy, + I_MRProxied, + I_GeneralTransferManagerFactory, + I_STFactory, + I_SecurityTokenRegistry, + I_SecurityTokenRegistryProxy, + I_STRProxied, + I_STRGetter + ); + return Promise.all(tempArray); } - async function deployPolyRegistryAndPolyToken(account_polymath, token_owner) { // Step 0: Deploy the PolymathRegistry I_PolymathRegistry = await PolymathRegistry.new({ from: account_polymath }); // Step 1: Deploy the token Faucet and Mint tokens for token_owner I_PolyToken = await PolyTokenFaucet.new(); - await I_PolyToken.getTokens(10000 * Math.pow(10, 18), token_owner); + await I_PolyToken.getTokens(new BN(10000).mul(new BN(10).pow(new BN(18))), token_owner); await I_PolymathRegistry.changeAddress("PolyToken", I_PolyToken.address, { from: account_polymath }); @@ -152,7 +165,11 @@ async function deployModuleRegistry(account_polymath) { } async function deployGTMLogic(account_polymath) { - I_GeneralTransferManagerLogic = await GeneralTransferManager.new("0x0000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000", { from: account_polymath }); + I_GeneralTransferManagerLogic = await GeneralTransferManager.new( + "0x0000000000000000000000000000000000000000", + "0x0000000000000000000000000000000000000000", + { from: account_polymath } + ); assert.notEqual( I_GeneralTransferManagerLogic.address.valueOf(), @@ -164,7 +181,9 @@ async function deployGTMLogic(account_polymath) { } async function deployGTM(account_polymath) { - I_GeneralTransferManagerFactory = await GeneralTransferManagerFactory.new(0, 0, 0, I_GeneralTransferManagerLogic.address, { from: account_polymath }); + I_GeneralTransferManagerFactory = await GeneralTransferManagerFactory.new(new BN(0), new BN(0), new BN(0), I_GeneralTransferManagerLogic.address, { + from: account_polymath + }); assert.notEqual( I_GeneralTransferManagerFactory.address.valueOf(), @@ -205,8 +224,8 @@ async function deploySTR(account_polymath) { I_STRGetter.address ]); await I_SecurityTokenRegistryProxy.upgradeToAndCall("1.0.0", I_SecurityTokenRegistry.address, bytesProxy, { from: account_polymath }); - I_STRProxied = SecurityTokenRegistry.at(I_SecurityTokenRegistryProxy.address); - + I_STRProxied = await SecurityTokenRegistry.at(I_SecurityTokenRegistryProxy.address); + I_STRGetter = await STRGetter.at(I_SecurityTokenRegistryProxy.address); return new Array(I_SecurityTokenRegistry, I_SecurityTokenRegistryProxy, I_STRProxied, I_STRGetter); } @@ -231,7 +250,9 @@ async function registerAndVerifyByMR(factoryAdrress, owner, mr) { /// Deploy the TransferManagers export async function deployGTMAndVerifyed(accountPolymath, MRProxyInstance, setupCost) { - I_GeneralTransferManagerFactory = await GeneralTransferManagerFactory.new(setupCost, 0, 0, I_GeneralTransferManagerLogic.address, { from: accountPolymath }); + I_GeneralTransferManagerFactory = await GeneralTransferManagerFactory.new(setupCost, new BN(0), new BN(0), I_GeneralTransferManagerLogic.address, { + from: accountPolymath + }); assert.notEqual( I_GeneralTransferManagerFactory.address.valueOf(), @@ -241,12 +262,12 @@ export async function deployGTMAndVerifyed(accountPolymath, MRProxyInstance, set // (B) : Register the GeneralDelegateManagerFactory await registerAndVerifyByMR(I_GeneralTransferManagerFactory.address, accountPolymath, MRProxyInstance); - return new Array(I_GeneralTransferManagerFactory); + return Promise.all(new Array(I_GeneralTransferManagerFactory)); } export async function deployCountTMAndVerifyed(accountPolymath, MRProxyInstance, setupCost) { I_CountTransferManagerLogic = await CountTransferManager.new("0x0000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000", { from: accountPolymath }); - I_CountTransferManagerFactory = await CountTransferManagerFactory.new(setupCost, 0, 0, I_CountTransferManagerLogic.address, { from: accountPolymath }); + I_CountTransferManagerFactory = await CountTransferManagerFactory.new(setupCost, new BN(0), new BN(0), I_CountTransferManagerLogic.address, { from: accountPolymath }); assert.notEqual( I_CountTransferManagerFactory.address.valueOf(), @@ -255,12 +276,12 @@ export async function deployCountTMAndVerifyed(accountPolymath, MRProxyInstance, ); await registerAndVerifyByMR(I_CountTransferManagerFactory.address, accountPolymath, MRProxyInstance); - return new Array(I_CountTransferManagerFactory); + return Promise.all(new Array(I_CountTransferManagerFactory)); } export async function deployManualApprovalTMAndVerifyed(accountPolymath, MRProxyInstance, setupCost) { I_ManualApprovalTransferManagerLogic = await ManualApprovalTransferManager.new("0x0000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000", { from: accountPolymath }); - I_ManualApprovalTransferManagerFactory = await ManualApprovalTransferManagerFactory.new(setupCost, 0, 0, ManualApprovalTransferManager.address, { from: accountPolymath }); + I_ManualApprovalTransferManagerFactory = await ManualApprovalTransferManagerFactory.new(setupCost, new BN(0), new BN(0), ManualApprovalTransferManager.address, { from: accountPolymath }); assert.notEqual( I_ManualApprovalTransferManagerFactory.address.valueOf(), "0x0000000000000000000000000000000000000000", @@ -268,12 +289,12 @@ export async function deployManualApprovalTMAndVerifyed(accountPolymath, MRProxy ); await registerAndVerifyByMR(I_ManualApprovalTransferManagerFactory.address, accountPolymath, MRProxyInstance); - return new Array(I_ManualApprovalTransferManagerFactory); + return Promise.all(new Array(I_ManualApprovalTransferManagerFactory)); } export async function deployPercentageTMAndVerified(accountPolymath, MRProxyInstance, setupCost) { I_PercentageTransferManagerLogic = await PercentageTransferManager.new("0x0000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000", { from: accountPolymath }); - I_PercentageTransferManagerFactory = await PercentageTransferManagerFactory.new(setupCost, 0, 0, I_PercentageTransferManagerLogic.address, { from: accountPolymath }); + I_PercentageTransferManagerFactory = await PercentageTransferManagerFactory.new(setupCost, new BN(0), new BN(0), I_PercentageTransferManagerLogic.address, { from: accountPolymath }); assert.notEqual( I_PercentageTransferManagerFactory.address.valueOf(), "0x0000000000000000000000000000000000000000", @@ -281,11 +302,13 @@ export async function deployPercentageTMAndVerified(accountPolymath, MRProxyInst ); await registerAndVerifyByMR(I_PercentageTransferManagerFactory.address, accountPolymath, MRProxyInstance); - return new Array(I_PercentageTransferManagerFactory); + return Promise.all(new Array(I_PercentageTransferManagerFactory)); } export async function deployLockupVolumeRTMAndVerified(accountPolymath, MRProxyInstance, setupCost) { - I_VolumeRestrictionTransferManagerFactory = await VolumeRestrictionTransferManagerFactory.new(setupCost, 0, 0, { from: accountPolymath }); + I_VolumeRestrictionTransferManagerFactory = await VolumeRestrictionTransferManagerFactory.new(setupCost, new BN(0), new BN(0), { + from: accountPolymath + }); assert.notEqual( I_VolumeRestrictionTransferManagerFactory.address.valueOf(), "0x0000000000000000000000000000000000000000", @@ -293,11 +316,11 @@ export async function deployLockupVolumeRTMAndVerified(accountPolymath, MRProxyI ); await registerAndVerifyByMR(I_VolumeRestrictionTransferManagerFactory.address, accountPolymath, MRProxyInstance); - return new Array(I_VolumeRestrictionTransferManagerFactory); + return Promise.all(new Array(I_VolumeRestrictionTransferManagerFactory)); } export async function deployScheduleCheckpointAndVerified(accountPolymath, MRProxyInstance, setupCost) { - I_ScheduledCheckpointFactory = await ScheduledCheckpointFactory.new(setupCost, 0, 0, { from: accountPolymath }); + I_ScheduledCheckpointFactory = await ScheduledCheckpointFactory.new(setupCost, new BN(0), new BN(0), { from: accountPolymath }); assert.notEqual( I_ScheduledCheckpointFactory.address.valueOf(), "0x0000000000000000000000000000000000000000", @@ -305,14 +328,14 @@ export async function deployScheduleCheckpointAndVerified(accountPolymath, MRPro ); await registerAndVerifyByMR(I_ScheduledCheckpointFactory.address, accountPolymath, MRProxyInstance); - return new Array(I_ScheduledCheckpointFactory); + return Promise.all(new Array(I_ScheduledCheckpointFactory)); } /// Deploy the Permission Manager export async function deployGPMAndVerifyed(accountPolymath, MRProxyInstance, setupCost) { I_GeneralPermissionManagerLogic = await GeneralPermissionManager.new("0x0000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000", { from: accountPolymath }); - I_GeneralPermissionManagerFactory = await GeneralPermissionManagerFactory.new(setupCost, 0, 0, I_GeneralPermissionManagerLogic.address, { from: accountPolymath }); + I_GeneralPermissionManagerFactory = await GeneralPermissionManagerFactory.new(setupCost, new BN(0), new BN(0), I_GeneralPermissionManagerLogic.address, { from: accountPolymath }); assert.notEqual( I_GeneralPermissionManagerFactory.address.valueOf(), @@ -322,15 +345,14 @@ export async function deployGPMAndVerifyed(accountPolymath, MRProxyInstance, set // (B) : Register the GeneralDelegateManagerFactory await registerAndVerifyByMR(I_GeneralPermissionManagerFactory.address, accountPolymath, MRProxyInstance); - return new Array(I_GeneralPermissionManagerFactory); + return Promise.all(new Array(I_GeneralPermissionManagerFactory)); } - /// Deploy the STO Modules export async function deployDummySTOAndVerifyed(accountPolymath, MRProxyInstance, setupCost) { I_DummySTOLogic = await DummySTO.new("0x0000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000", { from: accountPolymath }); - I_DummySTOFactory = await DummySTOFactory.new(setupCost, 0, 0, I_DummySTOLogic.address,{ from: accountPolymath }); + I_DummySTOFactory = await DummySTOFactory.new(setupCost, new BN(0), new BN(0), I_DummySTOLogic.address,{ from: accountPolymath }); assert.notEqual( I_DummySTOFactory.address.valueOf(), @@ -338,12 +360,12 @@ export async function deployDummySTOAndVerifyed(accountPolymath, MRProxyInstance "DummySTOFactory contract was not deployed" ); await registerAndVerifyByMR(I_DummySTOFactory.address, accountPolymath, MRProxyInstance); - return new Array(I_DummySTOFactory); + return Promise.all(new Array(I_DummySTOFactory)); } export async function deployCappedSTOAndVerifyed(accountPolymath, MRProxyInstance, setupCost) { I_CappedSTOLogic = await CappedSTO.new("0x0000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000", { from: accountPolymath }); - I_CappedSTOFactory = await CappedSTOFactory.new(setupCost, 0, 0, I_CappedSTOLogic.address, { from: accountPolymath }); + I_CappedSTOFactory = await CappedSTOFactory.new(setupCost, new BN(0), new BN(0), I_CappedSTOLogic.address, { from: accountPolymath }); assert.notEqual( I_CappedSTOFactory.address.valueOf(), "0x0000000000000000000000000000000000000000", @@ -351,13 +373,12 @@ export async function deployCappedSTOAndVerifyed(accountPolymath, MRProxyInstanc ); await registerAndVerifyByMR(I_CappedSTOFactory.address, accountPolymath, MRProxyInstance); - return new Array(I_CappedSTOFactory); - + return Promise.all(new Array(I_CappedSTOFactory)); } export async function deployPresaleSTOAndVerified(accountPolymath, MRProxyInstance, setupCost) { I_PreSaleSTOLogic = await PreSaleSTO.new("0x0000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000", { from: accountPolymath }); - I_PreSaleSTOFactory = await PreSaleSTOFactory.new(setupCost, 0, 0, I_PreSaleSTOLogic.address, { from: accountPolymath }); + I_PreSaleSTOFactory = await PreSaleSTOFactory.new(setupCost, new BN(0), new BN(0), I_PreSaleSTOLogic.address, { from: accountPolymath }); assert.notEqual( I_PreSaleSTOFactory.address.valueOf(), @@ -366,13 +387,17 @@ export async function deployPresaleSTOAndVerified(accountPolymath, MRProxyInstan ); await registerAndVerifyByMR(I_PreSaleSTOFactory.address, accountPolymath, MRProxyInstance); - return new Array(I_PreSaleSTOFactory); + return Promise.all(new Array(I_PreSaleSTOFactory)); } export async function deployUSDTieredSTOAndVerified(accountPolymath, MRProxyInstance, setupCost) { - I_USDTieredSTOLogic = await USDTieredSTO.new("0x0000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000", { from: accountPolymath }); + I_USDTieredSTOLogic = await USDTieredSTO.new( + "0x0000000000000000000000000000000000000000", + "0x0000000000000000000000000000000000000000", + { from: accountPolymath } + ); - I_USDTieredSTOFactory = await USDTieredSTOFactory.new(setupCost, 0, 0, I_USDTieredSTOLogic.address, { from: accountPolymath }); + I_USDTieredSTOFactory = await USDTieredSTOFactory.new(setupCost, new BN(0), new BN(0), I_USDTieredSTOLogic.address, { from: accountPolymath }); assert.notEqual( I_USDTieredSTOFactory.address.valueOf(), @@ -381,15 +406,20 @@ export async function deployUSDTieredSTOAndVerified(accountPolymath, MRProxyInst ); await registerAndVerifyByMR(I_USDTieredSTOFactory.address, accountPolymath, MRProxyInstance); - return new Array(I_USDTieredSTOFactory); + return Promise.all(new Array(I_USDTieredSTOFactory)); } - /// Deploy the Dividend Modules export async function deployERC20DividendAndVerifyed(accountPolymath, MRProxyInstance, setupCost) { - I_ERC20DividendCheckpointLogic = await ERC20DividendCheckpoint.new("0x0000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000", { from: accountPolymath }); - I_ERC20DividendCheckpointFactory = await ERC20DividendCheckpointFactory.new(setupCost, 0, 0, I_ERC20DividendCheckpointLogic.address, { from: accountPolymath }); + I_ERC20DividendCheckpointLogic = await ERC20DividendCheckpoint.new( + "0x0000000000000000000000000000000000000000", + "0x0000000000000000000000000000000000000000", + { from: accountPolymath } + ); + I_ERC20DividendCheckpointFactory = await ERC20DividendCheckpointFactory.new(setupCost, new BN(0), new BN(0), I_ERC20DividendCheckpointLogic.address, { + from: accountPolymath + }); assert.notEqual( I_ERC20DividendCheckpointFactory.address.valueOf(), @@ -397,12 +427,18 @@ export async function deployERC20DividendAndVerifyed(accountPolymath, MRProxyIns "ERC20DividendCheckpointFactory contract was not deployed" ); await registerAndVerifyByMR(I_ERC20DividendCheckpointFactory.address, accountPolymath, MRProxyInstance); - return new Array(I_ERC20DividendCheckpointFactory); + return Promise.all(new Array(I_ERC20DividendCheckpointFactory)); } export async function deployEtherDividendAndVerifyed(accountPolymath, MRProxyInstance, setupCost) { - I_EtherDividendCheckpointLogic = await EtherDividendCheckpoint.new("0x0000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000", { from: accountPolymath }); - I_EtherDividendCheckpointFactory = await EtherDividendCheckpointFactory.new(setupCost, 0, 0, I_EtherDividendCheckpointLogic.address, { from: accountPolymath }); + I_EtherDividendCheckpointLogic = await EtherDividendCheckpoint.new( + "0x0000000000000000000000000000000000000000", + "0x0000000000000000000000000000000000000000", + { from: accountPolymath } + ); + I_EtherDividendCheckpointFactory = await EtherDividendCheckpointFactory.new(setupCost, new BN(0), new BN(0), I_EtherDividendCheckpointLogic.address, { + from: accountPolymath + }); assert.notEqual( I_EtherDividendCheckpointFactory.address.valueOf(), @@ -411,14 +447,13 @@ export async function deployEtherDividendAndVerifyed(accountPolymath, MRProxyIns ); await registerAndVerifyByMR(I_EtherDividendCheckpointFactory.address, accountPolymath, MRProxyInstance); - return new Array(I_EtherDividendCheckpointFactory); + return Promise.all(new Array(I_EtherDividendCheckpointFactory)); } - /// Deploy the Burn Module export async function deployRedemptionAndVerifyed(accountPolymath, MRProxyInstance, setupCost) { - I_TrackedRedemptionFactory = await TrackedRedemptionFactory.new(setupCost, 0, 0, { from: accountPolymath }); + I_TrackedRedemptionFactory = await TrackedRedemptionFactory.new(setupCost, new BN(0), new BN(0), { from: accountPolymath }); assert.notEqual( I_TrackedRedemptionFactory.address.valueOf(), @@ -427,12 +462,11 @@ export async function deployRedemptionAndVerifyed(accountPolymath, MRProxyInstan ); await registerAndVerifyByMR(I_TrackedRedemptionFactory.address, accountPolymath, MRProxyInstance); - return new Array(I_TrackedRedemptionFactory); + return Promise.all(new Array(I_TrackedRedemptionFactory)); } - export async function deployMockRedemptionAndVerifyed(accountPolymath, MRProxyInstance, setupCost) { - I_MockBurnFactory = await MockBurnFactory.new(setupCost, 0, 0, { from: accountPolymath }); + I_MockBurnFactory = await MockBurnFactory.new(setupCost, new BN(0), new BN(0), { from: accountPolymath }); assert.notEqual( I_MockBurnFactory.address.valueOf(), @@ -441,11 +475,11 @@ export async function deployMockRedemptionAndVerifyed(accountPolymath, MRProxyIn ); await registerAndVerifyByMR(I_MockBurnFactory.address, accountPolymath, MRProxyInstance); - return new Array(I_MockBurnFactory); + return Promise.all(new Array(I_MockBurnFactory)); } export async function deployMockWrongTypeRedemptionAndVerifyed(accountPolymath, MRProxyInstance, setupCost) { - I_MockWrongTypeBurnFactory = await MockWrongTypeFactory.new(setupCost, 0, 0, { from: accountPolymath }); + I_MockWrongTypeBurnFactory = await MockWrongTypeFactory.new(setupCost, new BN(0), new BN(0), { from: accountPolymath }); assert.notEqual( I_MockWrongTypeBurnFactory.address.valueOf(), @@ -454,18 +488,5 @@ export async function deployMockWrongTypeRedemptionAndVerifyed(accountPolymath, ); await registerAndVerifyByMR(I_MockWrongTypeBurnFactory.address, accountPolymath, MRProxyInstance); - return new Array(I_MockWrongTypeBurnFactory); -} - - - -/// Helper function -function mergeReturn(returnData) { - let returnArray = new Array(); - for (let i = 0; i < returnData.length; i++) { - for (let j = 0; j < returnData[i].length; j++) { - returnArray.push(returnData[i][j]); - } - } - return returnArray; + return Promise.all(new Array(I_MockWrongTypeBurnFactory)); } diff --git a/test/helpers/latestTime.js b/test/helpers/latestTime.js index 38c744969..58671e254 100644 --- a/test/helpers/latestTime.js +++ b/test/helpers/latestTime.js @@ -1,4 +1,9 @@ // Returns the time of the last mined block in seconds -export default function latestTime() { - return web3.eth.getBlock("latest").timestamp; +export default async function latestTime() { + let block = await latestBlock(); + return block.timestamp; +} + +async function latestBlock() { + return web3.eth.getBlock("latest"); } diff --git a/test/helpers/signData.js b/test/helpers/signData.js index ea7476cc3..f75572450 100644 --- a/test/helpers/signData.js +++ b/test/helpers/signData.js @@ -1,6 +1,8 @@ const ethers = require("ethers"); const utils = ethers.utils; const ethUtil = require("ethereumjs-util"); +const Web3 = require("web3"); +let BN = Web3.utils.BN; //this, _investor, _fromTime, _toTime, _validTo function signData(tmAddress, investorAddress, fromTime, toTime, expiryTime, restricted, validFrom, validTo, nonce, pk) { @@ -12,7 +14,7 @@ function signData(tmAddress, investorAddress, fromTime, toTime, expiryTime, rest .slice(2); packedData = new Buffer(packedData, "hex"); packedData = Buffer.concat([new Buffer(`\x19Ethereum Signed Message:\n${packedData.length.toString()}`), packedData]); - packedData = web3.sha3(`0x${packedData.toString("hex")}`, { encoding: "hex" }); + packedData = web3.utils.sha3(`0x${packedData.toString("hex")}`, { encoding: "hex" }); return ethUtil.ecsign(new Buffer(packedData.slice(2), "hex"), new Buffer(pk, "hex")); } diff --git a/test/helpers/time.js b/test/helpers/time.js index 3e3362d81..1bbe676ca 100644 --- a/test/helpers/time.js +++ b/test/helpers/time.js @@ -2,38 +2,71 @@ // aren’t included within the original RPC specification. // See https://github.com/ethereumjs/testrpc#implemented-methods -function increaseTime(duration) { - const id = Date.now(); +// async function increaseTime(duration) { +// //let currentTime = (await web3.eth.getBlock('latest')).timestamp +// await sendIncreaseTime(duration); +// return advanceBlock(); +// } - return new Promise((resolve, reject) => { - web3.currentProvider.sendAsync( - { - jsonrpc: "2.0", - method: "evm_increaseTime", - params: [duration], - id: id - }, - err1 => { - if (err1) return reject(err1); +// async function sendIncreaseTime(duration) { +// return new Promise(() => +// web3.currentProvider.send({ +// jsonrpc: '2.0', +// method: 'evm_increaseTime', +// params: [duration], +// }) +// ); +// } - web3.currentProvider.sendAsync( - { - jsonrpc: "2.0", - method: "evm_mine", - id: id + 1 - }, - (err2, res) => { - return err2 ? reject(err2) : resolve(res); - } - ); - } - ); - }); +// async function advanceBlock() { +// return new Promise(() => +// web3.currentProvider.send({ +// jsonrpc: '2.0', +// method: 'evm_mine', +// }) +// ); +// } + +const pify = require('pify'); + +function advanceBlock() { + return pify(web3.currentProvider.send)({ + jsonrpc: '2.0', + method: 'evm_mine', + }); +} + +// Increases ganache time by the passed duration in seconds +async function increaseTime(duration) { + await pify(web3.currentProvider.send)({ + jsonrpc: '2.0', + method: 'evm_increaseTime', + params: [duration], + }); + await advanceBlock(); +} + +async function jumpToTime(timestamp) { + const id = Date.now(); + + return new Promise((resolve, reject) => { + web3.currentProvider.send( + { + jsonrpc: "2.0", + method: "evm_mine", + params: [timestamp], + id: id + }, + (err, res) => { + return err ? reject(err) : resolve(res); + } + ); + }); } export default function takeSnapshot() { return new Promise((resolve, reject) => { - web3.currentProvider.sendAsync( + web3.currentProvider.send( { jsonrpc: "2.0", method: "evm_snapshot", @@ -51,9 +84,9 @@ export default function takeSnapshot() { }); } -function revertToSnapshot(snapShotId) { +async function revertToSnapshot(snapShotId) { return new Promise((resolve, reject) => { - web3.currentProvider.sendAsync( + web3.currentProvider.send( { jsonrpc: "2.0", method: "evm_revert", diff --git a/test/helpers/utils.js b/test/helpers/utils.js index a2c23c218..b89d8b9ee 100644 --- a/test/helpers/utils.js +++ b/test/helpers/utils.js @@ -49,25 +49,7 @@ export const duration = { } }; -/** - * Helper to wait for log emission. - * @param {Object} _event The event to wait for. - */ -export function promisifyLogWatch(_event, _times) { - return new Promise((resolve, reject) => { - let i = 0; - _event.watch((error, log) => { - if (error !== null) reject(error); - i = i + 1; - console.log("Received event: " + i + " out of: " + _times); - if (i == _times) { - _event.stopWatching(); - resolve(log); - } - }); - }); -} - -export function latestBlock() { - return web3.eth.getBlock("latest").number; +export async function latestBlock() { + let block = await web3.eth.getBlock("latest"); + return block.number; } diff --git a/test/i_Issuance.js b/test/i_Issuance.js index 179b571f1..7b62336bd 100644 --- a/test/i_Issuance.js +++ b/test/i_Issuance.js @@ -11,10 +11,10 @@ const GeneralTransferManager = artifacts.require("./GeneralTransferManager"); const GeneralPermissionManager = artifacts.require("./GeneralPermissionManager"); const Web3 = require("web3"); -const BigNumber = require("bignumber.js"); +let BN = Web3.utils.BN; const web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545")); // Hardcoded development port -contract("Issuance", accounts => { +contract("Issuance", async (accounts) => { // Accounts Variable declaration let account_polymath; let account_investor1; @@ -26,12 +26,12 @@ contract("Issuance", accounts => { let blockNo; let balanceOfReceiver; let message = "Transaction Should Fail!"; - const TM_Perm = "WHITELIST"; - const delegateDetails = "I am delegate"; + const TM_Perm = web3.utils.fromAscii("WHITELIST"); + const delegateDetails = web3.utils.fromAscii("I am delegate"); // investor Details - let fromTime = latestTime(); - let toTime = latestTime() + duration.days(15); - let expiryTime = toTime + duration.days(100); + let fromTime; + let toTime; + let expiryTime; // Contract Instance Declaration let I_GeneralPermissionManagerFactory; @@ -65,23 +65,27 @@ contract("Issuance", accounts => { const stoKey = 3; const budget = 0; const address_zero = "0x0000000000000000000000000000000000000000"; + const one_address = "0x0000000000000000000000000000000000000001"; // Initial fee for ticker registry and security token registry - const initRegFee = web3.utils.toWei("250"); + const initRegFee = new BN(web3.utils.toWei("250")); // Capped STO details //let startTime; // Start time will be 5000 seconds more than the latest time //let endTime; // Add 30 days more - const cap = web3.utils.toWei("10000"); - const rate = web3.utils.toWei("1000"); + const cap = new BN(web3.utils.toWei("10000")); + const rate = new BN(web3.utils.toWei("1000")); const fundRaiseType = [0]; - const cappedSTOSetupCost = web3.utils.toWei("20000", "ether"); + const cappedSTOSetupCost = new BN(web3.utils.toWei("20000", "ether")); const maxCost = cappedSTOSetupCost; const STOParameters = ["uint256", "uint256", "uint256", "uint256", "uint8[]", "address"]; const STRProxyParameters = ["address", "address", "uint256", "uint256", "address", "address"]; const MRProxyParameters = ["address", "address"]; before(async () => { + fromTime = await latestTime(); + toTime = await latestTime(); + expiryTime = toTime + duration.days(15); // Accounts setup account_polymath = accounts[0]; account_issuer = accounts[1]; @@ -134,11 +138,9 @@ contract("Issuance", accounts => { }); describe("Launch SecurityToken & STO on the behalf of the issuer", async () => { - describe("Create securityToken for the issuer by the polymath", async () => { - it("POLYMATH: Should register the ticker before the generation of the security token", async () => { - await I_PolyToken.getTokens(10000 * Math.pow(10, 18), account_polymath); + await I_PolyToken.getTokens(new BN(10000).mul(new BN(10).pow(new BN(18))), account_polymath); await I_PolyToken.approve(I_STRProxied.address, initRegFee, { from: account_polymath }); let tx = await I_STRProxied.registerTicker(account_polymath, symbol, name, { from: account_polymath }); assert.equal(tx.logs[0].args._owner, account_polymath); @@ -147,15 +149,15 @@ contract("Issuance", accounts => { it("POLYMATH: Should generate the new security token with the same symbol as registered above", async () => { await I_PolyToken.approve(I_STRProxied.address, initRegFee, { from: account_polymath }); - let _blockNo = latestBlock(); + let tx = await I_STRProxied.generateSecurityToken(name, symbol, tokenDetails, false, { from: account_polymath }); // Verify the successful generation of the security token assert.equal(tx.logs[2].args._ticker, symbol, "SecurityToken doesn't get deployed"); - I_SecurityToken = SecurityToken.at(tx.logs[2].args._securityTokenAddress); + I_SecurityToken = await SecurityToken.at(tx.logs[2].args._securityTokenAddress); - const log = await promisifyLogWatch(I_SecurityToken.ModuleAdded({ from: _blockNo }), 1); + const log = (await I_SecurityToken.getPastEvents('ModuleAdded', {filter: {transactionHash: tx.transactionHash}}))[0]; // Verify that GeneralTransferManager module get added successfully or not assert.equal(log.args._types[0].toNumber(), transferManagerKey); @@ -164,7 +166,7 @@ contract("Issuance", accounts => { it("POLYMATH: Should intialize the auto attached modules", async () => { let moduleData = (await I_SecurityToken.getModulesByType(transferManagerKey))[0]; - I_GeneralTransferManager = GeneralTransferManager.at(moduleData); + I_GeneralTransferManager = await GeneralTransferManager.at(moduleData); }); it("POLYMATH: Should successfully attach the STO factory with the security token", async () => { @@ -173,8 +175,8 @@ contract("Issuance", accounts => { [I_CappedSTOFactory] = await deployCappedSTOAndVerifyed(account_polymath, I_MRProxied, cappedSTOSetupCost); let bytesSTO = encodeModuleCall(STOParameters, [ - latestTime() + duration.seconds(5000), - latestTime() + duration.days(30), + await latestTime() + duration.seconds(5000), + await latestTime() + duration.days(30), cap, rate, fundRaiseType, @@ -184,7 +186,7 @@ contract("Issuance", accounts => { await I_PolyToken.getTokens(cappedSTOSetupCost, account_polymath); await I_PolyToken.transfer(I_SecurityToken.address, cappedSTOSetupCost, { from: account_polymath }); - const tx = await I_SecurityToken.addModule(I_CappedSTOFactory.address, bytesSTO, maxCost, 0, { from: account_polymath }); + const tx = await I_SecurityToken.addModule(I_CappedSTOFactory.address, bytesSTO, maxCost, new BN(0), { from: account_polymath }); assert.equal(tx.logs[3].args._types[0], stoKey, "CappedSTO doesn't get deployed"); assert.equal( @@ -192,14 +194,14 @@ contract("Issuance", accounts => { "CappedSTO", "CappedSTOFactory module was not added" ); - I_CappedSTO = CappedSTO.at(tx.logs[3].args._module); + I_CappedSTO = await CappedSTO.at(tx.logs[3].args._module); }); }); describe("Transfer Manager operations by the polymath_account", async () => { it("Should modify the whitelist", async () => { - fromTime = latestTime(); - toTime = latestTime() + duration.days(15); + fromTime = await latestTime(); + toTime = await latestTime() + duration.days(15); expiryTime = toTime + duration.days(100); let tx = await I_GeneralTransferManager.modifyWhitelist( @@ -215,17 +217,21 @@ contract("Issuance", accounts => { assert.equal(tx.logs[0].args._investor, account_investor1, "Failed in adding the investor in whitelist"); }); - it("Should add the delegate with permission", async() => { - //First attach a permission manager to the token - await I_SecurityToken.addModule(I_GeneralPermissionManagerFactory.address, "", 0, 0, {from: account_polymath}); - let moduleData = (await I_SecurityToken.getModulesByType(permissionManagerKey))[0]; - I_GeneralPermissionManager = GeneralPermissionManager.at(moduleData); - // Add permission to the deletgate (A regesteration process) - await I_GeneralPermissionManager.addDelegate(account_delegate, delegateDetails, { from: account_polymath}); - // Providing the permission to the delegate - await I_GeneralPermissionManager.changePermission(account_delegate, I_GeneralTransferManager.address, TM_Perm, true, { from: account_polymath }); - - assert.isTrue(await I_GeneralPermissionManager.checkPermission(account_delegate, I_GeneralTransferManager.address, TM_Perm)); + it("Should add the delegate with permission", async () => { + //First attach a permission manager to the token + await I_SecurityToken.addModule(I_GeneralPermissionManagerFactory.address, "0x0", new BN(0), new BN(0), { from: account_polymath }); + let moduleData = (await I_SecurityToken.getModulesByType(permissionManagerKey))[0]; + I_GeneralPermissionManager = await GeneralPermissionManager.at(moduleData); + // Add permission to the deletgate (A regesteration process) + await I_GeneralPermissionManager.addDelegate(account_delegate, delegateDetails, { from: account_polymath }); + // Providing the permission to the delegate + await I_GeneralPermissionManager.changePermission(account_delegate, I_GeneralTransferManager.address, TM_Perm, true, { + from: account_polymath + }); + + assert.isTrue( + await I_GeneralPermissionManager.checkPermission(account_delegate, I_GeneralTransferManager.address, TM_Perm) + ); }); it("POLYMATH: Should change the ownership of the SecurityToken", async () => { @@ -238,7 +244,7 @@ contract("Issuance", accounts => { describe("Operations on the STO", async () => { it("Should Buy the tokens", async () => { balanceOfReceiver = await web3.eth.getBalance(account_fundsReceiver); - blockNo = latestBlock(); + blockNo = await latestBlock(); // Jump time await increaseTime(5000); // Fallback transaction @@ -246,20 +252,20 @@ contract("Issuance", accounts => { from: account_investor1, to: I_CappedSTO.address, gas: 6100000, - value: web3.utils.toWei("1", "ether") + value: new BN(web3.utils.toWei("1", "ether")) }); - assert.equal((await I_CappedSTO.getRaised.call(0)).dividedBy(new BigNumber(10).pow(18)).toNumber(), 1); + assert.equal((await I_CappedSTO.getRaised.call(0)).div(new BN(10).pow(new BN(18))).toNumber(), 1); assert.equal(await I_CappedSTO.investorCount.call(), 1); - assert.equal((await I_SecurityToken.balanceOf(account_investor1)).dividedBy(new BigNumber(10).pow(18)).toNumber(), 1000); + assert.equal((await I_SecurityToken.balanceOf(account_investor1)).div(new BN(10).pow(new BN(18))).toNumber(), 1000); }); it("Verification of the event Token Purchase", async () => { - const log = await promisifyLogWatch(I_CappedSTO.TokenPurchase({ from: blockNo }), 1); + const log = (await I_CappedSTO.getPastEvents('TokenPurchase', {filter: {from: blockNo}}))[0]; assert.equal(log.args.purchaser, account_investor1, "Wrong address of the investor"); - assert.equal(log.args.amount.dividedBy(new BigNumber(10).pow(18)).toNumber(), 1000, "Wrong No. token get dilivered"); + assert.equal(log.args.amount.div(new BN(10).pow(new BN(18))).toNumber(), 1000, "Wrong No. token get dilivered"); }); it("should add the investor into the whitelist by the delegate", async () => { @@ -275,14 +281,14 @@ contract("Issuance", accounts => { from: account_investor2, to: I_CappedSTO.address, gas: 2100000, - value: web3.utils.toWei("1", "ether") + value: new BN(web3.utils.toWei("1", "ether")) }); - assert.equal((await I_CappedSTO.getRaised.call(0)).dividedBy(new BigNumber(10).pow(18)).toNumber(), 2); + assert.equal((await I_CappedSTO.getRaised.call(0)).div(new BN(10).pow(new BN(18))).toNumber(), 2); assert.equal(await I_CappedSTO.investorCount.call(), 2); - assert.equal((await I_SecurityToken.balanceOf(account_investor2)).dividedBy(new BigNumber(10).pow(18)).toNumber(), 1000); + assert.equal((await I_SecurityToken.balanceOf(account_investor2)).div(new BN(10).pow(new BN(18))).toNumber(), 1000); }); }); }); diff --git a/test/j_manual_approval_transfer_manager.js b/test/j_manual_approval_transfer_manager.js index 41fabbd46..7ac1bd4cf 100644 --- a/test/j_manual_approval_transfer_manager.js +++ b/test/j_manual_approval_transfer_manager.js @@ -3,7 +3,12 @@ import { duration, ensureException, promisifyLogWatch, latestBlock } from "./hel import takeSnapshot, { increaseTime, revertToSnapshot } from "./helpers/time"; import { encodeProxyCall } from "./helpers/encodeCall"; import { catchRevert } from "./helpers/exceptions"; -import { setUpPolymathNetwork, deployManualApprovalTMAndVerifyed, deployGPMAndVerifyed, deployCountTMAndVerifyed } from "./helpers/createInstances"; +import { + setUpPolymathNetwork, + deployManualApprovalTMAndVerifyed, + deployGPMAndVerifyed, + deployCountTMAndVerifyed +} from "./helpers/createInstances"; const SecurityToken = artifacts.require("./SecurityToken.sol"); const GeneralTransferManager = artifacts.require("./GeneralTransferManager"); @@ -12,10 +17,10 @@ const CountTransferManager = artifacts.require("./CountTransferManager"); const GeneralPermissionManager = artifacts.require("./GeneralPermissionManager"); const Web3 = require("web3"); -const BigNumber = require("bignumber.js"); +let BN = Web3.utils.BN; const web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545")); // Hardcoded development port -contract("ManualApprovalTransferManager", accounts => { +contract("ManualApprovalTransferManager", async (accounts) => { // Accounts Variable declaration let account_polymath; let account_issuer; @@ -26,11 +31,6 @@ contract("ManualApprovalTransferManager", accounts => { let account_investor4; let account_investor5; - // investor Details - let fromTime = latestTime(); - let toTime = latestTime(); - let expiryTime = toTime + duration.days(15); - let message = "Transaction Should Fail!"; // Contract Instance Declaration @@ -70,12 +70,16 @@ contract("ManualApprovalTransferManager", accounts => { const stoKey = 3; // Initial fee for ticker registry and security token registry - const initRegFee = web3.utils.toWei("250"); + const initRegFee = new BN(web3.utils.toWei("250")); const STOParameters = ["uint256", "uint256", "uint256", "uint256", "uint8[]", "address"]; + let currentTime; + const address_zero = "0x0000000000000000000000000000000000000000"; + const one_address = "0x0000000000000000000000000000000000000001"; + before(async () => { - // Accounts setup + currentTime = new BN(await latestTime()); account_polymath = accounts[0]; account_issuer = accounts[1]; @@ -110,7 +114,11 @@ contract("ManualApprovalTransferManager", accounts => { // STEP 3: Deploy the ManualApprovalTransferManagerFactory [I_ManualApprovalTransferManagerFactory] = await deployManualApprovalTMAndVerifyed(account_polymath, I_MRProxied, 0); // STEP 4: Deploy the Paid ManualApprovalTransferManagerFactory - [P_ManualApprovalTransferManagerFactory] = await deployManualApprovalTMAndVerifyed(account_polymath, I_MRProxied, web3.utils.toWei("500", "ether")); + [P_ManualApprovalTransferManagerFactory] = await deployManualApprovalTMAndVerifyed( + account_polymath, + I_MRProxied, + new BN(web3.utils.toWei("500", "ether")) + ); // STEP 5: Deploy the CountTransferManagerFactory [I_CountTransferManagerFactory] = await deployCountTMAndVerifyed(account_polymath, I_MRProxied, 0); @@ -143,15 +151,15 @@ contract("ManualApprovalTransferManager", accounts => { it("Should generate the new security token with the same symbol as registered above", async () => { await I_PolyToken.approve(I_STRProxied.address, initRegFee, { from: token_owner }); - let _blockNo = latestBlock(); + let tx = await I_STRProxied.generateSecurityToken(name, symbol, tokenDetails, false, { from: token_owner }); // Verify the successful generation of the security token assert.equal(tx.logs[2].args._ticker, symbol.toUpperCase(), "SecurityToken doesn't get deployed"); - I_SecurityToken = SecurityToken.at(tx.logs[2].args._securityTokenAddress); + I_SecurityToken = await SecurityToken.at(tx.logs[2].args._securityTokenAddress); - const log = await promisifyLogWatch(I_SecurityToken.ModuleAdded({ from: _blockNo }), 1); + const log = (await I_SecurityToken.getPastEvents('ModuleAdded', {filter: {transactionHash: tx.transactionHash}}))[0]; // Verify that GeneralTransferManager module get added successfully or not assert.equal(log.args._types[0].toNumber(), 2); @@ -160,7 +168,7 @@ contract("ManualApprovalTransferManager", accounts => { it("Should intialize the auto attached modules", async () => { let moduleData = (await I_SecurityToken.getModulesByType(2))[0]; - I_GeneralTransferManager = GeneralTransferManager.at(moduleData); + I_GeneralTransferManager = await GeneralTransferManager.at(moduleData); }); }); @@ -170,9 +178,9 @@ contract("ManualApprovalTransferManager", accounts => { let tx = await I_GeneralTransferManager.modifyWhitelist( account_investor1, - latestTime(), - latestTime(), - latestTime() + duration.days(10), + currentTime, + currentTime, + currentTime.add(new BN(duration.days(10))), true, { from: account_issuer, @@ -190,9 +198,9 @@ contract("ManualApprovalTransferManager", accounts => { await increaseTime(5000); // Mint some tokens - await I_SecurityToken.mint(account_investor1, web3.utils.toWei("4", "ether"), { from: token_owner }); + await I_SecurityToken.mint(account_investor1, new BN(web3.utils.toWei("4", "ether")), { from: token_owner }); - assert.equal((await I_SecurityToken.balanceOf(account_investor1)).toNumber(), web3.utils.toWei("4", "ether")); + assert.equal((await I_SecurityToken.balanceOf(account_investor1)).toString(), new BN(web3.utils.toWei("4", "ether")).toString()); }); it("Should Buy some more tokens", async () => { @@ -200,9 +208,9 @@ contract("ManualApprovalTransferManager", accounts => { let tx = await I_GeneralTransferManager.modifyWhitelist( account_investor2, - latestTime(), - latestTime(), - latestTime() + duration.days(10), + currentTime, + currentTime, + currentTime.add(new BN(duration.days(10))), true, { from: account_issuer, @@ -217,15 +225,15 @@ contract("ManualApprovalTransferManager", accounts => { ); // Mint some tokens - await I_SecurityToken.mint(account_investor2, web3.utils.toWei("1", "ether"), { from: token_owner }); + await I_SecurityToken.mint(account_investor2, new BN(web3.utils.toWei("1", "ether")), { from: token_owner }); - assert.equal((await I_SecurityToken.balanceOf(account_investor2)).toNumber(), web3.utils.toWei("1", "ether")); + assert.equal((await I_SecurityToken.balanceOf(account_investor2)).toString(), new BN(web3.utils.toWei("1", "ether")).toString()); }); it("Should successfully attach the ManualApprovalTransferManager with the security token", async () => { - await I_PolyToken.getTokens(web3.utils.toWei("500", "ether"), token_owner); + await I_PolyToken.getTokens(new BN(web3.utils.toWei("500", "ether")), token_owner); await catchRevert( - I_SecurityToken.addModule(P_ManualApprovalTransferManagerFactory.address, "0x", web3.utils.toWei("500", "ether"), 0, { + I_SecurityToken.addModule(P_ManualApprovalTransferManagerFactory.address, "0x", new BN(web3.utils.toWei("500", "ether")), new BN(0), { from: token_owner }) ); @@ -233,12 +241,12 @@ contract("ManualApprovalTransferManager", accounts => { it("Should successfully attach the General permission manager factory with the security token", async () => { let snapId = await takeSnapshot(); - await I_PolyToken.transfer(I_SecurityToken.address, web3.utils.toWei("500", "ether"), { from: token_owner }); + await I_PolyToken.transfer(I_SecurityToken.address, new BN(web3.utils.toWei("500", "ether")), { from: token_owner }); const tx = await I_SecurityToken.addModule( P_ManualApprovalTransferManagerFactory.address, "0x", - web3.utils.toWei("500", "ether"), - 0, + new BN(web3.utils.toWei("500", "ether")), + new BN(0), { from: token_owner } ); assert.equal(tx.logs[3].args._types[0].toNumber(), transferManagerKey, "Manual Approval Transfer Manager doesn't get deployed"); @@ -247,19 +255,19 @@ contract("ManualApprovalTransferManager", accounts => { "ManualApprovalTransferManager", "ManualApprovalTransferManagerFactory module was not added" ); - P_ManualApprovalTransferManagerFactory = ManualApprovalTransferManager.at(tx.logs[3].args._module); + P_ManualApprovalTransferManagerFactory = await ManualApprovalTransferManager.at(tx.logs[3].args._module); await revertToSnapshot(snapId); }); it("Should successfully attach the ManualApprovalTransferManager with the security token", async () => { - const tx = await I_SecurityToken.addModule(I_ManualApprovalTransferManagerFactory.address, "", 0, 0, { from: token_owner }); + const tx = await I_SecurityToken.addModule(I_ManualApprovalTransferManagerFactory.address, "0x0", new BN(0), new BN(0), { from: token_owner }); assert.equal(tx.logs[2].args._types[0].toNumber(), transferManagerKey, "ManualApprovalTransferManager doesn't get deployed"); assert.equal( web3.utils.toUtf8(tx.logs[2].args._name), "ManualApprovalTransferManager", "ManualApprovalTransferManager module was not added" ); - I_ManualApprovalTransferManager = ManualApprovalTransferManager.at(tx.logs[2].args._module); + I_ManualApprovalTransferManager = await ManualApprovalTransferManager.at(tx.logs[2].args._module); }); //function verifyTransfer(address _from, address _to, uint256 _amount, bool _isTransfer) public returns(Result) { it("Cannot call verifyTransfer on the TM directly if _isTransfer == true", async () => { @@ -267,8 +275,8 @@ contract("ManualApprovalTransferManager", accounts => { I_ManualApprovalTransferManager.verifyTransfer( account_investor4, account_investor4, - web3.utils.toWei("2", "ether"), - "", + new BN(web3.utils.toWei("2", "ether")), + "0x0", true, { from: token_owner } ) @@ -279,8 +287,8 @@ contract("ManualApprovalTransferManager", accounts => { await I_ManualApprovalTransferManager.verifyTransfer( account_investor4, account_investor4, - web3.utils.toWei("2", "ether"), - "", + new BN(web3.utils.toWei("2", "ether")), + "0x0", false, { from: token_owner } ); @@ -289,9 +297,9 @@ contract("ManualApprovalTransferManager", accounts => { it("Add a new token holder", async () => { let tx = await I_GeneralTransferManager.modifyWhitelist( account_investor3, - latestTime(), - latestTime(), - latestTime() + duration.days(10), + currentTime, + currentTime, + currentTime.add(new BN(duration.days(10))), true, { from: account_issuer, @@ -305,31 +313,31 @@ contract("ManualApprovalTransferManager", accounts => { "Failed in adding the investor in whitelist" ); // Pause at the transferManager level - await I_ManualApprovalTransferManager.pause({from: token_owner}); + await I_ManualApprovalTransferManager.pause({ from: token_owner }); // Add the Investor in to the whitelist // Mint some tokens - await I_SecurityToken.mint(account_investor3, web3.utils.toWei("1", "ether"), { from: token_owner }); + await I_SecurityToken.mint(account_investor3, new BN(web3.utils.toWei("1", "ether")), { from: token_owner }); - assert.equal((await I_SecurityToken.balanceOf(account_investor3)).toNumber(), web3.utils.toWei("1", "ether")); + assert.equal((await I_SecurityToken.balanceOf(account_investor3)).toString(), new BN(web3.utils.toWei("1", "ether")).toString()); // Unpause at the transferManager level - await I_ManualApprovalTransferManager.unpause({from: token_owner}); + await I_ManualApprovalTransferManager.unpause({ from: token_owner }); }); it("Should still be able to transfer between existing token holders", async () => { // Add the Investor in to the whitelist // Mint some tokens - await I_SecurityToken.transfer(account_investor1, web3.utils.toWei("1", "ether"), { from: account_investor2 }); + await I_SecurityToken.transfer(account_investor1, new BN(web3.utils.toWei("1", "ether")), { from: account_investor2 }); - assert.equal((await I_SecurityToken.balanceOf(account_investor1)).toNumber(), web3.utils.toWei("5", "ether")); + assert.equal((await I_SecurityToken.balanceOf(account_investor1)).toString(), new BN(web3.utils.toWei("5", "ether")).toString()); }); it("Should fail to add a manual approval because invalid _to address", async () => { await catchRevert( I_ManualApprovalTransferManager.addManualApproval( account_investor1, - "", - web3.utils.toWei("2", "ether"), - latestTime() + duration.days(1), + address_zero, + new BN(web3.utils.toWei("2", "ether")), + currentTime.add(new BN(duration.days(1))), { from: token_owner } ) ); @@ -340,7 +348,7 @@ contract("ManualApprovalTransferManager", accounts => { I_ManualApprovalTransferManager.addManualApproval( account_investor1, account_investor4, - web3.utils.toWei("2", "ether"), + new BN(web3.utils.toWei("2", "ether")), 99999, { from: token_owner } ) @@ -351,18 +359,18 @@ contract("ManualApprovalTransferManager", accounts => { await I_ManualApprovalTransferManager.addManualApproval( account_investor1, account_investor4, - web3.utils.toWei("2", "ether"), - latestTime() + duration.days(1), + new BN(web3.utils.toWei("2", "ether")), + currentTime.add(new BN(duration.days(1))), { from: token_owner } ); }); it("Add a manual approval for a 5th investor from issuance", async () => { await I_ManualApprovalTransferManager.addManualApproval( - "", + address_zero, account_investor5, - web3.utils.toWei("2", "ether"), - latestTime() + duration.days(1), + new BN(web3.utils.toWei("2", "ether")), + currentTime.add(new BN(duration.days(1))), { from: token_owner } ); }); @@ -372,15 +380,15 @@ contract("ManualApprovalTransferManager", accounts => { I_ManualApprovalTransferManager.addManualApproval( account_investor1, account_investor4, - web3.utils.toWei("2", "ether"), - latestTime() + duration.days(5), + new BN(web3.utils.toWei("2", "ether")), + currentTime.add(new BN(duration.days(5))), { from: token_owner } ) ); }); it("Should fail to revoke manual approval because invalid _to address", async () => { - await catchRevert(I_ManualApprovalTransferManager.revokeManualApproval(account_investor1, "", { from: token_owner })); + await catchRevert(I_ManualApprovalTransferManager.revokeManualApproval(account_investor1, address_zero, { from: token_owner })); }); it("Should revoke manual approval", async () => { @@ -393,60 +401,59 @@ contract("ManualApprovalTransferManager", accounts => { await I_ManualApprovalTransferManager.addManualApproval( account_investor1, account_investor4, - web3.utils.toWei("2", "ether"), - latestTime() + duration.days(1), + new BN(web3.utils.toWei("2", "ether")), + currentTime.add(new BN(duration.days(1))), { from: token_owner } ); }); it("Use 50% of manual approval for transfer", async () => { - await I_SecurityToken.transfer(account_investor4, web3.utils.toWei("1", "ether"), { from: account_investor1 }); + await I_SecurityToken.transfer(account_investor4, new BN(web3.utils.toWei("1", "ether")), { from: account_investor1 }); - assert.equal((await I_SecurityToken.balanceOf(account_investor4)).toNumber(), web3.utils.toWei("1", "ether")); + assert.equal((await I_SecurityToken.balanceOf(account_investor4)).toString(), new BN(web3.utils.toWei("1", "ether")).toString()); }); it("Approval fails with wrong from to address", async () => { - await catchRevert(I_SecurityToken.transfer(account_investor5, web3.utils.toWei("1", "ether"), { from: account_investor1 })); + await catchRevert(I_SecurityToken.transfer(account_investor5, new BN(web3.utils.toWei("1", "ether")), { from: account_investor1 })); }); it("Use 100% of issuance approval", async () => { - await I_SecurityToken.mint(account_investor5, web3.utils.toWei("2", "ether"), { from: token_owner }); - assert.equal((await I_SecurityToken.balanceOf(account_investor5)).toNumber(), web3.utils.toWei("2", "ether")); + await I_SecurityToken.mint(account_investor5, new BN(web3.utils.toWei("2", "ether")), { from: token_owner }); + assert.equal((await I_SecurityToken.balanceOf(account_investor5)).toString(), new BN(web3.utils.toWei("2", "ether")).toString()); }); it("Check verifyTransfer without actually transferring", async () => { let verified = await I_SecurityToken.verifyTransfer.call( account_investor1, account_investor4, - web3.utils.toWei("1", "ether"), - "" + new BN(web3.utils.toWei("1", "ether")), + "0x0" ); - console.log(JSON.stringify(verified)); assert.equal(verified, true); - verified = await I_SecurityToken.verifyTransfer.call(account_investor1, account_investor4, web3.utils.toWei("2", "ether"), ""); + verified = await I_SecurityToken.verifyTransfer.call(account_investor1, account_investor4, new BN(web3.utils.toWei("2", "ether")), "0x0"); assert.equal(verified, false); - verified = await I_SecurityToken.verifyTransfer.call(account_investor1, account_investor4, web3.utils.toWei("1", "ether"), ""); + verified = await I_SecurityToken.verifyTransfer.call(account_investor1, account_investor4, new BN(web3.utils.toWei("1", "ether")), "0x0"); assert.equal(verified, true); }); it("Use remaining 50% of manual approval for transfer", async () => { - await I_SecurityToken.transfer(account_investor4, web3.utils.toWei("1", "ether"), { from: account_investor1 }); + await I_SecurityToken.transfer(account_investor4, new BN(web3.utils.toWei("1", "ether")), { from: account_investor1 }); - assert.equal((await I_SecurityToken.balanceOf(account_investor4)).toNumber(), web3.utils.toWei("2", "ether")); + assert.equal((await I_SecurityToken.balanceOf(account_investor4)).toString(), new BN(web3.utils.toWei("2", "ether")).toString()); }); it("Check further transfers fail", async () => { - await catchRevert(I_SecurityToken.transfer(account_investor4, web3.utils.toWei("1", "ether"), { from: account_investor1 })); + await catchRevert(I_SecurityToken.transfer(account_investor4, new BN(web3.utils.toWei("1", "ether")), { from: account_investor1 })); //Check that other transfers are still valid - await I_SecurityToken.transfer(account_investor2, web3.utils.toWei("1", "ether"), { from: account_investor1 }); + await I_SecurityToken.transfer(account_investor2, new BN(web3.utils.toWei("1", "ether")), { from: account_investor1 }); }); it("Should fail to add a manual block because invalid _to address", async () => { await catchRevert( - I_ManualApprovalTransferManager.addManualBlocking(account_investor1, "", latestTime() + duration.days(1), { + I_ManualApprovalTransferManager.addManualBlocking(account_investor1, address_zero, currentTime.add(new BN(duration.days(1))), { from: token_owner }) ); @@ -459,39 +466,41 @@ contract("ManualApprovalTransferManager", accounts => { }); it("Add a manual block for a 2nd investor", async () => { - await I_ManualApprovalTransferManager.addManualBlocking(account_investor1, account_investor2, latestTime() + duration.days(1), { + await I_ManualApprovalTransferManager.addManualBlocking(account_investor1, account_investor2, currentTime.add(new BN(duration.days(1))), { from: token_owner }); }); it("Should fail to add a manual block because blocking already exist", async () => { await catchRevert( - I_ManualApprovalTransferManager.addManualBlocking(account_investor1, account_investor2, latestTime() + duration.days(5), { from: token_owner }) + I_ManualApprovalTransferManager.addManualBlocking(account_investor1, account_investor2, currentTime.add(new BN(duration.days(5))), { + from: token_owner + }) ); }); it("Check manual block causes failure", async () => { - await catchRevert(I_SecurityToken.transfer(account_investor2, web3.utils.toWei("1", "ether"), { from: account_investor1 })); + await catchRevert(I_SecurityToken.transfer(account_investor2, new BN(web3.utils.toWei("1", "ether")), { from: account_investor1 })); }); it("Should fail to revoke manual block because invalid _to address", async () => { - await catchRevert(I_ManualApprovalTransferManager.revokeManualBlocking(account_investor1, "0x0", { from: token_owner })); + await catchRevert(I_ManualApprovalTransferManager.revokeManualBlocking(account_investor1, address_zero, { from: token_owner })); }); it("Revoke manual block and check transfer works", async () => { await I_ManualApprovalTransferManager.revokeManualBlocking(account_investor1, account_investor2, { from: token_owner }); - await I_SecurityToken.transfer(account_investor2, web3.utils.toWei("1", "ether"), { from: account_investor1 }); - assert.equal((await I_SecurityToken.balanceOf(account_investor2)).toNumber(), web3.utils.toWei("2", "ether")); + await I_SecurityToken.transfer(account_investor2, new BN(web3.utils.toWei("1", "ether")), { from: account_investor1 }); + assert.equal((await I_SecurityToken.balanceOf(account_investor2)).toString(), new BN(web3.utils.toWei("2", "ether")).toString()); }); it("Check manual block ignored after expiry", async () => { - await I_ManualApprovalTransferManager.addManualBlocking(account_investor1, account_investor2, latestTime() + duration.days(1), { + await I_ManualApprovalTransferManager.addManualBlocking(account_investor1, account_investor2, currentTime.add(new BN(duration.days(1))), { from: token_owner }); - await catchRevert(I_SecurityToken.transfer(account_investor2, web3.utils.toWei("1", "ether"), { from: account_investor1 })); + await catchRevert(I_SecurityToken.transfer(account_investor2, new BN(web3.utils.toWei("1", "ether")), { from: account_investor1 })); await increaseTime(1 + 24 * 60 * 60); - await I_SecurityToken.transfer(account_investor2, web3.utils.toWei("1", "ether"), { from: account_investor1 }); + await I_SecurityToken.transfer(account_investor2, new BN(web3.utils.toWei("1", "ether")), { from: account_investor1 }); }); it("Should successfully attach the CountTransferManager with the security token (count of 1)", async () => { @@ -509,11 +518,11 @@ contract("ManualApprovalTransferManager", accounts => { [1] ); - const tx = await I_SecurityToken.addModule(I_CountTransferManagerFactory.address, bytesCountTM, 0, 0, { from: token_owner }); + const tx = await I_SecurityToken.addModule(I_CountTransferManagerFactory.address, bytesCountTM, new BN(0), new BN(0), { from: token_owner }); assert.equal(tx.logs[2].args._types[0].toNumber(), transferManagerKey, "CountTransferManager doesn't get deployed"); let name = web3.utils.toUtf8(tx.logs[2].args._name); assert.equal(name, "CountTransferManager", "CountTransferManager module was not added"); - I_CountTransferManager = CountTransferManager.at(tx.logs[2].args._module); + I_CountTransferManager = await CountTransferManager.at(tx.logs[2].args._module); }); it("Should get the permission list", async () => { diff --git a/test/k_module_registry.js b/test/k_module_registry.js index ec58b28e9..1504d86b6 100644 --- a/test/k_module_registry.js +++ b/test/k_module_registry.js @@ -19,10 +19,10 @@ const TestSTOFactory = artifacts.require("./TestSTOFactory.sol"); const ReclaimTokens = artifacts.require("./ReclaimTokens.sol"); const Web3 = require("web3"); -const BigNumber = require("bignumber.js"); +let BN = Web3.utils.BN; const web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545")); // Hardcoded development port -contract("ModuleRegistry", accounts => { +contract("ModuleRegistry", async (accounts) => { // Accounts Variable declaration let account_polymath; let account_investor1; @@ -34,9 +34,6 @@ contract("ModuleRegistry", accounts => { let account_temp; let balanceOfReceiver; - // investor Details - let fromTime = latestTime(); - let toTime = latestTime() + duration.days(15); let ID_snap; let message = "Transaction Should fail!"; @@ -80,9 +77,10 @@ contract("ModuleRegistry", accounts => { const stoKey = 3; const budget = 0; const address_zero = "0x0000000000000000000000000000000000000000"; + const one_address = "0x0000000000000000000000000000000000000001"; // Initial fee for ticker registry and security token registry - const initRegFee = web3.utils.toWei("250"); + const initRegFee = new BN(web3.utils.toWei("250")); // delagate details const delegateDetails = "I am delegate .."; @@ -91,14 +89,16 @@ contract("ModuleRegistry", accounts => { // Capped STO details let startTime; let endTime; - const cap = web3.utils.toWei("10000"); + const cap = new BN(web3.utils.toWei("10000")); const rate = 1000; const fundRaiseType = [0]; const STOParameters = ["uint256", "uint256", "uint256", "uint256", "uint8[]", "address"]; const MRProxyParameters = ["address", "address"]; + let currentTime; + before(async () => { - // Accounts setup + currentTime = new BN(await latestTime()); account_polymath = accounts[0]; account_issuer = accounts[1]; account_investor1 = accounts[9]; @@ -146,10 +146,7 @@ contract("ModuleRegistry", accounts => { describe("Test the initialize the function", async () => { it("Should successfully update the implementation address -- fail because polymathRegistry address is 0x", async () => { - let bytesProxy = encodeProxyCall(MRProxyParameters, [ - address_zero, - account_polymath - ]); + let bytesProxy = encodeProxyCall(MRProxyParameters, [address_zero, account_polymath]); catchRevert( I_ModuleRegistryProxy.upgradeToAndCall("1.0.0", I_ModuleRegistry.address, bytesProxy, { from: account_polymath @@ -159,10 +156,7 @@ contract("ModuleRegistry", accounts => { }); it("Should successfully update the implementation address -- fail because owner address is 0x", async () => { - let bytesProxy = encodeProxyCall(MRProxyParameters, [ - I_PolymathRegistry.address, - address_zero - ]); + let bytesProxy = encodeProxyCall(MRProxyParameters, [I_PolymathRegistry.address, address_zero]); catchRevert( I_ModuleRegistryProxy.upgradeToAndCall("1.0.0", I_ModuleRegistry.address, bytesProxy, { from: account_polymath @@ -172,10 +166,7 @@ contract("ModuleRegistry", accounts => { }); it("Should successfully update the implementation address -- fail because all params are 0x", async () => { - let bytesProxy = encodeProxyCall(MRProxyParameters, [ - address_zero, - address_zero - ]); + let bytesProxy = encodeProxyCall(MRProxyParameters, [address_zero, address_zero]); catchRevert( I_ModuleRegistryProxy.upgradeToAndCall("1.0.0", I_ModuleRegistry.address, bytesProxy, { from: account_polymath @@ -184,15 +175,12 @@ contract("ModuleRegistry", accounts => { ); }); - it("Should successfully update the implementation address", async() => { - let bytesProxy = encodeProxyCall(MRProxyParameters, [ - I_PolymathRegistry.address, - account_polymath - ]); + it("Should successfully update the implementation address", async () => { + let bytesProxy = encodeProxyCall(MRProxyParameters, [I_PolymathRegistry.address, account_polymath]); await I_ModuleRegistryProxy.upgradeToAndCall("1.0.0", I_ModuleRegistry.address, bytesProxy, { from: account_polymath }); I_MRProxied = await ModuleRegistry.at(I_ModuleRegistryProxy.address); await I_PolymathRegistry.changeAddress("ModuleRegistry", I_ModuleRegistryProxy.address, { from: account_polymath }); - }) + }); }); describe("Test cases for the ModuleRegistry", async () => { @@ -265,25 +253,21 @@ contract("ModuleRegistry", accounts => { }); it("Should fail in registering the module-- type = 0", async () => { - I_MockFactory = await MockFactory.new(0, 0, 0, 0, { from: account_polymath }); + I_MockFactory = await MockFactory.new(new BN(0), new BN(0), new BN(0), address_zero, { from: account_polymath }); catchRevert(I_MRProxied.registerModule(I_MockFactory.address, { from: account_polymath })); }); it("Should fail to register the new module because msg.sender is not the owner of the module", async() => { - I_CappedSTOLogic = await CappedSTO.new("0x0000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000", { from: account_polymath }); - I_CappedSTOFactory3 = await CappedSTOFactory.new(0, 0, 0, I_CappedSTOLogic.address, { from: account_temp }); - catchRevert( - I_MRProxied.registerModule(I_CappedSTOFactory3.address, { from: token_owner }) - ); + I_CappedSTOLogic = await CappedSTO.new(address_zero, address_zero, { from: account_polymath }); + I_CappedSTOFactory3 = await CappedSTOFactory.new(new BN(0), new BN(0), new BN(0), I_CappedSTOLogic.address, { from: account_temp }); + catchRevert(I_MRProxied.registerModule(I_CappedSTOFactory3.address, { from: token_owner })); }); - it("Should successfully register the module -- fail because no module type uniqueness", async() => { - await I_MockFactory.changeTypes({from: account_polymath }); - catchRevert( - I_MRProxied.registerModule(I_MockFactory.address, { from: account_polymath }) - ); - }) + it("Should successfully register the module -- fail because no module type uniqueness", async () => { + await I_MockFactory.changeTypes({ from: account_polymath }); + catchRevert(I_MRProxied.registerModule(I_MockFactory.address, { from: account_polymath })); + }); }); describe("Test case for verifyModule", async () => { @@ -298,7 +282,7 @@ contract("ModuleRegistry", accounts => { }); it("Should successfully verify the module -- false", async () => { - I_CappedSTOFactory1 = await CappedSTOFactory.new(0, 0, 0, I_CappedSTOLogic.address, { from: account_polymath }); + I_CappedSTOFactory1 = await CappedSTOFactory.new(new BN(0), new BN(0), new BN(0), I_CappedSTOLogic.address, { from: account_polymath }); await I_MRProxied.registerModule(I_CappedSTOFactory1.address, { from: account_polymath }); let tx = await I_MRProxied.verifyModule(I_CappedSTOFactory1.address, false, { from: account_polymath }); assert.equal(tx.logs[0].args._moduleFactory, I_CappedSTOFactory1.address, "Failed in verifying the module"); @@ -312,30 +296,26 @@ contract("ModuleRegistry", accounts => { describe("Test cases for the useModule function of the module registry", async () => { it("Deploy the securityToken", async () => { - await I_PolyToken.getTokens(web3.utils.toWei("500"), account_issuer); - await I_PolyToken.approve(I_STRProxied.address, web3.utils.toWei("500"), { from: account_issuer }); + await I_PolyToken.getTokens(new BN(web3.utils.toWei("500")), account_issuer); + await I_PolyToken.approve(I_STRProxied.address, new BN(web3.utils.toWei("500")), { from: account_issuer }); await I_STRProxied.registerTicker(account_issuer, symbol, name, { from: account_issuer }); let tx = await I_STRProxied.generateSecurityToken(name, symbol, tokenDetails, true, { from: account_issuer }); assert.equal(tx.logs[2].args._ticker, symbol.toUpperCase()); - I_SecurityToken = SecurityToken.at(tx.logs[2].args._securityTokenAddress); + I_SecurityToken = await SecurityToken.at(tx.logs[2].args._securityTokenAddress); }); it("Should fail in adding module. Because module is un-verified", async () => { - startTime = latestTime() + duration.seconds(5000); + startTime = await latestTime() + duration.seconds(5000); endTime = startTime + duration.days(30); let bytesSTO = encodeModuleCall(STOParameters, [startTime, endTime, cap, rate, fundRaiseType, account_fundsReceiver]); - await catchRevert(I_SecurityToken.addModule(I_CappedSTOFactory1.address, bytesSTO, 0, 0, { from: token_owner })); + await catchRevert(I_SecurityToken.addModule(I_CappedSTOFactory1.address, bytesSTO, new BN(0), new BN(0), { from: token_owner })); }); it("Should fail to register module because custom modules not allowed", async () => { - I_CappedSTOFactory2 = await CappedSTOFactory.new(0, 0, 0, I_CappedSTOLogic.address, { from: token_owner }); + I_CappedSTOFactory2 = await CappedSTOFactory.new(0, new BN(0), new BN(0), I_CappedSTOLogic.address, { from: token_owner }); - assert.notEqual( - I_CappedSTOFactory2.address.valueOf(), - address_zero, - "CappedSTOFactory contract was not deployed" - ); + assert.notEqual(I_CappedSTOFactory2.address.valueOf(), address_zero, "CappedSTOFactory contract was not deployed"); await catchRevert(I_MRProxied.registerModule(I_CappedSTOFactory2.address, { from: token_owner })); }); @@ -355,11 +335,11 @@ contract("ModuleRegistry", accounts => { }); it("Should successfully add module because custom modules switched on", async () => { - startTime = latestTime() + duration.seconds(5000); + startTime = await latestTime() + duration.seconds(5000); endTime = startTime + duration.days(30); let bytesSTO = encodeModuleCall(STOParameters, [startTime, endTime, cap, rate, fundRaiseType, account_fundsReceiver]); let tx = await I_MRProxied.registerModule(I_CappedSTOFactory2.address, { from: token_owner }); - tx = await I_SecurityToken.addModule(I_CappedSTOFactory2.address, bytesSTO, 0, 0, { from: token_owner }); + tx = await I_SecurityToken.addModule(I_CappedSTOFactory2.address, bytesSTO, new BN(0), new BN(0), { from: token_owner }); assert.equal(tx.logs[2].args._types[0], stoKey, "CappedSTO doesn't get deployed"); assert.equal( @@ -371,29 +351,27 @@ contract("ModuleRegistry", accounts => { assert.equal(_reputation.length, 1); }); - it("Should successfully add module when custom modules switched on -- fail because factory owner is different", async() => { - await I_MRProxied.registerModule(I_CappedSTOFactory3.address, { from: account_temp }) - startTime = latestTime() + duration.seconds(5000); + it("Should successfully add module when custom modules switched on -- fail because factory owner is different", async () => { + await I_MRProxied.registerModule(I_CappedSTOFactory3.address, { from: account_temp }); + startTime = await latestTime() + duration.seconds(5000); endTime = startTime + duration.days(30); let bytesSTO = encodeModuleCall(STOParameters, [startTime, endTime, cap, rate, fundRaiseType, account_fundsReceiver]); - catchRevert( - I_SecurityToken.addModule(I_CappedSTOFactory3.address, bytesSTO, 0, 0, { from: token_owner }) - ); - }) + catchRevert(I_SecurityToken.addModule(I_CappedSTOFactory3.address, bytesSTO, new BN(0), new BN(0), { from: token_owner })); + }); it("Should successfully add verified module", async () => { I_GeneralPermissionManagerLogic = await GeneralPermissionManager.new("0x0000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000", { from: account_polymath }); - I_GeneralPermissionManagerFactory = await GeneralPermissionManagerFactory.new(0, 0, 0, I_GeneralPermissionManagerLogic.address, { + I_GeneralPermissionManagerFactory = await GeneralPermissionManagerFactory.new(0, new BN(0), new BN(0), I_GeneralPermissionManagerLogic.address, { from: account_polymath }); await I_MRProxied.registerModule(I_GeneralPermissionManagerFactory.address, { from: account_polymath }); await I_MRProxied.verifyModule(I_GeneralPermissionManagerFactory.address, true, { from: account_polymath }); - let tx = await I_SecurityToken.addModule(I_GeneralPermissionManagerFactory.address, "", 0, 0, { from: token_owner }); + let tx = await I_SecurityToken.addModule(I_GeneralPermissionManagerFactory.address, "0x0", new BN(0), new BN(0), { from: token_owner }); assert.equal(tx.logs[2].args._types[0], permissionManagerKey, "module doesn't get deployed"); }); it("Should failed in adding the TestSTOFactory module because not compatible with the current protocol version --lower", async () => { - I_TestSTOFactory = await TestSTOFactory.new(0, 0, 0, 0, { from: account_polymath }); + I_TestSTOFactory = await TestSTOFactory.new(new BN(0), new BN(0), new BN(0), address_zero, { from: account_polymath }); await I_MRProxied.registerModule(I_TestSTOFactory.address, { from: account_polymath }); await I_MRProxied.verifyModule(I_TestSTOFactory.address, true, { from: account_polymath }); // Taking the snapshot the revert the changes from here @@ -404,35 +382,35 @@ contract("ModuleRegistry", accounts => { assert.equal(_lstVersion[1], 1); let bytesData = encodeModuleCall( ["uint256", "uint256", "uint256", "string"], - [latestTime(), latestTime() + duration.days(1), cap, "Test STO"] + [await latestTime(), currentTime.add(new BN(duration.days(1))), cap, "Test STO"] ); - await catchRevert(I_SecurityToken.addModule(I_TestSTOFactory.address, bytesData, 0, 0, { from: token_owner })); + await catchRevert(I_SecurityToken.addModule(I_TestSTOFactory.address, bytesData, new BN(0), new BN(0), { from: token_owner })); await revertToSnapshot(id); }); it("Should failed in adding the TestSTOFactory module because not compatible with the current protocol version --upper", async () => { - await I_TestSTOFactory.changeSTVersionBounds("upperBound", [0, 0, 1], { from: account_polymath }); + await I_TestSTOFactory.changeSTVersionBounds("upperBound", [0, new BN(0), 1], { from: account_polymath }); let _ustVersion = await I_TestSTOFactory.getUpperSTVersionBounds.call(); assert.equal(_ustVersion[0], 0); assert.equal(_ustVersion[2], 1); - await I_STRProxied.setProtocolVersion(I_STFactory.address, 2, 0, 1); + await I_STRProxied.setProtocolVersion(I_STFactory.address, 2, new BN(0), 1); // Generate the new securityToken let newSymbol = "toro"; - await I_PolyToken.getTokens(web3.utils.toWei("500"), account_issuer); - await I_PolyToken.approve(I_STRProxied.address, web3.utils.toWei("500"), { from: account_issuer }); + await I_PolyToken.getTokens(new BN(web3.utils.toWei("500")), account_issuer); + await I_PolyToken.approve(I_STRProxied.address, new BN(web3.utils.toWei("500")), { from: account_issuer }); await I_STRProxied.registerTicker(account_issuer, newSymbol, name, { from: account_issuer }); let tx = await I_STRProxied.generateSecurityToken(name, newSymbol, tokenDetails, true, { from: account_issuer }); assert.equal(tx.logs[2].args._ticker, newSymbol.toUpperCase()); - I_SecurityToken2 = SecurityToken.at(tx.logs[2].args._securityTokenAddress); + I_SecurityToken2 = await SecurityToken.at(tx.logs[2].args._securityTokenAddress); let bytesData = encodeModuleCall( ["uint256", "uint256", "uint256", "string"], - [latestTime(), latestTime() + duration.days(1), cap, "Test STO"] + [await latestTime(), currentTime.add(new BN(duration.days(1))), cap, "Test STO"] ); - await catchRevert(I_SecurityToken2.addModule(I_TestSTOFactory.address, bytesData, 0, 0, { from: token_owner })); + await catchRevert(I_SecurityToken2.addModule(I_TestSTOFactory.address, bytesData, new BN(0), new BN(0), { from: token_owner })); }); }); @@ -542,28 +520,23 @@ contract("ModuleRegistry", accounts => { describe("Test cases for IRegistry functionality", async () => { describe("Test cases for reclaiming funds", async () => { - - it("Should successfully reclaim POLY tokens -- fail because token address will be 0x", async() => { - await I_PolyToken.transfer(I_MRProxied.address, web3.utils.toWei("1"), { from: token_owner }); - catchRevert( - I_MRProxied.reclaimERC20("0x000000000000000000000000000000000000000", { from: account_polymath }) - ); + it("Should successfully reclaim POLY tokens -- fail because token address will be 0x", async () => { + await I_PolyToken.transfer(I_MRProxied.address, new BN(web3.utils.toWei("1")), { from: token_owner }); + catchRevert(I_MRProxied.reclaimERC20(address_zero, { from: account_polymath })); }); - it("Should successfully reclaim POLY tokens -- not authorised", async() => { - catchRevert( - I_MRProxied.reclaimERC20(I_PolyToken.address, { from: account_temp }) - ); + it("Should successfully reclaim POLY tokens -- not authorised", async () => { + catchRevert(I_MRProxied.reclaimERC20(I_PolyToken.address, { from: account_temp })); }); it("Should successfully reclaim POLY tokens", async () => { - await I_PolyToken.getTokens(web3.utils.toWei("1"), I_MRProxied.address); + await I_PolyToken.getTokens(new BN(web3.utils.toWei("1")), I_MRProxied.address); let bal1 = await I_PolyToken.balanceOf.call(account_polymath); await I_MRProxied.reclaimERC20(I_PolyToken.address); let bal2 = await I_PolyToken.balanceOf.call(account_polymath); assert.isAtLeast( - bal2.dividedBy(new BigNumber(10).pow(18)).toNumber(), - bal2.dividedBy(new BigNumber(10).pow(18)).toNumber() + bal2.div(new BN(10).pow(new BN(18))).toNumber(), + bal2.div(new BN(10).pow(new BN(18))).toNumber() ); }); }); @@ -590,76 +563,61 @@ contract("ModuleRegistry", accounts => { }); }); - describe("Test cases for the ReclaimTokens contract", async() => { - - it("Should successfully reclaim POLY tokens -- fail because token address will be 0x", async() => { + describe("Test cases for the ReclaimTokens contract", async () => { + it("Should successfully reclaim POLY tokens -- fail because token address will be 0x", async () => { I_ReclaimERC20 = await ReclaimTokens.at(I_FeatureRegistry.address); - await I_PolyToken.transfer(I_ReclaimERC20.address, web3.utils.toWei("1"), { from: token_owner }); - catchRevert( - I_ReclaimERC20.reclaimERC20("0x000000000000000000000000000000000000000", { from: account_polymath }) - ); + await I_PolyToken.transfer(I_ReclaimERC20.address, new BN(web3.utils.toWei("1")), { from: token_owner }); + catchRevert(I_ReclaimERC20.reclaimERC20(address_zero, { from: account_polymath })); }); - it("Should successfully reclaim POLY tokens -- not authorised", async() => { - catchRevert( - I_ReclaimERC20.reclaimERC20(I_PolyToken.address, { from: account_temp }) - ); + it("Should successfully reclaim POLY tokens -- not authorised", async () => { + catchRevert(I_ReclaimERC20.reclaimERC20(I_PolyToken.address, { from: account_temp })); }); it("Should successfully reclaim POLY tokens", async () => { - await I_PolyToken.getTokens(web3.utils.toWei("1"), I_ReclaimERC20.address); + await I_PolyToken.getTokens(new BN(web3.utils.toWei("1")), I_ReclaimERC20.address); let bal1 = await I_PolyToken.balanceOf.call(account_polymath); await I_ReclaimERC20.reclaimERC20(I_PolyToken.address); let bal2 = await I_PolyToken.balanceOf.call(account_polymath); assert.isAtLeast( - bal2.dividedBy(new BigNumber(10).pow(18)).toNumber(), - bal2.dividedBy(new BigNumber(10).pow(18)).toNumber() + bal2.div(new BN(10).pow(new BN(18))).toNumber(), + bal2.div(new BN(10).pow(new BN(18))).toNumber() ); }); - }) - - describe("Test case for the PolymathRegistry", async() => { + }); - it("Should successfully get the address -- fail because key is not exist", async() => { - catchRevert( - I_PolymathRegistry.getAddress("PolyOracle") - ); + describe("Test case for the PolymathRegistry", async () => { + it("Should successfully get the address -- fail because key is not exist", async () => { + catchRevert(I_PolymathRegistry.getAddress("PolyOracle")); }); - it("Should successfully get the address", async() => { + it("Should successfully get the address", async () => { let _moduleR = await I_PolymathRegistry.getAddress("ModuleRegistry"); assert.equal(_moduleR, I_ModuleRegistryProxy.address); - }) - }) - - - describe("Test cases for the transferOwnership", async() => { + }); + }); - it("Should fail to transfer the ownership -- not authorised", async() => { - catchRevert( - I_MRProxied.transferOwnership(account_temp, { from: account_issuer}) - ); + describe("Test cases for the transferOwnership", async () => { + it("Should fail to transfer the ownership -- not authorised", async () => { + catchRevert(I_MRProxied.transferOwnership(account_temp, { from: account_issuer })); }); - it("Should fail to transfer the ownership -- 0x address is not allowed", async() => { - catchRevert( - I_MRProxied.transferOwnership("0x000000000000000000000000000000000000000", { from: account_polymath}) - ); + it("Should fail to transfer the ownership -- 0x address is not allowed", async () => { + catchRevert(I_MRProxied.transferOwnership(address_zero, { from: account_polymath })); }); - it("Should successfully transfer the ownership of the STR", async() => { + it("Should successfully transfer the ownership of the STR", async () => { let tx = await I_MRProxied.transferOwnership(account_temp, { from: account_polymath }); assert.equal(tx.logs[0].args.previousOwner, account_polymath); assert.equal(tx.logs[0].args.newOwner, account_temp); }); - it("New owner has authorisation", async() => { + it("New owner has authorisation", async () => { let tx = await I_MRProxied.transferOwnership(account_polymath, { from: account_temp }); assert.equal(tx.logs[0].args.previousOwner, account_temp); assert.equal(tx.logs[0].args.newOwner, account_polymath); }); - - }) + }); }); }); }); diff --git a/test/l_percentage_transfer_manager.js b/test/l_percentage_transfer_manager.js index c3d08ba58..f98e2c41f 100644 --- a/test/l_percentage_transfer_manager.js +++ b/test/l_percentage_transfer_manager.js @@ -10,10 +10,10 @@ const GeneralPermissionManager = artifacts.require("./GeneralPermissionManager") const SecurityToken = artifacts.require("./SecurityToken.sol"); const Web3 = require("web3"); -const BigNumber = require("bignumber.js"); +let BN = Web3.utils.BN; const web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545")); // Hardcoded development port -contract("PercentageTransferManager", accounts => { +contract("PercentageTransferManager", async (accounts) => { // Accounts Variable declaration let account_polymath; let account_issuer; @@ -24,11 +24,6 @@ contract("PercentageTransferManager", accounts => { let account_investor4; let account_delegate; - // investor Details - let fromTime = latestTime(); - let toTime = latestTime(); - let expiryTime = toTime + duration.days(15); - let message = "Transaction Should Fail!"; // Contract Instance Declaration @@ -59,7 +54,8 @@ contract("PercentageTransferManager", accounts => { const tokenDetails = "This is equity type of issuance"; const decimals = 18; const contact = "team@polymath.network"; - const delegateDetails = "Hello I am legit delegate"; + const managerDetails = web3.utils.fromAscii("Hello"); + const delegateDetails = web3.utils.fromAscii("I am delegate"); // Module key const delegateManagerKey = 1; @@ -67,26 +63,35 @@ contract("PercentageTransferManager", accounts => { const stoKey = 3; // Initial fee for ticker registry and security token registry - const initRegFee = web3.utils.toWei("250"); + const initRegFee = new BN(web3.utils.toWei("250")); // PercentageTransferManager details - const holderPercentage = 70 * 10**16; // Maximum number of token holders - - let bytesSTO = web3.eth.abi.encodeFunctionCall({ - name: 'configure', - type: 'function', - inputs: [{ - type: 'uint256', - name: '_maxHolderPercentage' - },{ - type: 'bool', - name: '_allowPrimaryIssuance' - } - ] - }, [holderPercentage, false]); - - before(async() => { - // Accounts setup + const holderPercentage = 70 * 10 ** 16; // Maximum number of token holders + + let bytesSTO = web3.eth.abi.encodeFunctionCall( + { + name: "configure", + type: "function", + inputs: [ + { + type: "uint256", + name: "_maxHolderPercentage" + }, + { + type: "bool", + name: "_allowPrimaryIssuance" + } + ] + }, + [holderPercentage, false] + ); + + let currentTime; + const address_zero = "0x0000000000000000000000000000000000000000"; + const one_address = "0x0000000000000000000000000000000000000001"; + + before(async () => { + currentTime = new BN(await latestTime()); account_polymath = accounts[0]; account_issuer = accounts[1]; @@ -95,6 +100,7 @@ contract("PercentageTransferManager", accounts => { account_investor1 = accounts[7]; account_investor2 = accounts[8]; account_investor3 = accounts[9]; + account_investor4 = accounts[5] account_delegate = accounts[6]; let instances = await setUpPolymathNetwork(account_polymath, token_owner); @@ -121,7 +127,11 @@ contract("PercentageTransferManager", accounts => { [I_PercentageTransferManagerFactory] = await deployPercentageTMAndVerified(account_polymath, I_MRProxied, 0); // STEP 4(b): Deploy the PercentageTransferManager - [P_PercentageTransferManagerFactory] = await deployPercentageTMAndVerified(account_polymath, I_MRProxied, web3.utils.toWei("500", "ether")); + [P_PercentageTransferManagerFactory] = await deployPercentageTMAndVerified( + account_polymath, + I_MRProxied, + new BN(web3.utils.toWei("500", "ether")) + ); // Printing all the contract addresses console.log(` @@ -152,15 +162,15 @@ contract("PercentageTransferManager", accounts => { it("Should generate the new security token with the same symbol as registered above", async () => { await I_PolyToken.approve(I_STRProxied.address, initRegFee, { from: token_owner }); - let _blockNo = latestBlock(); + let tx = await I_STRProxied.generateSecurityToken(name, symbol, tokenDetails, false, { from: token_owner }); // Verify the successful generation of the security token assert.equal(tx.logs[2].args._ticker, symbol.toUpperCase(), "SecurityToken doesn't get deployed"); - I_SecurityToken = SecurityToken.at(tx.logs[2].args._securityTokenAddress); + I_SecurityToken = await SecurityToken.at(tx.logs[2].args._securityTokenAddress); - const log = await promisifyLogWatch(I_SecurityToken.ModuleAdded({ from: _blockNo }), 1); + const log = (await I_SecurityToken.getPastEvents('ModuleAdded', {filter: {transactionHash: tx.transactionHash}}))[0]; // Verify that GeneralTransferManager module get added successfully or not assert.equal(log.args._types[0].toNumber(), 2); @@ -169,20 +179,19 @@ contract("PercentageTransferManager", accounts => { it("Should intialize the auto attached modules", async () => { let moduleData = (await I_SecurityToken.getModulesByType(2))[0]; - I_GeneralTransferManager = GeneralTransferManager.at(moduleData); + I_GeneralTransferManager = await GeneralTransferManager.at(moduleData); }); it("Should successfully attach the General permission manager factory with the security token", async () => { - const tx = await I_SecurityToken.addModule(I_GeneralPermissionManagerFactory.address, "0x", 0, 0, { from: token_owner }); + const tx = await I_SecurityToken.addModule(I_GeneralPermissionManagerFactory.address, "0x", new BN(0), new BN(0), { from: token_owner }); assert.equal(tx.logs[2].args._types[0].toNumber(), delegateManagerKey, "General Permission Manager doesn't get deployed"); assert.equal( web3.utils.toAscii(tx.logs[2].args._name).replace(/\u0000/g, ""), "GeneralPermissionManager", "GeneralPermissionManagerFactory module was not added" ); - I_GeneralPermissionManager = GeneralPermissionManager.at(tx.logs[2].args._module); + I_GeneralPermissionManager = await GeneralPermissionManager.at(tx.logs[2].args._module); }); - }); describe("Buy tokens using on-chain whitelist", async () => { @@ -191,9 +200,9 @@ contract("PercentageTransferManager", accounts => { let tx = await I_GeneralTransferManager.modifyWhitelist( account_investor1, - latestTime(), - latestTime(), - latestTime() + duration.days(10), + currentTime, + currentTime, + currentTime.add(new BN(duration.days(10))), true, { from: account_issuer, @@ -211,9 +220,9 @@ contract("PercentageTransferManager", accounts => { await increaseTime(5000); // Mint some tokens - await I_SecurityToken.mint(account_investor1, web3.utils.toWei("1", "ether"), { from: token_owner }); + await I_SecurityToken.mint(account_investor1, new BN(web3.utils.toWei("1", "ether")), { from: token_owner }); - assert.equal((await I_SecurityToken.balanceOf(account_investor1)).toNumber(), web3.utils.toWei("1", "ether")); + assert.equal((await I_SecurityToken.balanceOf(account_investor1)).toString(), new BN(web3.utils.toWei("1", "ether")).toString()); }); it("Should Buy some more tokens", async () => { @@ -221,9 +230,9 @@ contract("PercentageTransferManager", accounts => { let tx = await I_GeneralTransferManager.modifyWhitelist( account_investor2, - latestTime(), - latestTime(), - latestTime() + duration.days(10), + currentTime, + currentTime, + currentTime.add(new BN(duration.days(10))), true, { from: account_issuer, @@ -238,15 +247,15 @@ contract("PercentageTransferManager", accounts => { ); // Mint some tokens - await I_SecurityToken.mint(account_investor2, web3.utils.toWei("1", "ether"), { from: token_owner }); + await I_SecurityToken.mint(account_investor2, new BN(web3.utils.toWei("1", "ether")), { from: token_owner }); - assert.equal((await I_SecurityToken.balanceOf(account_investor2)).toNumber(), web3.utils.toWei("1", "ether")); + assert.equal((await I_SecurityToken.balanceOf(account_investor2)).toString(), new BN(web3.utils.toWei("1", "ether")).toString()); }); it("Should successfully attach the PercentageTransferManager factory with the security token - failed payment", async () => { - await I_PolyToken.getTokens(web3.utils.toWei("500", "ether"), token_owner); + await I_PolyToken.getTokens(new BN(web3.utils.toWei("500", "ether")), token_owner); await catchRevert( - I_SecurityToken.addModule(P_PercentageTransferManagerFactory.address, bytesSTO, web3.utils.toWei("500", "ether"), 0, { + I_SecurityToken.addModule(P_PercentageTransferManagerFactory.address, bytesSTO, new BN(web3.utils.toWei("500", "ether")), new BN(0), { from: token_owner }) ); @@ -254,12 +263,12 @@ contract("PercentageTransferManager", accounts => { it("Should successfully attach the PercentageTransferManager factory with the security token", async () => { let snapId = await takeSnapshot(); - await I_PolyToken.transfer(I_SecurityToken.address, web3.utils.toWei("500", "ether"), { from: token_owner }); + await I_PolyToken.transfer(I_SecurityToken.address, new BN(web3.utils.toWei("500", "ether")), { from: token_owner }); const tx = await I_SecurityToken.addModule( P_PercentageTransferManagerFactory.address, bytesSTO, - web3.utils.toWei("500", "ether"), - 0, + new BN(web3.utils.toWei("500", "ether")), + new BN(0), { from: token_owner } ); assert.equal(tx.logs[3].args._types[0].toNumber(), transferManagerKey, "PercentageTransferManagerFactory doesn't get deployed"); @@ -268,27 +277,27 @@ contract("PercentageTransferManager", accounts => { "PercentageTransferManager", "PercentageTransferManagerFactory module was not added" ); - P_PercentageTransferManager = PercentageTransferManager.at(tx.logs[3].args._module); + P_PercentageTransferManager = await PercentageTransferManager.at(tx.logs[3].args._module); await revertToSnapshot(snapId); }); it("Should successfully attach the PercentageTransferManager with the security token", async () => { - const tx = await I_SecurityToken.addModule(I_PercentageTransferManagerFactory.address, bytesSTO, 0, 0, { from: token_owner }); + const tx = await I_SecurityToken.addModule(I_PercentageTransferManagerFactory.address, bytesSTO, new BN(0), new BN(0), { from: token_owner }); assert.equal(tx.logs[2].args._types[0].toNumber(), transferManagerKey, "PercentageTransferManager doesn't get deployed"); assert.equal( web3.utils.toAscii(tx.logs[2].args._name).replace(/\u0000/g, ""), "PercentageTransferManager", "PercentageTransferManager module was not added" ); - I_PercentageTransferManager = PercentageTransferManager.at(tx.logs[2].args._module); + I_PercentageTransferManager = await PercentageTransferManager.at(tx.logs[2].args._module); }); it("Add a new token holder", async () => { let tx = await I_GeneralTransferManager.modifyWhitelist( account_investor3, - latestTime(), - latestTime(), - latestTime() + duration.days(10), + currentTime, + currentTime, + currentTime.add(new BN(duration.days(10))), true, { from: account_issuer, @@ -304,9 +313,9 @@ contract("PercentageTransferManager", accounts => { // Add the Investor in to the whitelist // Mint some tokens - await I_SecurityToken.mint(account_investor3, web3.utils.toWei("1", "ether"), { from: token_owner }); + await I_SecurityToken.mint(account_investor3, new BN(web3.utils.toWei("1", "ether")), { from: token_owner }); - assert.equal((await I_SecurityToken.balanceOf(account_investor3)).toNumber(), web3.utils.toWei("1", "ether")); + assert.equal((await I_SecurityToken.balanceOf(account_investor3)).toString(), new BN(web3.utils.toWei("1", "ether")).toString()); }); it("Should pause the tranfers at transferManager level", async () => { @@ -316,9 +325,9 @@ contract("PercentageTransferManager", accounts => { it("Should still be able to transfer between existing token holders up to limit", async () => { // Add the Investor in to the whitelist // Mint some tokens - await I_SecurityToken.transfer(account_investor1, web3.utils.toWei("1", "ether"), { from: account_investor2 }); + await I_SecurityToken.transfer(account_investor1, new BN(web3.utils.toWei("1", "ether")), { from: account_investor2 }); - assert.equal((await I_SecurityToken.balanceOf(account_investor1)).toNumber(), web3.utils.toWei("2", "ether")); + assert.equal((await I_SecurityToken.balanceOf(account_investor1)).toString(), new BN(web3.utils.toWei("2", "ether")).toString()); }); it("Should unpause the tranfers at transferManager level", async () => { @@ -326,48 +335,42 @@ contract("PercentageTransferManager", accounts => { }); it("Should not be able to transfer between existing token holders over limit", async () => { - await catchRevert(I_SecurityToken.transfer(account_investor3, web3.utils.toWei("2", "ether"), { from: account_investor1 })); + await catchRevert(I_SecurityToken.transfer(account_investor3, new BN(web3.utils.toWei("2", "ether")), { from: account_investor1 })); }); - it("Should not be able to mint token amount over limit", async() => { - await catchRevert(I_SecurityToken.mint(account_investor3, web3.utils.toWei('100', 'ether'), { from: token_owner })) + it("Should not be able to mint token amount over limit", async () => { + await catchRevert(I_SecurityToken.mint(account_investor3, new BN(web3.utils.toWei("100", "ether")), { from: token_owner })); }); - it("Allow unlimited primary issuance and remint", async() => { + it("Allow unlimited primary issuance and remint", async () => { let snapId = await takeSnapshot(); await I_PercentageTransferManager.setAllowPrimaryIssuance(true, { from: token_owner }); - await I_SecurityToken.mint(account_investor3, web3.utils.toWei('100', 'ether'), { from: token_owner }); + await I_SecurityToken.mint(account_investor3, new BN(web3.utils.toWei("100", "ether")), { from: token_owner }); // trying to call it again with the same value. should fail - await catchRevert( - I_PercentageTransferManager.setAllowPrimaryIssuance(true, { from: token_owner }) - ) + await catchRevert(I_PercentageTransferManager.setAllowPrimaryIssuance(true, { from: token_owner })); await revertToSnapshot(snapId); }); - it("Should not be able to transfer between existing token holders over limit", async() => { - await catchRevert( - I_SecurityToken.transfer(account_investor3, web3.utils.toWei('2', 'ether'), { from: account_investor1 }) - ) + it("Should not be able to transfer between existing token holders over limit", async () => { + await catchRevert(I_SecurityToken.transfer(account_investor3, new BN(web3.utils.toWei("2", "ether")), { from: account_investor1 })); }); it("Should not be able to modify holder percentage to 100 - Unauthorized msg.sender", async () => { - await catchRevert( - I_PercentageTransferManager.changeHolderPercentage(100 * 10 ** 16, { from: account_delegate }) - ) + await catchRevert(I_PercentageTransferManager.changeHolderPercentage(new BN(10).pow(new BN(18)), { from: account_delegate })); }); - it("Should successfully add the delegate", async() => { - let tx = await I_GeneralPermissionManager.addDelegate(account_delegate, delegateDetails, { from: token_owner}); + it("Should successfully add the delegate", async () => { + let tx = await I_GeneralPermissionManager.addDelegate(account_delegate, delegateDetails, { from: token_owner }); assert.equal(tx.logs[0].args._delegate, account_delegate); }); - it("Should provide the permission", async() => { + it("Should provide the permission", async () => { let tx = await I_GeneralPermissionManager.changePermission( account_delegate, I_PercentageTransferManager.address, - "ADMIN", + web3.utils.fromAscii("ADMIN"), true, - {from: token_owner} + { from: token_owner } ); assert.equal(tx.logs[0].args._delegate, account_delegate); }); @@ -375,32 +378,38 @@ contract("PercentageTransferManager", accounts => { it("Modify holder percentage to 100", async () => { // Add the Investor in to the whitelist // Mint some tokens - await I_PercentageTransferManager.changeHolderPercentage(100 * 10 ** 16, { from: account_delegate }); + await I_PercentageTransferManager.changeHolderPercentage(new BN(10).pow(new BN(18)), { from: account_delegate }); - assert.equal((await I_PercentageTransferManager.maxHolderPercentage()).toNumber(), 100 * 10 ** 16); + assert.equal((await I_PercentageTransferManager.maxHolderPercentage()).toString(), (new BN(10).pow(new BN(18))).toString()); }); it("Should be able to transfer between existing token holders up to limit", async () => { await I_PercentageTransferManager.modifyWhitelist(account_investor3, false, { from: token_owner }); - await I_SecurityToken.transfer(account_investor3, web3.utils.toWei("2", "ether"), { from: account_investor1 }); + await I_SecurityToken.transfer(account_investor3, new BN(web3.utils.toWei("2", "ether")), { from: account_investor1 }); }); - it("Should whitelist in batch --failed because of mismatch in array lengths", async() => { + it("Should whitelist in batch --failed because of mismatch in array lengths", async () => { + let addressArray = [account_investor3, account_investor4]; await catchRevert( - I_PercentageTransferManager.modifyWhitelistMulti([account_investor3, account_investor4], [false], { from: token_owner }) + I_PercentageTransferManager.modifyWhitelistMulti(addressArray, [false], { from: token_owner }) ); - }) + }); - it("Should whitelist in batch", async() => { + it("Should whitelist in batch", async () => { let snapId = await takeSnapshot(); - await I_PercentageTransferManager.modifyWhitelistMulti([account_investor3, account_investor4], [false, true], { from: token_owner }); + let addressArray = []; + addressArray.push(account_investor3); + addressArray.push(account_investor4); + await I_PercentageTransferManager.modifyWhitelistMulti(addressArray, [false, true], { + from: token_owner + }); await revertToSnapshot(snapId); - }) + }); it("Should be able to whitelist address and then transfer regardless of holders", async () => { - await I_PercentageTransferManager.changeHolderPercentage(30 * 10 ** 16, { from: token_owner }); + await I_PercentageTransferManager.changeHolderPercentage(new BN(30).mul(new BN(10).pow(new BN(16))), { from: token_owner }); await I_PercentageTransferManager.modifyWhitelist(account_investor1, true, { from: token_owner }); - await I_SecurityToken.transfer(account_investor1, web3.utils.toWei("2", "ether"), { from: account_investor3 }); + await I_SecurityToken.transfer(account_investor1, new BN(web3.utils.toWei("2", "ether")), { from: account_investor3 }); }); it("Should get the permission", async () => { diff --git a/test/m_presale_sto.js b/test/m_presale_sto.js index 696ec92a1..daa982397 100644 --- a/test/m_presale_sto.js +++ b/test/m_presale_sto.js @@ -3,7 +3,7 @@ import { duration, ensureException, promisifyLogWatch, latestBlock } from "./hel import { takeSnapshot, increaseTime, revertToSnapshot } from "./helpers/time"; import { encodeProxyCall, encodeModuleCall } from "./helpers/encodeCall"; import { catchRevert } from "./helpers/exceptions"; -import { setUpPolymathNetwork, deployPresaleSTOAndVerified } from "./helpers/createInstances" +import { setUpPolymathNetwork, deployPresaleSTOAndVerified } from "./helpers/createInstances"; const PreSaleSTOFactory = artifacts.require("./PreSaleSTOFactory.sol"); const PreSaleSTO = artifacts.require("./PreSaleSTO.sol"); @@ -11,10 +11,10 @@ const SecurityToken = artifacts.require("./SecurityToken.sol"); const GeneralTransferManager = artifacts.require("./GeneralTransferManager"); const Web3 = require("web3"); -const BigNumber = require("bignumber.js"); +let BN = Web3.utils.BN; const web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545")); // Hardcoded development port -contract("PreSaleSTO", accounts => { +contract("PreSaleSTO", async (accounts) => { // Accounts Variable declaration let account_polymath; let account_investor1; @@ -69,13 +69,16 @@ contract("PreSaleSTO", accounts => { const budget = 0; // Initial fee for ticker registry and security token registry - const initRegFee = web3.utils.toWei("250"); + const initRegFee = new BN(web3.utils.toWei("250")); let endTime; const address_zero = "0x0000000000000000000000000000000000000000"; + const one_address = "0x0000000000000000000000000000000000000001"; const STOParameters = ["uint256"]; + let currentTime; + before(async () => { - // Accounts setup + currentTime = new BN(await latestTime()); account_polymath = accounts[0]; account_issuer = accounts[1]; account_investor1 = accounts[4]; @@ -134,15 +137,15 @@ contract("PreSaleSTO", accounts => { it("Should generate the new security token with the same symbol as registered above", async () => { await I_PolyToken.approve(I_STRProxied.address, initRegFee, { from: token_owner }); - let _blockNo = latestBlock(); + let tx = await I_STRProxied.generateSecurityToken(name, symbol, tokenDetails, false, { from: token_owner }); // Verify the successful generation of the security token assert.equal(tx.logs[2].args._ticker, symbol, "SecurityToken doesn't get deployed"); - I_SecurityToken = SecurityToken.at(tx.logs[2].args._securityTokenAddress); + I_SecurityToken = await SecurityToken.at(tx.logs[2].args._securityTokenAddress); - const log = await promisifyLogWatch(I_SecurityToken.ModuleAdded({ from: _blockNo }), 1); + const log = (await I_SecurityToken.getPastEvents('ModuleAdded', {filter: {transactionHash: tx.transactionHash}}))[0]; // Verify that GeneralTransferManager module get added successfully or not assert.equal(log.args._types[0].toNumber(), transferManagerKey); @@ -151,21 +154,23 @@ contract("PreSaleSTO", accounts => { it("Should intialize the auto attached modules", async () => { let moduleData = (await I_SecurityToken.getModulesByType(transferManagerKey))[0]; - I_GeneralTransferManager = GeneralTransferManager.at(moduleData); + I_GeneralTransferManager = await GeneralTransferManager.at(moduleData); }); it("Should fail to launch the STO due to endTime is 0", async () => { let bytesSTO = encodeModuleCall(STOParameters, [0]); - await catchRevert(I_SecurityToken.addModule(I_PreSaleSTOFactory.address, bytesSTO, 0, 0, { from: token_owner })); + await catchRevert(I_SecurityToken.addModule(I_PreSaleSTOFactory.address, bytesSTO, new BN(0), new BN(0), { from: token_owner })); }); it("Should successfully attach the Paid STO factory with the security token", async () => { let snap_id = await takeSnapshot(); - endTime = latestTime() + duration.days(30); // Start time will be 5000 seconds more than the latest time + endTime = await latestTime() + duration.days(30); // Start time will be 5000 seconds more than the latest time let bytesSTO = encodeModuleCall(STOParameters, [endTime]); - await I_PolyToken.getTokens(web3.utils.toWei("500"), I_SecurityToken.address); - const tx = await I_SecurityToken.addModule(P_PreSaleSTOFactory.address, bytesSTO, web3.utils.toWei("500"), 0, { from: token_owner }); + await I_PolyToken.getTokens(new BN(web3.utils.toWei("500")), I_SecurityToken.address); + const tx = await I_SecurityToken.addModule(P_PreSaleSTOFactory.address, bytesSTO, new BN(web3.utils.toWei("500")), new BN(0), { + from: token_owner + }); assert.equal(tx.logs[2].args._types[0], stoKey, "PreSaleSTO doesn't get deployed"); assert.equal( @@ -173,23 +178,21 @@ contract("PreSaleSTO", accounts => { "PreSaleSTO", "PreSaleSTOFactory module was not added" ); - I_PreSaleSTO = PreSaleSTO.at(tx.logs[2].args._module); + I_PreSaleSTO = await PreSaleSTO.at(tx.logs[2].args._module); await revertToSnapshot(snap_id); }); it("Should successfully attach the STO factory with the security token -- fail because signature is different", async () => { - endTime = latestTime() + duration.days(30); // Start time will be 5000 seconds more than the latest time + endTime = await latestTime() + duration.days(30); // Start time will be 5000 seconds more than the latest time let bytesSTO = encodeModuleCall(["string"], ["hey"]); - await catchRevert( - I_SecurityToken.addModule(I_PreSaleSTOFactory.address, bytesSTO, 0, 0, { from: token_owner }) - ); + await catchRevert(I_SecurityToken.addModule(I_PreSaleSTOFactory.address, bytesSTO, new BN(0), new BN(0), { from: token_owner })); }); it("Should successfully attach the STO factory with the security token", async () => { - endTime = latestTime() + duration.days(30); // Start time will be 5000 seconds more than the latest time + endTime = await latestTime() + duration.days(30); // Start time will be 5000 seconds more than the latest time let bytesSTO = encodeModuleCall(STOParameters, [endTime]); - const tx = await I_SecurityToken.addModule(I_PreSaleSTOFactory.address, bytesSTO, 0, 0, { from: token_owner }); + const tx = await I_SecurityToken.addModule(I_PreSaleSTOFactory.address, bytesSTO, new BN(0), new BN(0), { from: token_owner }); assert.equal(tx.logs[2].args._types[0], stoKey, "PreSaleSTO doesn't get deployed"); assert.equal( @@ -197,14 +200,14 @@ contract("PreSaleSTO", accounts => { "PreSaleSTO", "PreSaleSTOFactory module was not added" ); - I_PreSaleSTO = PreSaleSTO.at(tx.logs[2].args._module); + I_PreSaleSTO = await PreSaleSTO.at(tx.logs[2].args._module); }); it("Should successfully attach the STO factory with the security token", async () => { - endTime = latestTime() + duration.days(30); // Start time will be 5000 seconds more than the latest time + endTime = await latestTime() + duration.days(30); // Start time will be 5000 seconds more than the latest time let bytesSTO = encodeModuleCall(STOParameters, [endTime]); - const tx = await I_SecurityToken.addModule(I_PreSaleSTOFactory.address, bytesSTO, 0, 0, { from: token_owner }); + const tx = await I_SecurityToken.addModule(I_PreSaleSTOFactory.address, bytesSTO, new BN(0), new BN(0), { from: token_owner }); assert.equal(tx.logs[2].args._types[0], stoKey, "PreSaleSTO doesn't get deployed"); assert.equal( @@ -212,7 +215,7 @@ contract("PreSaleSTO", accounts => { "PreSaleSTO", "PreSaleSTOFactory module was not added" ); - I_PreSaleSTO = PreSaleSTO.at(tx.logs[2].args._module); + I_PreSaleSTO = await PreSaleSTO.at(tx.logs[2].args._module); }); }); @@ -229,11 +232,11 @@ contract("PreSaleSTO", accounts => { describe("Buy tokens", async () => { it("Should allocate the tokens -- failed due to investor not on whitelist", async () => { - await catchRevert(I_PreSaleSTO.allocateTokens(account_investor1, 1000, web3.utils.toWei("1", "ether"), 0)); + await catchRevert(I_PreSaleSTO.allocateTokens(account_investor1, 1000, new BN(web3.utils.toWei("1", "ether")), 0)); }); it("Should Buy the tokens", async () => { - fromTime = latestTime(); + fromTime = await latestTime(); toTime = fromTime + duration.days(100); expiryTime = toTime + duration.days(100); @@ -247,34 +250,34 @@ contract("PreSaleSTO", accounts => { // Jump time await increaseTime(duration.days(1)); - await I_PreSaleSTO.allocateTokens(account_investor1, web3.utils.toWei("1", "ether"), web3.utils.toWei("1", "ether"), 0, { + await I_PreSaleSTO.allocateTokens(account_investor1, new BN(web3.utils.toWei("1", "ether")), new BN(web3.utils.toWei("1", "ether")), new BN(0), { from: account_issuer }); - assert.equal((await I_PreSaleSTO.getRaised.call(0)).dividedBy(new BigNumber(10).pow(18)).toNumber(), 1); + assert.equal((await I_PreSaleSTO.getRaised.call(0)).div(new BN(10).pow(new BN(18))).toNumber(), 1); console.log(await I_PreSaleSTO.getNumberInvestors.call()); assert.equal((await I_PreSaleSTO.getNumberInvestors.call()).toNumber(), 1); // assert.isTrue(false); }); - it("Should allocate the tokens --failed because of amount is 0", async() => { + it("Should allocate the tokens --failed because of amount is 0", async () => { await catchRevert( - I_PreSaleSTO.allocateTokens(account_investor1, 0, web3.utils.toWei("1", "ether"), 0, { + I_PreSaleSTO.allocateTokens(account_investor1, new BN(0), new BN(web3.utils.toWei("1", "ether")), new BN(0), { from: account_issuer }) ); - }) + }); it("Should allocate the tokens -- failed due to msg.sender is not pre sale admin", async () => { await catchRevert( - I_PreSaleSTO.allocateTokens(account_investor1, web3.utils.toWei("1", "ether"), web3.utils.toWei("1", "ether"), 0, { + I_PreSaleSTO.allocateTokens(account_investor1, new BN(web3.utils.toWei("1", "ether")), new BN(web3.utils.toWei("1", "ether")), new BN(0), { from: account_fundsReceiver }) ); }); it("Should allocate tokens to multiple investors", async () => { - fromTime = latestTime(); + fromTime = await latestTime(); toTime = fromTime + duration.days(100); expiryTime = toTime + duration.days(100); @@ -296,82 +299,84 @@ contract("PreSaleSTO", accounts => { await I_PreSaleSTO.allocateTokensMulti( [account_investor2, account_investor3], - [web3.utils.toWei("1", "ether"), web3.utils.toWei("1", "ether")], + [new BN(web3.utils.toWei("1", "ether")), new BN(web3.utils.toWei("1", "ether"))], [0, 0], - [web3.utils.toWei("1000", "ether"), web3.utils.toWei("1000", "ether")], + [new BN(web3.utils.toWei("1000", "ether")), new BN(web3.utils.toWei("1000", "ether"))], { from: account_issuer } ); - assert.equal((await I_PreSaleSTO.getRaised.call(1)).dividedBy(new BigNumber(10).pow(18)).toNumber(), 2000); + assert.equal((await I_PreSaleSTO.getRaised.call(1)).div(new BN(10).pow(new BN(18))).toNumber(), 2000); assert.equal((await I_PreSaleSTO.getNumberInvestors.call()).toNumber(), 3); }); - it("Should successfully mint multiple tokens -- failed because array mismatch", async() => { + it("Should successfully mint multiple tokens -- failed because array mismatch", async () => { await catchRevert( I_PreSaleSTO.allocateTokensMulti( [account_investor2], - [web3.utils.toWei("1", "ether"), web3.utils.toWei("1", "ether")], + [new BN(web3.utils.toWei("1", "ether")), new BN(web3.utils.toWei("1", "ether"))], [0, 0], - [web3.utils.toWei("1000", "ether"), web3.utils.toWei("1000", "ether")], + [new BN(web3.utils.toWei("1000", "ether")), new BN(web3.utils.toWei("1000", "ether"))], { from: account_issuer } ) ); - }) + }); - it("Should successfully mint multiple tokens -- failed because array mismatch", async() => { + it("Should successfully mint multiple tokens -- failed because array mismatch", async () => { await catchRevert( I_PreSaleSTO.allocateTokensMulti( [account_investor2, account_investor3], - [web3.utils.toWei("1", "ether"), web3.utils.toWei("1", "ether")], + [new BN(web3.utils.toWei("1", "ether")), new BN(web3.utils.toWei("1", "ether"))], [0], - [web3.utils.toWei("1000", "ether"), web3.utils.toWei("1000", "ether")], + [new BN(web3.utils.toWei("1000", "ether")), new BN(web3.utils.toWei("1000", "ether"))], { from: account_issuer } ) ); }); - it("Should successfully mint multiple tokens -- failed because array mismatch", async() => { + it("Should successfully mint multiple tokens -- failed because array mismatch", async () => { await catchRevert( I_PreSaleSTO.allocateTokensMulti( [account_investor2, account_investor3], - [web3.utils.toWei("1", "ether"), web3.utils.toWei("1", "ether")], - [0,0], - [web3.utils.toWei("1000", "ether")], + [new BN(web3.utils.toWei("1", "ether")), new BN(web3.utils.toWei("1", "ether"))], + [0, 0], + [new BN(web3.utils.toWei("1000", "ether"))], { from: account_issuer } ) ); }); - it("Should successfully mint multiple tokens -- failed because array mismatch", async() => { + it("Should successfully mint multiple tokens -- failed because array mismatch", async () => { await catchRevert( I_PreSaleSTO.allocateTokensMulti( [account_investor2, account_investor3], - [web3.utils.toWei("1", "ether"), web3.utils.toWei("1", "ether")], + [new BN(web3.utils.toWei("1", "ether")), new BN(web3.utils.toWei("1", "ether"))], [0], - [web3.utils.toWei("1000", "ether"), web3.utils.toWei("1000", "ether")], + [new BN(web3.utils.toWei("1000", "ether")), new BN(web3.utils.toWei("1000", "ether"))], { from: account_issuer } ) ); }); - it("Should buy some more tokens to previous investor", async() => { - await I_PreSaleSTO.allocateTokens(account_investor1, web3.utils.toWei("1000", "ether"), web3.utils.toWei("1", "ether"), 0, { from: account_issuer }); + it("Should buy some more tokens to previous investor", async () => { + await I_PreSaleSTO.allocateTokens(account_investor1, new BN(web3.utils.toWei("1000", "ether")), new BN(web3.utils.toWei("1", "ether")), new BN(0), { + from: account_issuer + }); // No change in the investor count assert.equal((await I_PreSaleSTO.getNumberInvestors.call()).toNumber(), 3); - }) + }); it("Should failed at the time of buying the tokens -- Because STO has ended", async () => { await increaseTime(duration.days(100)); // increased beyond the end time of the STO await catchRevert( - I_PreSaleSTO.allocateTokens(account_investor1, 1000, web3.utils.toWei("1", "ether"), 0, { from: account_issuer }) + I_PreSaleSTO.allocateTokens(account_investor1, 1000, new BN(web3.utils.toWei("1", "ether")), new BN(0), { from: account_issuer }) ); }); }); describe("Reclaim poly sent to STO by mistake", async () => { it("Should fail to reclaim POLY because token contract address is 0 address", async () => { - let value = web3.utils.toWei("100", "ether"); + let value = new BN(web3.utils.toWei("100", "ether")); await I_PolyToken.getTokens(value, account_investor1); await I_PolyToken.transfer(I_PreSaleSTO.address, value, { from: account_investor1 }); @@ -379,7 +384,7 @@ contract("PreSaleSTO", accounts => { }); it("Should successfully reclaim POLY", async () => { - let value = web3.utils.toWei("100", "ether"); + let value = new BN(web3.utils.toWei("100", "ether")); await I_PolyToken.getTokens(value, account_investor1); let initInvestorBalance = await I_PolyToken.balanceOf(account_investor1); let initOwnerBalance = await I_PolyToken.balanceOf(token_owner); @@ -388,29 +393,29 @@ contract("PreSaleSTO", accounts => { await I_PolyToken.transfer(I_PreSaleSTO.address, value, { from: account_investor1 }); await I_PreSaleSTO.reclaimERC20(I_PolyToken.address, { from: token_owner }); assert.equal( - (await I_PolyToken.balanceOf(account_investor1)).toNumber(), - initInvestorBalance.sub(value).toNumber(), + (await I_PolyToken.balanceOf(account_investor1)).toString(), + initInvestorBalance.sub(value).toString(), "tokens are not transferred out from investor account" ); assert.equal( - (await I_PolyToken.balanceOf(token_owner)).toNumber(), + (await I_PolyToken.balanceOf(token_owner)).toString(), initOwnerBalance .add(value) .add(initContractBalance) - .toNumber(), + .toString(), "tokens are not added to the owner account" ); assert.equal( (await I_PolyToken.balanceOf(I_PreSaleSTO.address)).toNumber(), - 0, + new BN(0).toNumber(), "tokens are not trandfered out from STO contract" ); }); - it("Should get the the tokens sold", async() => { + it("Should get the the tokens sold", async () => { let _tokensSold = await I_PreSaleSTO.getTokensSold.call(); console.log(_tokensSold); - }) + }); }); describe("Test cases for the PresaleSTOFactory", async () => { diff --git a/test/n_security_token_registry.js b/test/n_security_token_registry.js index c8210a786..05955cb71 100644 --- a/test/n_security_token_registry.js +++ b/test/n_security_token_registry.js @@ -13,12 +13,11 @@ const SecurityTokenRegistryMock = artifacts.require("./SecurityTokenRegistryMock const STFactory = artifacts.require("./STFactory.sol"); const STRGetter = artifacts.require('./STRGetter.sol'); - const Web3 = require("web3"); -const BigNumber = require("bignumber.js"); +let BN = Web3.utils.BN; const web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545")); // Hardcoded development port -contract("SecurityTokenRegistry", accounts => { +contract("SecurityTokenRegistry", async (accounts) => { // Accounts Variable declaration let account_polymath; let account_investor1; @@ -31,9 +30,6 @@ contract("SecurityTokenRegistry", accounts => { let dummy_token; let balanceOfReceiver; - // investor Details - let fromTime = latestTime(); - let toTime = latestTime() + duration.days(100); let ID_snap; const message = "Transaction Should Fail!!"; @@ -74,6 +70,7 @@ contract("SecurityTokenRegistry", accounts => { const symbol2 = "DET2"; const tokenDetails2 = "This is equity type of issuance"; const address_zero = "0x0000000000000000000000000000000000000000"; + const one_address = "0x0000000000000000000000000000000000000001"; // Module key const permissionManagerKey = 1; @@ -82,18 +79,20 @@ contract("SecurityTokenRegistry", accounts => { const budget = 0; // Initial fee for ticker registry and security token registry - const initRegFee = web3.utils.toWei("250"); - const newRegFee = web3.utils.toWei("300"); + const initRegFee = new BN(web3.utils.toWei("250")); + const newRegFee = new BN(web3.utils.toWei("300")); const STRProxyParameters = ["address", "address", "uint256", "uint256", "address", "address"]; const STOParameters = ["uint256", "uint256", "uint256", "string"]; // Capped STO details - const cap = web3.utils.toWei("10000"); + const cap = new BN(web3.utils.toWei("10000")); const someString = "Hello string"; + let currentTime; + before(async () => { - // Accounts setup + currentTime = new BN(await latestTime()); account_polymath = accounts[0]; account_issuer = accounts[1]; account_investor1 = accounts[9]; @@ -199,7 +198,7 @@ contract("SecurityTokenRegistry", accounts => { let bytesProxy = encodeProxyCall(STRProxyParameters, [ I_PolymathRegistry.address, I_STFactory.address, - 0, + new BN(0), initRegFee, account_polymath, I_STRGetter.address @@ -217,7 +216,7 @@ contract("SecurityTokenRegistry", accounts => { I_PolymathRegistry.address, I_STFactory.address, initRegFee, - 0, + new BN(0), account_polymath, I_STRGetter.address ]); @@ -247,14 +246,7 @@ contract("SecurityTokenRegistry", accounts => { }); it("Should successfully update the implementation address -- fail because all params get 0", async () => { - let bytesProxy = encodeProxyCall(STRProxyParameters, [ - address_zero, - address_zero, - 0, - 0, - address_zero, - address_zero - ]); + let bytesProxy = encodeProxyCall(STRProxyParameters, [address_zero, address_zero, new BN(0), new BN(0), address_zero, address_zero]); await catchRevert( I_SecurityTokenRegistryProxy.upgradeToAndCall("1.0.0", I_SecurityTokenRegistry.address, bytesProxy, { from: account_polymath @@ -275,8 +267,8 @@ contract("SecurityTokenRegistry", accounts => { await I_SecurityTokenRegistryProxy.upgradeToAndCall("1.0.0", I_SecurityTokenRegistry.address, bytesProxy, { from: account_polymath }); - I_Getter = STRGetter.at(I_SecurityTokenRegistryProxy.address); - I_STRProxied = SecurityTokenRegistry.at(I_SecurityTokenRegistryProxy.address); + I_Getter = await STRGetter.at(I_SecurityTokenRegistryProxy.address); + I_STRProxied = await SecurityTokenRegistry.at(I_SecurityTokenRegistryProxy.address); }); }); @@ -292,10 +284,10 @@ contract("SecurityTokenRegistry", accounts => { assert.equal(polytoken, I_PolyToken.address, "Should be the polytoken address"); let stlaunchFee = await I_STRProxied.getUintValues.call(web3.utils.soliditySha3("stLaunchFee")); - assert.equal(stlaunchFee.toNumber(), initRegFee, "Should be provided reg fee"); + assert.equal(stlaunchFee.toString(), initRegFee.toString(), "Should be provided reg fee"); let tickerRegFee = await I_STRProxied.getUintValues.call(web3.utils.soliditySha3("tickerRegFee")); - assert.equal(tickerRegFee.toNumber(), tickerRegFee, "Should be provided reg fee"); + assert.equal(tickerRegFee.toString(), tickerRegFee.toString(), "Should be provided reg fee"); let polymathRegistry = await I_STRProxied.getAddressValues.call(web3.utils.soliditySha3("polymathRegistry")); assert.equal(polymathRegistry, I_PolymathRegistry.address, "Should be the address of the polymath registry"); @@ -362,14 +354,14 @@ contract("SecurityTokenRegistry", accounts => { assert.equal(data[3], ""); }); - it("Should register the ticker when the tickerRegFee is 0", async() => { + it("Should register the ticker when the tickerRegFee is 0", async () => { let snap_Id = await takeSnapshot(); await I_STRProxied.changeTickerRegistrationFee(0, { from: account_polymath }); let tx = await I_STRProxied.registerTicker(account_temp, "ZERO", name, { from: account_temp }); assert.equal(tx.logs[0].args._owner, account_temp, `Owner should be the ${account_temp}`); assert.equal(tx.logs[0].args._ticker, "ZERO", `Symbol should be ZERO`); await revertToSnapshot(snap_Id); - }) + }); it("Should fail to register same symbol again", async () => { // Give POLY to token issuer @@ -467,7 +459,7 @@ contract("SecurityTokenRegistry", accounts => { }); it("Should fail to generate new security token if fee not provided", async () => { - await I_PolyToken.approve(I_STRProxied.address, 0, { from: token_owner }); + await I_PolyToken.approve(I_STRProxied.address, new BN(0), { from: token_owner }); await catchRevert( I_STRProxied.generateSecurityToken(name, symbol, tokenDetails, false, { from: token_owner }), @@ -489,7 +481,7 @@ contract("SecurityTokenRegistry", accounts => { await I_STRProxied.unpause({ from: account_polymath }); await catchRevert( - I_STRProxied.generateSecurityToken(name, "", tokenDetails, false, { from: token_owner }), + I_STRProxied.generateSecurityToken(name, "0x0", tokenDetails, false, { from: token_owner }), "tx revert -> Zero ticker length is not allowed" ); }); @@ -509,15 +501,15 @@ contract("SecurityTokenRegistry", accounts => { }); it("Should generate the new security token with the same symbol as registered above", async () => { - let _blockNo = latestBlock(); + let tx = await I_STRProxied.generateSecurityToken(name, symbol, tokenDetails, false, { from: token_owner }); // Verify the successful generation of the security token assert.equal(tx.logs[2].args._ticker, symbol, "SecurityToken doesn't get deployed"); - I_SecurityToken = SecurityToken.at(tx.logs[2].args._securityTokenAddress); + I_SecurityToken = await SecurityToken.at(tx.logs[2].args._securityTokenAddress); - const log = await promisifyLogWatch(I_SecurityToken.ModuleAdded({ from: _blockNo }), 1); + const log = (await I_SecurityToken.getPastEvents('ModuleAdded', {filter: {transactionHash: tx.transactionHash}}))[0]; // Verify that GeneralTrasnferManager module get added successfully or not assert.equal(log.args._types[0].toNumber(), transferManagerKey, `Should be equal to the ${transferManagerKey}`); @@ -531,9 +523,9 @@ contract("SecurityTokenRegistry", accounts => { ); }); - it("Should fail to generate the SecurityToken because ticker gets expired", async() => { + it("Should fail to generate the SecurityToken because ticker gets expired", async () => { let snap_Id = await takeSnapshot(); - await I_PolyToken.approve(I_STRProxied.address, web3.utils.toWei("500"), { from: token_owner }); + await I_PolyToken.approve(I_STRProxied.address, new BN(web3.utils.toWei("500")), { from: token_owner }); let tx = await I_STRProxied.registerTicker(token_owner, "CCC", name, { from: token_owner }); await increaseTime(duration.days(65)); await catchRevert( @@ -543,13 +535,13 @@ contract("SecurityTokenRegistry", accounts => { await revertToSnapshot(snap_Id); }); - it("Should generate the SecurityToken when launch fee is 0", async() => { + it("Should generate the SecurityToken when launch fee is 0", async () => { let snap_Id = await takeSnapshot(); await I_STRProxied.changeSecurityLaunchFee(0, { from: account_polymath }); - await I_PolyToken.approve(I_STRProxied.address, web3.utils.toWei("500"), { from: token_owner }); + await I_PolyToken.approve(I_STRProxied.address, new BN(web3.utils.toWei("500")), { from: token_owner }); let tx = await I_STRProxied.registerTicker(token_owner, "CCC", name, { from: token_owner }); await I_STRProxied.generateSecurityToken(name, "CCC", tokenDetails, false, { from: token_owner }), - await revertToSnapshot(snap_Id); + await revertToSnapshot(snap_Id); }); it("Should get all created security tokens", async() => { @@ -562,11 +554,11 @@ contract("SecurityTokenRegistry", accounts => { // Verify the successful generation of the security token assert.equal(tx.logs[2].args._ticker, "TMP", "SecurityToken doesn't get deployed"); - let securityTokenTmp = SecurityToken.at(tx.logs[2].args._securityTokenAddress); + let securityTokenTmp = await SecurityToken.at(tx.logs[2].args._securityTokenAddress); let tokens = await I_Getter.getTokensByOwner.call(token_owner); - assert.equal(tokens.length, 1); - assert.equal(tokens[0], I_SecurityToken.address); + assert.equal(tokens.length, 1, "tokens array length error"); + assert.equal(tokens[0], I_SecurityToken.address, "ST address incorrect"); let allTokens = await I_Getter.getTokens.call(); assert.equal(allTokens.length, 2); @@ -588,7 +580,7 @@ contract("SecurityTokenRegistry", accounts => { address_zero, "STFactory002 contract was not deployed" ); - await I_STRProxied.setProtocolVersion(I_STFactory002.address, 2, 2, 0, { from: account_polymath }); + await I_STRProxied.setProtocolVersion(I_STFactory002.address, new BN(2), new BN(2), new BN(0), { from: account_polymath }); let _protocol = await I_Getter.getProtocolVersion.call(); assert.equal(_protocol[0], 2); assert.equal(_protocol[1], 2); @@ -604,18 +596,14 @@ contract("SecurityTokenRegistry", accounts => { it("Should generate the new security token with version 2", async () => { await I_PolyToken.approve(I_STRProxied.address, initRegFee, { from: token_owner }); - let _blockNo = latestBlock(); + let tx = await I_STRProxied.generateSecurityToken(name2, symbol2, tokenDetails, false, { from: token_owner }); // Verify the successful generation of the security token assert.equal(tx.logs[2].args._ticker, symbol2, "SecurityToken doesn't get deployed"); - I_SecurityToken002 = SecurityToken.at(tx.logs[2].args._securityTokenAddress); - let tokens = await I_Getter.getTokensByOwner.call(token_owner); - assert.equal(tokens[0], I_SecurityToken.address); - assert.equal(tokens[1], I_SecurityToken002.address); - - const log = await promisifyLogWatch(I_SecurityToken002.ModuleAdded({ from: _blockNo }), 1); + I_SecurityToken002 = await SecurityToken.at(tx.logs[2].args._securityTokenAddress); + const log = (await I_SecurityToken002.getPastEvents('ModuleAdded'))[0]; // Verify that GeneralTransferManager module get added successfully or not assert.equal(log.args._types[0].toNumber(), transferManagerKey); assert.equal(web3.utils.toAscii(log.args._name).replace(/\u0000/g, ""), "GeneralTransferManager"); @@ -625,17 +613,13 @@ contract("SecurityTokenRegistry", accounts => { describe("Deploy the new SecurityTokenRegistry", async () => { it("Should deploy the new SecurityTokenRegistry contract logic", async () => { I_SecurityTokenRegistryV2 = await SecurityTokenRegistryMock.new({ from: account_polymath }); - assert.notEqual( - I_SecurityTokenRegistryV2.address.valueOf(), - address_zero, - "SecurityTokenRegistry contract was not deployed" - ); + assert.notEqual(I_SecurityTokenRegistryV2.address.valueOf(), address_zero, "SecurityTokenRegistry contract was not deployed"); }); it("Should fail to upgrade the logic contract of the STRProxy -- bad owner", async () => { await I_STRProxied.pause({ from: account_polymath }); - catchRevert( + await catchRevert( I_SecurityTokenRegistryProxy.upgradeTo("1.1.0", I_SecurityTokenRegistryV2.address, { from: account_temp }), "tx revert -> bad owner" ); @@ -663,25 +647,25 @@ contract("SecurityTokenRegistry", accounts => { describe("Generate custom tokens", async () => { it("Should fail if msg.sender is not polymath", async () => { await catchRevert( - I_STRProxied.modifySecurityToken("LOGAN", "LOG", account_temp, dummy_token, "I am custom ST", latestTime(), { + I_STRProxied.modifySecurityToken("LOGAN", "LOG", account_temp, dummy_token, "I am custom ST", currentTime, { from: account_delegate }), "tx revert -> msg.sender is not polymath account" ); }); - it("Should fail to genrate the custom security token -- ticker length is greater than 10 chars", async() => { + it("Should fail to genrate the custom security token -- ticker length is greater than 10 chars", async () => { await catchRevert( - I_STRProxied.modifySecurityToken("LOGAN", "LOGLOGLOGLOG", account_temp, dummy_token, "I am custom ST", latestTime(), { + I_STRProxied.modifySecurityToken("LOGAN", "LOGLOGLOGLOG", account_temp, dummy_token, "I am custom ST", currentTime, { from: account_polymath }), - "tx revert -> msg.sender is not polymath account" + "tx revert -> ticker length is greater than 10 chars" ); - }) + }); it("Should fail to generate the custom security token -- name should not be 0 length ", async () => { await catchRevert( - I_STRProxied.modifySecurityToken("", "LOG", account_temp, dummy_token, "I am custom ST", latestTime(), { + I_STRProxied.modifySecurityToken("", "LOG", account_temp, dummy_token, "I am custom ST", currentTime, { from: account_polymath }), "tx revert -> name should not be 0 length" @@ -690,7 +674,7 @@ contract("SecurityTokenRegistry", accounts => { it("Should fail if ST address is 0 address", async () => { await catchRevert( - I_STRProxied.modifySecurityToken("LOGAN", "LOG", account_temp, 0, "I am custom ST", latestTime(), { + I_STRProxied.modifySecurityToken("LOGAN", "LOG", account_temp, address_zero, "I am custom ST", currentTime, { from: account_polymath }), "tx revert -> Security token address is 0" @@ -699,7 +683,7 @@ contract("SecurityTokenRegistry", accounts => { it("Should fail if symbol length is 0", async () => { await catchRevert( - I_STRProxied.modifySecurityToken("", "", account_temp, dummy_token, "I am custom ST", latestTime(), { + I_STRProxied.modifySecurityToken("", "0x0", account_temp, dummy_token, "I am custom ST", currentTime, { from: account_polymath }), "tx revert -> zero length of the symbol is not allowed" @@ -708,14 +692,14 @@ contract("SecurityTokenRegistry", accounts => { it("Should fail to generate the custom ST -- deployedAt param is 0", async () => { await catchRevert( - I_STRProxied.modifySecurityToken(name2, symbol2, token_owner, dummy_token, "I am custom ST", 0, { from: account_polymath }), + I_STRProxied.modifySecurityToken(name2, symbol2, token_owner, dummy_token, "I am custom ST", new BN(0), { from: account_polymath }), "tx revert -> because deployedAt param is 0" ); }); it("Should successfully generate custom token", async () => { // Register the new ticker -- Fulfiling the TickerStatus.ON condition - await I_PolyToken.getTokens(web3.utils.toWei("1000"), account_temp); + await I_PolyToken.getTokens(new BN(web3.utils.toWei("1000")), account_temp); await I_PolyToken.approve(I_STRProxied.address, initRegFee, { from: account_temp }); let tickersListArray = await I_Getter.getTickersByOwner.call(account_temp); console.log(tickersListArray); @@ -723,7 +707,7 @@ contract("SecurityTokenRegistry", accounts => { tickersListArray = await I_Getter.getTickersByOwner.call(account_temp); console.log(tickersListArray); // Generating the ST - let tx = await I_STRProxied.modifySecurityToken("LOGAN", "LOG", account_temp, dummy_token, "I am custom ST", latestTime(), { + let tx = await I_STRProxied.modifySecurityToken("LOGAN", "LOG", account_temp, dummy_token, "I am custom ST", currentTime, { from: account_polymath }); tickersListArray = await I_Getter.getTickersByOwner.call(account_temp); @@ -742,10 +726,10 @@ contract("SecurityTokenRegistry", accounts => { it("Should successfully generate the custom token", async () => { // Fulfilling the TickerStatus.NN condition // - // await catchRevert(I_STRProxied.modifySecurityToken("LOGAN2", "LOG2", account_temp, dummy_token, "I am custom ST", latestTime(), {from: account_polymath})); - // await I_STRProxied.modifyTicker(account_temp, "LOG2", "LOGAN2", latestTime(), latestTime() + duration.days(10), false, {from: account_polymath}); + // await catchRevert(I_STRProxied.modifySecurityToken("LOGAN2", "LOG2", account_temp, dummy_token, "I am custom ST", await latestTime(), {from: account_polymath})); + // await I_STRProxied.modifyTicker(account_temp, "LOG2", "LOGAN2", await latestTime(), currentTime.add(new BN(duration.days(10))), false, {from: account_polymath}); // await increaseTime(duration.days(1)); - let tx = await I_STRProxied.modifySecurityToken("LOGAN2", "LOG2", account_temp, dummy_token, "I am custom ST", latestTime(), { + let tx = await I_STRProxied.modifySecurityToken("LOGAN2", "LOG2", account_temp, dummy_token, "I am custom ST", currentTime, { from: account_polymath }); assert.equal(tx.logs[1].args._ticker, "LOG2", "Symbol should match with the registered symbol"); @@ -761,17 +745,26 @@ contract("SecurityTokenRegistry", accounts => { assert.equal(symbolDetails[3], "LOGAN2", `Name of the symbol should be LOGAN`); }); - it("Should successfully modify the ticker", async() => { + it("Should successfully modify the ticker", async () => { let snap_Id = await takeSnapshot(); - let tx = await I_STRProxied.modifyTicker(account_temp, "LOG2", "LOGAN2", latestTime(), latestTime() + duration.days(60), false, {from: account_polymath}); + let tx = await I_STRProxied.modifyTicker( + account_temp, + "LOG2", + "LOGAN2", + currentTime, + currentTime.add(new BN(duration.days(60))), + false, + { from: account_polymath } + ); await revertToSnapshot(snap_Id); - }) + }); }); describe("Test case for modifyTicker", async () => { it("Should add the custom ticker --failed because of bad owner", async () => { + currentTime = new BN(await latestTime()); await catchRevert( - I_STRProxied.modifyTicker(token_owner, "ETH", "Ether", latestTime(), latestTime() + duration.days(10), false, { + I_STRProxied.modifyTicker(token_owner, "ETH", "Ether", currentTime, currentTime.add(new BN(duration.days(10))), false, { from: account_temp }), "tx revert -> failed beacause of bad owner0" @@ -780,7 +773,7 @@ contract("SecurityTokenRegistry", accounts => { it("Should add the custom ticker --fail ticker length should not be 0", async () => { await catchRevert( - I_STRProxied.modifyTicker(token_owner, "", "Ether", latestTime(), latestTime() + duration.days(10), false, { + I_STRProxied.modifyTicker(token_owner, "", "Ether", currentTime, currentTime.add(new BN(duration.days(10))), false, { from: account_polymath }), "tx revert -> failed beacause ticker length should not be 0" @@ -789,7 +782,7 @@ contract("SecurityTokenRegistry", accounts => { it("Should add the custom ticker --failed because time should not be 0", async () => { await catchRevert( - I_STRProxied.modifyTicker(token_owner, "ETH", "Ether", 0, latestTime() + duration.days(10), false, { + I_STRProxied.modifyTicker(token_owner, "ETH", "Ether", new BN(0), currentTime.add(new BN(duration.days(10))), false, { from: account_polymath }), "tx revert -> failed because time should not be 0" @@ -797,8 +790,9 @@ contract("SecurityTokenRegistry", accounts => { }); it("Should add the custom ticker --failed because registeration date is greater than the expiryDate", async () => { + let ctime = currentTime; await catchRevert( - I_STRProxied.modifyTicker(token_owner, "ETH", "Ether", latestTime(), latestTime() - duration.minutes(10), false, { + I_STRProxied.modifyTicker(token_owner, "ETH", "Ether", ctime, ctime.sub(new BN(duration.minutes(10))), false, { from: account_polymath }), "tx revert -> failed because registeration date is greater than the expiryDate" @@ -806,13 +800,14 @@ contract("SecurityTokenRegistry", accounts => { }); it("Should add the custom ticker --failed because owner should not be 0x", async () => { + let ctime = currentTime; await catchRevert( I_STRProxied.modifyTicker( - "0x000000000000000000000000000000000000000000", + address_zero, "ETH", "Ether", - latestTime(), - latestTime() + duration.minutes(10), + ctime, + ctime.add(new BN(duration.minutes(10))), false, { from: account_polymath } ), @@ -821,12 +816,13 @@ contract("SecurityTokenRegistry", accounts => { }); it("Should add the new custom ticker", async () => { + let ctime = currentTime; let tx = await I_STRProxied.modifyTicker( account_temp, "ETH", "Ether", - latestTime(), - latestTime() + duration.minutes(10), + ctime, + ctime.add(new BN(duration.minutes(10))), false, { from: account_polymath } ); @@ -835,12 +831,13 @@ contract("SecurityTokenRegistry", accounts => { }); it("Should change the details of the existing ticker", async () => { + let ctime = currentTime; let tx = await I_STRProxied.modifyTicker( token_owner, "ETH", "Ether", - latestTime(), - latestTime() + duration.minutes(10), + ctime, + ctime.add(new BN(duration.minutes(10))), false, { from: account_polymath } ); @@ -859,7 +856,7 @@ contract("SecurityTokenRegistry", accounts => { it("Should able to transfer the ticker ownership -- failed because new owner is 0x", async () => { await I_SecurityToken002.transferOwnership(account_temp, { from: token_owner }); await catchRevert( - I_STRProxied.transferTickerOwnership("0x00000000000000000000000000000000000000000", symbol2, { from: token_owner }), + I_STRProxied.transferTickerOwnership(address_zero, symbol2, { from: token_owner }), "tx revert -> failed because new owner is 0x" ); }); @@ -883,7 +880,7 @@ contract("SecurityTokenRegistry", accounts => { describe("Test case for the changeSecurityLaunchFee()", async () => { it("Should able to change the STLaunchFee-- failed because of bad owner", async () => { await catchRevert( - I_STRProxied.changeSecurityLaunchFee(web3.utils.toWei("500"), { from: account_temp }), + I_STRProxied.changeSecurityLaunchFee(new BN(web3.utils.toWei("500")), { from: account_temp }), "tx revert -> failed because of bad owner" ); }); @@ -896,10 +893,10 @@ contract("SecurityTokenRegistry", accounts => { }); it("Should able to change the STLaunchFee", async () => { - let tx = await I_STRProxied.changeSecurityLaunchFee(web3.utils.toWei("500"), { from: account_polymath }); - assert.equal(tx.logs[0].args._newFee, web3.utils.toWei("500")); + let tx = await I_STRProxied.changeSecurityLaunchFee(new BN(web3.utils.toWei("500")), { from: account_polymath }); + assert.equal(tx.logs[0].args._newFee.toString(), new BN(web3.utils.toWei("500")).toString()); let stLaunchFee = await I_STRProxied.getUintValues(web3.utils.soliditySha3("stLaunchFee")); - assert.equal(stLaunchFee, web3.utils.toWei("500")); + assert.equal(stLaunchFee.toString(), new BN(web3.utils.toWei("500")).toString()); }); }); @@ -929,7 +926,7 @@ contract("SecurityTokenRegistry", accounts => { describe("Test cases for the changeTickerRegistrationFee()", async () => { it("Should able to change the TickerRegFee-- failed because of bad owner", async () => { await catchRevert( - I_STRProxied.changeTickerRegistrationFee(web3.utils.toWei("500"), { from: account_temp }), + I_STRProxied.changeTickerRegistrationFee(new BN(web3.utils.toWei("500")), { from: account_temp }), "tx revert -> failed because of bad owner" ); }); @@ -942,10 +939,10 @@ contract("SecurityTokenRegistry", accounts => { }); it("Should able to change the TickerRegFee", async () => { - let tx = await I_STRProxied.changeTickerRegistrationFee(web3.utils.toWei("400"), { from: account_polymath }); - assert.equal(tx.logs[0].args._newFee, web3.utils.toWei("400")); + let tx = await I_STRProxied.changeTickerRegistrationFee(new BN(web3.utils.toWei("400")), { from: account_polymath }); + assert.equal(tx.logs[0].args._newFee.toString(), new BN(web3.utils.toWei("400")).toString()); let tickerRegFee = await I_STRProxied.getUintValues(web3.utils.soliditySha3("tickerRegFee")); - assert.equal(tickerRegFee, web3.utils.toWei("400")); + assert.equal(tickerRegFee.toString(), new BN(web3.utils.toWei("400")).toString()); }); it("Should fail to register the ticker with the old fee", async () => { @@ -957,8 +954,8 @@ contract("SecurityTokenRegistry", accounts => { }); it("Should register the ticker with the new fee", async () => { - await I_PolyToken.getTokens(web3.utils.toWei("1000"), token_owner); - await I_PolyToken.approve(I_STRProxied.address, web3.utils.toWei("500"), { from: token_owner }); + await I_PolyToken.getTokens(new BN(web3.utils.toWei("1000")), token_owner); + await I_PolyToken.approve(I_STRProxied.address, new BN(web3.utils.toWei("500")), { from: token_owner }); let tx = await I_STRProxied.registerTicker(token_owner, "POLY", "Polymath", { from: token_owner }); assert.equal(tx.logs[0].args._owner, token_owner, `Token owner should be ${token_owner}`); assert.equal(tx.logs[0].args._ticker, "POLY", `Symbol should be POLY`); @@ -973,7 +970,7 @@ contract("SecurityTokenRegistry", accounts => { }); it("Should launch the the securityToken", async () => { - await I_PolyToken.approve(I_STRProxied.address, web3.utils.toWei("500"), { from: token_owner }); + await I_PolyToken.approve(I_STRProxied.address, new BN(web3.utils.toWei("500")), { from: token_owner }); let tx = await I_STRProxied.generateSecurityToken("Polymath", "POLY", tokenDetails, false, { from: token_owner }); // Verify the successful generation of the security token @@ -1026,27 +1023,27 @@ contract("SecurityTokenRegistry", accounts => { describe(" Test cases of the registerTicker", async () => { it("Should register the ticker 1", async () => { - await I_PolyToken.getTokens(web3.utils.toWei("1000"), account_temp); - await I_PolyToken.approve(I_STRProxied.address, web3.utils.toWei("1000"), { from: account_temp }); - let tx = await I_STRProxied.registerTicker(account_temp, "TOK1", "", { from: account_temp }); + await I_PolyToken.getTokens(new BN(web3.utils.toWei("1000")), account_temp); + await I_PolyToken.approve(I_STRProxied.address, new BN(web3.utils.toWei("1000")), { from: account_temp }); + let tx = await I_STRProxied.registerTicker(account_temp, "TOK1", "0x0", { from: account_temp }); assert.equal(tx.logs[0].args._owner, account_temp, `Owner should be the ${account_temp}`); assert.equal(tx.logs[0].args._ticker, "TOK1", `Symbol should be TOK1`); console.log((await I_Getter.getTickersByOwner.call(account_temp)).map(x => web3.utils.toUtf8(x))); }); it("Should register the ticker 2", async () => { - await I_PolyToken.getTokens(web3.utils.toWei("1000"), account_temp); - await I_PolyToken.approve(I_STRProxied.address, web3.utils.toWei("1000"), { from: account_temp }); - let tx = await I_STRProxied.registerTicker(account_temp, "TOK2", "", { from: account_temp }); + await I_PolyToken.getTokens(new BN(web3.utils.toWei("1000")), account_temp); + await I_PolyToken.approve(I_STRProxied.address, new BN(web3.utils.toWei("1000")), { from: account_temp }); + let tx = await I_STRProxied.registerTicker(account_temp, "TOK2", "0x0", { from: account_temp }); assert.equal(tx.logs[0].args._owner, account_temp, `Owner should be the ${account_temp}`); assert.equal(tx.logs[0].args._ticker, "TOK2", `Symbol should be TOK2`); console.log((await I_Getter.getTickersByOwner.call(account_temp)).map(x => web3.utils.toUtf8(x))); }); it("Should register the ticker 3", async () => { - await I_PolyToken.getTokens(web3.utils.toWei("1000"), account_temp); - await I_PolyToken.approve(I_STRProxied.address, web3.utils.toWei("1000"), { from: account_temp }); - let tx = await I_STRProxied.registerTicker(account_temp, "TOK3", "", { from: account_temp }); + await I_PolyToken.getTokens(new BN(web3.utils.toWei("1000")), account_temp); + await I_PolyToken.approve(I_STRProxied.address, new BN(web3.utils.toWei("1000")), { from: account_temp }); + let tx = await I_STRProxied.registerTicker(account_temp, "TOK3", "0x0", { from: account_temp }); assert.equal(tx.logs[0].args._owner, account_temp, `Owner should be the ${account_temp}`); assert.equal(tx.logs[0].args._ticker, "TOK3", `Symbol should be TOK3`); console.log((await I_Getter.getTickersByOwner.call(account_temp)).map(x => web3.utils.toUtf8(x))); @@ -1059,12 +1056,13 @@ contract("SecurityTokenRegistry", accounts => { }); it("Should modify ticker 1", async () => { + currentTime = new BN(await latestTime()); let tx = await I_STRProxied.modifyTicker( account_temp, "TOK1", "TOKEN 1", - latestTime(), - latestTime() + duration.minutes(10), + currentTime, + currentTime.add(new BN(duration.minutes(10))), false, { from: account_polymath } ); @@ -1079,8 +1077,8 @@ contract("SecurityTokenRegistry", accounts => { account_temp, "TOK3", "TOKEN 3", - latestTime(), - latestTime() + duration.minutes(10), + currentTime, + currentTime.add(new BN(duration.minutes(10))), false, { from: account_polymath } ); @@ -1092,18 +1090,13 @@ contract("SecurityTokenRegistry", accounts => { }); describe("Test cases for IRegistry functionality", async () => { describe("Test cases for reclaiming funds", async () => { - - it("Should successfully reclaim POLY tokens -- fail because token address will be 0x", async() => { - I_PolyToken.transfer(I_STRProxied.address, web3.utils.toWei("1"), { from: token_owner }); - await catchRevert( - I_STRProxied.reclaimERC20("0x000000000000000000000000000000000000000", { from: account_polymath }) - ); + it("Should successfully reclaim POLY tokens -- fail because token address will be 0x", async () => { + I_PolyToken.transfer(I_STRProxied.address, new BN(web3.utils.toWei("1")), { from: token_owner }); + await catchRevert(I_STRProxied.reclaimERC20(address_zero, { from: account_polymath })); }); - it("Should successfully reclaim POLY tokens -- not authorised", async() => { - await catchRevert( - I_STRProxied.reclaimERC20(I_PolyToken.address, { from: account_temp }) - ); + it("Should successfully reclaim POLY tokens -- not authorised", async () => { + await catchRevert(I_STRProxied.reclaimERC20(I_PolyToken.address, { from: account_temp })); }); it("Should successfully reclaim POLY tokens", async () => { @@ -1111,8 +1104,8 @@ contract("SecurityTokenRegistry", accounts => { await I_STRProxied.reclaimERC20(I_PolyToken.address, { from: account_polymath }); let bal2 = await I_PolyToken.balanceOf.call(account_polymath); assert.isAtLeast( - bal2.dividedBy(new BigNumber(10).pow(18)).toNumber(), - bal2.dividedBy(new BigNumber(10).pow(18)).toNumber() + bal2.div(new BN(10).pow(new BN(18))).toNumber(), + bal2.div(new BN(10).pow(new BN(18))).toNumber() ); }); }); @@ -1139,56 +1132,43 @@ contract("SecurityTokenRegistry", accounts => { }); }); - describe("Test cases for the setProtocolVersion", async() => { - - it("Should successfully change the protocolVersion -- failed because of bad owner", async() => { - await catchRevert( - I_STRProxied.setProtocolVersion(accounts[8], 5, 6, 7, { from: account_temp }) - ); + describe("Test cases for the setProtocolVersion", async () => { + it("Should successfully change the protocolVersion -- failed because of bad owner", async () => { + await catchRevert(I_STRProxied.setProtocolVersion(accounts[8], 5, 6, 7, { from: account_temp })); }); - - it("Should successfully change the protocolVersion -- failed because factory address is 0x", async() => { + + it("Should successfully change the protocolVersion -- failed because factory address is 0x", async () => { await catchRevert( - I_STRProxied.setProtocolVersion("0x000000000000000000000000000000000000000", 5, 6, 7, { from: account_polymath }) + I_STRProxied.setProtocolVersion(address_zero, 5, 6, 7, { from: account_polymath }) ); }); - - it("Should successfully change the protocolVersion -- not a valid vesrion", async() => { - await catchRevert( - I_STRProxied.setProtocolVersion(accounts[8], 0, 0, 0, { from: account_polymath }) - ); + + it("Should successfully change the protocolVersion -- not a valid vesrion", async () => { + await catchRevert(I_STRProxied.setProtocolVersion(accounts[8], new BN(0), new BN(0), new BN(0), { from: account_polymath })); }); - it("Should successfully change the protocolVersion -- fail in second attempt because of invalid version", async() => { + it("Should successfully change the protocolVersion -- fail in second attempt because of invalid version", async () => { let snap_Id = await takeSnapshot(); - await I_STRProxied.setProtocolVersion(accounts[8], 2, 3, 1, {from: account_polymath }); - await catchRevert( - I_STRProxied.setProtocolVersion(accounts[8], 1, 3, 1, {from: account_polymath }) - ); + await I_STRProxied.setProtocolVersion(accounts[8], 2, 3, 1, { from: account_polymath }); + await catchRevert(I_STRProxied.setProtocolVersion(accounts[8], 1, 3, 1, { from: account_polymath })); await revertToSnapshot(snap_Id); }); - }); - describe("Test cases for the transferOwnership", async() => { - - it("Should fail to transfer the ownership -- not authorised", async() => { - await catchRevert( - I_STRProxied.transferOwnership(account_temp, { from: account_issuer}) - ); + describe("Test cases for the transferOwnership", async () => { + it("Should fail to transfer the ownership -- not authorised", async () => { + await catchRevert(I_STRProxied.transferOwnership(account_temp, { from: account_issuer })); }); - it("Should fail to transfer the ownership -- 0x address is not allowed", async() => { - await catchRevert( - I_STRProxied.transferOwnership("0x000000000000000000000000000000000000000", { from: account_polymath}) - ); + it("Should fail to transfer the ownership -- 0x address is not allowed", async () => { + await catchRevert(I_STRProxied.transferOwnership(address_zero, { from: account_polymath })); }); - it("Should successfully transfer the ownership of the STR", async() => { + it("Should successfully transfer the ownership of the STR", async () => { let tx = await I_STRProxied.transferOwnership(account_temp, { from: account_polymath }); assert.equal(tx.logs[0].args.previousOwner, account_polymath); assert.equal(tx.logs[0].args.newOwner, account_temp); }); - }) + }); }); }); diff --git a/test/o_security_token.js b/test/o_security_token.js index 6ab78db67..aac62b9e0 100644 --- a/test/o_security_token.js +++ b/test/o_security_token.js @@ -9,7 +9,7 @@ import { deployCappedSTOAndVerifyed, deployMockRedemptionAndVerifyed, deployMockWrongTypeRedemptionAndVerifyed - } from "./helpers/createInstances"; +} from "./helpers/createInstances"; const CappedSTOFactory = artifacts.require("./CappedSTOFactory.sol"); const CappedSTO = artifacts.require("./CappedSTO.sol"); @@ -19,10 +19,10 @@ const GeneralPermissionManager = artifacts.require("./GeneralPermissionManager") const MockRedemptionManager = artifacts.require("./MockRedemptionManager.sol"); const Web3 = require("web3"); -const BigNumber = require("bignumber.js"); +let BN = Web3.utils.BN; const web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545")); // Hardcoded development port -contract("SecurityToken", accounts => { +contract("SecurityToken", async (accounts) => { // Accounts Variable declaration let account_polymath; let account_investor1; @@ -36,7 +36,8 @@ contract("SecurityToken", accounts => { let account_delegate; let account_temp; let account_controller; - let address_zero = "0x0000000000000000000000000000000000000000"; + const address_zero = "0x0000000000000000000000000000000000000000"; + const one_address = "0x0000000000000000000000000000000000000001"; let balanceOfReceiver; // investor Details @@ -83,25 +84,27 @@ contract("SecurityToken", accounts => { const budget = 0; // Initial fee for ticker registry and security token registry - const initRegFee = web3.utils.toWei("250"); + const initRegFee = new BN(web3.utils.toWei("250")); // delagate details - const delegateDetails = "I am delegate .."; - const TM_Perm = "FLAGS"; - const TM_Perm_Whitelist = "WHITELIST"; + const delegateDetails = web3.utils.fromAscii("I am delegate .."); + const TM_Perm = web3.utils.fromAscii("FLAGS"); + const TM_Perm_Whitelist = web3.utils.fromAscii("WHITELIST"); // Capped STO details let startTime; let endTime; - const cap = web3.utils.toWei("10000"); - const rate = web3.utils.toWei("1000"); + const cap = new BN(web3.utils.toWei("10000")); + const rate = new BN(web3.utils.toWei("1000")); const fundRaiseType = [0]; - const cappedSTOSetupCost = web3.utils.toWei("20000", "ether"); + const cappedSTOSetupCost = new BN(web3.utils.toWei("20000", "ether")); const maxCost = cappedSTOSetupCost; const STOParameters = ["uint256", "uint256", "uint256", "uint256", "uint8[]", "address"]; + let currentTime; + before(async () => { - // Accounts setup + currentTime = new BN(await latestTime()); account_polymath = accounts[0]; account_issuer = accounts[1]; account_affiliate1 = accounts[2]; @@ -168,14 +171,14 @@ contract("SecurityToken", accounts => { it("Should generate the new security token with the same symbol as registered above", async () => { await I_PolyToken.approve(I_STRProxied.address, initRegFee, { from: token_owner }); - let _blockNo = latestBlock(); + let tx = await I_STRProxied.generateSecurityToken(name, symbol, tokenDetails, false, { from: token_owner }); // Verify the successful generation of the security token assert.equal(tx.logs[2].args._ticker, symbol, "SecurityToken doesn't get deployed"); - I_SecurityToken = SecurityToken.at(tx.logs[2].args._securityTokenAddress); + I_SecurityToken = await SecurityToken.at(tx.logs[2].args._securityTokenAddress); - const log = await promisifyLogWatch(I_SecurityToken.ModuleAdded({ from: _blockNo }), 1); + const log = (await I_SecurityToken.getPastEvents('ModuleAdded', {filter: {transactionHash: tx.transactionHash}}))[0]; // Verify that GeneralTransferManager module get added successfully or not console.log(log.args); @@ -185,43 +188,43 @@ contract("SecurityToken", accounts => { it("Should intialize the auto attached modules", async () => { let moduleData = (await I_SecurityToken.getModulesByType(transferManagerKey))[0]; - I_GeneralTransferManager = GeneralTransferManager.at(moduleData); + I_GeneralTransferManager = await GeneralTransferManager.at(moduleData); assert.notEqual(I_GeneralTransferManager.address.valueOf(), address_zero, "GeneralTransferManager contract was not deployed"); }); it("Should mint the tokens before attaching the STO -- fail only be called by the owner", async () => { - let fromTime = latestTime(); - let toTime = fromTime + duration.days(100); - let expiryTime = toTime + duration.days(100); + currentTime = new BN(await latestTime()); + let toTime = new BN(currentTime.add(new BN(duration.days(100)))); + let expiryTime = new BN(toTime.add(new BN(duration.days(100)))); - let tx = await I_GeneralTransferManager.modifyWhitelist(account_affiliate1, fromTime, toTime, expiryTime, true, { + let tx = await I_GeneralTransferManager.modifyWhitelist(account_affiliate1, currentTime, toTime, expiryTime, true, { from: token_owner, gas: 6000000 }); assert.equal(tx.logs[0].args._investor, account_affiliate1, "Failed in adding the investor in whitelist"); - await catchRevert(I_SecurityToken.mint(account_investor1, 100 * Math.pow(10, 18), { from: account_delegate })); + await catchRevert(I_SecurityToken.mint(account_investor1, new BN(100).mul(new BN(10).pow(new BN(18))), { from: account_delegate })); }); it("Should mint the tokens before attaching the STO", async () => { - await I_SecurityToken.mint(account_affiliate1, 100 * Math.pow(10, 18), { from: token_owner, gas: 500000 }); + await I_SecurityToken.mint(account_affiliate1, new BN(100).mul(new BN(10).pow(new BN(18))), { from: token_owner }); let balance = await I_SecurityToken.balanceOf(account_affiliate1); - assert.equal(balance.dividedBy(new BigNumber(10).pow(18)).toNumber(), 100); + assert.equal(balance.div(new BN(10).pow(new BN(18))).toNumber(), 100); }); it("Should mint the multi tokens before attaching the STO -- fail only be called by the owner", async () => { - let fromTime = latestTime(); - let toTime = fromTime + duration.days(100); - let expiryTime = toTime + duration.days(100); + currentTime = new BN(await latestTime()); + let toTime = new BN(currentTime.add(new BN(duration.days(100)))); + let expiryTime = new BN(toTime.add(new BN(duration.days(100)))); - let tx = await I_GeneralTransferManager.modifyWhitelist(account_affiliate2, fromTime, toTime, expiryTime, true, { + let tx = await I_GeneralTransferManager.modifyWhitelist(account_affiliate2, currentTime, toTime, expiryTime, true, { from: token_owner, gas: 6000000 }); assert.equal(tx.logs[0].args._investor, account_affiliate2, "Failed in adding the investor in whitelist"); await catchRevert( - I_SecurityToken.mintMulti([account_affiliate1, account_affiliate2], [100 * Math.pow(10, 18), 110 * Math.pow(10, 18)], { + I_SecurityToken.mintMulti([account_affiliate1, account_affiliate2], [new BN(100).mul(new BN(10).pow(new BN(18))), new BN(110).mul(new BN(10).pow(new BN(18)))], { from: account_delegate, gas: 500000 }) @@ -230,7 +233,7 @@ contract("SecurityToken", accounts => { it("Should mintMulti", async () => { await catchRevert( - I_SecurityToken.mintMulti([account_affiliate1, account_affiliate2], [100 * Math.pow(10, 18)], { + I_SecurityToken.mintMulti([account_affiliate1, account_affiliate2], [new BN(100).mul(new BN(10).pow(new BN(18)))], { from: token_owner, gas: 500000 }) @@ -238,14 +241,13 @@ contract("SecurityToken", accounts => { }); it("Should mint the tokens for multiple afiliated investors before attaching the STO", async () => { - await I_SecurityToken.mintMulti([account_affiliate1, account_affiliate2], [100 * Math.pow(10, 18), 110 * Math.pow(10, 18)], { - from: token_owner, - gas: 500000 + await I_SecurityToken.mintMulti([account_affiliate1, account_affiliate2], [new BN(100).mul(new BN(10).pow(new BN(18))), new BN(110).mul(new BN(10).pow(new BN(18)))], { + from: token_owner }); let balance1 = await I_SecurityToken.balanceOf(account_affiliate1); - assert.equal(balance1.dividedBy(new BigNumber(10).pow(18)).toNumber(), 200); + assert.equal(balance1.div(new BN(10).pow(new BN(18))).toNumber(), 200); let balance2 = await I_SecurityToken.balanceOf(account_affiliate2); - assert.equal(balance2.dividedBy(new BigNumber(10).pow(18)).toNumber(), 110); + assert.equal(balance2.div(new BN(10).pow(new BN(18))).toNumber(), 110); }); it("Should finish the minting -- fail because feature is not activated", async () => { @@ -274,76 +276,77 @@ contract("SecurityToken", accounts => { let id = await takeSnapshot(); await I_SecurityToken.freezeMinting({ from: token_owner }); - await catchRevert(I_SecurityToken.mint(account_affiliate1, 100 * Math.pow(10, 18), { from: token_owner, gas: 500000 })); + await catchRevert(I_SecurityToken.mint(account_affiliate1, new BN(100).mul(new BN(10).pow(new BN(18))), { from: token_owner, gas: 500000 })); await revertToSnapshot(id); }); it("Should fail to attach the STO factory because not enough poly in contract", async () => { - startTime = latestTime() + duration.seconds(5000); + startTime = await latestTime() + duration.seconds(5000); endTime = startTime + duration.days(30); let bytesSTO = encodeModuleCall(STOParameters, [startTime, endTime, cap, rate, fundRaiseType, account_fundsReceiver]); - await catchRevert(I_SecurityToken.addModule(I_CappedSTOFactory.address, bytesSTO, maxCost, 0, { from: token_owner })); + await catchRevert(I_SecurityToken.addModule(I_CappedSTOFactory.address, bytesSTO, maxCost, new BN(0), { from: token_owner })); }); it("Should fail to attach the STO factory because max cost too small", async () => { - startTime = latestTime() + duration.seconds(5000); + startTime = await latestTime() + duration.seconds(5000); endTime = startTime + duration.days(30); let bytesSTO = encodeModuleCall(STOParameters, [startTime, endTime, cap, rate, fundRaiseType, account_fundsReceiver]); await I_PolyToken.getTokens(cappedSTOSetupCost, token_owner); await I_PolyToken.transfer(I_SecurityToken.address, cappedSTOSetupCost, { from: token_owner }); await catchRevert( - I_SecurityToken.addModule(I_CappedSTOFactory.address, bytesSTO, web3.utils.toWei("1000", "ether"), 0, { from: token_owner }) + I_SecurityToken.addModule(I_CappedSTOFactory.address, bytesSTO, new BN(web3.utils.toWei("1000", "ether")), new BN(0), { from: token_owner }) ); }); it("Should successfully add module with label", async () => { let snapId = await takeSnapshot(); - startTime = latestTime() + duration.seconds(5000); + startTime = await latestTime() + duration.seconds(5000); endTime = startTime + duration.days(30); let bytesSTO = encodeModuleCall(STOParameters, [startTime, endTime, cap, rate, fundRaiseType, account_fundsReceiver]); await I_PolyToken.getTokens(cappedSTOSetupCost, token_owner); await I_PolyToken.transfer(I_SecurityToken.address, cappedSTOSetupCost, { from: token_owner }); console.log("0"); - const tx = await I_SecurityToken.addModuleWithLabel(I_CappedSTOFactory.address, bytesSTO, maxCost, 0, 'stofactory', { from: token_owner }); + const tx = await I_SecurityToken.addModuleWithLabel(I_CappedSTOFactory.address, bytesSTO, maxCost, new BN(0), web3.utils.fromAscii("stofactory"), { + from: token_owner + }); console.log("1"); assert.equal(tx.logs[3].args._types[0], stoKey, "CappedSTO doesn't get deployed"); assert.equal(web3.utils.toUtf8(tx.logs[3].args._name), "CappedSTO", "CappedSTOFactory module was not added"); - console.log("module label is .. "+ web3.utils.toAscii(tx.logs[3].args._label)); + console.log("module label is .. " + web3.utils.toAscii(tx.logs[3].args._label)); assert(web3.utils.toAscii(tx.logs[3].args._label), "stofactory", "label doesnt match"); - I_CappedSTO = CappedSTO.at(tx.logs[3].args._module); + I_CappedSTO = await CappedSTO.at(tx.logs[3].args._module); await revertToSnapshot(snapId); }); it("Should successfully attach the STO factory with the security token", async () => { - - startTime = latestTime() + duration.seconds(5000); + startTime = await latestTime() + duration.seconds(5000); endTime = startTime + duration.days(30); let bytesSTO = encodeModuleCall(STOParameters, [startTime, endTime, cap, rate, fundRaiseType, account_fundsReceiver]); await I_PolyToken.getTokens(cappedSTOSetupCost, token_owner); await I_PolyToken.transfer(I_SecurityToken.address, cappedSTOSetupCost, { from: token_owner }); - const tx = await I_SecurityToken.addModule(I_CappedSTOFactory.address, bytesSTO, maxCost, 0, { from: token_owner }); + const tx = await I_SecurityToken.addModule(I_CappedSTOFactory.address, bytesSTO, maxCost, new BN(0), { from: token_owner }); assert.equal(tx.logs[3].args._types[0], stoKey, "CappedSTO doesn't get deployed"); assert.equal(web3.utils.toUtf8(tx.logs[3].args._name), "CappedSTO", "CappedSTOFactory module was not added"); - I_CappedSTO = CappedSTO.at(tx.logs[3].args._module); + I_CappedSTO = await CappedSTO.at(tx.logs[3].args._module); }); it("Should successfully mint tokens while STO attached", async () => { - await I_SecurityToken.mint(account_affiliate1, 100 * Math.pow(10, 18), { from: token_owner, gas: 500000 }); + await I_SecurityToken.mint(account_affiliate1, new BN(100).mul(new BN(10).pow(new BN(18))), { from: token_owner }); let balance = await I_SecurityToken.balanceOf(account_affiliate1); - assert.equal(balance.dividedBy(new BigNumber(10).pow(18)).toNumber(), 300); + assert.equal(balance.div(new BN(10).pow(new BN(18))).toNumber(), 300); }); it("Should fail to mint tokens while STO attached after freezeMinting called", async () => { let id = await takeSnapshot(); await I_SecurityToken.freezeMinting({ from: token_owner }); - await catchRevert(I_SecurityToken.mint(account_affiliate1, 100 * Math.pow(10, 18), { from: token_owner, gas: 500000 })); + await catchRevert(I_SecurityToken.mint(account_affiliate1, new BN(100).mul(new BN(10).pow(new BN(18))), { from: token_owner })); await revertToSnapshot(id); }); }); @@ -366,7 +369,7 @@ contract("SecurityToken", accounts => { }); it("Should get the modules of the securityToken by name", async () => { - let moduleList = await I_SecurityToken.getModulesByName.call("CappedSTO"); + let moduleList = await I_SecurityToken.getModulesByName.call(web3.utils.fromAscii("CappedSTO")); assert.isTrue(moduleList.length == 1, "Only one STO"); let moduleData = await I_SecurityToken.getModule.call(moduleList[0]); assert.equal(web3.utils.toAscii(moduleData[0]).replace(/\u0000/g, ""), "CappedSTO"); @@ -374,13 +377,13 @@ contract("SecurityToken", accounts => { }); it("Should get the modules of the securityToken by name (not added into the security token yet)", async () => { - let moduleData = await I_SecurityToken.getModulesByName.call("GeneralPermissionManager"); - assert.isTrue(moduleData.length == 0, "No Permission Manager"); + let moduleData = await I_SecurityToken.getModulesByName.call(web3.utils.fromAscii("GeneralPermissionManager")); + assert.isTrue(moduleData.length == new BN(0), "No Permission Manager"); }); it("Should get the modules of the securityToken by name (not added into the security token yet)", async () => { - let moduleData = await I_SecurityToken.getModulesByName.call("CountTransferManager"); - assert.isTrue(moduleData.length == 0, "No Permission Manager"); + let moduleData = await I_SecurityToken.getModulesByName.call(web3.utils.fromAscii("CountTransferManager")); + assert.isTrue(moduleData.length == new BN(0), "No Permission Manager"); }); it("Should fail in updating the token details", async () => { @@ -393,7 +396,7 @@ contract("SecurityToken", accounts => { }); it("Should successfully remove the general transfer manager module from the securityToken -- fails msg.sender should be Owner", async () => { - await catchRevert(I_SecurityToken.removeModule(I_GeneralTransferManager.address, { from: token_owner })); + await catchRevert(I_SecurityToken.removeModule(I_GeneralTransferManager.address, { from: account_delegate })); }); it("Should fail to remove the module - module not archived", async () => { @@ -401,7 +404,7 @@ contract("SecurityToken", accounts => { }); it("Should fail to remove the module - incorrect address", async () => { - await catchRevert(I_SecurityToken.removeModule(0, { from: token_owner })); + await catchRevert(I_SecurityToken.removeModule(address_zero, { from: token_owner })); }); it("Should successfully remove the general transfer manager module from the securityToken", async () => { @@ -410,13 +413,13 @@ contract("SecurityToken", accounts => { let tx = await I_SecurityToken.removeModule(I_GeneralTransferManager.address, { from: token_owner }); assert.equal(tx.logs[0].args._types[0], transferManagerKey); assert.equal(tx.logs[0].args._module, I_GeneralTransferManager.address); - await I_SecurityToken.mint(account_investor1, web3.utils.toWei("500"), {from: token_owner}); - await I_SecurityToken.transfer(account_investor2, web3.utils.toWei("200"), {from: account_investor1 }); - assert.equal((await I_SecurityToken.balanceOf(account_investor2)).dividedBy(new BigNumber(10).pow(18)).toNumber(), 200); + await I_SecurityToken.mint(account_investor1, new BN(web3.utils.toWei("500")), { from: token_owner }); + await I_SecurityToken.transfer(account_investor2, new BN(web3.utils.toWei("200")), { from: account_investor1 }); + assert.equal((await I_SecurityToken.balanceOf(account_investor2)).div(new BN(10).pow(new BN(18))).toNumber(), 200); await revertToSnapshot(key); }); - it("Should successfully remove the module from the middle of the names mapping", async() => { + it("Should successfully remove the module from the middle of the names mapping", async () => { let snap_Id = await takeSnapshot(); let D_GPM, D_GPM_1, D_GPM_2; let FactoryInstances; @@ -428,25 +431,23 @@ contract("SecurityToken", accounts => { FactoryInstances = [D_GPM, D_GPM_1, D_GPM_2]; // Adding module in the ST for (let i = 0; i < FactoryInstances.length; i++) { - let tx = await I_SecurityToken.addModule(FactoryInstances[i].address, "", 0, 0, {from: token_owner }); - assert.equal(tx.logs[2].args._types[0], permissionManagerKey, "fail in adding the GPM") + let tx = await I_SecurityToken.addModule(FactoryInstances[i].address, "0x0", new BN(0), new BN(0), { from: token_owner }); + assert.equal(tx.logs[2].args._types[0], permissionManagerKey, "fail in adding the GPM"); GPMAddress.push(tx.logs[2].args._module); } // Archive the one of the module - await I_SecurityToken.archiveModule(GPMAddress[0], {from: token_owner}); + await I_SecurityToken.archiveModule(GPMAddress[0], { from: token_owner }); // Remove the module - let tx = await I_SecurityToken.removeModule(GPMAddress[0], {from: token_owner}); + let tx = await I_SecurityToken.removeModule(GPMAddress[0], { from: token_owner }); assert.equal(tx.logs[0].args._types[0], permissionManagerKey); assert.equal(tx.logs[0].args._module, GPMAddress[0]); await revertToSnapshot(snap_Id); }); - it("Should successfully archive the module first and fail during achiving the module again", async() => { + it("Should successfully archive the module first and fail during achiving the module again", async () => { let key = await takeSnapshot(); await I_SecurityToken.archiveModule(I_GeneralTransferManager.address, { from: token_owner }); - await catchRevert( - I_SecurityToken.archiveModule(I_GeneralTransferManager.address, { from: token_owner }) - ); + await catchRevert(I_SecurityToken.archiveModule(I_GeneralTransferManager.address, { from: token_owner })); await revertToSnapshot(key); }); @@ -469,9 +470,9 @@ contract("SecurityToken", accounts => { it("Should successfully mint tokens while GTM archived", async () => { let key = await takeSnapshot(); - await I_SecurityToken.mint(1, 100 * Math.pow(10, 18), { from: token_owner, gas: 500000 }); - let balance = await I_SecurityToken.balanceOf(1); - assert.equal(balance.dividedBy(new BigNumber(10).pow(18)).toNumber(), 100); + await I_SecurityToken.mint(one_address, new BN(100).mul(new BN(10).pow(new BN(18))), { from: token_owner, gas: 500000 }); + let balance = await I_SecurityToken.balanceOf(one_address); + assert.equal(balance.div(new BN(10).pow(new BN(18))).toNumber(), 100); await revertToSnapshot(key); }); @@ -487,48 +488,42 @@ contract("SecurityToken", accounts => { }); it("Should successfully unarchive the general transfer manager module from the securityToken -- fail because module is already unarchived", async () => { - await catchRevert( - I_SecurityToken.unarchiveModule(I_GeneralTransferManager.address, { from: token_owner }) - ); + await catchRevert(I_SecurityToken.unarchiveModule(I_GeneralTransferManager.address, { from: token_owner })); }); - it("Should successfully archive the module -- fail because module is not existed", async() => { - await catchRevert( - I_SecurityToken.archiveModule(I_GeneralPermissionManagerFactory.address, { from: token_owner }) - ); - }) + it("Should successfully archive the module -- fail because module is not existed", async () => { + await catchRevert(I_SecurityToken.archiveModule(I_GeneralPermissionManagerFactory.address, { from: token_owner })); + }); it("Should fail to mint tokens while GTM unarchived", async () => { - await catchRevert(I_SecurityToken.mint(1, 100 * Math.pow(10, 18), { from: token_owner, gas: 500000 })); + await catchRevert(I_SecurityToken.mint(one_address, new BN(100).mul(new BN(10).pow(new BN(18))), { from: token_owner, gas: 500000 })); }); it("Should change the budget of the module - fail incorrect address", async () => { - await catchRevert(I_SecurityToken.changeModuleBudget(0, 100 * Math.pow(10, 18), true, { from: token_owner })); + await catchRevert(I_SecurityToken.changeModuleBudget(address_zero, new BN(100).mul(new BN(10).pow(new BN(18))), true, { from: token_owner })); }); it("Should change the budget of the module", async () => { let budget = await I_PolyToken.allowance.call(I_SecurityToken.address, I_CappedSTO.address); - let increaseAmount = 100 * Math.pow(10, 18); + let increaseAmount = new BN(100).mul(new BN(10).pow(new BN(18))); let tx = await I_SecurityToken.changeModuleBudget(I_CappedSTO.address, increaseAmount, true, { from: token_owner }); assert.equal(tx.logs[1].args._moduleTypes[0], stoKey); assert.equal(tx.logs[1].args._module, I_CappedSTO.address); - assert.equal(tx.logs[1].args._budget.toNumber(), budget.plus(increaseAmount).toNumber()); + assert.equal(tx.logs[1].args._budget.toString(), budget.add(increaseAmount).toString()); }); - it("Should change the budget of the module (decrease it)", async() => { + it("Should change the budget of the module (decrease it)", async () => { let budget = await I_PolyToken.allowance.call(I_SecurityToken.address, I_CappedSTO.address); - let decreaseAmount = 100 * Math.pow(10, 18); + let decreaseAmount = new BN(100).mul(new BN(10).pow(new BN(18))); let tx = await I_SecurityToken.changeModuleBudget(I_CappedSTO.address, decreaseAmount, false, { from: token_owner }); assert.equal(tx.logs[1].args._moduleTypes[0], stoKey); assert.equal(tx.logs[1].args._module, I_CappedSTO.address); - assert.equal(tx.logs[1].args._budget.toNumber(), budget.minus(decreaseAmount).toNumber()); + assert.equal(tx.logs[1].args._budget.toString(), budget.sub(decreaseAmount).toString()); }); - it("Should fail to get the total supply -- because checkpoint id is greater than present", async() => { - await catchRevert( - I_SecurityToken.totalSupplyAt.call(50) - ); - }) + it("Should fail to get the total supply -- because checkpoint id is greater than present", async () => { + await catchRevert(I_SecurityToken.totalSupplyAt.call(50)); + }); }); describe("General Transfer manager Related test cases", async () => { @@ -536,7 +531,7 @@ contract("SecurityToken", accounts => { balanceOfReceiver = await web3.eth.getBalance(account_fundsReceiver); // Add the Investor in to the whitelist - fromTime = latestTime(); + fromTime = await latestTime(); toTime = fromTime + duration.days(100); expiryTime = toTime + duration.days(100); @@ -553,25 +548,25 @@ contract("SecurityToken", accounts => { from: account_investor1, to: I_CappedSTO.address, gas: 2100000, - value: web3.utils.toWei("1", "ether") + value: new BN(web3.utils.toWei("1", "ether")) }); console.log("AFTER"); - assert.equal((await I_CappedSTO.getRaised.call(0)).dividedBy(new BigNumber(10).pow(18)).toNumber(), 1); + assert.equal((await I_CappedSTO.getRaised.call(0)).div(new BN(10).pow(new BN(18))).toNumber(), 1); assert.equal(await I_CappedSTO.investorCount.call(), 1); - assert.equal((await I_SecurityToken.balanceOf(account_investor1)).dividedBy(new BigNumber(10).pow(18)).toNumber(), 1000); + assert.equal((await I_SecurityToken.balanceOf(account_investor1)).div(new BN(10).pow(new BN(18))).toNumber(), 1000); }); it("Should Fail in transferring the token from one whitelist investor 1 to non whitelist investor 2", async () => { - await catchRevert(I_SecurityToken.transfer(account_investor2, 10 * Math.pow(10, 18), { from: account_investor1 })); + await catchRevert(I_SecurityToken.transfer(account_investor2, new BN(10).mul(new BN(10).pow(new BN(18))), { from: account_investor1 })); }); it("Should fail to provide the permission to the delegate to change the transfer bools -- Bad owner", async () => { // Add permission to the deletgate (A regesteration process) - await I_SecurityToken.addModule(I_GeneralPermissionManagerFactory.address, "", 0, 0, { from: token_owner }); + await I_SecurityToken.addModule(I_GeneralPermissionManagerFactory.address, "0x0", new BN(0), new BN(0), { from: token_owner }); let moduleData = (await I_SecurityToken.getModulesByType(permissionManagerKey))[0]; - I_GeneralPermissionManager = GeneralPermissionManager.at(moduleData); + I_GeneralPermissionManager = await GeneralPermissionManager.at(moduleData); await catchRevert(I_GeneralPermissionManager.addDelegate(account_delegate, delegateDetails, { from: account_temp })); }); @@ -593,7 +588,7 @@ contract("SecurityToken", accounts => { }); it("Should fail to send tokens with the wrong granularity", async () => { - await catchRevert(I_SecurityToken.transfer(accounts[7], Math.pow(10, 17), { from: account_investor1 })); + await catchRevert(I_SecurityToken.transfer(accounts[7], new BN(10).pow(new BN(17)), { from: account_investor1 })); }); it("Should adjust granularity", async () => { @@ -601,24 +596,24 @@ contract("SecurityToken", accounts => { }); it("Should adjust granularity", async () => { - await I_SecurityToken.changeGranularity(Math.pow(10, 17), { from: token_owner }); - await I_SecurityToken.transfer(accounts[7], Math.pow(10, 17), { from: account_investor1, gas: 2500000 }); - await I_SecurityToken.transfer(account_investor1, Math.pow(10, 17), { from: accounts[7], gas: 2500000 }); + await I_SecurityToken.changeGranularity(new BN(10).pow(new BN(17)), { from: token_owner }); + await I_SecurityToken.transfer(accounts[7], new BN(10).pow(new BN(17)), { from: account_investor1, gas: 2500000 }); + await I_SecurityToken.transfer(account_investor1, new BN(10).pow(new BN(17)), { from: accounts[7], gas: 2500000 }); }); it("Should transfer from whitelist investor to non-whitelist investor in first tx and in 2nd tx non-whitelist to non-whitelist transfer", async () => { - await I_SecurityToken.transfer(accounts[7], 10 * Math.pow(10, 18), { from: account_investor1, gas: 2500000 }); + await I_SecurityToken.transfer(accounts[7], new BN(10).mul(new BN(10).pow(new BN(18))), { from: account_investor1, gas: 2500000 }); assert.equal( - (await I_SecurityToken.balanceOf(accounts[7])).dividedBy(new BigNumber(10).pow(18)).toNumber(), + (await I_SecurityToken.balanceOf(accounts[7])).div(new BN(10).pow(new BN(18))).toNumber(), 10, "Transfer doesn't take place properly" ); - await I_SecurityToken.transfer(account_temp, 5 * Math.pow(10, 18), { from: accounts[7], gas: 2500000 }); + await I_SecurityToken.transfer(account_temp, new BN(5).mul(new BN(10).pow(new BN(18))), { from: accounts[7], gas: 2500000 }); assert.equal( - (await I_SecurityToken.balanceOf(account_temp)).dividedBy(new BigNumber(10).pow(18)).toNumber(), + (await I_SecurityToken.balanceOf(account_temp)).div(new BN(10).pow(new BN(18))).toNumber(), 5, "Transfer doesn't take place properly" ); @@ -644,53 +639,52 @@ contract("SecurityToken", accounts => { assert.equal(tx.logs[0].args._investor, account_investor2, "Failed in adding the investor in whitelist"); - await I_SecurityToken.transfer(account_investor2, 10 * Math.pow(10, 18), { from: account_investor1, gas: 2500000 }); + await I_SecurityToken.transfer(account_investor2, new BN(10).mul(new BN(10).pow(new BN(18))), { from: account_investor1, gas: 2500000 }); assert.equal( - (await I_SecurityToken.balanceOf(account_investor2)).dividedBy(new BigNumber(10).pow(18)).toNumber(), + (await I_SecurityToken.balanceOf(account_investor2)).div(new BN(10).pow(new BN(18))).toNumber(), 10, "Transfer doesn't take place properly" ); }); it("Should transfer from whitelist investor1 to whitelist investor 2 -- value = 0", async () => { - let tx = await I_SecurityToken.transfer(account_investor2, 0, { from: account_investor1, gas: 2500000 }); + let tx = await I_SecurityToken.transfer(account_investor2, new BN(0), { from: account_investor1, gas: 2500000 }); assert.equal(tx.logs[0].args.value.toNumber(), 0); }); it("Should transferFrom from one investor to other", async () => { - await I_SecurityToken.approve(account_investor1, 2 * Math.pow(10, 18), { from: account_investor2 }); + await I_SecurityToken.approve(account_investor1, new BN(2).mul(new BN(10).pow(new BN(18))), { from: account_investor2 }); let tx = await I_GeneralTransferManager.modifyWhitelist(account_investor3, fromTime, toTime, expiryTime, true, { from: token_owner, gas: 500000 }); assert.equal(tx.logs[0].args._investor, account_investor3, "Failed in adding the investor in whitelist"); - let log = await I_SecurityToken.transferFrom(account_investor2, account_investor3, 2 * Math.pow(10, 18), { + let log = await I_SecurityToken.transferFrom(account_investor2, account_investor3, new BN(2).mul(new BN(10).pow(new BN(18))), { from: account_investor1 }); - assert.equal(log.logs[0].args.value.toNumber(), 2 * Math.pow(10, 18)); + assert.equal(log.logs[0].args.value.toString(), new BN(2).mul(new BN(10).pow(new BN(18))).toString()); }); it("Should Fail in trasferring from whitelist investor1 to non-whitelist investor", async () => { - await catchRevert(I_SecurityToken.transfer(account_temp, 10 * Math.pow(10, 18), { from: account_investor1, gas: 2500000 })); + await catchRevert(I_SecurityToken.transfer(account_temp, new BN(10).mul(new BN(10).pow(new BN(18))), { from: account_investor1, gas: 2500000 })); await revertToSnapshot(ID_snap); }); it("Should successfully mint tokens while STO attached", async () => { - await I_SecurityToken.mint(account_affiliate1, 100 * Math.pow(10, 18), { from: token_owner, gas: 500000 }); + await I_SecurityToken.mint(account_affiliate1, new BN(100).mul(new BN(10).pow(new BN(18))), { from: token_owner }); let balance = await I_SecurityToken.balanceOf(account_affiliate1); - assert.equal(balance.dividedBy(new BigNumber(10).pow(18)).toNumber(), 400); + assert.equal(balance.div(new BN(10).pow(new BN(18))).toNumber(), 400); }); it("Should mint the tokens for multiple afiliated investors while STO attached", async () => { - await I_SecurityToken.mintMulti([account_affiliate1, account_affiliate2], [100 * Math.pow(10, 18), 110 * Math.pow(10, 18)], { - from: token_owner, - gas: 500000 + await I_SecurityToken.mintMulti([account_affiliate1, account_affiliate2], [new BN(100).mul(new BN(10).pow(new BN(18))), new BN(110).mul(new BN(10).pow(new BN(18)))], { + from: token_owner }); let balance1 = await I_SecurityToken.balanceOf(account_affiliate1); - assert.equal(balance1.dividedBy(new BigNumber(10).pow(18)).toNumber(), 500); + assert.equal(balance1.div(new BN(10).pow(new BN(18))).toNumber(), 500); let balance2 = await I_SecurityToken.balanceOf(account_affiliate2); - assert.equal(balance2.dividedBy(new BigNumber(10).pow(18)).toNumber(), 220); + assert.equal(balance2.div(new BN(10).pow(new BN(18))).toNumber(), 220); }); it("Should provide more permissions to the delegate", async () => { @@ -719,14 +713,14 @@ contract("SecurityToken", accounts => { from: account_temp, to: I_CappedSTO.address, gas: 2100000, - value: web3.utils.toWei("1", "ether") + value: new BN(web3.utils.toWei("1", "ether")) }); - assert.equal((await I_CappedSTO.getRaised.call(0)).dividedBy(new BigNumber(10).pow(18)).toNumber(), 2); + assert.equal((await I_CappedSTO.getRaised.call(0)).div(new BN(10).pow(new BN(18))).toNumber(), 2); assert.equal(await I_CappedSTO.investorCount.call(), 2); - assert.equal((await I_SecurityToken.balanceOf(account_investor1)).dividedBy(new BigNumber(10).pow(18)).toNumber(), 1000); + assert.equal((await I_SecurityToken.balanceOf(account_investor1)).div(new BN(10).pow(new BN(18))).toNumber(), 1000); }); it("STO should fail to mint tokens after minting is frozen", async () => { @@ -738,14 +732,14 @@ contract("SecurityToken", accounts => { from: account_temp, to: I_CappedSTO.address, gas: 2100000, - value: web3.utils.toWei("1", "ether") + value: new BN(web3.utils.toWei("1", "ether")) }) ); await revertToSnapshot(id); }); it("Should remove investor from the whitelist by the delegate", async () => { - let tx = await I_GeneralTransferManager.modifyWhitelist(account_temp, 0, 0, 0, true, { + let tx = await I_GeneralTransferManager.modifyWhitelist(account_temp, new BN(0), new BN(0), new BN(0), true, { from: account_delegate, gas: 6000000 }); @@ -759,7 +753,7 @@ contract("SecurityToken", accounts => { from: account_temp, to: I_CappedSTO.address, gas: 2100000, - value: web3.utils.toWei("1", "ether") + value: new BN(web3.utils.toWei("1", "ether")) }) ); }); @@ -786,7 +780,7 @@ contract("SecurityToken", accounts => { from: account_temp, to: I_CappedSTO.address, gas: 2100000, - value: web3.utils.toWei("1", "ether") + value: new BN(web3.utils.toWei("1", "ether")) }) ); }); @@ -795,7 +789,7 @@ contract("SecurityToken", accounts => { await I_GeneralTransferManager.changeAllowAllWhitelistTransfers(true, { from: token_owner }); console.log(await I_SecurityToken.balanceOf(account_investor1)); - await catchRevert(I_SecurityToken.transfer(account_investor1, web3.utils.toWei("1", "ether"), { from: account_temp })); + await catchRevert(I_SecurityToken.transfer(account_investor1, new BN(web3.utils.toWei("1", "ether")), { from: account_temp })); }); it("Should unfreeze all the transfers", async () => { @@ -808,7 +802,7 @@ contract("SecurityToken", accounts => { }); it("Should able to transfers the tokens from one user to another", async () => { - await I_SecurityToken.transfer(account_investor1, web3.utils.toWei("1", "ether"), { from: account_temp }); + await I_SecurityToken.transfer(account_investor1, new BN(web3.utils.toWei("1", "ether")), { from: account_temp }); }); it("Should check that the list of investors is correct", async () => { @@ -856,7 +850,7 @@ contract("SecurityToken", accounts => { let currentInvestorCount = await I_SecurityToken.getInvestorCount.call(); let currentBalance = await I_SecurityToken.balanceOf(account_temp); await catchRevert( - I_SecurityToken.forceBurn(account_temp, currentBalance + web3.utils.toWei("500", "ether"), "", "", { + I_SecurityToken.forceBurn(account_temp, currentBalance + new BN(web3.utils.toWei("500", "ether")), "0x0", "0x0", { from: account_controller }) ); @@ -865,16 +859,16 @@ contract("SecurityToken", accounts => { await I_GeneralTransferManager.changeAllowAllBurnTransfers(true, { from: token_owner }); let currentInvestorCount = await I_SecurityToken.getInvestorCount.call(); let currentBalance = await I_SecurityToken.balanceOf(account_temp); - await catchRevert(I_SecurityToken.forceBurn(account_temp, currentBalance, "", "", { from: token_owner })); + await catchRevert(I_SecurityToken.forceBurn(account_temp, currentBalance, "0x0", "0x0", { from: token_owner })); }); it("Should burn the tokens", async () => { let currentInvestorCount = await I_SecurityToken.getInvestorCount.call(); let currentBalance = await I_SecurityToken.balanceOf(account_temp); // console.log(currentInvestorCount.toString(), currentBalance.toString()); - let tx = await I_SecurityToken.forceBurn(account_temp, currentBalance, "", "", { from: account_controller }); + let tx = await I_SecurityToken.forceBurn(account_temp, currentBalance, "0x0", "0x0", { from: account_controller }); // console.log(tx.logs[1].args._value.toNumber(), currentBalance.toNumber()); - assert.equal(tx.logs[1].args._value.toNumber(), currentBalance.toNumber()); + assert.equal(tx.logs[1].args._value.toString(), currentBalance.toString()); let newInvestorCount = await I_SecurityToken.getInvestorCount.call(); // console.log(newInvestorCount.toString()); assert.equal(newInvestorCount.toNumber() + 1, currentInvestorCount.toNumber(), "Investor count drops by one"); @@ -894,8 +888,8 @@ contract("SecurityToken", accounts => { it("Should prune investor length test #2", async () => { let balance = await I_SecurityToken.balanceOf(account_affiliate2); let balance2 = await I_SecurityToken.balanceOf(account_investor1); - await I_SecurityToken.transfer(account_affiliate1, balance, { from: account_affiliate2}); - await I_SecurityToken.transfer(account_affiliate1, balance2, { from: account_investor1}); + await I_SecurityToken.transfer(account_affiliate1, balance, { from: account_affiliate2 }); + await I_SecurityToken.transfer(account_affiliate1, balance2, { from: account_investor1 }); await I_SecurityToken.createCheckpoint({ from: token_owner }); let investors = await I_SecurityToken.getInvestors.call(); console.log("All investors:" + investors); @@ -911,8 +905,8 @@ contract("SecurityToken", accounts => { assert.equal(investors[i], expectedAccounts[i]); } assert.equal(investors.length, 1); - await I_SecurityToken.transfer(account_affiliate2, balance, { from: account_affiliate1}); - await I_SecurityToken.transfer(account_investor1, balance2, { from: account_affiliate1}); + await I_SecurityToken.transfer(account_affiliate2, balance, { from: account_affiliate1 }); + await I_SecurityToken.transfer(account_investor1, balance2, { from: account_affiliate1 }); }); it("Should get filtered investors", async () => { @@ -934,9 +928,7 @@ contract("SecurityToken", accounts => { assert.equal(filteredInvestors[2], investors[2]); assert.equal(filteredInvestors[3], investors[3]); assert.equal(filteredInvestors.length, 4); - await catchRevert( - I_SecurityToken.iterateInvestors(0, 5) - ); + await catchRevert(I_SecurityToken.iterateInvestors(0, 5)); }); it("Should check the balance of investor at checkpoint", async () => { @@ -949,112 +941,116 @@ contract("SecurityToken", accounts => { }); }); - describe("Test cases for the Mock TrackedRedeemption", async() => { - - it("Should add the tracked redeemption module successfully", async() => { + describe("Test cases for the Mock TrackedRedeemption", async () => { + it("Should add the tracked redeemption module successfully", async () => { [I_MockRedemptionManagerFactory] = await deployMockRedemptionAndVerifyed(account_polymath, I_MRProxied, 0); - let tx = await I_SecurityToken.addModule(I_MockRedemptionManagerFactory.address, "", 0, 0, {from: token_owner }); + let tx = await I_SecurityToken.addModule(I_MockRedemptionManagerFactory.address, "0x0", new BN(0), new BN(0), { from: token_owner }); assert.equal(tx.logs[2].args._types[0], burnKey, "fail in adding the burn manager"); - I_MockRedemptionManager = MockRedemptionManager.at(tx.logs[2].args._module); + I_MockRedemptionManager = await MockRedemptionManager.at(tx.logs[2].args._module); // adding the burn module into the GTM + currentTime = new BN(await latestTime()); tx = await I_GeneralTransferManager.modifyWhitelist( I_MockRedemptionManager.address, - latestTime(), - latestTime() + duration.seconds(2), - latestTime() + duration.days(50), + currentTime, + currentTime.add(new BN(duration.seconds(2))), + currentTime.add(new BN(duration.days(50))), true, { - from: account_delegate, - gas: 6000000 + from: account_delegate, + gas: 6000000 } ); assert.equal(tx.logs[0].args._investor, I_MockRedemptionManager.address, "Failed in adding the investor in whitelist"); }); - it("Should successfully burn tokens", async() => { - await I_GeneralTransferManager.changeAllowAllWhitelistTransfers(false, {from: token_owner}); + it("Should successfully burn tokens", async () => { + await I_GeneralTransferManager.changeAllowAllWhitelistTransfers(false, { from: token_owner }); // Minting some tokens - await I_SecurityToken.mint(account_investor1, web3.utils.toWei("1000"), {from: token_owner}); + await I_SecurityToken.mint(account_investor1, new BN(web3.utils.toWei("1000")), { from: token_owner }); // Provide approval to trnafer the tokens to Module - await I_SecurityToken.approve(I_MockRedemptionManager.address, web3.utils.toWei("500"), {from: account_investor1}); + await I_SecurityToken.approve(I_MockRedemptionManager.address, new BN(web3.utils.toWei("500")), { from: account_investor1 }); // Allow all whitelist transfer - await I_GeneralTransferManager.changeAllowAllWhitelistTransfers(true, {from: token_owner}); + await I_GeneralTransferManager.changeAllowAllWhitelistTransfers(true, { from: token_owner }); // Transfer the tokens to module (Burn) - await I_MockRedemptionManager.transferToRedeem(web3.utils.toWei("500"), { from: account_investor1}); + await I_MockRedemptionManager.transferToRedeem(new BN(web3.utils.toWei("500")), { from: account_investor1 }); // Redeem tokens - let tx = await I_MockRedemptionManager.redeemTokenByOwner(web3.utils.toWei("250"), {from: account_investor1}); + let tx = await I_MockRedemptionManager.redeemTokenByOwner(new BN(web3.utils.toWei("250")), { from: account_investor1 }); assert.equal(tx.logs[0].args._investor, account_investor1, "Burn tokens of wrong owner"); - assert.equal((tx.logs[0].args._value).dividedBy(new BigNumber(10).pow(18)).toNumber(), 250); + assert.equal(tx.logs[0].args._value.div(new BN(10).pow(new BN(18))).toNumber(), 250); }); - it("Should fail to burn the tokens because module get archived", async() => { - await I_SecurityToken.archiveModule(I_MockRedemptionManager.address, {from: token_owner}); - await catchRevert( - I_MockRedemptionManager.redeemTokenByOwner(web3.utils.toWei("250"), {from: account_investor1}) - ); - }) + it("Should fail to burn the tokens because module get archived", async () => { + await I_SecurityToken.archiveModule(I_MockRedemptionManager.address, { from: token_owner }); + await catchRevert(I_MockRedemptionManager.redeemTokenByOwner(new BN(web3.utils.toWei("250")), { from: account_investor1 })); + }); - it("Should successfully fail in calling the burn functions", async() => { + it("Should successfully fail in calling the burn functions", async () => { [I_MockRedemptionManagerFactory] = await deployMockWrongTypeRedemptionAndVerifyed(account_polymath, I_MRProxied, 0); - let tx = await I_SecurityToken.addModule(I_MockRedemptionManagerFactory.address, "", 0, 0, {from: token_owner }); - I_MockRedemptionManager = MockRedemptionManager.at(tx.logs[2].args._module); + let tx = await I_SecurityToken.addModule(I_MockRedemptionManagerFactory.address, "0x0", new BN(0), new BN(0), { from: token_owner }); + I_MockRedemptionManager = await MockRedemptionManager.at(tx.logs[2].args._module); - // adding the burn module into the GTM - tx = await I_GeneralTransferManager.modifyWhitelist( + // adding the burn module into the GTM + currentTime = new BN(await latestTime()); + tx = await I_GeneralTransferManager.modifyWhitelist( I_MockRedemptionManager.address, - latestTime(), - latestTime() + duration.seconds(2), - latestTime() + duration.days(50), + currentTime, + currentTime.add(new BN(duration.seconds(2))), + currentTime.add(new BN(duration.days(50))), true, { - from: account_delegate, - gas: 6000000 + from: account_delegate, + gas: 6000000 } ); assert.equal(tx.logs[0].args._investor, I_MockRedemptionManager.address, "Failed in adding the investor in whitelist"); // Provide approval to trnafer the tokens to Module - await I_SecurityToken.approve(I_MockRedemptionManager.address, web3.utils.toWei("500"), {from: account_investor1}); + await I_SecurityToken.approve(I_MockRedemptionManager.address, new BN(web3.utils.toWei("500")), { from: account_investor1 }); // Transfer the tokens to module (Burn) - await I_MockRedemptionManager.transferToRedeem(web3.utils.toWei("500"), { from: account_investor1}); + await I_MockRedemptionManager.transferToRedeem(new BN(web3.utils.toWei("500")), { from: account_investor1 }); await catchRevert( // Redeem tokens - I_MockRedemptionManager.redeemTokenByOwner(web3.utils.toWei("250"), {from: account_investor1}) + I_MockRedemptionManager.redeemTokenByOwner(new BN(web3.utils.toWei("250")), { from: account_investor1 }) ); }); - - }) + }); describe("Withdraw Poly", async () => { - it("Should successfully withdraw the poly -- failed because of zero address of token", async() => { - await catchRevert(I_SecurityToken.withdrawERC20("0x00000000000000000000000000000000000000000", web3.utils.toWei("20000", "ether"), { from: account_temp })); - }) + it("Should successfully withdraw the poly -- failed because of zero address of token", async () => { + await catchRevert( + I_SecurityToken.withdrawERC20(address_zero, new BN(web3.utils.toWei("20000", "ether")), { + from: account_temp + }) + ); + }); it("Should successfully withdraw the poly", async () => { - await catchRevert(I_SecurityToken.withdrawERC20(I_PolyToken.address, web3.utils.toWei("20000", "ether"), { from: account_temp })); + await catchRevert( + I_SecurityToken.withdrawERC20(I_PolyToken.address, new BN(web3.utils.toWei("20000", "ether")), { from: account_temp }) + ); }); it("Should successfully withdraw the poly", async () => { let balanceBefore = await I_PolyToken.balanceOf(token_owner); - await I_SecurityToken.withdrawERC20(I_PolyToken.address, web3.utils.toWei("20000", "ether"), { from: token_owner }); + await I_SecurityToken.withdrawERC20(I_PolyToken.address, new BN(web3.utils.toWei("20000", "ether")), { from: token_owner }); let balanceAfter = await I_PolyToken.balanceOf(token_owner); assert.equal( - BigNumber(balanceAfter) - .sub(new BigNumber(balanceBefore)) - .toNumber(), - web3.utils.toWei("20000", "ether") + BN(balanceAfter) + .sub(new BN(balanceBefore)) + .toString(), + new BN(web3.utils.toWei("20000", "ether").toString()) ); }); it("Should successfully withdraw the poly", async () => { - await catchRevert(I_SecurityToken.withdrawERC20(I_PolyToken.address, web3.utils.toWei("10", "ether"), { from: token_owner })); + await catchRevert(I_SecurityToken.withdrawERC20(I_PolyToken.address, new BN(web3.utils.toWei("10", "ether")), { from: token_owner })); }); }); describe("Force Transfer", async () => { it("Should fail to forceTransfer because not approved controller", async () => { await catchRevert( - I_SecurityToken.forceTransfer(account_investor1, account_investor2, web3.utils.toWei("10", "ether"), "", "reason", { + I_SecurityToken.forceTransfer(account_investor1, account_investor2, new BN(web3.utils.toWei("10", "ether")), "0x0", web3.utils.fromAscii("reason"), { from: account_investor1 }) ); @@ -1062,7 +1058,7 @@ contract("SecurityToken", accounts => { it("Should fail to forceTransfer because insufficient balance", async () => { await catchRevert( - I_SecurityToken.forceTransfer(account_investor2, account_investor1, web3.utils.toWei("10", "ether"), "", "reason", { + I_SecurityToken.forceTransfer(account_investor2, account_investor1, new BN(web3.utils.toWei("10", "ether")), "0x0", web3.utils.fromAscii("reason"), { from: account_controller }) ); @@ -1070,7 +1066,7 @@ contract("SecurityToken", accounts => { it("Should fail to forceTransfer because recipient is zero address", async () => { await catchRevert( - I_SecurityToken.forceTransfer(account_investor1, address_zero, web3.utils.toWei("10", "ether"), "", "reason", { + I_SecurityToken.forceTransfer(account_investor1, address_zero, new BN(web3.utils.toWei("10", "ether")), "0x0", web3.utils.fromAscii("reason"), { from: account_controller }) ); @@ -1087,9 +1083,9 @@ contract("SecurityToken", accounts => { let tx = await I_SecurityToken.forceTransfer( account_investor1, account_investor2, - web3.utils.toWei("10", "ether"), - "", - "reason", + new BN(web3.utils.toWei("10", "ether")), + "0x0", + web3.utils.fromAscii("reason"), { from: account_controller } ); @@ -1097,15 +1093,15 @@ contract("SecurityToken", accounts => { let end_balInv1 = await I_SecurityToken.balanceOf.call(account_investor1); let end_balInv2 = await I_SecurityToken.balanceOf.call(account_investor2); - assert.equal(start_investorCount.add(1).toNumber(), end_investorCount.toNumber(), "Investor count not changed"); + assert.equal(start_investorCount.add(new BN(1)).toNumber(), end_investorCount.toNumber(), "Investor count not changed"); assert.equal( - start_balInv1.sub(web3.utils.toWei("10", "ether")).toNumber(), - end_balInv1.toNumber(), + start_balInv1.sub(new BN(web3.utils.toWei("10", "ether"))).toString(), + end_balInv1.toString(), "Investor balance not changed" ); assert.equal( - start_balInv2.add(web3.utils.toWei("10", "ether")).toNumber(), - end_balInv2.toNumber(), + start_balInv2.add(new BN(web3.utils.toWei("10", "ether"))).toString(), + end_balInv2.toString(), "Investor balance not changed" ); let eventForceTransfer = tx.logs[1]; @@ -1115,14 +1111,14 @@ contract("SecurityToken", accounts => { assert.equal(account_controller, eventForceTransfer.args._controller, "Event not emitted as expected"); assert.equal(account_investor1, eventForceTransfer.args._from, "Event not emitted as expected"); assert.equal(account_investor2, eventForceTransfer.args._to, "Event not emitted as expected"); - assert.equal(web3.utils.toWei("10", "ether"), eventForceTransfer.args._value, "Event not emitted as expected"); + assert.equal(new BN(web3.utils.toWei("10", "ether")).toString(), eventForceTransfer.args._value.toString(), "Event not emitted as expected"); console.log(eventForceTransfer.args._verifyTransfer); assert.equal(false, eventForceTransfer.args._verifyTransfer, "Event not emitted as expected"); assert.equal("reason", web3.utils.hexToUtf8(eventForceTransfer.args._data), "Event not emitted as expected"); assert.equal(account_investor1, eventTransfer.args.from, "Event not emitted as expected"); assert.equal(account_investor2, eventTransfer.args.to, "Event not emitted as expected"); - assert.equal(web3.utils.toWei("10", "ether"), eventTransfer.args.value, "Event not emitted as expected"); + assert.equal(new BN(web3.utils.toWei("10", "ether")).toString(), eventTransfer.args.value.toString(), "Event not emitted as expected"); }); it("Should fail to freeze controller functionality because not owner", async () => { @@ -1157,11 +1153,10 @@ contract("SecurityToken", accounts => { it("Should fail to forceTransfer because controller functionality frozen", async () => { await catchRevert( - I_SecurityToken.forceTransfer(account_investor1, account_investor2, web3.utils.toWei("10", "ether"), "", "reason", { + I_SecurityToken.forceTransfer(account_investor1, account_investor2, new BN(web3.utils.toWei("10", "ether")), "0x0", web3.utils.fromAscii("reason"), { from: account_controller }) ); }); }); - }); diff --git a/test/p_usd_tiered_sto.js b/test/p_usd_tiered_sto.js index 3bf09d604..1ee447b7f 100644 --- a/test/p_usd_tiered_sto.js +++ b/test/p_usd_tiered_sto.js @@ -12,10 +12,12 @@ const GeneralTransferManager = artifacts.require("./GeneralTransferManager"); const PolyTokenFaucet = artifacts.require("./PolyTokenFaucet.sol"); const Web3 = require("web3"); -const BigNumber = require("bignumber.js"); +let BN = Web3.utils.BN; const web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545")); // Hardcoded development port -contract("USDTieredSTO", accounts => { +contract("USDTieredSTO", async (accounts) => { + let e18; + let e16; // Accounts Variable declaration let POLYMATH; let ISSUER; @@ -72,14 +74,15 @@ contract("USDTieredSTO", accounts => { const STOKEY = 3; let snapId; const address_zero = "0x0000000000000000000000000000000000000000"; + const one_address = "0x0000000000000000000000000000000000000001"; // Initial fee for ticker registry and security token registry - const REGFEE = web3.utils.toWei("250"); + let REGFEE; const STOSetupCost = 0; // MockOracle USD prices - const USDETH = new BigNumber(500).mul(10 ** 18); // 500 USD/ETH - const USDPOLY = new BigNumber(25).mul(10 ** 16); // 0.25 USD/POLY + let USDETH; // 500 USD/ETH + let USDPOLY; // 0.25 USD/POLY // STO Configuration Arrays let _startTime = []; @@ -166,13 +169,14 @@ contract("USDTieredSTO", accounts => { async function convert(_stoID, _tier, _discount, _currencyFrom, _currencyTo, _amount) { let USDTOKEN; - if (_discount) USDTOKEN = ((await I_USDTieredSTO_Array[_stoID].tiers.call(_tier))[1]); - else USDTOKEN = ((await I_USDTieredSTO_Array[_stoID].tiers.call(_tier))[0]); + _amount = new BN(_amount); + if (_discount) USDTOKEN = (await I_USDTieredSTO_Array[_stoID].tiers.call(_tier))[1]; + else USDTOKEN = (await I_USDTieredSTO_Array[_stoID].tiers.call(_tier))[0]; + USDTOKEN = new BN(USDTOKEN); if (_currencyFrom == "TOKEN") { - let tokenToUSD = _amount - .div(10 ** 18) - .mul(USDTOKEN.div(10 ** 18)) - .mul(10 ** 18); // TOKEN * USD/TOKEN = USD + let tokenToUSD = new BN(_amount) + .mul(USDTOKEN) + .div(e18); if (_currencyTo == "USD") return tokenToUSD; if (_currencyTo == "ETH") { return await I_USDTieredSTO_Array[_stoID].convertFromUSD(ETH, tokenToUSD); @@ -181,20 +185,27 @@ contract("USDTieredSTO", accounts => { } } if (_currencyFrom == "USD") { - if (_currencyTo == "TOKEN") return _amount.div(USDTOKEN).mul(10 ** 18); // USD / USD/TOKEN = TOKEN + if (_currencyTo == "TOKEN") return _amount.div(USDTOKEN).mul(e18); // USD / USD/TOKEN = TOKEN if (_currencyTo == "ETH" || _currencyTo == "POLY") return await I_USDTieredSTO_Array[_stoID].convertFromUSD(_currencyTo == "ETH" ? ETH : POLY, _amount); } if (_currencyFrom == "ETH" || _currencyFrom == "POLY") { let ethToUSD = await I_USDTieredSTO_Array[_stoID].convertToUSD(_currencyTo == "ETH" ? ETH : POLY, _amount); if (_currencyTo == "USD") return ethToUSD; - if (_currencyTo == "TOKEN") return ethToUSD.div(USDTOKEN).mul(10 ** 18); // USD / USD/TOKEN = TOKEN + if (_currencyTo == "TOKEN") return ethToUSD.div(USDTOKEN).mul(e18); // USD / USD/TOKEN = TOKEN } return 0; } + let currentTime; + before(async () => { - // Accounts setup + e18 = new BN(10).pow(new BN(18)); + e16 = new BN(10).pow(new BN(16)); + currentTime = new BN(await latestTime()); + REGFEE = new BN(web3.utils.toWei("250")); + USDETH = new BN(500).mul(new BN(10).pow(new BN(18))); // 500 USD/ETH + USDPOLY = new BN(25).mul(new BN(10).pow(new BN(16))); // 0.25 USD/POLY POLYMATH = accounts[0]; ISSUER = accounts[1]; WALLET = accounts[2]; @@ -231,10 +242,10 @@ contract("USDTieredSTO", accounts => { // STEP 5: Deploy the USDTieredSTOFactory [I_USDTieredSTOFactory] = await deployUSDTieredSTOAndVerified(POLYMATH, I_MRProxied, STOSetupCost); - [P_USDTieredSTOFactory] = await deployUSDTieredSTOAndVerified(POLYMATH, I_MRProxied, web3.utils.toWei("500")); + [P_USDTieredSTOFactory] = await deployUSDTieredSTOAndVerified(POLYMATH, I_MRProxied, new BN(web3.utils.toWei("500"))); // Step 12: Deploy & Register Mock Oracles - I_USDOracle = await MockOracle.new(0, "ETH", "USD", USDETH, { from: POLYMATH }); // 500 dollars per POLY - I_POLYOracle = await MockOracle.new(I_PolyToken.address, "POLY", "USD", USDPOLY, { from: POLYMATH }); // 25 cents per POLY + I_USDOracle = await MockOracle.new(address_zero, web3.utils.fromAscii("ETH"), web3.utils.fromAscii("USD"), USDETH, { from: POLYMATH }); // 500 dollars per POLY + I_POLYOracle = await MockOracle.new(I_PolyToken.address, web3.utils.fromAscii("POLY"), web3.utils.fromAscii("USD"), USDPOLY, { from: POLYMATH }); // 25 cents per POLY await I_PolymathRegistry.changeAddress("EthUsdOracle", I_USDOracle.address, { from: POLYMATH }); await I_PolymathRegistry.changeAddress("PolyUsdOracle", I_POLYOracle.address, { from: POLYMATH }); @@ -269,22 +280,22 @@ contract("USDTieredSTO", accounts => { it("Should generate the new security token with the same symbol as registered above", async () => { await I_PolyToken.getTokens(REGFEE, ISSUER); await I_PolyToken.approve(I_STRProxied.address, REGFEE, { from: ISSUER }); - let _blockNo = latestBlock(); + let tx = await I_STRProxied.generateSecurityToken(NAME, SYMBOL, TOKENDETAILS, true, { from: ISSUER }); assert.equal(tx.logs[2].args._ticker, SYMBOL, "SecurityToken doesn't get deployed"); - I_SecurityToken = SecurityToken.at(tx.logs[2].args._securityTokenAddress); + I_SecurityToken = await SecurityToken.at(tx.logs[2].args._securityTokenAddress); - const log = await promisifyLogWatch(I_SecurityToken.ModuleAdded({ from: _blockNo }), 1); + const log = (await I_SecurityToken.getPastEvents('ModuleAdded', {filter: {transactionHash: tx.transactionHash}}))[0]; // Verify that GeneralTransferManager module get added successfully or not - assert.equal(log.args._types[0].toNumber(), TMKEY); + assert.equal(log.args._types[0].toString(), TMKEY); assert.equal(web3.utils.hexToString(log.args._name), "GeneralTransferManager"); }); it("Should intialize the auto attached modules", async () => { let moduleData = (await I_SecurityToken.getModulesByType(TMKEY))[0]; - I_GeneralTransferManager = GeneralTransferManager.at(moduleData); + I_GeneralTransferManager = await GeneralTransferManager.at(moduleData); }); }); @@ -292,14 +303,14 @@ contract("USDTieredSTO", accounts => { it("Should successfully attach the first STO module to the security token", async () => { let stoId = 0; // No discount - _startTime.push(latestTime() + duration.days(2)); - _endTime.push(_startTime[stoId] + duration.days(100)); - _ratePerTier.push([BigNumber(10 * 10 ** 16), BigNumber(15 * 10 ** 16)]); // [ 0.10 USD/Token, 0.15 USD/Token ] - _ratePerTierDiscountPoly.push([BigNumber(10 * 10 ** 16), BigNumber(15 * 10 ** 16)]); // [ 0.10 USD/Token, 0.15 USD/Token ] - _tokensPerTierTotal.push([BigNumber(100000000).mul(new BigNumber(10 ** 18)), BigNumber(200000000).mul(new BigNumber(10 ** 18))]); // [ 100m Token, 200m Token ] - _tokensPerTierDiscountPoly.push([BigNumber(0), BigNumber(0)]); // [ 0, 0 ] - _nonAccreditedLimitUSD.push(new BigNumber(10000).mul(new BigNumber(10 ** 18))); // 10k USD - _minimumInvestmentUSD.push(new BigNumber(5 * 10 ** 18)); // 5 USD + _startTime.push(new BN(currentTime).add(new BN(duration.days(2)))); + _endTime.push(new BN(_startTime[stoId]).add(new BN(currentTime).add(new BN(duration.days(100))))); + _ratePerTier.push([new BN(10).mul(e16), new BN(15).mul(e16)]); // [ 0.10 USD/Token, 0.15 USD/Token ] + _ratePerTierDiscountPoly.push([new BN(10).mul(e16), new BN(15).mul(e16)]); // [ 0.10 USD/Token, 0.15 USD/Token ] + _tokensPerTierTotal.push([new BN(100000000).mul(new BN(e18)), new BN(200000000).mul(new BN(e18))]); // [ 100m Token, 200m Token ] + _tokensPerTierDiscountPoly.push([new BN(0), new BN(0)]); // [ new BN(0), 0 ] + _nonAccreditedLimitUSD.push(new BN(10000).mul(new BN(e18))); // 10k USD + _minimumInvestmentUSD.push(new BN(5).mul(e18)); // 5 USD _fundRaiseTypes.push([0, 1, 2]); _wallet.push(WALLET); _reserveWallet.push(RESERVEWALLET); @@ -321,44 +332,44 @@ contract("USDTieredSTO", accounts => { ]; let bytesSTO = web3.eth.abi.encodeFunctionCall(functionSignature, config); - let tx = await I_SecurityToken.addModule(I_USDTieredSTOFactory.address, bytesSTO, 0, 0, { from: ISSUER, gasPrice: GAS_PRICE }); + let tx = await I_SecurityToken.addModule(I_USDTieredSTOFactory.address, bytesSTO, new BN(0), new BN(0), { from: ISSUER, gasPrice: GAS_PRICE }); console.log(" Gas addModule: ".grey + tx.receipt.gasUsed.toString().grey); assert.equal(tx.logs[2].args._types[0], STOKEY, "USDTieredSTO doesn't get deployed"); assert.equal(web3.utils.hexToString(tx.logs[2].args._name), "USDTieredSTO", "USDTieredSTOFactory module was not added"); - I_USDTieredSTO_Array.push(USDTieredSTO.at(tx.logs[2].args._module)); + I_USDTieredSTO_Array.push(await USDTieredSTO.at(tx.logs[2].args._module)); - assert.equal(await I_USDTieredSTO_Array[stoId].startTime.call(), _startTime[stoId], "Incorrect _startTime in config"); - assert.equal(await I_USDTieredSTO_Array[stoId].endTime.call(), _endTime[stoId], "Incorrect _endTime in config"); + assert.equal((await I_USDTieredSTO_Array[stoId].startTime.call()).toString(), _startTime[stoId].toString(), "Incorrect _startTime in config"); + assert.equal((await I_USDTieredSTO_Array[stoId].endTime.call()).toString(), _endTime[stoId].toString(), "Incorrect _endTime in config"); for (var i = 0; i < _ratePerTier[stoId].length; i++) { assert.equal( - (await I_USDTieredSTO_Array[stoId].tiers.call(i))[0].toNumber(), - _ratePerTier[stoId][i].toNumber(), + (await I_USDTieredSTO_Array[stoId].tiers.call(i))[0].toString(), + _ratePerTier[stoId][i].toString(), "Incorrect _ratePerTier in config" ); assert.equal( - (await I_USDTieredSTO_Array[stoId].tiers.call(i))[1].toNumber(), - _ratePerTierDiscountPoly[stoId][i].toNumber(), + (await I_USDTieredSTO_Array[stoId].tiers.call(i))[1].toString(), + _ratePerTierDiscountPoly[stoId][i].toString(), "Incorrect _ratePerTierDiscountPoly in config" ); assert.equal( - (await I_USDTieredSTO_Array[stoId].tiers.call(i))[2].toNumber(), - _tokensPerTierTotal[stoId][i].toNumber(), + (await I_USDTieredSTO_Array[stoId].tiers.call(i))[2].toString(), + _tokensPerTierTotal[stoId][i].toString(), "Incorrect _tokensPerTierTotal in config" ); assert.equal( - (await I_USDTieredSTO_Array[stoId].tiers.call(i))[3].toNumber(), - _tokensPerTierDiscountPoly[stoId][i].toNumber(), + (await I_USDTieredSTO_Array[stoId].tiers.call(i))[3].toString(), + _tokensPerTierDiscountPoly[stoId][i].toString(), "Incorrect _tokensPerTierDiscountPoly in config" ); } assert.equal( - (await I_USDTieredSTO_Array[stoId].nonAccreditedLimitUSD.call()).toNumber(), - _nonAccreditedLimitUSD[stoId].toNumber(), + (await I_USDTieredSTO_Array[stoId].nonAccreditedLimitUSD.call()).toString(), + _nonAccreditedLimitUSD[stoId].toString(), "Incorrect _nonAccreditedLimitUSD in config" ); assert.equal( - (await I_USDTieredSTO_Array[stoId].minimumInvestmentUSD.call()).toNumber(), - _minimumInvestmentUSD[stoId].toNumber(), + (await I_USDTieredSTO_Array[stoId].minimumInvestmentUSD.call()).toString(), + _minimumInvestmentUSD[stoId].toString(), "Incorrect _minimumInvestmentUSD in config" ); assert.equal(await I_USDTieredSTO_Array[stoId].wallet.call(), _wallet[stoId], "Incorrect _wallet in config"); @@ -373,10 +384,10 @@ contract("USDTieredSTO", accounts => { _tokensPerTierTotal[stoId].length, "Incorrect number of tiers" ); - assert.equal((await I_USDTieredSTO_Array[stoId].getPermissions()).length, 0, "Incorrect number of permissions"); + assert.equal((await I_USDTieredSTO_Array[stoId].getPermissions()).length, new BN(0), "Incorrect number of permissions"); }); - it("Should attach the paid STO factory -- failed because of no tokens", async() => { + it("Should attach the paid STO factory -- failed because of no tokens", async () => { let stoId = 0; // No discount let config = [ _startTime[stoId], @@ -395,11 +406,14 @@ contract("USDTieredSTO", accounts => { let bytesSTO = web3.eth.abi.encodeFunctionCall(functionSignature, config); await catchRevert( - I_SecurityToken.addModule(P_USDTieredSTOFactory.address, bytesSTO, web3.utils.toWei("500"), 0, { from: ISSUER, gasPrice: GAS_PRICE }) + I_SecurityToken.addModule(P_USDTieredSTOFactory.address, bytesSTO, new BN(web3.utils.toWei("500")), new BN(0), { + from: ISSUER, + gasPrice: GAS_PRICE + }) ); }); - it("Should attach the paid STO factory", async() => { + it("Should attach the paid STO factory", async () => { let snapId = await takeSnapshot(); let stoId = 0; // No discount let config = [ @@ -418,8 +432,11 @@ contract("USDTieredSTO", accounts => { ]; let bytesSTO = web3.eth.abi.encodeFunctionCall(functionSignature, config); - await I_PolyToken.getTokens(web3.utils.toWei("500"), I_SecurityToken.address); - let tx = await I_SecurityToken.addModule(P_USDTieredSTOFactory.address, bytesSTO, web3.utils.toWei("500"), 0, { from: ISSUER, gasPrice: GAS_PRICE }); + await I_PolyToken.getTokens(new BN(web3.utils.toWei("500")), I_SecurityToken.address); + let tx = await I_SecurityToken.addModule(P_USDTieredSTOFactory.address, bytesSTO, new BN(web3.utils.toWei("500")), new BN(0), { + from: ISSUER, + gasPrice: GAS_PRICE + }); await revertToSnapshot(snapId); }); @@ -431,60 +448,58 @@ contract("USDTieredSTO", accounts => { }); it("Should allow non-matching beneficiary -- failed because it is already active", async () => { - await catchRevert( - I_USDTieredSTO_Array[0].changeAllowBeneficialInvestments(true, { from: ISSUER }) - ); + await catchRevert(I_USDTieredSTO_Array[0].changeAllowBeneficialInvestments(true, { from: ISSUER })); await revertToSnapshot(snapId); }); - it("Should successfully call the modifyTimes before starting the STO -- fail because of bad owner", async() => { + it("Should successfully call the modifyTimes before starting the STO -- fail because of bad owner", async () => { await catchRevert( - I_USDTieredSTO_Array[0].modifyTimes(latestTime() + duration.days(15), latestTime() + duration.days(55), { from: POLYMATH }) + I_USDTieredSTO_Array[0].modifyTimes(new BN(currentTime).add(new BN(duration.days(15))), new BN(currentTime).add(new BN(duration.days(55))), { from: POLYMATH }) ); - }) + }); - it("Should successfully call the modifyTimes before starting the STO", async() => { + it("Should successfully call the modifyTimes before starting the STO", async () => { let snapId = await takeSnapshot(); - let _startTime = latestTime() + duration.days(15); - let _endTime = latestTime() + duration.days(55) + let _startTime = new BN(currentTime).add(new BN(duration.days(15))); + let _endTime = new BN(currentTime).add(new BN(duration.days(55))); await I_USDTieredSTO_Array[0].modifyTimes(_startTime, _endTime, { from: ISSUER }); - assert.equal(await I_USDTieredSTO_Array[0].startTime.call(), _startTime, "Incorrect _startTime in config"); - assert.equal(await I_USDTieredSTO_Array[0].endTime.call(), _endTime, "Incorrect _endTime in config"); + assert.equal((await I_USDTieredSTO_Array[0].startTime.call()).toString(), _startTime.toString(), "Incorrect _startTime in config"); + assert.equal((await I_USDTieredSTO_Array[0].endTime.call()).toString(), _endTime.toString(), "Incorrect _endTime in config"); await revertToSnapshot(snapId); }); it("Should successfully attach the second STO module to the security token", async () => { let stoId = 1; // No discount - _startTime.push(latestTime() + duration.days(2)); - _endTime.push(_startTime[stoId] + duration.days(100)); + _startTime.push(new BN(currentTime).add(new BN(duration.days(2)))); + _endTime.push(new BN(_startTime[stoId]).add(new BN(currentTime).add(new BN(duration.days(100))))); _ratePerTier.push([ - BigNumber(10 * 10 ** 16), - BigNumber(15 * 10 ** 16), - BigNumber(15 * 10 ** 16), - BigNumber(15 * 10 ** 16), - BigNumber(15 * 10 ** 16), - BigNumber(15 * 10 ** 16) + new BN(10).mul(e16), + new BN(15).mul(e16), + new BN(15).mul(e16), + new BN(15).mul(e16), + new BN(15).mul(e16), + new BN(15).mul(e16) ]); _ratePerTierDiscountPoly.push([ - BigNumber(10 * 10 ** 16), - BigNumber(15 * 10 ** 16), - BigNumber(15 * 10 ** 16), - BigNumber(15 * 10 ** 16), - BigNumber(15 * 10 ** 16), - BigNumber(15 * 10 ** 16) + new BN(10).mul(e16), + new BN(15).mul(e16), + new BN(15).mul(e16), + new BN(15).mul(e16), + new BN(15).mul(e16), + new BN(15).mul(e16) ]); _tokensPerTierTotal.push([ - BigNumber(5 * 10 ** 18), - BigNumber(10 * 10 ** 18), - BigNumber(10 * 10 ** 18), - BigNumber(10 * 10 ** 18), - BigNumber(10 * 10 ** 18), - BigNumber(50 * 10 ** 18) + new BN(5).mul(e18), + new BN(10).mul(e18), + new BN(10).mul(e18), + new BN(10).mul(e18), + new BN(10).mul(e18), + new BN(50).mul(e18) ]); - _tokensPerTierDiscountPoly.push([BigNumber(0), BigNumber(0), BigNumber(0), BigNumber(0), BigNumber(0), BigNumber(0)]); - _nonAccreditedLimitUSD.push(new BigNumber(10000).mul(new BigNumber(10 ** 18))); - _minimumInvestmentUSD.push(new BigNumber(0)); + _tokensPerTierDiscountPoly.push([new BN(0), new BN(0), new BN(0), new BN(0), new BN(0), new BN(0)]); + _nonAccreditedLimitUSD.push(new BN(10000).mul(new BN(e18))); + _minimumInvestmentUSD.push(new BN(0)); _fundRaiseTypes.push([0, 1, 2]); _wallet.push(WALLET); _reserveWallet.push(RESERVEWALLET); @@ -506,44 +521,44 @@ contract("USDTieredSTO", accounts => { ]; let bytesSTO = web3.eth.abi.encodeFunctionCall(functionSignature, config); - let tx = await I_SecurityToken.addModule(I_USDTieredSTOFactory.address, bytesSTO, 0, 0, { from: ISSUER, gasPrice: GAS_PRICE }); + let tx = await I_SecurityToken.addModule(I_USDTieredSTOFactory.address, bytesSTO, new BN(0), new BN(0), { from: ISSUER, gasPrice: GAS_PRICE }); console.log(" Gas addModule: ".grey + tx.receipt.gasUsed.toString().grey); assert.equal(tx.logs[2].args._types[0], STOKEY, "USDTieredSTO doesn't get deployed"); assert.equal(web3.utils.hexToString(tx.logs[2].args._name), "USDTieredSTO", "USDTieredSTOFactory module was not added"); - I_USDTieredSTO_Array.push(USDTieredSTO.at(tx.logs[2].args._module)); + I_USDTieredSTO_Array.push(await USDTieredSTO.at(tx.logs[2].args._module)); - assert.equal(await I_USDTieredSTO_Array[stoId].startTime.call(), _startTime[stoId], "Incorrect _startTime in config"); - assert.equal(await I_USDTieredSTO_Array[stoId].endTime.call(), _endTime[stoId], "Incorrect _endTime in config"); + assert.equal((await I_USDTieredSTO_Array[stoId].startTime.call()).toString(), _startTime[stoId].toString(), "Incorrect _startTime in config"); + assert.equal((await I_USDTieredSTO_Array[stoId].endTime.call()).toString(), _endTime[stoId].toString(), "Incorrect _endTime in config"); for (var i = 0; i < _ratePerTier[stoId].length; i++) { assert.equal( - (await I_USDTieredSTO_Array[stoId].tiers.call(i))[0].toNumber(), - _ratePerTier[stoId][i].toNumber(), + (await I_USDTieredSTO_Array[stoId].tiers.call(i))[0].toString(), + _ratePerTier[stoId][i].toString(), "Incorrect _ratePerTier in config" ); assert.equal( - (await I_USDTieredSTO_Array[stoId].tiers.call(i))[1].toNumber(), - _ratePerTierDiscountPoly[stoId][i].toNumber(), + (await I_USDTieredSTO_Array[stoId].tiers.call(i))[1].toString(), + _ratePerTierDiscountPoly[stoId][i].toString(), "Incorrect _ratePerTierDiscountPoly in config" ); assert.equal( - (await I_USDTieredSTO_Array[stoId].tiers.call(i))[2].toNumber(), - _tokensPerTierTotal[stoId][i].toNumber(), + (await I_USDTieredSTO_Array[stoId].tiers.call(i))[2].toString(), + _tokensPerTierTotal[stoId][i].toString(), "Incorrect _tokensPerTierTotal in config" ); assert.equal( - (await I_USDTieredSTO_Array[stoId].tiers.call(i))[3].toNumber(), - _tokensPerTierDiscountPoly[stoId][i].toNumber(), + (await I_USDTieredSTO_Array[stoId].tiers.call(i))[3].toString(), + _tokensPerTierDiscountPoly[stoId][i].toString(), "Incorrect _tokensPerTierDiscountPoly in config" ); } assert.equal( - (await I_USDTieredSTO_Array[stoId].nonAccreditedLimitUSD.call()).toNumber(), - _nonAccreditedLimitUSD[stoId].toNumber(), + (await I_USDTieredSTO_Array[stoId].nonAccreditedLimitUSD.call()).toString(), + _nonAccreditedLimitUSD[stoId].toString(), "Incorrect _nonAccreditedLimitUSD in config" ); assert.equal( - (await I_USDTieredSTO_Array[stoId].minimumInvestmentUSD.call()).toNumber(), - _minimumInvestmentUSD[stoId].toNumber(), + (await I_USDTieredSTO_Array[stoId].minimumInvestmentUSD.call()).toString(), + _minimumInvestmentUSD[stoId].toString(), "Incorrect _minimumInvestmentUSD in config" ); assert.equal(await I_USDTieredSTO_Array[stoId].wallet.call(), _wallet[stoId], "Incorrect _wallet in config"); @@ -558,25 +573,23 @@ contract("USDTieredSTO", accounts => { _tokensPerTierTotal[stoId].length, "Incorrect number of tiers" ); - assert.equal((await I_USDTieredSTO_Array[stoId].getPermissions()).length, 0, "Incorrect number of permissions"); + assert.equal((await I_USDTieredSTO_Array[stoId].getPermissions()).length, new BN(0), "Incorrect number of permissions"); }); it("Should successfully attach the third STO module to the security token", async () => { let stoId = 2; // Poly discount - - _startTime.push(latestTime() + duration.days(2)); - _endTime.push(_startTime[stoId] + duration.days(100)); - _ratePerTier.push([BigNumber(1 * 10 ** 18), BigNumber(1.5 * 10 ** 18)]); // [ 1 USD/Token, 1.5 USD/Token ] - _ratePerTierDiscountPoly.push([BigNumber(0.5 * 10 ** 18), BigNumber(1 * 10 ** 18)]); // [ 0.5 USD/Token, 1.5 USD/Token ] - _tokensPerTierTotal.push([BigNumber(100 * 10 ** 18), BigNumber(50 * 10 ** 18)]); // [ 100 Token, 50 Token ] - _tokensPerTierDiscountPoly.push([BigNumber(100 * 10 ** 18), BigNumber(25 * 10 ** 18)]); // [ 100 Token, 25 Token ] - _nonAccreditedLimitUSD.push(new BigNumber(25 * 10 ** 18)); // [ 25 USD ] - _minimumInvestmentUSD.push(new BigNumber(5)); + _startTime.push(new BN(currentTime).add(new BN(duration.days(2)))); + _endTime.push(new BN(_startTime[stoId]).add(new BN(currentTime).add(new BN(duration.days(100))))); + _ratePerTier.push([new BN(1).mul(e18), new BN(150).mul(e16)]); // [ 1 USD/Token, 1.5 USD/Token ] + _ratePerTierDiscountPoly.push([new BN(50).mul(e16), new BN(1).mul(e18)]); // [ 0.5 USD/Token, 1.5 USD/Token ] + _tokensPerTierTotal.push([new BN(100).mul(e18), new BN(50).mul(e18)]); // [ 100 Token, 50 Token ] + _tokensPerTierDiscountPoly.push([new BN(100).mul(e18), new BN(25).mul(e18)]); // [ 100 Token, 25 Token ] + _nonAccreditedLimitUSD.push(new BN(25).mul(e18)); // [ 25 USD ] + _minimumInvestmentUSD.push(new BN(5)); _fundRaiseTypes.push([0, 1, 2]); _wallet.push(WALLET); _reserveWallet.push(RESERVEWALLET); _usdToken.push(I_DaiToken.address); - let config = [ _startTime[stoId], _endTime[stoId], @@ -591,26 +604,25 @@ contract("USDTieredSTO", accounts => { _reserveWallet[stoId], _usdToken[stoId] ]; - let bytesSTO = web3.eth.abi.encodeFunctionCall(functionSignature, config); - let tx = await I_SecurityToken.addModule(I_USDTieredSTOFactory.address, bytesSTO, 0, 0, { from: ISSUER, gasPrice: GAS_PRICE }); + let tx = await I_SecurityToken.addModule(I_USDTieredSTOFactory.address, bytesSTO, new BN(0), new BN(0), { from: ISSUER, gasPrice: GAS_PRICE }); console.log(" Gas addModule: ".grey + tx.receipt.gasUsed.toString().grey); assert.equal(tx.logs[2].args._types[0], STOKEY, "USDTieredSTO doesn't get deployed"); assert.equal(web3.utils.hexToString(tx.logs[2].args._name), "USDTieredSTO", "USDTieredSTOFactory module was not added"); - I_USDTieredSTO_Array.push(USDTieredSTO.at(tx.logs[2].args._module)); + I_USDTieredSTO_Array.push(await USDTieredSTO.at(tx.logs[2].args._module)); }); it("Should successfully attach the fourth STO module to the security token", async () => { let stoId = 3; - _startTime.push(latestTime() + duration.days(0.1)); - _endTime.push(_startTime[stoId] + duration.days(0.1)); - _ratePerTier.push([BigNumber(10 * 10 ** 16), BigNumber(15 * 10 ** 16)]); - _ratePerTierDiscountPoly.push([BigNumber(10 * 10 ** 16), BigNumber(12 * 10 ** 16)]); - _tokensPerTierTotal.push([BigNumber(100 * 10 ** 18), BigNumber(200 * 10 ** 18)]); - _tokensPerTierDiscountPoly.push([BigNumber(0), BigNumber(50 * 10 ** 18)]); - _nonAccreditedLimitUSD.push(new BigNumber(10000).mul(new BigNumber(10 ** 18))); - _minimumInvestmentUSD.push(new BigNumber(0)); + _startTime.push(new BN(currentTime).add(new BN(duration.days(0.1)))); + _endTime.push(new BN(_startTime[stoId]).add(new BN(currentTime).add(new BN(duration.days(0.1))))); + _ratePerTier.push([new BN(10).mul(e16), new BN(15).mul(e16)]); + _ratePerTierDiscountPoly.push([new BN(10).mul(e16), new BN(12).mul(e16)]); + _tokensPerTierTotal.push([new BN(100).mul(e18), new BN(200).mul( e18)]); + _tokensPerTierDiscountPoly.push([new BN(0), new BN(50).mul( e18)]); + _nonAccreditedLimitUSD.push(new BN(10000).mul(new BN(e18))); + _minimumInvestmentUSD.push(new BN(0)); _fundRaiseTypes.push([0, 1, 2]); _wallet.push(WALLET); _reserveWallet.push(RESERVEWALLET); @@ -632,24 +644,24 @@ contract("USDTieredSTO", accounts => { ]; let bytesSTO = web3.eth.abi.encodeFunctionCall(functionSignature, config); - let tx = await I_SecurityToken.addModule(I_USDTieredSTOFactory.address, bytesSTO, 0, 0, { from: ISSUER, gasPrice: GAS_PRICE }); + let tx = await I_SecurityToken.addModule(I_USDTieredSTOFactory.address, bytesSTO, new BN(0), new BN(0), { from: ISSUER, gasPrice: GAS_PRICE }); console.log(" Gas addModule: ".grey + tx.receipt.gasUsed.toString().grey); assert.equal(tx.logs[2].args._types[0], STOKEY, "USDTieredSTO doesn't get deployed"); assert.equal(web3.utils.hexToString(tx.logs[2].args._name), "USDTieredSTO", "USDTieredSTOFactory module was not added"); - I_USDTieredSTO_Array.push(USDTieredSTO.at(tx.logs[2].args._module)); + I_USDTieredSTO_Array.push(await USDTieredSTO.at(tx.logs[2].args._module)); }); it("Should successfully attach the fifth STO module to the security token", async () => { let stoId = 4; // Non-divisible tokens - _startTime.push(latestTime() + duration.days(2)); - _endTime.push(_startTime[stoId] + duration.days(100)); - _ratePerTier.push([BigNumber(1 * 10 ** 18), BigNumber(1.5 * 10 ** 18)]); // [ 1 USD/Token, 1.5 USD/Token ] - _ratePerTierDiscountPoly.push([BigNumber(0.5 * 10 ** 18), BigNumber(1 * 10 ** 18)]); // [ 0.5 USD/Token, 1.5 USD/Token ] - _tokensPerTierTotal.push([BigNumber(100 * 10 ** 18), BigNumber(50 * 10 ** 18)]); // [ 100 Token, 50 Token ] - _tokensPerTierDiscountPoly.push([BigNumber(100 * 10 ** 18), BigNumber(25 * 10 ** 18)]); // [ 100 Token, 25 Token ] - _nonAccreditedLimitUSD.push(BigNumber(25 * 10 ** 18)); // [ 25 USD ] - _minimumInvestmentUSD.push(BigNumber(5)); + _startTime.push(new BN(currentTime).add(new BN(duration.days(2)))); + _endTime.push(new BN(_startTime[stoId]).add(new BN(currentTime).add(new BN(duration.days(100))))); + _ratePerTier.push([new BN(1).mul(e18), new BN(150).mul(e16)]); // [ 1 USD/Token, 1.5 USD/Token ] + _ratePerTierDiscountPoly.push([new BN(50).mul(e16), new BN(1).mul(e18)]); // [ 0.5 USD/Token, 1.5 USD/Token ] + _tokensPerTierTotal.push([new BN(100).mul(e18), new BN(50).mul( e18)]); // [ 100 Token, 50 Token ] + _tokensPerTierDiscountPoly.push([new BN(100).mul(e18), new BN(25).mul(e18)]); // [ 100 Token, 25 Token ] + _nonAccreditedLimitUSD.push(new BN(25).mul(e18)); // [ 25 USD ] + _minimumInvestmentUSD.push(new BN(5)); _fundRaiseTypes.push([0, 1, 2]); _wallet.push(WALLET); _reserveWallet.push(RESERVEWALLET); @@ -671,11 +683,11 @@ contract("USDTieredSTO", accounts => { ]; let bytesSTO = web3.eth.abi.encodeFunctionCall(functionSignature, config); - let tx = await I_SecurityToken.addModule(I_USDTieredSTOFactory.address, bytesSTO, 0, 0, { from: ISSUER, gasPrice: GAS_PRICE }); + let tx = await I_SecurityToken.addModule(I_USDTieredSTOFactory.address, bytesSTO, new BN(0), new BN(0), { from: ISSUER, gasPrice: GAS_PRICE }); console.log(" Gas addModule: ".grey + tx.receipt.gasUsed.toString().grey); assert.equal(tx.logs[2].args._types[0], STOKEY, "USDTieredSTO doesn't get deployed"); assert.equal(web3.utils.hexToString(tx.logs[2].args._name), "USDTieredSTO", "USDTieredSTOFactory module was not added"); - I_USDTieredSTO_Array.push(USDTieredSTO.at(tx.logs[2].args._module)); + I_USDTieredSTO_Array.push(await USDTieredSTO.at(tx.logs[2].args._module)); }); it("Should fail because rates and tier array of different length", async () => { @@ -746,14 +758,14 @@ contract("USDTieredSTO", accounts => { for (var i = 0; i < config.length; i++) { let bytesSTO = web3.eth.abi.encodeFunctionCall(functionSignature, config[i]); - await catchRevert(I_SecurityToken.addModule(I_USDTieredSTOFactory.address, bytesSTO, 0, 0, { from: ISSUER })); + await catchRevert(I_SecurityToken.addModule(I_USDTieredSTOFactory.address, bytesSTO, new BN(0), new BN(0), { from: ISSUER })); } }); it("Should fail because rate of token should be greater than 0", async () => { let stoId = 0; - let ratePerTier = [BigNumber(10 * 10 ** 16), BigNumber(0)]; + let ratePerTier = [new BN(10).mul(e16), new BN(0)]; let config = [ _startTime[stoId], _endTime[stoId], @@ -770,7 +782,7 @@ contract("USDTieredSTO", accounts => { ]; let bytesSTO = web3.eth.abi.encodeFunctionCall(functionSignature, config); - await catchRevert(I_SecurityToken.addModule(I_USDTieredSTOFactory.address, bytesSTO, 0, 0, { from: ISSUER })); + await catchRevert(I_SecurityToken.addModule(I_USDTieredSTOFactory.address, bytesSTO, new BN(0), new BN(0), { from: ISSUER })); }); it("Should fail because Zero address is not permitted for wallet", async () => { @@ -793,7 +805,7 @@ contract("USDTieredSTO", accounts => { ]; let bytesSTO = web3.eth.abi.encodeFunctionCall(functionSignature, config); - await catchRevert(I_SecurityToken.addModule(I_USDTieredSTOFactory.address, bytesSTO, 0, 0, { from: ISSUER })); + await catchRevert(I_SecurityToken.addModule(I_USDTieredSTOFactory.address, bytesSTO, new BN(0), new BN(0), { from: ISSUER })); }); it("Should fail because Zero address is not permitted for reserveWallet", async () => { @@ -815,14 +827,14 @@ contract("USDTieredSTO", accounts => { ]; let bytesSTO = web3.eth.abi.encodeFunctionCall(functionSignature, config); - await catchRevert(I_SecurityToken.addModule(I_USDTieredSTOFactory.address, bytesSTO, 0, 0, { from: ISSUER })); + await catchRevert(I_SecurityToken.addModule(I_USDTieredSTOFactory.address, bytesSTO, new BN(0), new BN(0), { from: ISSUER })); }); it("Should fail because end time before start time", async () => { let stoId = 0; - let startTime = latestTime() + duration.days(35); - let endTime = latestTime() + duration.days(1); + let startTime = await latestTime() + duration.days(35); + let endTime = await latestTime() + duration.days(1); let config = [ startTime, endTime, @@ -839,13 +851,13 @@ contract("USDTieredSTO", accounts => { ]; let bytesSTO = web3.eth.abi.encodeFunctionCall(functionSignature, config); - await catchRevert(I_SecurityToken.addModule(I_USDTieredSTOFactory.address, bytesSTO, 0, 0, { from: ISSUER })); + await catchRevert(I_SecurityToken.addModule(I_USDTieredSTOFactory.address, bytesSTO, new BN(0), new BN(0), { from: ISSUER })); }); it("Should fail because start time is in the past", async () => { let stoId = 0; - let startTime = latestTime() - duration.days(35); + let startTime = await latestTime() - duration.days(35); let endTime = startTime + duration.days(50); let config = [ startTime, @@ -863,7 +875,7 @@ contract("USDTieredSTO", accounts => { ]; let bytesSTO = web3.eth.abi.encodeFunctionCall(functionSignature, config); - await catchRevert(I_SecurityToken.addModule(I_USDTieredSTOFactory.address, bytesSTO, 0, 0, { from: ISSUER })); + await catchRevert(I_SecurityToken.addModule(I_USDTieredSTOFactory.address, bytesSTO, new BN(0), new BN(0), { from: ISSUER })); }); }); @@ -886,52 +898,52 @@ contract("USDTieredSTO", accounts => { it("Should successfully change config before startTime - limits and tiers, times, addresses", async () => { let stoId = 3; - await I_USDTieredSTO_Array[stoId].modifyLimits(new BigNumber(1 * 10 ** 18), BigNumber(15 * 10 ** 18), { from: ISSUER }); + await I_USDTieredSTO_Array[stoId].modifyLimits(new BN(1).mul(e18), new BN(15).mul(e18), { from: ISSUER }); assert.equal( - (await I_USDTieredSTO_Array[stoId].minimumInvestmentUSD.call()).toNumber(), - BigNumber(15 * 10 ** 18).toNumber(), + (await I_USDTieredSTO_Array[stoId].minimumInvestmentUSD.call()).toString(), + new BN(15).mul(e18).toString(), "STO Configuration doesn't set as expected" ); assert.equal( - (await I_USDTieredSTO_Array[stoId].nonAccreditedLimitUSD.call()).toNumber(), - BigNumber(1 * 10 ** 18).toNumber(), + (await I_USDTieredSTO_Array[stoId].nonAccreditedLimitUSD.call()).toString(), + new BN(1).mul(e18).toString(), "STO Configuration doesn't set as expected" ); await I_USDTieredSTO_Array[stoId].modifyTiers( - [BigNumber(15 * 10 ** 18)], - [BigNumber(13 * 10 ** 18)], - [BigNumber(15 * 10 ** 20)], - [BigNumber(15 * 10 ** 20)], + [new BN(15).mul(e18)], + [new BN(13).mul(e18)], + [new BN(1500).mul(e18)], + [new BN(1500).mul(e18)], { from: ISSUER } ); assert.equal( - (await I_USDTieredSTO_Array[stoId].tiers.call(0))[0].toNumber(), - BigNumber(15 * 10 ** 18).toNumber(), + (await I_USDTieredSTO_Array[stoId].tiers.call(0))[0].toString(), + new BN(15).mul(e18).toString(), "STO Configuration doesn't set as expected" ); assert.equal( - (await I_USDTieredSTO_Array[stoId].tiers.call(0))[1].toNumber(), - BigNumber(13 * 10 ** 18).toNumber(), + (await I_USDTieredSTO_Array[stoId].tiers.call(0))[1].toString(), + new BN(13).mul(e18).toString(), "STO Configuration doesn't set as expected" ); assert.equal( - (await I_USDTieredSTO_Array[stoId].tiers.call(0))[2], - BigNumber(15 * 10 ** 20).toNumber(), + (await I_USDTieredSTO_Array[stoId].tiers.call(0))[2].toString(), + new BN(1500).mul(e18).toString(), "STO Configuration doesn't set as expected" ); assert.equal( - (await I_USDTieredSTO_Array[stoId].tiers.call(0))[3], - BigNumber(15 * 10 ** 20).toNumber(), + (await I_USDTieredSTO_Array[stoId].tiers.call(0))[3].toString(), + new BN(1500).mul(e18).toString(), "STO Configuration doesn't set as expected" ); - let tempTime1 = latestTime() + duration.days(0.1); - let tempTime2 = latestTime() + duration.days(0.2); + let tempTime1 = new BN(currentTime).add(new BN(duration.days(0.1))); + let tempTime2 = new BN(currentTime).add(new BN(duration.days(0.2))); - await I_USDTieredSTO_Array[stoId].modifyTimes(tempTime1, tempTime2, { from: ISSUER }); - assert.equal(await I_USDTieredSTO_Array[stoId].startTime.call(), tempTime1, "STO Configuration doesn't set as expected"); - assert.equal(await I_USDTieredSTO_Array[stoId].endTime.call(), tempTime2, "STO Configuration doesn't set as expected"); + await I_USDTieredSTO_Array[stoId].modifyTimes(new BN(tempTime1), new BN(tempTime2), { from: ISSUER }); + assert.equal((await I_USDTieredSTO_Array[stoId].startTime.call()).toString(), tempTime1.toString(), "STO Configuration doesn't set as expected"); + assert.equal((await I_USDTieredSTO_Array[stoId].endTime.call()).toString(), tempTime2.toString(), "STO Configuration doesn't set as expected"); await I_USDTieredSTO_Array[stoId].modifyAddresses( "0x0000000000000000000000000400000000000000", @@ -949,11 +961,7 @@ contract("USDTieredSTO", accounts => { "0x0000000000000000000003000000000000000000", "STO Configuration doesn't set as expected" ); - assert.equal( - await I_USDTieredSTO_Array[stoId].usdToken.call(), - address_zero, - "STO Configuration doesn't set as expected" - ); + assert.equal(await I_USDTieredSTO_Array[stoId].usdToken.call(), address_zero, "STO Configuration doesn't set as expected"); }); it("Should fail to change config after endTime", async () => { @@ -964,22 +972,20 @@ contract("USDTieredSTO", accounts => { await catchRevert(I_USDTieredSTO_Array[stoId].modifyFunding([0, 1], { from: ISSUER })); - await catchRevert( - I_USDTieredSTO_Array[stoId].modifyLimits(new BigNumber(15 * 10 ** 18), BigNumber(1 * 10 ** 18), { from: ISSUER }) - ); + await catchRevert(I_USDTieredSTO_Array[stoId].modifyLimits(new BN(15).mul(e18), new BN(1).mul(e18), { from: ISSUER })); await catchRevert( I_USDTieredSTO_Array[stoId].modifyTiers( - [BigNumber(15 * 10 ** 18)], - [BigNumber(13 * 10 ** 18)], - [BigNumber(15 * 10 ** 20)], - [BigNumber(15 * 10 ** 20)], + [new BN(15).mul(e18)], + [new BN(13).mul(e18)], + [new BN(1500).mul(e18)], + [new BN(1500).mul(e18)], { from: ISSUER } ) ); - let tempTime1 = latestTime(); - let tempTime2 = latestTime() + duration.days(3); + let tempTime1 = await latestTime(); + let tempTime2 = await latestTime() + duration.days(3); await catchRevert(I_USDTieredSTO_Array[stoId].modifyTimes(tempTime1, tempTime2, { from: ISSUER })); @@ -1004,8 +1010,8 @@ contract("USDTieredSTO", accounts => { assert.equal(await I_USDTieredSTO_Array[stoId].isOpen(), false, "STO is not showing correct status"); // Whitelist - let fromTime = latestTime(); - let toTime = latestTime() + duration.days(15); + let fromTime = await latestTime(); + let toTime = await latestTime() + duration.days(15); let expiryTime = toTime + duration.days(100); let whitelisted = true; @@ -1019,13 +1025,13 @@ contract("USDTieredSTO", accounts => { await I_USDTieredSTO_Array[stoId].changeAccredited([ACCREDITED1], [true], { from: ISSUER }); // Prep for investments - let investment_ETH = web3.utils.toWei("1", "ether"); // Invest 1 ETH - let investment_POLY = web3.utils.toWei("10000", "ether"); // Invest 10000 POLY + let investment_ETH = new BN(web3.utils.toWei("1", "ether")); // Invest 1 ETH + let investment_POLY = new BN(web3.utils.toWei("10000", "ether")); // Invest 10000 POLY await I_PolyToken.getTokens(investment_POLY, NONACCREDITED1); await I_PolyToken.approve(I_USDTieredSTO_Array[stoId].address, investment_POLY, { from: NONACCREDITED1 }); await I_PolyToken.getTokens(investment_POLY, ACCREDITED1); await I_PolyToken.approve(I_USDTieredSTO_Array[stoId].address, investment_POLY, { from: ACCREDITED1 }); - let investment_DAI = web3.utils.toWei("500", "ether"); // Invest 10000 POLY + let investment_DAI = new BN(web3.utils.toWei("500", "ether")); // Invest 10000 POLY await I_DaiToken.getTokens(investment_DAI, NONACCREDITED1); await I_DaiToken.approve(I_USDTieredSTO_Array[stoId].address, investment_DAI, { from: NONACCREDITED1 }); await I_DaiToken.getTokens(investment_DAI, ACCREDITED1); @@ -1050,8 +1056,8 @@ contract("USDTieredSTO", accounts => { let snapId = await takeSnapshot(); // // Whitelist - // let fromTime = latestTime(); - // let toTime = latestTime() + duration.days(15); + // let fromTime = await latestTime(); + // let toTime = await latestTime() + duration.days(15); // let expiryTime = toTime + duration.days(100); // let whitelisted = true; // @@ -1065,13 +1071,13 @@ contract("USDTieredSTO", accounts => { await I_USDTieredSTO_Array[stoId].changeAccredited([ACCREDITED1], [true], { from: ISSUER }); // Prep for investments - let investment_ETH = web3.utils.toWei("1", "ether"); // Invest 1 ETH - let investment_POLY = web3.utils.toWei("10000", "ether"); // Invest 10000 POLY + let investment_ETH = new BN(web3.utils.toWei("1", "ether")); // Invest 1 ETH + let investment_POLY = new BN(web3.utils.toWei("10000", "ether")); // Invest 10000 POLY await I_PolyToken.getTokens(investment_POLY, NONACCREDITED1); await I_PolyToken.approve(I_USDTieredSTO_Array[stoId].address, investment_POLY, { from: NONACCREDITED1 }); await I_PolyToken.getTokens(investment_POLY, ACCREDITED1); await I_PolyToken.approve(I_USDTieredSTO_Array[stoId].address, investment_POLY, { from: ACCREDITED1 }); - let investment_DAI = web3.utils.toWei("500", "ether"); // Invest 10000 POLY + let investment_DAI = new BN(web3.utils.toWei("500", "ether")); // Invest 10000 POLY await I_DaiToken.getTokens(investment_DAI, NONACCREDITED1); await I_DaiToken.approve(I_USDTieredSTO_Array[stoId].address, investment_DAI, { from: NONACCREDITED1 }); await I_DaiToken.getTokens(investment_DAI, ACCREDITED1); @@ -1104,8 +1110,8 @@ contract("USDTieredSTO", accounts => { let snapId = await takeSnapshot(); // Whitelist - let fromTime = latestTime(); - let toTime = latestTime() + duration.days(15); + let fromTime = await latestTime(); + let toTime = await latestTime() + duration.days(15); let expiryTime = toTime + duration.days(100); let whitelisted = true; @@ -1118,7 +1124,7 @@ contract("USDTieredSTO", accounts => { // Set as accredited await I_USDTieredSTO_Array[stoId].changeAccredited([ACCREDITED1], [true], { from: ISSUER }); - let investment_USD = new BigNumber(2).mul(10 ** 18); + let investment_USD = new BN(2).mul(e18); let investment_ETH = await convert(stoId, tierId, false, "USD", "ETH", investment_USD); let investment_POLY = await convert(stoId, tierId, false, "USD", "POLY", investment_USD); let investment_DAI = investment_USD; @@ -1159,8 +1165,8 @@ contract("USDTieredSTO", accounts => { let snapId = await takeSnapshot(); // Whitelist - let fromTime = latestTime(); - let toTime = latestTime() + duration.days(15); + let fromTime = await latestTime(); + let toTime = await latestTime() + duration.days(15); let expiryTime = toTime + duration.days(100); let whitelisted = true; @@ -1178,14 +1184,14 @@ contract("USDTieredSTO", accounts => { assert.equal(await I_USDTieredSTO_Array[stoId].paused.call(), true, "STO did not pause successfully"); // Prep for investments - let investment_ETH = web3.utils.toWei("1", "ether"); // Invest 1 ETH - let investment_POLY = web3.utils.toWei("10000", "ether"); // Invest 10000 POLY + let investment_ETH = new BN(web3.utils.toWei("1", "ether")); // Invest 1 ETH + let investment_POLY = new BN(web3.utils.toWei("10000", "ether")); // Invest 10000 POLY await I_PolyToken.getTokens(investment_POLY, NONACCREDITED1); await I_PolyToken.approve(I_USDTieredSTO_Array[stoId].address, investment_POLY, { from: NONACCREDITED1 }); await I_PolyToken.getTokens(investment_POLY, ACCREDITED1); await I_PolyToken.approve(I_USDTieredSTO_Array[stoId].address, investment_POLY, { from: ACCREDITED1 }); - let investment_DAI = web3.utils.toWei("500", "ether"); // Invest 10000 POLY + let investment_DAI = new BN(web3.utils.toWei("500", "ether")); // Invest 10000 POLY await I_DaiToken.getTokens(investment_DAI, NONACCREDITED1); await I_DaiToken.approve(I_USDTieredSTO_Array[stoId].address, investment_DAI, { from: NONACCREDITED1 }); await I_DaiToken.getTokens(investment_DAI, ACCREDITED1); @@ -1229,8 +1235,8 @@ contract("USDTieredSTO", accounts => { let snapId = await takeSnapshot(); // Whitelist - let fromTime = latestTime(); - let toTime = latestTime() + duration.days(15); + let fromTime = await latestTime(); + let toTime = await latestTime() + duration.days(15); let expiryTime = toTime + duration.days(100); let whitelisted = true; @@ -1246,13 +1252,13 @@ contract("USDTieredSTO", accounts => { await I_USDTieredSTO_Array[stoId].changeAccredited([ACCREDITED1], [true], { from: ISSUER }); // Prep for investments - let investment_ETH = web3.utils.toWei("1", "ether"); // Invest 1 ETH - let investment_POLY = web3.utils.toWei("10000", "ether"); // Invest 10000 POLY + let investment_ETH = new BN(web3.utils.toWei("1", "ether")); // Invest 1 ETH + let investment_POLY = new BN(web3.utils.toWei("10000", "ether")); // Invest 10000 POLY await I_PolyToken.getTokens(investment_POLY, NONACCREDITED1); await I_PolyToken.approve(I_USDTieredSTO_Array[stoId].address, investment_POLY, { from: NONACCREDITED1 }); await I_PolyToken.getTokens(investment_POLY, ACCREDITED1); await I_PolyToken.approve(I_USDTieredSTO_Array[stoId].address, investment_POLY, { from: ACCREDITED1 }); - let investment_DAI = web3.utils.toWei("500", "ether"); // Invest 10000 POLY + let investment_DAI = new BN(web3.utils.toWei("500", "ether")); // Invest 10000 POLY await I_DaiToken.getTokens(investment_DAI, NONACCREDITED1); await I_DaiToken.approve(I_USDTieredSTO_Array[stoId].address, investment_DAI, { from: NONACCREDITED1 }); await I_DaiToken.getTokens(investment_DAI, ACCREDITED1); @@ -1284,8 +1290,8 @@ contract("USDTieredSTO", accounts => { let snapId = await takeSnapshot(); // Whitelist - let fromTime = latestTime(); - let toTime = latestTime(); + let fromTime = await latestTime(); + let toTime = await latestTime(); let expiryTime = toTime + duration.days(100); let whitelisted = true; @@ -1308,13 +1314,13 @@ contract("USDTieredSTO", accounts => { await catchRevert(I_USDTieredSTO_Array[stoId].finalize({ from: ISSUER })); // Prep for investments - let investment_ETH = web3.utils.toWei("1", "ether"); // Invest 1 ETH - let investment_POLY = web3.utils.toWei("10000", "ether"); // Invest 10000 POLY + let investment_ETH = new BN(web3.utils.toWei("1", "ether")); // Invest 1 ETH + let investment_POLY = new BN(web3.utils.toWei("10000", "ether")); // Invest 10000 POLY await I_PolyToken.getTokens(investment_POLY, NONACCREDITED1); await I_PolyToken.approve(I_USDTieredSTO_Array[stoId].address, investment_POLY, { from: NONACCREDITED1 }); await I_PolyToken.getTokens(investment_POLY, ACCREDITED1); await I_PolyToken.approve(I_USDTieredSTO_Array[stoId].address, investment_POLY, { from: ACCREDITED1 }); - let investment_DAI = web3.utils.toWei("500", "ether"); // Invest 10000 POLY + let investment_DAI = new BN(web3.utils.toWei("500", "ether")); // Invest 10000 POLY await I_DaiToken.getTokens(investment_DAI, NONACCREDITED1); await I_DaiToken.approve(I_USDTieredSTO_Array[stoId].address, investment_DAI, { from: NONACCREDITED1 }); await I_DaiToken.getTokens(investment_DAI, ACCREDITED1); @@ -1352,8 +1358,8 @@ contract("USDTieredSTO", accounts => { it("should whitelist ACCREDITED1 and NONACCREDITED1", async () => { let stoId = 0; - let fromTime = latestTime(); - let toTime = latestTime() + duration.days(15); + let fromTime = await latestTime(); + let toTime = await latestTime() + duration.days(15); let expiryTime = toTime + duration.days(100); let whitelisted = true; @@ -1402,23 +1408,23 @@ contract("USDTieredSTO", accounts => { let stoId = 0; let tierId = 0; - let investment_Token = new BigNumber(50).mul(10 ** 18); + let investment_Token = new BN(50).mul(e18); let investment_USD = await convert(stoId, tierId, false, "TOKEN", "USD", investment_Token); let investment_ETH = await convert(stoId, tierId, false, "TOKEN", "ETH", investment_Token); let investment_POLY = await convert(stoId, tierId, false, "TOKEN", "POLY", investment_Token); let init_TokenSupply = await I_SecurityToken.totalSupply(); let init_InvestorTokenBal = await I_SecurityToken.balanceOf(NONACCREDITED1); - let init_InvestorETHBal = new BigNumber(await web3.eth.getBalance(NONACCREDITED1)); + let init_InvestorETHBal = new BN(await web3.eth.getBalance(NONACCREDITED1)); let init_InvestorPOLYBal = await I_PolyToken.balanceOf(NONACCREDITED1); let init_STOTokenSold = await I_USDTieredSTO_Array[stoId].getTokensSold(); - let init_STOETHBal = new BigNumber(await web3.eth.getBalance(I_USDTieredSTO_Array[stoId].address)); + let init_STOETHBal = new BN(await web3.eth.getBalance(I_USDTieredSTO_Array[stoId].address)); let init_STOPOLYBal = await I_PolyToken.balanceOf(I_USDTieredSTO_Array[stoId].address); let init_RaisedUSD = await I_USDTieredSTO_Array[stoId].fundsRaisedUSD.call(); let init_RaisedETH = await I_USDTieredSTO_Array[stoId].fundsRaised.call(ETH); let init_RaisedPOLY = await I_USDTieredSTO_Array[stoId].fundsRaised.call(POLY); let init_RaisedDAI = await I_USDTieredSTO_Array[stoId].fundsRaised.call(DAI); - let init_WalletETHBal = new BigNumber(await web3.eth.getBalance(WALLET)); + let init_WalletETHBal = new BN(await web3.eth.getBalance(WALLET)); let init_WalletPOLYBal = await I_PolyToken.balanceOf(WALLET); let tx1 = await web3.eth.sendTransaction({ @@ -1426,101 +1432,101 @@ contract("USDTieredSTO", accounts => { to: I_USDTieredSTO_Array[stoId].address, value: investment_ETH, gasPrice: GAS_PRICE, - gas: 1000000 + gas: 7000000 }); - let gasCost1 = new BigNumber(GAS_PRICE).mul(tx1.gasUsed); - console.log(" Gas fallback purchase: ".grey + tx1.gasUsed.toString().grey); + let gasCost1 = new BN(GAS_PRICE).mul(new BN(tx1.gasUsed)); + console.log(" Gas fallback purchase: ".grey + new BN(tx1.gasUsed).toString().grey); let final_TokenSupply = await I_SecurityToken.totalSupply(); let final_InvestorTokenBal = await I_SecurityToken.balanceOf(NONACCREDITED1); - let final_InvestorETHBal = new BigNumber(await web3.eth.getBalance(NONACCREDITED1)); + let final_InvestorETHBal = new BN(await web3.eth.getBalance(NONACCREDITED1)); let final_InvestorPOLYBal = await I_PolyToken.balanceOf(NONACCREDITED1); let final_STOTokenSold = await I_USDTieredSTO_Array[stoId].getTokensSold(); - let final_STOETHBal = new BigNumber(await web3.eth.getBalance(I_USDTieredSTO_Array[stoId].address)); + let final_STOETHBal = new BN(await web3.eth.getBalance(I_USDTieredSTO_Array[stoId].address)); let final_STOPOLYBal = await I_PolyToken.balanceOf(I_USDTieredSTO_Array[stoId].address); let final_RaisedUSD = await I_USDTieredSTO_Array[stoId].fundsRaisedUSD.call(); let final_RaisedETH = await I_USDTieredSTO_Array[stoId].fundsRaised.call(ETH); let final_RaisedPOLY = await I_USDTieredSTO_Array[stoId].fundsRaised.call(POLY); let final_RaisedDAI = await I_USDTieredSTO_Array[stoId].fundsRaised.call(DAI); - let final_WalletETHBal = new BigNumber(await web3.eth.getBalance(WALLET)); + let final_WalletETHBal = new BN(await web3.eth.getBalance(WALLET)); let final_WalletPOLYBal = await I_PolyToken.balanceOf(WALLET); assert.equal( - final_TokenSupply.toNumber(), - init_TokenSupply.add(investment_Token).toNumber(), + final_TokenSupply.toString(), + init_TokenSupply.add(investment_Token).toString(), "Token Supply not changed as expected" ); assert.equal( - final_InvestorTokenBal.toNumber(), - init_InvestorTokenBal.add(investment_Token).toNumber(), + final_InvestorTokenBal.toString(), + init_InvestorTokenBal.add(investment_Token).toString(), "Investor Token Balance not changed as expected" ); assert.equal( - final_InvestorETHBal.toNumber(), + final_InvestorETHBal.toString(), init_InvestorETHBal .sub(gasCost1) .sub(investment_ETH) - .toNumber(), + .toString(), "Investor ETH Balance not changed as expected" ); assert.equal( - final_InvestorPOLYBal.toNumber(), - init_InvestorPOLYBal.toNumber(), + final_InvestorPOLYBal.toString(), + init_InvestorPOLYBal.toString(), "Investor POLY Balance not changed as expected" ); assert.equal( - final_STOTokenSold.toNumber(), - init_STOTokenSold.add(investment_Token).toNumber(), + final_STOTokenSold.toString(), + init_STOTokenSold.add(investment_Token).toString(), "STO Token Sold not changed as expected" ); - assert.equal(final_STOETHBal.toNumber(), init_STOETHBal.toNumber(), "STO ETH Balance not changed as expected"); - assert.equal(final_STOPOLYBal.toNumber(), init_STOPOLYBal.toNumber(), "STO POLY Balance not changed as expected"); - assert.equal(final_RaisedUSD.toNumber(), init_RaisedUSD.add(investment_USD).toNumber(), "Raised USD not changed as expected"); - assert.equal(final_RaisedETH.toNumber(), init_RaisedETH.add(investment_ETH).toNumber(), "Raised ETH not changed as expected"); - assert.equal(final_RaisedPOLY.toNumber(), init_RaisedPOLY.toNumber(), "Raised POLY not changed as expected"); - assert.equal(final_RaisedDAI.toNumber(), init_RaisedDAI.toNumber(), "Raised POLY not changed as expected"); + assert.equal(final_STOETHBal.toString(), init_STOETHBal.toString(), "STO ETH Balance not changed as expected"); + assert.equal(final_STOPOLYBal.toString(), init_STOPOLYBal.toString(), "STO POLY Balance not changed as expected"); + assert.equal(final_RaisedUSD.toString(), init_RaisedUSD.add(investment_USD).toString(), "Raised USD not changed as expected"); + assert.equal(final_RaisedETH.toString(), init_RaisedETH.add(investment_ETH).toString(), "Raised ETH not changed as expected"); + assert.equal(final_RaisedPOLY.toString(), init_RaisedPOLY.toString(), "Raised POLY not changed as expected"); + assert.equal(final_RaisedDAI.toString(), init_RaisedDAI.toString(), "Raised POLY not changed as expected"); assert.equal( - final_WalletETHBal.toNumber(), - init_WalletETHBal.add(investment_ETH).toNumber(), + final_WalletETHBal.toString(), + init_WalletETHBal.add(investment_ETH).toString(), "Wallet ETH Balance not changed as expected" ); - assert.equal(final_WalletPOLYBal.toNumber(), init_WalletPOLYBal.toNumber(), "Wallet POLY Balance not changed as expected"); + assert.equal(final_WalletPOLYBal.toString(), init_WalletPOLYBal.toString(), "Wallet POLY Balance not changed as expected"); // Additional checks on getters - assert.equal((await I_USDTieredSTO_Array[stoId].investorCount.call()).toNumber(), 1, "Investor count not changed as expected"); + assert.equal((await I_USDTieredSTO_Array[stoId].investorCount.call()).toString(), 1, "Investor count not changed as expected"); assert.equal( - (await I_USDTieredSTO_Array[stoId].getTokensSold()).toNumber(), - investment_Token.toNumber(), + (await I_USDTieredSTO_Array[stoId].getTokensSold()).toString(), + investment_Token.toString(), "getTokensSold not changed as expected" ); assert.equal( - (await I_USDTieredSTO_Array[stoId].getTokensMinted()).toNumber(), - investment_Token.toNumber(), + (await I_USDTieredSTO_Array[stoId].getTokensMinted()).toString(), + investment_Token.toString(), "getTokensMinted not changed as expected" ); assert.equal( - (await I_USDTieredSTO_Array[stoId].getTokensSoldFor(ETH)).toNumber(), - investment_Token.toNumber(), + (await I_USDTieredSTO_Array[stoId].getTokensSoldFor(ETH)).toString(), + investment_Token.toString(), "getTokensSoldForETH not changed as expected" ); assert.equal( - (await I_USDTieredSTO_Array[stoId].getTokensSoldFor(POLY)).toNumber(), - 0, + (await I_USDTieredSTO_Array[stoId].getTokensSoldFor(POLY)).toString(), + new BN(0), "getTokensSoldForPOLY not changed as expected" ); assert.equal( - (await I_USDTieredSTO_Array[stoId].investorInvestedUSD.call(NONACCREDITED1)).toNumber(), - investment_USD.toNumber(), + (await I_USDTieredSTO_Array[stoId].investorInvestedUSD.call(NONACCREDITED1)).toString(), + investment_USD.toString(), "investorInvestedUSD not changed as expected" ); assert.equal( - (await I_USDTieredSTO_Array[stoId].investorInvested.call(NONACCREDITED1, ETH)).toNumber(), - investment_ETH.toNumber(), + (await I_USDTieredSTO_Array[stoId].investorInvested.call(NONACCREDITED1, ETH)).toString(), + investment_ETH.toString(), "investorInvestedETH not changed as expected" ); assert.equal( - (await I_USDTieredSTO_Array[stoId].investorInvested.call(NONACCREDITED1, POLY)).toNumber(), - 0, + (await I_USDTieredSTO_Array[stoId].investorInvested.call(NONACCREDITED1, POLY)).toString(), + new BN(0), "investorInvestedPOLY not changed as expected" ); }); @@ -1529,22 +1535,22 @@ contract("USDTieredSTO", accounts => { let stoId = 0; let tierId = 0; - let investment_Token = new BigNumber(50).mul(10 ** 18); + let investment_Token = new BN(50).mul(e18); let investment_USD = await convert(stoId, tierId, false, "TOKEN", "USD", investment_Token); let investment_ETH = await convert(stoId, tierId, false, "TOKEN", "ETH", investment_Token); let investment_POLY = await convert(stoId, tierId, false, "TOKEN", "POLY", investment_Token); let init_TokenSupply = await I_SecurityToken.totalSupply(); let init_InvestorTokenBal = await I_SecurityToken.balanceOf(NONACCREDITED1); - let init_InvestorETHBal = new BigNumber(await web3.eth.getBalance(NONACCREDITED1)); + let init_InvestorETHBal = new BN(await web3.eth.getBalance(NONACCREDITED1)); let init_InvestorPOLYBal = await I_PolyToken.balanceOf(NONACCREDITED1); let init_STOTokenSold = await I_USDTieredSTO_Array[stoId].getTokensSold(); - let init_STOETHBal = new BigNumber(await web3.eth.getBalance(I_USDTieredSTO_Array[stoId].address)); + let init_STOETHBal = new BN(await web3.eth.getBalance(I_USDTieredSTO_Array[stoId].address)); let init_STOPOLYBal = await I_PolyToken.balanceOf(I_USDTieredSTO_Array[stoId].address); let init_RaisedETH = await I_USDTieredSTO_Array[stoId].fundsRaised.call(ETH); let init_RaisedPOLY = await I_USDTieredSTO_Array[stoId].fundsRaised.call(POLY); let init_RaisedDAI = await I_USDTieredSTO_Array[stoId].fundsRaised.call(DAI); - let init_WalletETHBal = new BigNumber(await web3.eth.getBalance(WALLET)); + let init_WalletETHBal = new BN(await web3.eth.getBalance(WALLET)); let init_WalletPOLYBal = await I_PolyToken.balanceOf(WALLET); let tx1 = await I_USDTieredSTO_Array[stoId].buyWithETH(NONACCREDITED1, { @@ -1552,68 +1558,68 @@ contract("USDTieredSTO", accounts => { value: investment_ETH, gasPrice: GAS_PRICE }); - let gasCost1 = new BigNumber(GAS_PRICE).mul(tx1.receipt.gasUsed); - console.log(" Gas buyWithETH: ".grey + tx1.receipt.gasUsed.toString().grey); + let gasCost1 = new BN(GAS_PRICE).mul(new BN(tx1.receipt.gasUsed)); + console.log(" Gas buyWithETH: ".grey + new BN(tx1.receipt.gasUsed).toString().grey); let final_TokenSupply = await I_SecurityToken.totalSupply(); let final_InvestorTokenBal = await I_SecurityToken.balanceOf(NONACCREDITED1); - let final_InvestorETHBal = new BigNumber(await web3.eth.getBalance(NONACCREDITED1)); + let final_InvestorETHBal = new BN(await web3.eth.getBalance(NONACCREDITED1)); let final_InvestorPOLYBal = await I_PolyToken.balanceOf(NONACCREDITED1); let final_STOTokenSold = await I_USDTieredSTO_Array[stoId].getTokensSold(); - let final_STOETHBal = new BigNumber(await web3.eth.getBalance(I_USDTieredSTO_Array[stoId].address)); + let final_STOETHBal = new BN(await web3.eth.getBalance(I_USDTieredSTO_Array[stoId].address)); let final_STOPOLYBal = await I_PolyToken.balanceOf(I_USDTieredSTO_Array[stoId].address); let final_RaisedETH = await I_USDTieredSTO_Array[stoId].fundsRaised.call(ETH); let final_RaisedPOLY = await I_USDTieredSTO_Array[stoId].fundsRaised.call(POLY); let final_RaisedDAI = await I_USDTieredSTO_Array[stoId].fundsRaised.call(DAI); - let final_WalletETHBal = new BigNumber(await web3.eth.getBalance(WALLET)); + let final_WalletETHBal = new BN(await web3.eth.getBalance(WALLET)); let final_WalletPOLYBal = await I_PolyToken.balanceOf(WALLET); assert.equal( - final_TokenSupply.toNumber(), - init_TokenSupply.add(investment_Token).toNumber(), + final_TokenSupply.toString(), + init_TokenSupply.add(investment_Token).toString(), "Token Supply not changed as expected" ); assert.equal( - final_InvestorTokenBal.toNumber(), - init_InvestorTokenBal.add(investment_Token).toNumber(), + final_InvestorTokenBal.toString(), + init_InvestorTokenBal.add(investment_Token).toString(), "Investor Token Balance not changed as expected" ); assert.equal( - final_InvestorETHBal.toNumber(), + final_InvestorETHBal.toString(), init_InvestorETHBal .sub(gasCost1) .sub(investment_ETH) - .toNumber(), + .toString(), "Investor ETH Balance not changed as expected" ); assert.equal( - final_InvestorPOLYBal.toNumber(), - init_InvestorPOLYBal.toNumber(), + final_InvestorPOLYBal.toString(), + init_InvestorPOLYBal.toString(), "Investor POLY Balance not changed as expected" ); assert.equal( - final_STOTokenSold.toNumber(), - init_STOTokenSold.add(investment_Token).toNumber(), + final_STOTokenSold.toString(), + init_STOTokenSold.add(investment_Token).toString(), "STO Token Sold not changed as expected" ); - assert.equal(final_STOETHBal.toNumber(), init_STOETHBal.toNumber(), "STO ETH Balance not changed as expected"); - assert.equal(final_STOPOLYBal.toNumber(), init_STOPOLYBal.toNumber(), "STO POLY Balance not changed as expected"); - assert.equal(final_RaisedETH.toNumber(), init_RaisedETH.add(investment_ETH).toNumber(), "Raised ETH not changed as expected"); - assert.equal(final_RaisedPOLY.toNumber(), init_RaisedPOLY.toNumber(), "Raised POLY not changed as expected"); - assert.equal(final_RaisedDAI.toNumber(), init_RaisedDAI.toNumber(), "Raised DAI not changed as expected"); + assert.equal(final_STOETHBal.toString(), init_STOETHBal.toString(), "STO ETH Balance not changed as expected"); + assert.equal(final_STOPOLYBal.toString(), init_STOPOLYBal.toString(), "STO POLY Balance not changed as expected"); + assert.equal(final_RaisedETH.toString(), init_RaisedETH.add(investment_ETH).toString(), "Raised ETH not changed as expected"); + assert.equal(final_RaisedPOLY.toString(), init_RaisedPOLY.toString(), "Raised POLY not changed as expected"); + assert.equal(final_RaisedDAI.toString(), init_RaisedDAI.toString(), "Raised DAI not changed as expected"); assert.equal( - final_WalletETHBal.toNumber(), - init_WalletETHBal.add(investment_ETH).toNumber(), + final_WalletETHBal.toString(), + init_WalletETHBal.add(investment_ETH).toString(), "Wallet ETH Balance not changed as expected" ); - assert.equal(final_WalletPOLYBal.toNumber(), init_WalletPOLYBal.toNumber(), "Wallet POLY Balance not changed as expected"); + assert.equal(final_WalletPOLYBal.toString(), init_WalletPOLYBal.toString(), "Wallet POLY Balance not changed as expected"); }); it("should successfully buy using buyWithPOLY at tier 0 for NONACCREDITED1", async () => { let stoId = 0; let tierId = 0; - let investment_Token = new BigNumber(50).mul(10 ** 18); + let investment_Token = new BN(50).mul(e18); let investment_USD = await convert(stoId, tierId, false, "TOKEN", "USD", investment_Token); let investment_ETH = await convert(stoId, tierId, false, "TOKEN", "ETH", investment_Token); let investment_POLY = await convert(stoId, tierId, false, "TOKEN", "POLY", investment_Token); @@ -1623,15 +1629,15 @@ contract("USDTieredSTO", accounts => { let init_TokenSupply = await I_SecurityToken.totalSupply(); let init_InvestorTokenBal = await I_SecurityToken.balanceOf(NONACCREDITED1); - let init_InvestorETHBal = new BigNumber(await web3.eth.getBalance(NONACCREDITED1)); + let init_InvestorETHBal = new BN(await web3.eth.getBalance(NONACCREDITED1)); let init_InvestorPOLYBal = await I_PolyToken.balanceOf(NONACCREDITED1); let init_STOTokenSold = await I_USDTieredSTO_Array[stoId].getTokensSold(); - let init_STOETHBal = new BigNumber(await web3.eth.getBalance(I_USDTieredSTO_Array[stoId].address)); + let init_STOETHBal = new BN(await web3.eth.getBalance(I_USDTieredSTO_Array[stoId].address)); let init_STOPOLYBal = await I_PolyToken.balanceOf(I_USDTieredSTO_Array[stoId].address); let init_RaisedETH = await I_USDTieredSTO_Array[stoId].fundsRaised.call(ETH); let init_RaisedPOLY = await I_USDTieredSTO_Array[stoId].fundsRaised.call(POLY); let init_RaisedDAI = await I_USDTieredSTO_Array[stoId].fundsRaised.call(DAI); - let init_WalletETHBal = new BigNumber(await web3.eth.getBalance(WALLET)); + let init_WalletETHBal = new BN(await web3.eth.getBalance(WALLET)); let init_WalletPOLYBal = await I_PolyToken.balanceOf(WALLET); // Buy With POLY @@ -1639,60 +1645,60 @@ contract("USDTieredSTO", accounts => { from: NONACCREDITED1, gasPrice: GAS_PRICE }); - let gasCost2 = new BigNumber(GAS_PRICE).mul(tx2.receipt.gasUsed); - console.log(" Gas buyWithPOLY: ".grey + tx2.receipt.gasUsed.toString().grey); + let gasCost2 = new BN(GAS_PRICE).mul(new BN(tx2.receipt.gasUsed)); + console.log(" Gas buyWithPOLY: ".grey + new BN(tx2.receipt.gasUsed).toString().grey); let final_TokenSupply = await I_SecurityToken.totalSupply(); let final_InvestorTokenBal = await I_SecurityToken.balanceOf(NONACCREDITED1); - let final_InvestorETHBal = new BigNumber(await web3.eth.getBalance(NONACCREDITED1)); + let final_InvestorETHBal = new BN(await web3.eth.getBalance(NONACCREDITED1)); let final_InvestorPOLYBal = await I_PolyToken.balanceOf(NONACCREDITED1); let final_STOTokenSold = await I_USDTieredSTO_Array[stoId].getTokensSold(); - let final_STOETHBal = new BigNumber(await web3.eth.getBalance(I_USDTieredSTO_Array[stoId].address)); + let final_STOETHBal = new BN(await web3.eth.getBalance(I_USDTieredSTO_Array[stoId].address)); let final_STOPOLYBal = await I_PolyToken.balanceOf(I_USDTieredSTO_Array[stoId].address); let final_RaisedETH = await I_USDTieredSTO_Array[stoId].fundsRaised.call(ETH); let final_RaisedPOLY = await I_USDTieredSTO_Array[stoId].fundsRaised.call(POLY); let final_RaisedDAI = await I_USDTieredSTO_Array[stoId].fundsRaised.call(DAI); - let final_WalletETHBal = new BigNumber(await web3.eth.getBalance(WALLET)); + let final_WalletETHBal = new BN(await web3.eth.getBalance(WALLET)); let final_WalletPOLYBal = await I_PolyToken.balanceOf(WALLET); assert.equal( - final_TokenSupply.toNumber(), - init_TokenSupply.add(investment_Token).toNumber(), + final_TokenSupply.toString(), + init_TokenSupply.add(investment_Token).toString(), "Token Supply not changed as expected" ); assert.equal( - final_InvestorTokenBal.toNumber(), - init_InvestorTokenBal.add(investment_Token).toNumber(), + final_InvestorTokenBal.toString(), + init_InvestorTokenBal.add(investment_Token).toString(), "Investor Token Balance not changed as expected" ); assert.equal( - final_InvestorETHBal.toNumber(), - init_InvestorETHBal.sub(gasCost2).toNumber(), + final_InvestorETHBal.toString(), + init_InvestorETHBal.sub(gasCost2).toString(), "Investor ETH Balance not changed as expected" ); assert.equal( - final_InvestorPOLYBal.toNumber(), - init_InvestorPOLYBal.sub(investment_POLY).toNumber(), + final_InvestorPOLYBal.toString(), + init_InvestorPOLYBal.sub(investment_POLY).toString(), "Investor POLY Balance not changed as expected" ); assert.equal( - final_STOTokenSold.toNumber(), - init_STOTokenSold.add(investment_Token).toNumber(), + final_STOTokenSold.toString(), + init_STOTokenSold.add(investment_Token).toString(), "STO Token Sold not changed as expected" ); - assert.equal(final_STOETHBal.toNumber(), init_STOETHBal.toNumber(), "STO ETH Balance not changed as expected"); - assert.equal(final_STOPOLYBal.toNumber(), init_STOPOLYBal.toNumber(), "STO POLY Balance not changed as expected"); - assert.equal(final_RaisedETH.toNumber(), init_RaisedETH.toNumber(), "Raised ETH not changed as expected"); + assert.equal(final_STOETHBal.toString(), init_STOETHBal.toString(), "STO ETH Balance not changed as expected"); + assert.equal(final_STOPOLYBal.toString(), init_STOPOLYBal.toString(), "STO POLY Balance not changed as expected"); + assert.equal(final_RaisedETH.toString(), init_RaisedETH.toString(), "Raised ETH not changed as expected"); assert.equal( - final_RaisedPOLY.toNumber(), - init_RaisedPOLY.add(investment_POLY).toNumber(), + final_RaisedPOLY.toString(), + init_RaisedPOLY.add(investment_POLY).toString(), "Raised POLY not changed as expected" ); - assert.equal(final_RaisedDAI.toNumber(), init_RaisedDAI.toNumber(), "Raised POLY not changed as expected"); - assert.equal(final_WalletETHBal.toNumber(), init_WalletETHBal.toNumber(), "Wallet ETH Balance not changed as expected"); + assert.equal(final_RaisedDAI.toString(), init_RaisedDAI.toString(), "Raised POLY not changed as expected"); + assert.equal(final_WalletETHBal.toString(), init_WalletETHBal.toString(), "Wallet ETH Balance not changed as expected"); assert.equal( - final_WalletPOLYBal.toNumber(), - init_WalletPOLYBal.add(investment_POLY).toNumber(), + final_WalletPOLYBal.toString(), + init_WalletPOLYBal.add(investment_POLY).toString(), "Wallet POLY Balance not changed as expected" ); }); @@ -1701,7 +1707,7 @@ contract("USDTieredSTO", accounts => { let stoId = 0; let tierId = 0; - let investment_Token = new BigNumber(50).mul(10 ** 18); + let investment_Token = new BN(50).mul(e18); let investment_USD = await convert(stoId, tierId, false, "TOKEN", "USD", investment_Token); let investment_ETH = await convert(stoId, tierId, false, "TOKEN", "ETH", investment_Token); let investment_POLY = await convert(stoId, tierId, false, "TOKEN", "POLY", investment_Token); @@ -1712,16 +1718,16 @@ contract("USDTieredSTO", accounts => { let init_TokenSupply = await I_SecurityToken.totalSupply(); let init_InvestorTokenBal = await I_SecurityToken.balanceOf(NONACCREDITED1); - let init_InvestorETHBal = new BigNumber(await web3.eth.getBalance(NONACCREDITED1)); + let init_InvestorETHBal = new BN(await web3.eth.getBalance(NONACCREDITED1)); let init_InvestorPOLYBal = await I_PolyToken.balanceOf(NONACCREDITED1); let init_InvestorDAIBal = await I_DaiToken.balanceOf(NONACCREDITED1); let init_STOTokenSold = await I_USDTieredSTO_Array[stoId].getTokensSold(); - let init_STOETHBal = new BigNumber(await web3.eth.getBalance(I_USDTieredSTO_Array[stoId].address)); + let init_STOETHBal = new BN(await web3.eth.getBalance(I_USDTieredSTO_Array[stoId].address)); let init_STOPOLYBal = await I_PolyToken.balanceOf(I_USDTieredSTO_Array[stoId].address); let init_RaisedETH = await I_USDTieredSTO_Array[stoId].fundsRaised.call(ETH); let init_RaisedPOLY = await I_USDTieredSTO_Array[stoId].fundsRaised.call(POLY); let init_RaisedDAI = await I_USDTieredSTO_Array[stoId].fundsRaised.call(DAI); - let init_WalletETHBal = new BigNumber(await web3.eth.getBalance(WALLET)); + let init_WalletETHBal = new BN(await web3.eth.getBalance(WALLET)); let init_WalletPOLYBal = await I_PolyToken.balanceOf(WALLET); let init_WalletDAIBal = await I_DaiToken.balanceOf(WALLET); @@ -1730,64 +1736,64 @@ contract("USDTieredSTO", accounts => { from: NONACCREDITED1, gasPrice: GAS_PRICE }); - let gasCost2 = new BigNumber(GAS_PRICE).mul(tx2.receipt.gasUsed); - console.log(" Gas buyWithUSD: ".grey + tx2.receipt.gasUsed.toString().grey); + let gasCost2 = new BN(GAS_PRICE).mul(new BN(tx2.receipt.gasUsed)); + console.log(" Gas buyWithUSD: ".grey + new BN(tx2.receipt.gasUsed).toString().grey); let final_TokenSupply = await I_SecurityToken.totalSupply(); let final_InvestorTokenBal = await I_SecurityToken.balanceOf(NONACCREDITED1); - let final_InvestorETHBal = new BigNumber(await web3.eth.getBalance(NONACCREDITED1)); + let final_InvestorETHBal = new BN(await web3.eth.getBalance(NONACCREDITED1)); let final_InvestorPOLYBal = await I_PolyToken.balanceOf(NONACCREDITED1); let final_InvestorDAIBal = await I_DaiToken.balanceOf(NONACCREDITED1); let final_STOTokenSold = await I_USDTieredSTO_Array[stoId].getTokensSold(); - let final_STOETHBal = new BigNumber(await web3.eth.getBalance(I_USDTieredSTO_Array[stoId].address)); + let final_STOETHBal = new BN(await web3.eth.getBalance(I_USDTieredSTO_Array[stoId].address)); let final_STOPOLYBal = await I_PolyToken.balanceOf(I_USDTieredSTO_Array[stoId].address); let final_RaisedETH = await I_USDTieredSTO_Array[stoId].fundsRaised.call(ETH); let final_RaisedPOLY = await I_USDTieredSTO_Array[stoId].fundsRaised.call(POLY); let final_RaisedDAI = await I_USDTieredSTO_Array[stoId].fundsRaised.call(DAI); - let final_WalletETHBal = new BigNumber(await web3.eth.getBalance(WALLET)); + let final_WalletETHBal = new BN(await web3.eth.getBalance(WALLET)); let final_WalletPOLYBal = await I_PolyToken.balanceOf(WALLET); let final_WalletDAIBal = await I_DaiToken.balanceOf(WALLET); assert.equal( - final_TokenSupply.toNumber(), - init_TokenSupply.add(investment_Token).toNumber(), + final_TokenSupply.toString(), + init_TokenSupply.add(investment_Token).toString(), "Token Supply not changed as expected" ); assert.equal( - final_InvestorTokenBal.toNumber(), - init_InvestorTokenBal.add(investment_Token).toNumber(), + final_InvestorTokenBal.toString(), + init_InvestorTokenBal.add(investment_Token).toString(), "Investor Token Balance not changed as expected" ); assert.equal( - final_InvestorETHBal.toNumber(), - init_InvestorETHBal.sub(gasCost2).toNumber(), + final_InvestorETHBal.toString(), + init_InvestorETHBal.sub(gasCost2).toString(), "Investor ETH Balance not changed as expected" ); assert.equal( - final_InvestorPOLYBal.toNumber(), - init_InvestorPOLYBal.toNumber(), + final_InvestorPOLYBal.toString(), + init_InvestorPOLYBal.toString(), "Investor POLY Balance not changed as expected" ); assert.equal( - final_InvestorDAIBal.toNumber(), - init_InvestorDAIBal.sub(investment_DAI).toNumber(), + final_InvestorDAIBal.toString(), + init_InvestorDAIBal.sub(investment_DAI).toString(), "Investor DAI Balance not changed as expected" ); assert.equal( - final_STOTokenSold.toNumber(), - init_STOTokenSold.add(investment_Token).toNumber(), + final_STOTokenSold.toString(), + init_STOTokenSold.add(investment_Token).toString(), "STO Token Sold not changed as expected" ); - assert.equal(final_STOETHBal.toNumber(), init_STOETHBal.toNumber(), "STO ETH Balance not changed as expected"); - assert.equal(final_STOPOLYBal.toNumber(), init_STOPOLYBal.toNumber(), "STO POLY Balance not changed as expected"); - assert.equal(final_RaisedETH.toNumber(), init_RaisedETH.toNumber(), "Raised ETH not changed as expected"); - assert.equal(final_RaisedPOLY.toNumber(), init_RaisedPOLY.toNumber(), "Raised POLY not changed as expected"); - assert.equal(final_RaisedDAI.toNumber(), init_RaisedDAI.add(investment_DAI).toNumber(), "Raised POLY not changed as expected"); - assert.equal(final_WalletETHBal.toNumber(), init_WalletETHBal.toNumber(), "Wallet ETH Balance not changed as expected"); - assert.equal(final_WalletPOLYBal.toNumber(), init_WalletPOLYBal.toNumber(), "Wallet POLY Balance not changed as expected"); + assert.equal(final_STOETHBal.toString(), init_STOETHBal.toString(), "STO ETH Balance not changed as expected"); + assert.equal(final_STOPOLYBal.toString(), init_STOPOLYBal.toString(), "STO POLY Balance not changed as expected"); + assert.equal(final_RaisedETH.toString(), init_RaisedETH.toString(), "Raised ETH not changed as expected"); + assert.equal(final_RaisedPOLY.toString(), init_RaisedPOLY.toString(), "Raised POLY not changed as expected"); + assert.equal(final_RaisedDAI.toString(), init_RaisedDAI.add(investment_DAI).toString(), "Raised POLY not changed as expected"); + assert.equal(final_WalletETHBal.toString(), init_WalletETHBal.toString(), "Wallet ETH Balance not changed as expected"); + assert.equal(final_WalletPOLYBal.toString(), init_WalletPOLYBal.toString(), "Wallet POLY Balance not changed as expected"); assert.equal( - final_WalletDAIBal.toNumber(), - init_WalletDAIBal.add(investment_DAI).toNumber(), + final_WalletDAIBal.toString(), + init_WalletDAIBal.add(investment_DAI).toString(), "Wallet DAI Balance not changed as expected" ); }); @@ -1798,21 +1804,21 @@ contract("USDTieredSTO", accounts => { await I_USDTieredSTO_Array[stoId].changeAccredited([ACCREDITED1], [true], { from: ISSUER }); - let investment_Token = new BigNumber(50).mul(10 ** 18); + let investment_Token = new BN(50).mul(e18); let investment_USD = await convert(stoId, tierId, false, "TOKEN", "USD", investment_Token); let investment_ETH = await convert(stoId, tierId, false, "TOKEN", "ETH", investment_Token); let investment_POLY = await convert(stoId, tierId, false, "TOKEN", "POLY", investment_Token); let init_TokenSupply = await I_SecurityToken.totalSupply(); let init_InvestorTokenBal = await I_SecurityToken.balanceOf(ACCREDITED1); - let init_InvestorETHBal = new BigNumber(await web3.eth.getBalance(ACCREDITED1)); + let init_InvestorETHBal = new BN(await web3.eth.getBalance(ACCREDITED1)); let init_InvestorPOLYBal = await I_PolyToken.balanceOf(ACCREDITED1); let init_STOTokenSold = await I_USDTieredSTO_Array[stoId].getTokensSold(); - let init_STOETHBal = new BigNumber(await web3.eth.getBalance(I_USDTieredSTO_Array[stoId].address)); + let init_STOETHBal = new BN(await web3.eth.getBalance(I_USDTieredSTO_Array[stoId].address)); let init_STOPOLYBal = await I_PolyToken.balanceOf(I_USDTieredSTO_Array[stoId].address); let init_RaisedETH = await I_USDTieredSTO_Array[stoId].fundsRaised.call(ETH); let init_RaisedPOLY = await I_USDTieredSTO_Array[stoId].fundsRaised.call(POLY); - let init_WalletETHBal = new BigNumber(await web3.eth.getBalance(WALLET)); + let init_WalletETHBal = new BN(await web3.eth.getBalance(WALLET)); let init_WalletPOLYBal = await I_PolyToken.balanceOf(WALLET); let tx1 = await web3.eth.sendTransaction({ @@ -1820,82 +1826,82 @@ contract("USDTieredSTO", accounts => { to: I_USDTieredSTO_Array[stoId].address, value: investment_ETH, gasPrice: GAS_PRICE, - gas: 1000000 + gas: 7000000 }); - let gasCost1 = new BigNumber(GAS_PRICE).mul(tx1.gasUsed); - console.log(" Gas fallback purchase: ".grey + tx1.gasUsed.toString().grey); + let gasCost1 = new BN(GAS_PRICE).mul(new BN(tx1.gasUsed)); + console.log(" Gas fallback purchase: ".grey + new BN(tx1.gasUsed).toString().grey); let final_TokenSupply = await I_SecurityToken.totalSupply(); let final_InvestorTokenBal = await I_SecurityToken.balanceOf(ACCREDITED1); - let final_InvestorETHBal = new BigNumber(await web3.eth.getBalance(ACCREDITED1)); + let final_InvestorETHBal = new BN(await web3.eth.getBalance(ACCREDITED1)); let final_InvestorPOLYBal = await I_PolyToken.balanceOf(ACCREDITED1); let final_STOTokenSold = await I_USDTieredSTO_Array[stoId].getTokensSold(); - let final_STOETHBal = new BigNumber(await web3.eth.getBalance(I_USDTieredSTO_Array[stoId].address)); + let final_STOETHBal = new BN(await web3.eth.getBalance(I_USDTieredSTO_Array[stoId].address)); let final_STOPOLYBal = await I_PolyToken.balanceOf(I_USDTieredSTO_Array[stoId].address); let final_RaisedETH = await I_USDTieredSTO_Array[stoId].fundsRaised.call(ETH); let final_RaisedPOLY = await I_USDTieredSTO_Array[stoId].fundsRaised.call(POLY); - let final_WalletETHBal = new BigNumber(await web3.eth.getBalance(WALLET)); + let final_WalletETHBal = new BN(await web3.eth.getBalance(WALLET)); let final_WalletPOLYBal = await I_PolyToken.balanceOf(WALLET); assert.equal( - final_TokenSupply.toNumber(), - init_TokenSupply.add(investment_Token).toNumber(), + final_TokenSupply.toString(), + init_TokenSupply.add(investment_Token).toString(), "Token Supply not changed as expected" ); assert.equal( - final_InvestorTokenBal.toNumber(), - init_InvestorTokenBal.add(investment_Token).toNumber(), + final_InvestorTokenBal.toString(), + init_InvestorTokenBal.add(investment_Token).toString(), "Investor Token Balance not changed as expected" ); assert.equal( - final_InvestorETHBal.toNumber(), + final_InvestorETHBal.toString(), init_InvestorETHBal .sub(gasCost1) .sub(investment_ETH) - .toNumber(), + .toString(), "Investor ETH Balance not changed as expected" ); assert.equal( - final_InvestorPOLYBal.toNumber(), - init_InvestorPOLYBal.toNumber(), + final_InvestorPOLYBal.toString(), + init_InvestorPOLYBal.toString(), "Investor POLY Balance not changed as expected" ); assert.equal( - final_STOTokenSold.toNumber(), - init_STOTokenSold.add(investment_Token).toNumber(), + final_STOTokenSold.toString(), + init_STOTokenSold.add(investment_Token).toString(), "STO Token Sold not changed as expected" ); - assert.equal(final_STOETHBal.toNumber(), init_STOETHBal.toNumber(), "STO ETH Balance not changed as expected"); - assert.equal(final_STOPOLYBal.toNumber(), init_STOPOLYBal.toNumber(), "STO POLY Balance not changed as expected"); - assert.equal(final_RaisedETH.toNumber(), init_RaisedETH.add(investment_ETH).toNumber(), "Raised ETH not changed as expected"); - assert.equal(final_RaisedPOLY.toNumber(), init_RaisedPOLY.toNumber(), "Raised POLY not changed as expected"); + assert.equal(final_STOETHBal.toString(), init_STOETHBal.toString(), "STO ETH Balance not changed as expected"); + assert.equal(final_STOPOLYBal.toString(), init_STOPOLYBal.toString(), "STO POLY Balance not changed as expected"); + assert.equal(final_RaisedETH.toString(), init_RaisedETH.add(investment_ETH).toString(), "Raised ETH not changed as expected"); + assert.equal(final_RaisedPOLY.toString(), init_RaisedPOLY.toString(), "Raised POLY not changed as expected"); assert.equal( - final_WalletETHBal.toNumber(), - init_WalletETHBal.add(investment_ETH).toNumber(), + final_WalletETHBal.toString(), + init_WalletETHBal.add(investment_ETH).toString(), "Wallet ETH Balance not changed as expected" ); - assert.equal(final_WalletPOLYBal.toNumber(), init_WalletPOLYBal.toNumber(), "Wallet POLY Balance not changed as expected"); + assert.equal(final_WalletPOLYBal.toString(), init_WalletPOLYBal.toString(), "Wallet POLY Balance not changed as expected"); }); it("should successfully buy using buyWithETH at tier 0 for ACCREDITED1", async () => { let stoId = 0; let tierId = 0; - let investment_Token = new BigNumber(50).mul(10 ** 18); + let investment_Token = new BN(50).mul(e18); let investment_USD = await convert(stoId, tierId, false, "TOKEN", "USD", investment_Token); let investment_ETH = await convert(stoId, tierId, false, "TOKEN", "ETH", investment_Token); let investment_POLY = await convert(stoId, tierId, false, "TOKEN", "POLY", investment_Token); let init_TokenSupply = await I_SecurityToken.totalSupply(); let init_InvestorTokenBal = await I_SecurityToken.balanceOf(ACCREDITED1); - let init_InvestorETHBal = new BigNumber(await web3.eth.getBalance(ACCREDITED1)); + let init_InvestorETHBal = new BN(await web3.eth.getBalance(ACCREDITED1)); let init_InvestorPOLYBal = await I_PolyToken.balanceOf(ACCREDITED1); let init_STOTokenSold = await I_USDTieredSTO_Array[stoId].getTokensSold(); - let init_STOETHBal = new BigNumber(await web3.eth.getBalance(I_USDTieredSTO_Array[stoId].address)); + let init_STOETHBal = new BN(await web3.eth.getBalance(I_USDTieredSTO_Array[stoId].address)); let init_STOPOLYBal = await I_PolyToken.balanceOf(I_USDTieredSTO_Array[stoId].address); let init_RaisedETH = await I_USDTieredSTO_Array[stoId].fundsRaised.call(ETH); let init_RaisedPOLY = await I_USDTieredSTO_Array[stoId].fundsRaised.call(POLY); - let init_WalletETHBal = new BigNumber(await web3.eth.getBalance(WALLET)); + let init_WalletETHBal = new BN(await web3.eth.getBalance(WALLET)); let init_WalletPOLYBal = await I_PolyToken.balanceOf(WALLET); let tx1 = await I_USDTieredSTO_Array[stoId].buyWithETH(ACCREDITED1, { @@ -1903,66 +1909,66 @@ contract("USDTieredSTO", accounts => { value: investment_ETH, gasPrice: GAS_PRICE }); - let gasCost1 = new BigNumber(GAS_PRICE).mul(tx1.receipt.gasUsed); - console.log(" Gas buyWithETH: ".grey + tx1.receipt.gasUsed.toString().grey); + let gasCost1 = new BN(GAS_PRICE).mul(new BN(tx1.receipt.gasUsed)); + console.log(" Gas buyWithETH: ".grey + new BN(tx1.receipt.gasUsed).toString().grey); let final_TokenSupply = await I_SecurityToken.totalSupply(); let final_InvestorTokenBal = await I_SecurityToken.balanceOf(ACCREDITED1); - let final_InvestorETHBal = new BigNumber(await web3.eth.getBalance(ACCREDITED1)); + let final_InvestorETHBal = new BN(await web3.eth.getBalance(ACCREDITED1)); let final_InvestorPOLYBal = await I_PolyToken.balanceOf(ACCREDITED1); let final_STOTokenSold = await I_USDTieredSTO_Array[stoId].getTokensSold(); - let final_STOETHBal = new BigNumber(await web3.eth.getBalance(I_USDTieredSTO_Array[stoId].address)); + let final_STOETHBal = new BN(await web3.eth.getBalance(I_USDTieredSTO_Array[stoId].address)); let final_STOPOLYBal = await I_PolyToken.balanceOf(I_USDTieredSTO_Array[stoId].address); let final_RaisedETH = await I_USDTieredSTO_Array[stoId].fundsRaised.call(ETH); let final_RaisedPOLY = await I_USDTieredSTO_Array[stoId].fundsRaised.call(POLY); - let final_WalletETHBal = new BigNumber(await web3.eth.getBalance(WALLET)); + let final_WalletETHBal = new BN(await web3.eth.getBalance(WALLET)); let final_WalletPOLYBal = await I_PolyToken.balanceOf(WALLET); assert.equal( - final_TokenSupply.toNumber(), - init_TokenSupply.add(investment_Token).toNumber(), + final_TokenSupply.toString(), + init_TokenSupply.add(investment_Token).toString(), "Token Supply not changed as expected" ); assert.equal( - final_InvestorTokenBal.toNumber(), - init_InvestorTokenBal.add(investment_Token).toNumber(), + final_InvestorTokenBal.toString(), + init_InvestorTokenBal.add(investment_Token).toString(), "Investor Token Balance not changed as expected" ); assert.equal( - final_InvestorETHBal.toNumber(), + final_InvestorETHBal.toString(), init_InvestorETHBal .sub(gasCost1) .sub(investment_ETH) - .toNumber(), + .toString(), "Investor ETH Balance not changed as expected" ); assert.equal( - final_InvestorPOLYBal.toNumber(), - init_InvestorPOLYBal.toNumber(), + final_InvestorPOLYBal.toString(), + init_InvestorPOLYBal.toString(), "Investor POLY Balance not changed as expected" ); assert.equal( - final_STOTokenSold.toNumber(), - init_STOTokenSold.add(investment_Token).toNumber(), + final_STOTokenSold.toString(), + init_STOTokenSold.add(investment_Token).toString(), "STO Token Sold not changed as expected" ); - assert.equal(final_STOETHBal.toNumber(), init_STOETHBal.toNumber(), "STO ETH Balance not changed as expected"); - assert.equal(final_STOPOLYBal.toNumber(), init_STOPOLYBal.toNumber(), "STO POLY Balance not changed as expected"); - assert.equal(final_RaisedETH.toNumber(), init_RaisedETH.add(investment_ETH).toNumber(), "Raised ETH not changed as expected"); - assert.equal(final_RaisedPOLY.toNumber(), init_RaisedPOLY.toNumber(), "Raised POLY not changed as expected"); + assert.equal(final_STOETHBal.toString(), init_STOETHBal.toString(), "STO ETH Balance not changed as expected"); + assert.equal(final_STOPOLYBal.toString(), init_STOPOLYBal.toString(), "STO POLY Balance not changed as expected"); + assert.equal(final_RaisedETH.toString(), init_RaisedETH.add(investment_ETH).toString(), "Raised ETH not changed as expected"); + assert.equal(final_RaisedPOLY.toString(), init_RaisedPOLY.toString(), "Raised POLY not changed as expected"); assert.equal( - final_WalletETHBal.toNumber(), - init_WalletETHBal.add(investment_ETH).toNumber(), + final_WalletETHBal.toString(), + init_WalletETHBal.add(investment_ETH).toString(), "Wallet ETH Balance not changed as expected" ); - assert.equal(final_WalletPOLYBal.toNumber(), init_WalletPOLYBal.toNumber(), "Wallet POLY Balance not changed as expected"); + assert.equal(final_WalletPOLYBal.toString(), init_WalletPOLYBal.toString(), "Wallet POLY Balance not changed as expected"); }); it("should successfully buy using buyWithPOLY at tier 0 for ACCREDITED1", async () => { let stoId = 0; let tierId = 0; - let investment_Token = new BigNumber(50).mul(10 ** 18); + let investment_Token = new BN(50).mul(e18); let investment_USD = await convert(stoId, tierId, false, "TOKEN", "USD", investment_Token); let investment_ETH = await convert(stoId, tierId, false, "TOKEN", "ETH", investment_Token); let investment_POLY = await convert(stoId, tierId, false, "TOKEN", "POLY", investment_Token); @@ -1981,14 +1987,14 @@ contract("USDTieredSTO", accounts => { let init_TokenSupply = await I_SecurityToken.totalSupply(); let init_InvestorTokenBal = await I_SecurityToken.balanceOf(ACCREDITED1); - let init_InvestorETHBal = new BigNumber(await web3.eth.getBalance(ACCREDITED1)); + let init_InvestorETHBal = new BN(await web3.eth.getBalance(ACCREDITED1)); let init_InvestorPOLYBal = await I_PolyToken.balanceOf(ACCREDITED1); let init_STOTokenSold = await I_USDTieredSTO_Array[stoId].getTokensSold(); - let init_STOETHBal = new BigNumber(await web3.eth.getBalance(I_USDTieredSTO_Array[stoId].address)); + let init_STOETHBal = new BN(await web3.eth.getBalance(I_USDTieredSTO_Array[stoId].address)); let init_STOPOLYBal = await I_PolyToken.balanceOf(I_USDTieredSTO_Array[stoId].address); let init_RaisedETH = await I_USDTieredSTO_Array[stoId].fundsRaised.call(ETH); let init_RaisedPOLY = await I_USDTieredSTO_Array[stoId].fundsRaised.call(POLY); - let init_WalletETHBal = new BigNumber(await web3.eth.getBalance(WALLET)); + let init_WalletETHBal = new BN(await web3.eth.getBalance(WALLET)); let init_WalletPOLYBal = await I_PolyToken.balanceOf(WALLET); // Buy With POLY @@ -1996,96 +2002,96 @@ contract("USDTieredSTO", accounts => { from: ACCREDITED1, gasPrice: GAS_PRICE }); - let gasCost2 = new BigNumber(GAS_PRICE).mul(tx2.receipt.gasUsed); - console.log(" Gas buyWithPOLY: ".grey + tx2.receipt.gasUsed.toString().grey); + let gasCost2 = new BN(GAS_PRICE).mul(new BN(tx2.receipt.gasUsed)); + console.log(" Gas buyWithPOLY: ".grey + new BN(tx2.receipt.gasUsed).toString().grey); let final_TokenSupply = await I_SecurityToken.totalSupply(); let final_InvestorTokenBal = await I_SecurityToken.balanceOf(ACCREDITED1); - let final_InvestorETHBal = new BigNumber(await web3.eth.getBalance(ACCREDITED1)); + let final_InvestorETHBal = new BN(await web3.eth.getBalance(ACCREDITED1)); let final_InvestorPOLYBal = await I_PolyToken.balanceOf(ACCREDITED1); let final_STOTokenSold = await I_USDTieredSTO_Array[stoId].getTokensSold(); - let final_STOETHBal = new BigNumber(await web3.eth.getBalance(I_USDTieredSTO_Array[stoId].address)); + let final_STOETHBal = new BN(await web3.eth.getBalance(I_USDTieredSTO_Array[stoId].address)); let final_STOPOLYBal = await I_PolyToken.balanceOf(I_USDTieredSTO_Array[stoId].address); let final_RaisedETH = await I_USDTieredSTO_Array[stoId].fundsRaised.call(ETH); let final_RaisedPOLY = await I_USDTieredSTO_Array[stoId].fundsRaised.call(POLY); - let final_WalletETHBal = new BigNumber(await web3.eth.getBalance(WALLET)); + let final_WalletETHBal = new BN(await web3.eth.getBalance(WALLET)); let final_WalletPOLYBal = await I_PolyToken.balanceOf(WALLET); assert.equal( - final_TokenSupply.toNumber(), - init_TokenSupply.add(investment_Token).toNumber(), + final_TokenSupply.toString(), + init_TokenSupply.add(investment_Token).toString(), "Token Supply not changed as expected" ); assert.equal( - final_InvestorTokenBal.toNumber(), - init_InvestorTokenBal.add(investment_Token).toNumber(), + final_InvestorTokenBal.toString(), + init_InvestorTokenBal.add(investment_Token).toString(), "Investor Token Balance not changed as expected" ); assert.equal( - final_InvestorETHBal.toNumber(), - init_InvestorETHBal.sub(gasCost2).toNumber(), + final_InvestorETHBal.toString(), + init_InvestorETHBal.sub(gasCost2).toString(), "Investor ETH Balance not changed as expected" ); assert.equal( - final_InvestorPOLYBal.toNumber(), - init_InvestorPOLYBal.sub(investment_POLY).toNumber(), + final_InvestorPOLYBal.toString(), + init_InvestorPOLYBal.sub(investment_POLY).toString(), "Investor POLY Balance not changed as expected" ); assert.equal( - final_STOTokenSold.toNumber(), - init_STOTokenSold.add(investment_Token).toNumber(), + final_STOTokenSold.toString(), + init_STOTokenSold.add(investment_Token).toString(), "STO Token Sold not changed as expected" ); - assert.equal(final_STOETHBal.toNumber(), init_STOETHBal.toNumber(), "STO ETH Balance not changed as expected"); - assert.equal(final_STOPOLYBal.toNumber(), init_STOPOLYBal.toNumber(), "STO POLY Balance not changed as expected"); - assert.equal(final_RaisedETH.toNumber(), init_RaisedETH.toNumber(), "Raised ETH not changed as expected"); + assert.equal(final_STOETHBal.toString(), init_STOETHBal.toString(), "STO ETH Balance not changed as expected"); + assert.equal(final_STOPOLYBal.toString(), init_STOPOLYBal.toString(), "STO POLY Balance not changed as expected"); + assert.equal(final_RaisedETH.toString(), init_RaisedETH.toString(), "Raised ETH not changed as expected"); assert.equal( - final_RaisedPOLY.toNumber(), - init_RaisedPOLY.add(investment_POLY).toNumber(), + final_RaisedPOLY.toString(), + init_RaisedPOLY.add(investment_POLY).toString(), "Raised POLY not changed as expected" ); - assert.equal(final_WalletETHBal.toNumber(), init_WalletETHBal.toNumber(), "Wallet ETH Balance not changed as expected"); + assert.equal(final_WalletETHBal.toString(), init_WalletETHBal.toString(), "Wallet ETH Balance not changed as expected"); assert.equal( - final_WalletPOLYBal.toNumber(), - init_WalletPOLYBal.add(investment_POLY).toNumber(), + final_WalletPOLYBal.toString(), + init_WalletPOLYBal.add(investment_POLY).toString(), "Wallet POLY Balance not changed as expected" ); // Additional checks on getters - assert.equal((await I_USDTieredSTO_Array[stoId].investorCount.call()).toNumber(), 2, "Investor count not changed as expected"); + assert.equal((await I_USDTieredSTO_Array[stoId].investorCount.call()).toString(), 2, "Investor count not changed as expected"); assert.equal( - (await I_USDTieredSTO_Array[stoId].getTokensSold()).toNumber(), - init_getTokensSold.add(investment_Token).toNumber(), + (await I_USDTieredSTO_Array[stoId].getTokensSold()).toString(), + init_getTokensSold.add(investment_Token).toString(), "getTokensSold not changed as expected" ); assert.equal( - (await I_USDTieredSTO_Array[stoId].getTokensMinted()).toNumber(), - init_getTokensMinted.add(investment_Token).toNumber(), + (await I_USDTieredSTO_Array[stoId].getTokensMinted()).toString(), + init_getTokensMinted.add(investment_Token).toString(), "getTokensMinted not changed as expected" ); assert.equal( - (await I_USDTieredSTO_Array[stoId].getTokensSoldFor(ETH)).toNumber(), - init_getTokensSoldForETH.toNumber(), + (await I_USDTieredSTO_Array[stoId].getTokensSoldFor(ETH)).toString(), + init_getTokensSoldForETH.toString(), "getTokensSoldForETH not changed as expected" ); assert.equal( - (await I_USDTieredSTO_Array[stoId].getTokensSoldFor(POLY)).toNumber(), - init_getTokensSoldForPOLY.add(investment_Token).toNumber(), + (await I_USDTieredSTO_Array[stoId].getTokensSoldFor(POLY)).toString(), + init_getTokensSoldForPOLY.add(investment_Token).toString(), "getTokensSoldForPOLY not changed as expected" ); assert.equal( - (await I_USDTieredSTO_Array[stoId].investorInvestedUSD.call(ACCREDITED1)).toNumber(), - init_investorInvestedUSD.add(investment_USD).toNumber(), + (await I_USDTieredSTO_Array[stoId].investorInvestedUSD.call(ACCREDITED1)).toString(), + init_investorInvestedUSD.add(investment_USD).toString(), "investorInvestedUSD not changed as expected" ); assert.equal( - (await I_USDTieredSTO_Array[stoId].investorInvested.call(ACCREDITED1, ETH)).toNumber(), - init_investorInvestedETH.toNumber(), + (await I_USDTieredSTO_Array[stoId].investorInvested.call(ACCREDITED1, ETH)).toString(), + init_investorInvestedETH.toString(), "investorInvestedETH not changed as expected" ); assert.equal( - (await I_USDTieredSTO_Array[stoId].investorInvested.call(ACCREDITED1, POLY)).toNumber(), - init_investorInvestedPOLY.add(investment_POLY).toNumber(), + (await I_USDTieredSTO_Array[stoId].investorInvested.call(ACCREDITED1, POLY)).toString(), + init_investorInvestedPOLY.add(investment_POLY).toString(), "investorInvestedPOLY not changed as expected" ); }); @@ -2093,11 +2099,11 @@ contract("USDTieredSTO", accounts => { it("should successfully modify NONACCREDITED cap for NONACCREDITED1", async () => { let stoId = 0; let tierId = 0; - console.log("Current investment: " + (await I_USDTieredSTO_Array[stoId].investorInvestedUSD.call(NONACCREDITED1)).toNumber()); - await I_USDTieredSTO_Array[stoId].changeNonAccreditedLimit([NONACCREDITED1], [_nonAccreditedLimitUSD[stoId].div(2)], { + console.log("Current investment: " + (await I_USDTieredSTO_Array[stoId].investorInvestedUSD.call(NONACCREDITED1)).toString()); + await I_USDTieredSTO_Array[stoId].changeNonAccreditedLimit([NONACCREDITED1], [_nonAccreditedLimitUSD[stoId].div(new BN(2))], { from: ISSUER }); - console.log("Current limit: " + (await I_USDTieredSTO_Array[stoId].nonAccreditedLimitUSDOverride(NONACCREDITED1)).toNumber()); + console.log("Current limit: " + (await I_USDTieredSTO_Array[stoId].nonAccreditedLimitUSDOverride(NONACCREDITED1)).toString()); }); it("should successfully buy a partial amount and refund balance when reaching NONACCREDITED cap", async () => { @@ -2114,20 +2120,20 @@ contract("USDTieredSTO", accounts => { let refund_ETH = await convert(stoId, tierId, false, "USD", "ETH", refund_USD); let refund_POLY = await convert(stoId, tierId, false, "USD", "POLY", refund_USD); - console.log("Expected refund in tokens: " + refund_Token.toNumber()); + console.log("Expected refund in tokens: " + refund_Token.toString()); let snap = await takeSnapshot(); let init_TokenSupply = await I_SecurityToken.totalSupply(); let init_InvestorTokenBal = await I_SecurityToken.balanceOf(NONACCREDITED1); - let init_InvestorETHBal = new BigNumber(await web3.eth.getBalance(NONACCREDITED1)); + let init_InvestorETHBal = new BN(await web3.eth.getBalance(NONACCREDITED1)); let init_InvestorPOLYBal = await I_PolyToken.balanceOf(NONACCREDITED1); let init_STOTokenSold = await I_USDTieredSTO_Array[stoId].getTokensSold(); - let init_STOETHBal = new BigNumber(await web3.eth.getBalance(I_USDTieredSTO_Array[stoId].address)); + let init_STOETHBal = new BN(await web3.eth.getBalance(I_USDTieredSTO_Array[stoId].address)); let init_STOPOLYBal = await I_PolyToken.balanceOf(I_USDTieredSTO_Array[stoId].address); let init_RaisedETH = await I_USDTieredSTO_Array[stoId].fundsRaised.call(ETH); let init_RaisedPOLY = await I_USDTieredSTO_Array[stoId].fundsRaised.call(POLY); - let init_WalletETHBal = new BigNumber(await web3.eth.getBalance(WALLET)); + let init_WalletETHBal = new BN(await web3.eth.getBalance(WALLET)); let init_WalletPOLYBal = await I_PolyToken.balanceOf(WALLET); // Buy with ETH @@ -2136,79 +2142,79 @@ contract("USDTieredSTO", accounts => { value: investment_ETH, gasPrice: GAS_PRICE }); - let gasCost1 = new BigNumber(GAS_PRICE).mul(tx1.receipt.gasUsed); - console.log(" Gas buyWithETH: ".grey + tx1.receipt.gasUsed.toString().grey); + let gasCost1 = new BN(GAS_PRICE).mul(new BN(tx1.receipt.gasUsed)); + console.log(" Gas buyWithETH: ".grey + new BN(tx1.receipt.gasUsed).toString().grey); let final_TokenSupply = await I_SecurityToken.totalSupply(); let final_InvestorTokenBal = await I_SecurityToken.balanceOf(NONACCREDITED1); - let final_InvestorETHBal = new BigNumber(await web3.eth.getBalance(NONACCREDITED1)); + let final_InvestorETHBal = new BN(await web3.eth.getBalance(NONACCREDITED1)); let final_InvestorPOLYBal = await I_PolyToken.balanceOf(NONACCREDITED1); let final_STOTokenSold = await I_USDTieredSTO_Array[stoId].getTokensSold(); - let final_STOETHBal = new BigNumber(await web3.eth.getBalance(I_USDTieredSTO_Array[stoId].address)); + let final_STOETHBal = new BN(await web3.eth.getBalance(I_USDTieredSTO_Array[stoId].address)); let final_STOPOLYBal = await I_PolyToken.balanceOf(I_USDTieredSTO_Array[stoId].address); let final_RaisedETH = await I_USDTieredSTO_Array[stoId].fundsRaised.call(ETH); let final_RaisedPOLY = await I_USDTieredSTO_Array[stoId].fundsRaised.call(POLY); - let final_WalletETHBal = new BigNumber(await web3.eth.getBalance(WALLET)); + let final_WalletETHBal = new BN(await web3.eth.getBalance(WALLET)); let final_WalletPOLYBal = await I_PolyToken.balanceOf(WALLET); assert.equal( - final_TokenSupply.toNumber(), + final_TokenSupply.toString(), init_TokenSupply .add(investment_Token) .sub(refund_Token) - .toNumber(), + .toString(), "Token Supply not changed as expected" ); assert.equal( - final_InvestorTokenBal.toNumber(), + final_InvestorTokenBal.toString(), init_InvestorTokenBal .add(investment_Token) .sub(refund_Token) - .toNumber(), + .toString(), "Investor Token Balance not changed as expected" ); assert.equal( - final_InvestorETHBal.toNumber(), + final_InvestorETHBal.toString(), init_InvestorETHBal .sub(gasCost1) .sub(investment_ETH) .add(refund_ETH) - .toNumber(), + .toString(), "Investor ETH Balance not changed as expected" ); assert.equal( - final_InvestorPOLYBal.toNumber(), - init_InvestorPOLYBal.toNumber(), + final_InvestorPOLYBal.toString(), + init_InvestorPOLYBal.toString(), "Investor POLY Balance not changed as expected" ); assert.equal( - final_STOTokenSold.toNumber(), + final_STOTokenSold.toString(), init_STOTokenSold .add(investment_Token) .sub(refund_Token) - .toNumber(), + .toString(), "STO Token Sold not changed as expected" ); - assert.equal(final_STOETHBal.toNumber(), init_STOETHBal.toNumber(), "STO ETH Balance not changed as expected"); - assert.equal(final_STOPOLYBal.toNumber(), init_STOPOLYBal.toNumber(), "STO POLY Balance not changed as expected"); + assert.equal(final_STOETHBal.toString(), init_STOETHBal.toString(), "STO ETH Balance not changed as expected"); + assert.equal(final_STOPOLYBal.toString(), init_STOPOLYBal.toString(), "STO POLY Balance not changed as expected"); assert.equal( - final_RaisedETH.toNumber(), + final_RaisedETH.toString(), init_RaisedETH .add(investment_ETH) .sub(refund_ETH) - .toNumber(), + .toString(), "Raised ETH not changed as expected" ); - assert.equal(final_RaisedPOLY.toNumber(), init_RaisedPOLY.toNumber(), "Raised POLY not changed as expected"); + assert.equal(final_RaisedPOLY.toString(), init_RaisedPOLY.toString(), "Raised POLY not changed as expected"); assert.equal( - final_WalletETHBal.toNumber(), + final_WalletETHBal.toString(), init_WalletETHBal .add(investment_ETH) .sub(refund_ETH) - .toNumber(), + .toString(), "Wallet ETH Balance not changed as expected" ); - assert.equal(final_WalletPOLYBal.toNumber(), init_WalletPOLYBal.toNumber(), "Wallet POLY Balance not changed as expected"); + assert.equal(final_WalletPOLYBal.toString(), init_WalletPOLYBal.toString(), "Wallet POLY Balance not changed as expected"); await revertToSnapshot(snap); @@ -2217,14 +2223,14 @@ contract("USDTieredSTO", accounts => { init_TokenSupply = await I_SecurityToken.totalSupply(); init_InvestorTokenBal = await I_SecurityToken.balanceOf(NONACCREDITED1); - init_InvestorETHBal = new BigNumber(await web3.eth.getBalance(NONACCREDITED1)); + init_InvestorETHBal = new BN(await web3.eth.getBalance(NONACCREDITED1)); init_InvestorPOLYBal = await I_PolyToken.balanceOf(NONACCREDITED1); init_STOTokenSold = await I_USDTieredSTO_Array[stoId].getTokensSold(); - init_STOETHBal = new BigNumber(await web3.eth.getBalance(I_USDTieredSTO_Array[stoId].address)); + init_STOETHBal = new BN(await web3.eth.getBalance(I_USDTieredSTO_Array[stoId].address)); init_STOPOLYBal = await I_PolyToken.balanceOf(I_USDTieredSTO_Array[stoId].address); init_RaisedETH = await I_USDTieredSTO_Array[stoId].fundsRaised.call(ETH); init_RaisedPOLY = await I_USDTieredSTO_Array[stoId].fundsRaised.call(POLY); - init_WalletETHBal = new BigNumber(await web3.eth.getBalance(WALLET)); + init_WalletETHBal = new BN(await web3.eth.getBalance(WALLET)); init_WalletPOLYBal = await I_PolyToken.balanceOf(WALLET); // Buy With POLY @@ -2232,76 +2238,76 @@ contract("USDTieredSTO", accounts => { from: NONACCREDITED1, gasPrice: GAS_PRICE }); - let gasCost2 = new BigNumber(GAS_PRICE).mul(tx2.receipt.gasUsed); - console.log(" Gas buyWithPOLY: ".grey + tx2.receipt.gasUsed.toString().grey); + let gasCost2 = new BN(GAS_PRICE).mul(new BN(tx2.receipt.gasUsed)); + console.log(" Gas buyWithPOLY: ".grey + new BN(tx2.receipt.gasUsed).toString().grey); final_TokenSupply = await I_SecurityToken.totalSupply(); final_InvestorTokenBal = await I_SecurityToken.balanceOf(NONACCREDITED1); - final_InvestorETHBal = new BigNumber(await web3.eth.getBalance(NONACCREDITED1)); + final_InvestorETHBal = new BN(await web3.eth.getBalance(NONACCREDITED1)); final_InvestorPOLYBal = await I_PolyToken.balanceOf(NONACCREDITED1); final_STOTokenSold = await I_USDTieredSTO_Array[stoId].getTokensSold(); - final_STOETHBal = new BigNumber(await web3.eth.getBalance(I_USDTieredSTO_Array[stoId].address)); + final_STOETHBal = new BN(await web3.eth.getBalance(I_USDTieredSTO_Array[stoId].address)); final_STOPOLYBal = await I_PolyToken.balanceOf(I_USDTieredSTO_Array[stoId].address); final_RaisedETH = await I_USDTieredSTO_Array[stoId].fundsRaised.call(ETH); final_RaisedPOLY = await I_USDTieredSTO_Array[stoId].fundsRaised.call(POLY); - final_WalletETHBal = new BigNumber(await web3.eth.getBalance(WALLET)); + final_WalletETHBal = new BN(await web3.eth.getBalance(WALLET)); final_WalletPOLYBal = await I_PolyToken.balanceOf(WALLET); assert.equal( - final_TokenSupply.toNumber(), + final_TokenSupply.toString(), init_TokenSupply .add(investment_Token) .sub(refund_Token) - .toNumber(), + .toString(), "Token Supply not changed as expected" ); assert.equal( - final_InvestorTokenBal.toNumber(), + final_InvestorTokenBal.toString(), init_InvestorTokenBal .add(investment_Token) .sub(refund_Token) - .toNumber(), + .toString(), "Investor Token Balance not changed as expected" ); assert.equal( - final_InvestorETHBal.toNumber(), - init_InvestorETHBal.sub(gasCost2).toNumber(), + final_InvestorETHBal.toString(), + init_InvestorETHBal.sub(gasCost2).toString(), "Investor ETH Balance not changed as expected" ); assert.equal( - final_InvestorPOLYBal.toNumber(), + final_InvestorPOLYBal.toString(), init_InvestorPOLYBal .sub(investment_POLY) .add(refund_POLY) - .toNumber(), + .toString(), "Investor POLY Balance not changed as expected" ); assert.equal( - final_STOTokenSold.toNumber(), + final_STOTokenSold.toString(), init_STOTokenSold .add(investment_Token) .sub(refund_Token) - .toNumber(), + .toString(), "STO Token Sold not changed as expected" ); - assert.equal(final_STOETHBal.toNumber(), init_STOETHBal.toNumber(), "STO ETH Balance not changed as expected"); - assert.equal(final_STOPOLYBal.toNumber(), init_STOPOLYBal.toNumber(), "STO POLY Balance not changed as expected"); - assert.equal(final_RaisedETH.toNumber(), init_RaisedETH.toNumber(), "Raised ETH not changed as expected"); + assert.equal(final_STOETHBal.toString(), init_STOETHBal.toString(), "STO ETH Balance not changed as expected"); + assert.equal(final_STOPOLYBal.toString(), init_STOPOLYBal.toString(), "STO POLY Balance not changed as expected"); + assert.equal(final_RaisedETH.toString(), init_RaisedETH.toString(), "Raised ETH not changed as expected"); assert.equal( - final_RaisedPOLY.toNumber(), + final_RaisedPOLY.toString(), init_RaisedPOLY .add(investment_POLY) .sub(refund_POLY) - .toNumber(), + .toString(), "Raised POLY not changed as expected" ); - assert.equal(final_WalletETHBal.toNumber(), init_WalletETHBal.toNumber(), "Wallet ETH Balance not changed as expected"); + assert.equal(final_WalletETHBal.toString(), init_WalletETHBal.toString(), "Wallet ETH Balance not changed as expected"); assert.equal( - final_WalletPOLYBal.toNumber(), + final_WalletPOLYBal.toString(), init_WalletPOLYBal .add(investment_POLY) .sub(refund_POLY) - .toNumber(), + .toString(), "Wallet POLY Balance not changed as expected" ); }); @@ -2310,7 +2316,7 @@ contract("USDTieredSTO", accounts => { let stoId = 0; let tierId = 0; - let investment_Token = new BigNumber(50).mul(10 ** 18); + let investment_Token = new BN(50).mul(e18); let investment_USD = await convert(stoId, tierId, false, "TOKEN", "USD", investment_Token); let investment_ETH = await convert(stoId, tierId, false, "TOKEN", "ETH", investment_Token); let investment_POLY = await convert(stoId, tierId, false, "TOKEN", "POLY", investment_Token); @@ -2334,16 +2340,16 @@ contract("USDTieredSTO", accounts => { let tierId; // set new exchange rates - let high_USDETH = new BigNumber(1000).mul(10 ** 18); // 1000 USD per ETH - let high_USDPOLY = new BigNumber(50).mul(10 ** 16); // 0.5 USD per POLY - let low_USDETH = new BigNumber(250).mul(10 ** 18); // 250 USD per ETH - let low_USDPOLY = new BigNumber(20).mul(10 ** 16); // 0.2 USD per POLY + let high_USDETH = new BN(1000).mul(e18); // 1000 USD per ETH + let high_USDPOLY = new BN(50).mul(e16); // 0.5 USD per POLY + let low_USDETH = new BN(250).mul(e18); // 250 USD per ETH + let low_USDPOLY = new BN(20).mul(e16); // 0.2 USD per POLY - let investment_USD = new BigNumber(web3.utils.toWei("50")); // USD - let investment_ETH_high = investment_USD.div(high_USDETH).mul(10 ** 18); // USD / USD/ETH = ETH - let investment_POLY_high = investment_USD.div(high_USDPOLY).mul(10 ** 18); // USD / USD/POLY = POLY - let investment_ETH_low = investment_USD.div(low_USDETH).mul(10 ** 18); // USD / USD/ETH = ETH - let investment_POLY_low = investment_USD.div(low_USDPOLY).mul(10 ** 18); // USD / USD/POLY = POLY + let investment_USD = new BN(web3.utils.toWei("50")); // USD + let investment_ETH_high = investment_USD.div(high_USDETH).mul(e18); // USD / USD/ETH = ETH + let investment_POLY_high = investment_USD.div(high_USDPOLY).mul(e18); // USD / USD/POLY = POLY + let investment_ETH_low = investment_USD.div(low_USDETH).mul(e18); // USD / USD/ETH = ETH + let investment_POLY_low = investment_USD.div(low_USDPOLY).mul(e18); // USD / USD/POLY = POLY await I_PolyToken.getTokens(investment_POLY_low, NONACCREDITED1); await I_PolyToken.approve(I_USDTieredSTO_Array[stoId].address, investment_POLY_low, { from: NONACCREDITED1 }); @@ -2399,12 +2405,12 @@ contract("USDTieredSTO", accounts => { let endTier = 1; assert.equal( - (await I_USDTieredSTO_Array[stoId].currentTier.call()).toNumber(), + (await I_USDTieredSTO_Array[stoId].currentTier.call()).toString(), startTier, "currentTier not changed as expected" ); - let delta_Token = new BigNumber(5).mul(10 ** 18); + let delta_Token = new BN(5).mul(e18); let ethTier0 = await convert(stoId, startTier, false, "TOKEN", "ETH", delta_Token); let ethTier1 = await convert(stoId, endTier, false, "TOKEN", "ETH", delta_Token); @@ -2414,14 +2420,14 @@ contract("USDTieredSTO", accounts => { // Process investment let init_TokenSupply = await I_SecurityToken.totalSupply(); let init_InvestorTokenBal = await I_SecurityToken.balanceOf(NONACCREDITED1); - let init_InvestorETHBal = new BigNumber(await web3.eth.getBalance(NONACCREDITED1)); + let init_InvestorETHBal = new BN(await web3.eth.getBalance(NONACCREDITED1)); let init_InvestorPOLYBal = await I_PolyToken.balanceOf(NONACCREDITED1); let init_STOTokenSold = await I_USDTieredSTO_Array[stoId].getTokensSold(); - let init_STOETHBal = new BigNumber(await web3.eth.getBalance(I_USDTieredSTO_Array[stoId].address)); + let init_STOETHBal = new BN(await web3.eth.getBalance(I_USDTieredSTO_Array[stoId].address)); let init_STOPOLYBal = await I_PolyToken.balanceOf(I_USDTieredSTO_Array[stoId].address); let init_RaisedETH = await I_USDTieredSTO_Array[stoId].fundsRaised.call(ETH); let init_RaisedPOLY = await I_USDTieredSTO_Array[stoId].fundsRaised.call(POLY); - let init_WalletETHBal = new BigNumber(await web3.eth.getBalance(WALLET)); + let init_WalletETHBal = new BN(await web3.eth.getBalance(WALLET)); let init_WalletPOLYBal = await I_PolyToken.balanceOf(WALLET); let tx1 = await I_USDTieredSTO_Array[stoId].buyWithETH(NONACCREDITED1, { @@ -2429,62 +2435,62 @@ contract("USDTieredSTO", accounts => { value: investment_ETH, gasPrice: GAS_PRICE }); - let gasCost1 = new BigNumber(GAS_PRICE).mul(tx1.receipt.gasUsed); - console.log(" Gas buyWithETH: ".grey + tx1.receipt.gasUsed.toString().grey); + let gasCost1 = new BN(GAS_PRICE).mul(new BN(tx1.receipt.gasUsed)); + console.log(" Gas buyWithETH: ".grey + new BN(tx1.receipt.gasUsed).toString().grey); let final_TokenSupply = await I_SecurityToken.totalSupply(); let final_InvestorTokenBal = await I_SecurityToken.balanceOf(NONACCREDITED1); - let final_InvestorETHBal = new BigNumber(await web3.eth.getBalance(NONACCREDITED1)); + let final_InvestorETHBal = new BN(await web3.eth.getBalance(NONACCREDITED1)); let final_InvestorPOLYBal = await I_PolyToken.balanceOf(NONACCREDITED1); let final_STOTokenSold = await I_USDTieredSTO_Array[stoId].getTokensSold(); - let final_STOETHBal = new BigNumber(await web3.eth.getBalance(I_USDTieredSTO_Array[stoId].address)); + let final_STOETHBal = new BN(await web3.eth.getBalance(I_USDTieredSTO_Array[stoId].address)); let final_STOPOLYBal = await I_PolyToken.balanceOf(I_USDTieredSTO_Array[stoId].address); let final_RaisedETH = await I_USDTieredSTO_Array[stoId].fundsRaised.call(ETH); let final_RaisedPOLY = await I_USDTieredSTO_Array[stoId].fundsRaised.call(POLY); - let final_WalletETHBal = new BigNumber(await web3.eth.getBalance(WALLET)); + let final_WalletETHBal = new BN(await web3.eth.getBalance(WALLET)); let final_WalletPOLYBal = await I_PolyToken.balanceOf(WALLET); assert.equal( - final_TokenSupply.toNumber(), - init_TokenSupply.add(investment_Token).toNumber(), + final_TokenSupply.toString(), + init_TokenSupply.add(investment_Token).toString(), "Token Supply not changed as expected" ); assert.equal( - final_InvestorTokenBal.toNumber(), - init_InvestorTokenBal.add(investment_Token).toNumber(), + final_InvestorTokenBal.toString(), + init_InvestorTokenBal.add(investment_Token).toString(), "Investor Token Balance not changed as expected" ); assert.equal( - final_InvestorETHBal.toNumber(), + final_InvestorETHBal.toString(), init_InvestorETHBal .sub(gasCost1) .sub(investment_ETH) - .toNumber(), + .toString(), "Investor ETH Balance not changed as expected" ); assert.equal( - final_InvestorPOLYBal.toNumber(), - init_InvestorPOLYBal.toNumber(), + final_InvestorPOLYBal.toString(), + init_InvestorPOLYBal.toString(), "Investor POLY Balance not changed as expected" ); assert.equal( - final_STOTokenSold.toNumber(), - init_STOTokenSold.add(investment_Token).toNumber(), + final_STOTokenSold.toString(), + init_STOTokenSold.add(investment_Token).toString(), "STO Token Sold not changed as expected" ); - assert.equal(final_STOETHBal.toNumber(), init_STOETHBal.toNumber(), "STO ETH Balance not changed as expected"); - assert.equal(final_STOPOLYBal.toNumber(), init_STOPOLYBal.toNumber(), "STO POLY Balance not changed as expected"); - assert.equal(final_RaisedETH.toNumber(), init_RaisedETH.add(investment_ETH).toNumber(), "Raised ETH not changed as expected"); - assert.equal(final_RaisedPOLY.toNumber(), init_RaisedPOLY.toNumber(), "Raised POLY not changed as expected"); + assert.equal(final_STOETHBal.toString(), init_STOETHBal.toString(), "STO ETH Balance not changed as expected"); + assert.equal(final_STOPOLYBal.toString(), init_STOPOLYBal.toString(), "STO POLY Balance not changed as expected"); + assert.equal(final_RaisedETH.toString(), init_RaisedETH.add(investment_ETH).toString(), "Raised ETH not changed as expected"); + assert.equal(final_RaisedPOLY.toString(), init_RaisedPOLY.toString(), "Raised POLY not changed as expected"); assert.equal( - final_WalletETHBal.toNumber(), - init_WalletETHBal.add(investment_ETH).toNumber(), + final_WalletETHBal.toString(), + init_WalletETHBal.add(investment_ETH).toString(), "Wallet ETH Balance not changed as expected" ); - assert.equal(final_WalletPOLYBal.toNumber(), init_WalletPOLYBal.toNumber(), "Wallet POLY Balance not changed as expected"); + assert.equal(final_WalletPOLYBal.toString(), init_WalletPOLYBal.toString(), "Wallet POLY Balance not changed as expected"); // Additional Checks - assert.equal((await I_USDTieredSTO_Array[stoId].currentTier.call()).toNumber(), endTier, "currentTier not changed as expected"); + assert.equal((await I_USDTieredSTO_Array[stoId].currentTier.call()).toString(), endTier, "currentTier not changed as expected"); }); it("should successfully buy across tiers for NONACCREDITED POLY", async () => { @@ -2493,12 +2499,12 @@ contract("USDTieredSTO", accounts => { let endTier = 2; assert.equal( - (await I_USDTieredSTO_Array[stoId].currentTier.call()).toNumber(), + (await I_USDTieredSTO_Array[stoId].currentTier.call()).toString(), startTier, "currentTier not changed as expected" ); - let delta_Token = new BigNumber(5).mul(10 ** 18); // Token + let delta_Token = new BN(5).mul(e18); // Token let polyTier0 = await convert(stoId, startTier, false, "TOKEN", "POLY", delta_Token); let polyTier1 = await convert(stoId, endTier, false, "TOKEN", "POLY", delta_Token); @@ -2511,77 +2517,77 @@ contract("USDTieredSTO", accounts => { // Process investment let init_TokenSupply = await I_SecurityToken.totalSupply(); let init_InvestorTokenBal = await I_SecurityToken.balanceOf(NONACCREDITED1); - let init_InvestorETHBal = new BigNumber(await web3.eth.getBalance(NONACCREDITED1)); + let init_InvestorETHBal = new BN(await web3.eth.getBalance(NONACCREDITED1)); let init_InvestorPOLYBal = await I_PolyToken.balanceOf(NONACCREDITED1); let init_STOTokenSold = await I_USDTieredSTO_Array[stoId].getTokensSold(); - let init_STOETHBal = new BigNumber(await web3.eth.getBalance(I_USDTieredSTO_Array[stoId].address)); + let init_STOETHBal = new BN(await web3.eth.getBalance(I_USDTieredSTO_Array[stoId].address)); let init_STOPOLYBal = await I_PolyToken.balanceOf(I_USDTieredSTO_Array[stoId].address); let init_RaisedETH = await I_USDTieredSTO_Array[stoId].fundsRaised.call(ETH); let init_RaisedPOLY = await I_USDTieredSTO_Array[stoId].fundsRaised.call(POLY); - let init_WalletETHBal = new BigNumber(await web3.eth.getBalance(WALLET)); + let init_WalletETHBal = new BN(await web3.eth.getBalance(WALLET)); let init_WalletPOLYBal = await I_PolyToken.balanceOf(WALLET); let tx2 = await I_USDTieredSTO_Array[stoId].buyWithPOLY(NONACCREDITED1, investment_POLY, { from: NONACCREDITED1, gasPrice: GAS_PRICE }); - let gasCost2 = new BigNumber(GAS_PRICE).mul(tx2.receipt.gasUsed); - console.log(" Gas buyWithPOLY: ".grey + tx2.receipt.gasUsed.toString().grey); + let gasCost2 = new BN(GAS_PRICE).mul(new BN(tx2.receipt.gasUsed)); + console.log(" Gas buyWithPOLY: ".grey + new BN(tx2.receipt.gasUsed).toString().grey); let final_TokenSupply = await I_SecurityToken.totalSupply(); let final_InvestorTokenBal = await I_SecurityToken.balanceOf(NONACCREDITED1); - let final_InvestorETHBal = new BigNumber(await web3.eth.getBalance(NONACCREDITED1)); + let final_InvestorETHBal = new BN(await web3.eth.getBalance(NONACCREDITED1)); let final_InvestorPOLYBal = await I_PolyToken.balanceOf(NONACCREDITED1); let final_STOTokenSold = await I_USDTieredSTO_Array[stoId].getTokensSold(); - let final_STOETHBal = new BigNumber(await web3.eth.getBalance(I_USDTieredSTO_Array[stoId].address)); + let final_STOETHBal = new BN(await web3.eth.getBalance(I_USDTieredSTO_Array[stoId].address)); let final_STOPOLYBal = await I_PolyToken.balanceOf(I_USDTieredSTO_Array[stoId].address); let final_RaisedETH = await I_USDTieredSTO_Array[stoId].fundsRaised.call(ETH); let final_RaisedPOLY = await I_USDTieredSTO_Array[stoId].fundsRaised.call(POLY); - let final_WalletETHBal = new BigNumber(await web3.eth.getBalance(WALLET)); + let final_WalletETHBal = new BN(await web3.eth.getBalance(WALLET)); let final_WalletPOLYBal = await I_PolyToken.balanceOf(WALLET); assert.equal( - final_TokenSupply.toNumber(), - init_TokenSupply.add(investment_Token).toNumber(), + final_TokenSupply.toString(), + init_TokenSupply.add(investment_Token).toString(), "Token Supply not changed as expected" ); assert.equal( - final_InvestorTokenBal.toNumber(), - init_InvestorTokenBal.add(investment_Token).toNumber(), + final_InvestorTokenBal.toString(), + init_InvestorTokenBal.add(investment_Token).toString(), "Investor Token Balance not changed as expected" ); assert.equal( - final_InvestorETHBal.toNumber(), - init_InvestorETHBal.sub(gasCost2).toNumber(), + final_InvestorETHBal.toString(), + init_InvestorETHBal.sub(gasCost2).toString(), "Investor ETH Balance not changed as expected" ); assert.equal( - final_InvestorPOLYBal.toNumber(), - init_InvestorPOLYBal.sub(investment_POLY).toNumber(), + final_InvestorPOLYBal.toString(), + init_InvestorPOLYBal.sub(investment_POLY).toString(), "Investor POLY Balance not changed as expected" ); assert.equal( - final_STOTokenSold.toNumber(), - init_STOTokenSold.add(investment_Token).toNumber(), + final_STOTokenSold.toString(), + init_STOTokenSold.add(investment_Token).toString(), "STO Token Sold not changed as expected" ); - assert.equal(final_STOETHBal.toNumber(), init_STOETHBal.toNumber(), "STO ETH Balance not changed as expected"); - assert.equal(final_STOPOLYBal.toNumber(), init_STOPOLYBal.toNumber(), "STO POLY Balance not changed as expected"); - assert.equal(final_RaisedETH.toNumber(), init_RaisedETH.toNumber(), "Raised ETH not changed as expected"); + assert.equal(final_STOETHBal.toString(), init_STOETHBal.toString(), "STO ETH Balance not changed as expected"); + assert.equal(final_STOPOLYBal.toString(), init_STOPOLYBal.toString(), "STO POLY Balance not changed as expected"); + assert.equal(final_RaisedETH.toString(), init_RaisedETH.toString(), "Raised ETH not changed as expected"); assert.equal( - final_RaisedPOLY.toNumber(), - init_RaisedPOLY.add(investment_POLY).toNumber(), + final_RaisedPOLY.toString(), + init_RaisedPOLY.add(investment_POLY).toString(), "Raised POLY not changed as expected" ); - assert.equal(final_WalletETHBal.toNumber(), init_WalletETHBal.toNumber(), "Wallet ETH Balance not changed as expected"); + assert.equal(final_WalletETHBal.toString(), init_WalletETHBal.toString(), "Wallet ETH Balance not changed as expected"); assert.equal( - final_WalletPOLYBal.toNumber(), - init_WalletPOLYBal.add(investment_POLY).toNumber(), + final_WalletPOLYBal.toString(), + init_WalletPOLYBal.add(investment_POLY).toString(), "Wallet POLY Balance not changed as expected" ); // Additional Checks - assert.equal((await I_USDTieredSTO_Array[stoId].currentTier.call()).toNumber(), endTier, "currentTier not changed as expected"); + assert.equal((await I_USDTieredSTO_Array[stoId].currentTier.call()).toString(), endTier, "currentTier not changed as expected"); }); it("should successfully buy across tiers for ACCREDITED ETH", async () => { @@ -2592,12 +2598,12 @@ contract("USDTieredSTO", accounts => { await I_USDTieredSTO_Array[stoId].changeAccredited([ACCREDITED1], [true], { from: ISSUER }); assert.equal( - (await I_USDTieredSTO_Array[stoId].currentTier.call()).toNumber(), + (await I_USDTieredSTO_Array[stoId].currentTier.call()).toString(), startTier, "currentTier not changed as expected" ); - let delta_Token = new BigNumber(5).mul(10 ** 18); // Token + let delta_Token = new BN(5).mul(e18); // Token let ethTier0 = await convert(stoId, startTier, false, "TOKEN", "ETH", delta_Token); let ethTier1 = await convert(stoId, endTier, false, "TOKEN", "ETH", delta_Token); @@ -2607,14 +2613,14 @@ contract("USDTieredSTO", accounts => { // Process investment let init_TokenSupply = await I_SecurityToken.totalSupply(); let init_InvestorTokenBal = await I_SecurityToken.balanceOf(ACCREDITED1); - let init_InvestorETHBal = new BigNumber(await web3.eth.getBalance(ACCREDITED1)); + let init_InvestorETHBal = new BN(await web3.eth.getBalance(ACCREDITED1)); let init_InvestorPOLYBal = await I_PolyToken.balanceOf(ACCREDITED1); let init_STOTokenSold = await I_USDTieredSTO_Array[stoId].getTokensSold(); - let init_STOETHBal = new BigNumber(await web3.eth.getBalance(I_USDTieredSTO_Array[stoId].address)); + let init_STOETHBal = new BN(await web3.eth.getBalance(I_USDTieredSTO_Array[stoId].address)); let init_STOPOLYBal = await I_PolyToken.balanceOf(I_USDTieredSTO_Array[stoId].address); let init_RaisedETH = await I_USDTieredSTO_Array[stoId].fundsRaised.call(ETH); let init_RaisedPOLY = await I_USDTieredSTO_Array[stoId].fundsRaised.call(POLY); - let init_WalletETHBal = new BigNumber(await web3.eth.getBalance(WALLET)); + let init_WalletETHBal = new BN(await web3.eth.getBalance(WALLET)); let init_WalletPOLYBal = await I_PolyToken.balanceOf(WALLET); let tx1 = await I_USDTieredSTO_Array[stoId].buyWithETH(ACCREDITED1, { @@ -2622,62 +2628,62 @@ contract("USDTieredSTO", accounts => { value: investment_ETH, gasPrice: GAS_PRICE }); - let gasCost1 = new BigNumber(GAS_PRICE).mul(tx1.receipt.gasUsed); - console.log(" Gas buyWithETH: ".grey + tx1.receipt.gasUsed.toString().grey); + let gasCost1 = new BN(GAS_PRICE).mul(new BN(tx1.receipt.gasUsed)); + console.log(" Gas buyWithETH: ".grey + new BN(tx1.receipt.gasUsed).toString().grey); let final_TokenSupply = await I_SecurityToken.totalSupply(); let final_InvestorTokenBal = await I_SecurityToken.balanceOf(ACCREDITED1); - let final_InvestorETHBal = new BigNumber(await web3.eth.getBalance(ACCREDITED1)); + let final_InvestorETHBal = new BN(await web3.eth.getBalance(ACCREDITED1)); let final_InvestorPOLYBal = await I_PolyToken.balanceOf(ACCREDITED1); let final_STOTokenSold = await I_USDTieredSTO_Array[stoId].getTokensSold(); - let final_STOETHBal = new BigNumber(await web3.eth.getBalance(I_USDTieredSTO_Array[stoId].address)); + let final_STOETHBal = new BN(await web3.eth.getBalance(I_USDTieredSTO_Array[stoId].address)); let final_STOPOLYBal = await I_PolyToken.balanceOf(I_USDTieredSTO_Array[stoId].address); let final_RaisedETH = await I_USDTieredSTO_Array[stoId].fundsRaised.call(ETH); let final_RaisedPOLY = await I_USDTieredSTO_Array[stoId].fundsRaised.call(POLY); - let final_WalletETHBal = new BigNumber(await web3.eth.getBalance(WALLET)); + let final_WalletETHBal = new BN(await web3.eth.getBalance(WALLET)); let final_WalletPOLYBal = await I_PolyToken.balanceOf(WALLET); assert.equal( - final_TokenSupply.toNumber(), - init_TokenSupply.add(investment_Token).toNumber(), + final_TokenSupply.toString(), + init_TokenSupply.add(investment_Token).toString(), "Token Supply not changed as expected" ); assert.equal( - final_InvestorTokenBal.toNumber(), - init_InvestorTokenBal.add(investment_Token).toNumber(), + final_InvestorTokenBal.toString(), + init_InvestorTokenBal.add(investment_Token).toString(), "Investor Token Balance not changed as expected" ); assert.equal( - final_InvestorETHBal.toNumber(), + final_InvestorETHBal.toString(), init_InvestorETHBal .sub(gasCost1) .sub(investment_ETH) - .toNumber(), + .toString(), "Investor ETH Balance not changed as expected" ); assert.equal( - final_InvestorPOLYBal.toNumber(), - init_InvestorPOLYBal.toNumber(), + final_InvestorPOLYBal.toString(), + init_InvestorPOLYBal.toString(), "Investor POLY Balance not changed as expected" ); assert.equal( - final_STOTokenSold.toNumber(), - init_STOTokenSold.add(investment_Token).toNumber(), + final_STOTokenSold.toString(), + init_STOTokenSold.add(investment_Token).toString(), "STO Token Sold not changed as expected" ); - assert.equal(final_STOETHBal.toNumber(), init_STOETHBal.toNumber(), "STO ETH Balance not changed as expected"); - assert.equal(final_STOPOLYBal.toNumber(), init_STOPOLYBal.toNumber(), "STO POLY Balance not changed as expected"); - assert.equal(final_RaisedETH.toNumber(), init_RaisedETH.add(investment_ETH).toNumber(), "Raised ETH not changed as expected"); - assert.equal(final_RaisedPOLY.toNumber(), init_RaisedPOLY.toNumber(), "Raised POLY not changed as expected"); + assert.equal(final_STOETHBal.toString(), init_STOETHBal.toString(), "STO ETH Balance not changed as expected"); + assert.equal(final_STOPOLYBal.toString(), init_STOPOLYBal.toString(), "STO POLY Balance not changed as expected"); + assert.equal(final_RaisedETH.toString(), init_RaisedETH.add(investment_ETH).toString(), "Raised ETH not changed as expected"); + assert.equal(final_RaisedPOLY.toString(), init_RaisedPOLY.toString(), "Raised POLY not changed as expected"); assert.equal( - final_WalletETHBal.toNumber(), - init_WalletETHBal.add(investment_ETH).toNumber(), + final_WalletETHBal.toString(), + init_WalletETHBal.add(investment_ETH).toString(), "Wallet ETH Balance not changed as expected" ); - assert.equal(final_WalletPOLYBal.toNumber(), init_WalletPOLYBal.toNumber(), "Wallet POLY Balance not changed as expected"); + assert.equal(final_WalletPOLYBal.toString(), init_WalletPOLYBal.toString(), "Wallet POLY Balance not changed as expected"); // Additional Checks - assert.equal((await I_USDTieredSTO_Array[stoId].currentTier.call()).toNumber(), endTier, "currentTier not changed as expected"); + assert.equal((await I_USDTieredSTO_Array[stoId].currentTier.call()).toString(), endTier, "currentTier not changed as expected"); }); it("should successfully buy across tiers for ACCREDITED DAI", async () => { @@ -2686,12 +2692,12 @@ contract("USDTieredSTO", accounts => { let endTier = 4; assert.equal( - (await I_USDTieredSTO_Array[stoId].currentTier.call()).toNumber(), + (await I_USDTieredSTO_Array[stoId].currentTier.call()).toString(), startTier, "currentTier not changed as expected" ); - let delta_Token = new BigNumber(5).mul(10 ** 18); // Token + let delta_Token = new BN(5).mul(e18); // Token let daiTier0 = await convert(stoId, startTier, false, "TOKEN", "USD", delta_Token); let daiTier1 = await convert(stoId, endTier, false, "TOKEN", "USD", delta_Token); @@ -2704,83 +2710,83 @@ contract("USDTieredSTO", accounts => { // Process investment let init_TokenSupply = await I_SecurityToken.totalSupply(); let init_InvestorTokenBal = await I_SecurityToken.balanceOf(ACCREDITED1); - let init_InvestorETHBal = new BigNumber(await web3.eth.getBalance(ACCREDITED1)); + let init_InvestorETHBal = new BN(await web3.eth.getBalance(ACCREDITED1)); let init_InvestorPOLYBal = await I_PolyToken.balanceOf(ACCREDITED1); let init_InvestorDAIBal = await I_DaiToken.balanceOf(ACCREDITED1); let init_STOTokenSold = await I_USDTieredSTO_Array[stoId].getTokensSold(); - let init_STOETHBal = new BigNumber(await web3.eth.getBalance(I_USDTieredSTO_Array[stoId].address)); + let init_STOETHBal = new BN(await web3.eth.getBalance(I_USDTieredSTO_Array[stoId].address)); let init_STOPOLYBal = await I_PolyToken.balanceOf(I_USDTieredSTO_Array[stoId].address); let init_RaisedETH = await I_USDTieredSTO_Array[stoId].fundsRaised.call(ETH); let init_RaisedPOLY = await I_USDTieredSTO_Array[stoId].fundsRaised.call(POLY); let init_RaisedDAI = await I_USDTieredSTO_Array[stoId].fundsRaised.call(DAI); - let init_WalletETHBal = new BigNumber(await web3.eth.getBalance(WALLET)); + let init_WalletETHBal = new BN(await web3.eth.getBalance(WALLET)); let init_WalletPOLYBal = await I_PolyToken.balanceOf(WALLET); let init_WalletDAIBal = await I_DaiToken.balanceOf(WALLET); let tx2 = await I_USDTieredSTO_Array[stoId].buyWithUSD(ACCREDITED1, investment_DAI, { from: ACCREDITED1, gasPrice: GAS_PRICE }); - let gasCost2 = new BigNumber(GAS_PRICE).mul(tx2.receipt.gasUsed); - console.log(" Gas buyWithUSD: ".grey + tx2.receipt.gasUsed.toString().grey); + let gasCost2 = new BN(GAS_PRICE).mul(new BN(tx2.receipt.gasUsed)); + console.log(" Gas buyWithUSD: ".grey + new BN(tx2.receipt.gasUsed).toString().grey); let final_TokenSupply = await I_SecurityToken.totalSupply(); let final_InvestorTokenBal = await I_SecurityToken.balanceOf(ACCREDITED1); - let final_InvestorETHBal = new BigNumber(await web3.eth.getBalance(ACCREDITED1)); + let final_InvestorETHBal = new BN(await web3.eth.getBalance(ACCREDITED1)); let final_InvestorPOLYBal = await I_PolyToken.balanceOf(ACCREDITED1); let final_InvestorDAIBal = await I_DaiToken.balanceOf(ACCREDITED1); let final_STOTokenSold = await I_USDTieredSTO_Array[stoId].getTokensSold(); - let final_STOETHBal = new BigNumber(await web3.eth.getBalance(I_USDTieredSTO_Array[stoId].address)); + let final_STOETHBal = new BN(await web3.eth.getBalance(I_USDTieredSTO_Array[stoId].address)); let final_STOPOLYBal = await I_PolyToken.balanceOf(I_USDTieredSTO_Array[stoId].address); let final_RaisedETH = await I_USDTieredSTO_Array[stoId].fundsRaised.call(ETH); let final_RaisedPOLY = await I_USDTieredSTO_Array[stoId].fundsRaised.call(POLY); let final_RaisedDAI = await I_USDTieredSTO_Array[stoId].fundsRaised.call(DAI); - let final_WalletETHBal = new BigNumber(await web3.eth.getBalance(WALLET)); + let final_WalletETHBal = new BN(await web3.eth.getBalance(WALLET)); let final_WalletPOLYBal = await I_PolyToken.balanceOf(WALLET); let final_WalletDAIBal = await I_DaiToken.balanceOf(WALLET); assert.equal( - final_TokenSupply.toNumber(), - init_TokenSupply.add(investment_Token).toNumber(), + final_TokenSupply.toString(), + init_TokenSupply.add(investment_Token).toString(), "Token Supply not changed as expected" ); assert.equal( - final_InvestorTokenBal.toNumber(), - init_InvestorTokenBal.add(investment_Token).toNumber(), + final_InvestorTokenBal.toString(), + init_InvestorTokenBal.add(investment_Token).toString(), "Investor Token Balance not changed as expected" ); assert.equal( - final_InvestorETHBal.toNumber(), - init_InvestorETHBal.sub(gasCost2).toNumber(), + final_InvestorETHBal.toString(), + init_InvestorETHBal.sub(gasCost2).toString(), "Investor ETH Balance not changed as expected" ); assert.equal( - final_InvestorPOLYBal.toNumber(), - init_InvestorPOLYBal.toNumber(), + final_InvestorPOLYBal.toString(), + init_InvestorPOLYBal.toString(), "Investor POLY Balance not changed as expected" ); assert.equal( - final_InvestorDAIBal.toNumber(), - init_InvestorDAIBal.sub(investment_DAI).toNumber(), + final_InvestorDAIBal.toString(), + init_InvestorDAIBal.sub(investment_DAI).toString(), "Investor POLY Balance not changed as expected" ); assert.equal( - final_STOTokenSold.toNumber(), - init_STOTokenSold.add(investment_Token).toNumber(), + final_STOTokenSold.toString(), + init_STOTokenSold.add(investment_Token).toString(), "STO Token Sold not changed as expected" ); - assert.equal(final_STOETHBal.toNumber(), init_STOETHBal.toNumber(), "STO ETH Balance not changed as expected"); - assert.equal(final_STOPOLYBal.toNumber(), init_STOPOLYBal.toNumber(), "STO POLY Balance not changed as expected"); - assert.equal(final_RaisedETH.toNumber(), init_RaisedETH.toNumber(), "Raised ETH not changed as expected"); - assert.equal(final_RaisedPOLY.toNumber(), init_RaisedPOLY.toNumber(), "Raised POLY not changed as expected"); - assert.equal(final_RaisedDAI.toNumber(), init_RaisedDAI.add(investment_DAI).toNumber(), "Raised DAI not changed as expected"); - assert.equal(final_WalletETHBal.toNumber(), init_WalletETHBal.toNumber(), "Wallet ETH Balance not changed as expected"); - assert.equal(final_WalletPOLYBal.toNumber(), init_WalletPOLYBal.toNumber(), "Wallet POLY Balance not changed as expected"); + assert.equal(final_STOETHBal.toString(), init_STOETHBal.toString(), "STO ETH Balance not changed as expected"); + assert.equal(final_STOPOLYBal.toString(), init_STOPOLYBal.toString(), "STO POLY Balance not changed as expected"); + assert.equal(final_RaisedETH.toString(), init_RaisedETH.toString(), "Raised ETH not changed as expected"); + assert.equal(final_RaisedPOLY.toString(), init_RaisedPOLY.toString(), "Raised POLY not changed as expected"); + assert.equal(final_RaisedDAI.toString(), init_RaisedDAI.add(investment_DAI).toString(), "Raised DAI not changed as expected"); + assert.equal(final_WalletETHBal.toString(), init_WalletETHBal.toString(), "Wallet ETH Balance not changed as expected"); + assert.equal(final_WalletPOLYBal.toString(), init_WalletPOLYBal.toString(), "Wallet POLY Balance not changed as expected"); assert.equal( - final_WalletDAIBal.toNumber(), - init_WalletDAIBal.add(investment_DAI).toNumber(), + final_WalletDAIBal.toString(), + init_WalletDAIBal.add(investment_DAI).toString(), "Wallet POLY Balance not changed as expected" ); // Additional Checks - assert.equal((await I_USDTieredSTO_Array[stoId].currentTier.call()).toNumber(), endTier, "currentTier not changed as expected"); + assert.equal((await I_USDTieredSTO_Array[stoId].currentTier.call()).toString(), endTier, "currentTier not changed as expected"); }); it("should successfully buy across tiers for ACCREDITED POLY", async () => { @@ -2789,12 +2795,12 @@ contract("USDTieredSTO", accounts => { let endTier = 5; assert.equal( - (await I_USDTieredSTO_Array[stoId].currentTier.call()).toNumber(), + (await I_USDTieredSTO_Array[stoId].currentTier.call()).toString(), startTier, "currentTier not changed as expected" ); - let delta_Token = new BigNumber(5).mul(10 ** 18); // Token + let delta_Token = new BN(5).mul(e18); // Token let polyTier0 = await convert(stoId, startTier, false, "TOKEN", "POLY", delta_Token); let polyTier1 = await convert(stoId, endTier, false, "TOKEN", "POLY", delta_Token); @@ -2807,77 +2813,77 @@ contract("USDTieredSTO", accounts => { // Process investment let init_TokenSupply = await I_SecurityToken.totalSupply(); let init_InvestorTokenBal = await I_SecurityToken.balanceOf(ACCREDITED1); - let init_InvestorETHBal = new BigNumber(await web3.eth.getBalance(ACCREDITED1)); + let init_InvestorETHBal = new BN(await web3.eth.getBalance(ACCREDITED1)); let init_InvestorPOLYBal = await I_PolyToken.balanceOf(ACCREDITED1); let init_STOTokenSold = await I_USDTieredSTO_Array[stoId].getTokensSold(); - let init_STOETHBal = new BigNumber(await web3.eth.getBalance(I_USDTieredSTO_Array[stoId].address)); + let init_STOETHBal = new BN(await web3.eth.getBalance(I_USDTieredSTO_Array[stoId].address)); let init_STOPOLYBal = await I_PolyToken.balanceOf(I_USDTieredSTO_Array[stoId].address); let init_RaisedETH = await I_USDTieredSTO_Array[stoId].fundsRaised.call(ETH); let init_RaisedPOLY = await I_USDTieredSTO_Array[stoId].fundsRaised.call(POLY); - let init_WalletETHBal = new BigNumber(await web3.eth.getBalance(WALLET)); + let init_WalletETHBal = new BN(await web3.eth.getBalance(WALLET)); let init_WalletPOLYBal = await I_PolyToken.balanceOf(WALLET); let tx2 = await I_USDTieredSTO_Array[stoId].buyWithPOLY(ACCREDITED1, investment_POLY, { from: ACCREDITED1, gasPrice: GAS_PRICE }); - let gasCost2 = new BigNumber(GAS_PRICE).mul(tx2.receipt.gasUsed); - console.log(" Gas buyWithPOLY: ".grey + tx2.receipt.gasUsed.toString().grey); + let gasCost2 = new BN(GAS_PRICE).mul(new BN(tx2.receipt.gasUsed)); + console.log(" Gas buyWithPOLY: ".grey + new BN(tx2.receipt.gasUsed).toString().grey); let final_TokenSupply = await I_SecurityToken.totalSupply(); let final_InvestorTokenBal = await I_SecurityToken.balanceOf(ACCREDITED1); - let final_InvestorETHBal = new BigNumber(await web3.eth.getBalance(ACCREDITED1)); + let final_InvestorETHBal = new BN(await web3.eth.getBalance(ACCREDITED1)); let final_InvestorPOLYBal = await I_PolyToken.balanceOf(ACCREDITED1); let final_STOTokenSold = await I_USDTieredSTO_Array[stoId].getTokensSold(); - let final_STOETHBal = new BigNumber(await web3.eth.getBalance(I_USDTieredSTO_Array[stoId].address)); + let final_STOETHBal = new BN(await web3.eth.getBalance(I_USDTieredSTO_Array[stoId].address)); let final_STOPOLYBal = await I_PolyToken.balanceOf(I_USDTieredSTO_Array[stoId].address); let final_RaisedETH = await I_USDTieredSTO_Array[stoId].fundsRaised.call(ETH); let final_RaisedPOLY = await I_USDTieredSTO_Array[stoId].fundsRaised.call(POLY); - let final_WalletETHBal = new BigNumber(await web3.eth.getBalance(WALLET)); + let final_WalletETHBal = new BN(await web3.eth.getBalance(WALLET)); let final_WalletPOLYBal = await I_PolyToken.balanceOf(WALLET); assert.equal( - final_TokenSupply.toNumber(), - init_TokenSupply.add(investment_Token).toNumber(), + final_TokenSupply.toString(), + init_TokenSupply.add(investment_Token).toString(), "Token Supply not changed as expected" ); assert.equal( - final_InvestorTokenBal.toNumber(), - init_InvestorTokenBal.add(investment_Token).toNumber(), + final_InvestorTokenBal.toString(), + init_InvestorTokenBal.add(investment_Token).toString(), "Investor Token Balance not changed as expected" ); assert.equal( - final_InvestorETHBal.toNumber(), - init_InvestorETHBal.sub(gasCost2).toNumber(), + final_InvestorETHBal.toString(), + init_InvestorETHBal.sub(gasCost2).toString(), "Investor ETH Balance not changed as expected" ); assert.equal( - final_InvestorPOLYBal.toNumber(), - init_InvestorPOLYBal.sub(investment_POLY).toNumber(), + final_InvestorPOLYBal.toString(), + init_InvestorPOLYBal.sub(investment_POLY).toString(), "Investor POLY Balance not changed as expected" ); assert.equal( - final_STOTokenSold.toNumber(), - init_STOTokenSold.add(investment_Token).toNumber(), + final_STOTokenSold.toString(), + init_STOTokenSold.add(investment_Token).toString(), "STO Token Sold not changed as expected" ); - assert.equal(final_STOETHBal.toNumber(), init_STOETHBal.toNumber(), "STO ETH Balance not changed as expected"); - assert.equal(final_STOPOLYBal.toNumber(), init_STOPOLYBal.toNumber(), "STO POLY Balance not changed as expected"); - assert.equal(final_RaisedETH.toNumber(), init_RaisedETH.toNumber(), "Raised ETH not changed as expected"); + assert.equal(final_STOETHBal.toString(), init_STOETHBal.toString(), "STO ETH Balance not changed as expected"); + assert.equal(final_STOPOLYBal.toString(), init_STOPOLYBal.toString(), "STO POLY Balance not changed as expected"); + assert.equal(final_RaisedETH.toString(), init_RaisedETH.toString(), "Raised ETH not changed as expected"); assert.equal( - final_RaisedPOLY.toNumber(), - init_RaisedPOLY.add(investment_POLY).toNumber(), + final_RaisedPOLY.toString(), + init_RaisedPOLY.add(investment_POLY).toString(), "Raised POLY not changed as expected" ); - assert.equal(final_WalletETHBal.toNumber(), init_WalletETHBal.toNumber(), "Wallet ETH Balance not changed as expected"); + assert.equal(final_WalletETHBal.toString(), init_WalletETHBal.toString(), "Wallet ETH Balance not changed as expected"); assert.equal( - final_WalletPOLYBal.toNumber(), - init_WalletPOLYBal.add(investment_POLY).toNumber(), + final_WalletPOLYBal.toString(), + init_WalletPOLYBal.add(investment_POLY).toString(), "Wallet POLY Balance not changed as expected" ); // Additional Checks - assert.equal((await I_USDTieredSTO_Array[stoId].currentTier.call()).toNumber(), endTier, "currentTier not changed as expected"); + assert.equal((await I_USDTieredSTO_Array[stoId].currentTier.call()).toString(), endTier, "currentTier not changed as expected"); }); it("should buy out the rest of the sto", async () => { @@ -2885,9 +2891,9 @@ contract("USDTieredSTO", accounts => { let tierId = 5; let minted = (await I_USDTieredSTO_Array[stoId].tiers.call(tierId))[4]; - console.log(minted.toNumber() + ":" + _tokensPerTierTotal[stoId][tierId]); + console.log(minted.toString() + ":" + _tokensPerTierTotal[stoId][tierId]); let investment_Token = _tokensPerTierTotal[stoId][tierId].sub(minted); - console.log(investment_Token.toNumber()); + console.log(investment_Token.toString()); let investment_ETH = await convert(stoId, tierId, false, "TOKEN", "ETH", investment_Token); let init_TokenSupply = await I_SecurityToken.totalSupply(); @@ -2906,28 +2912,28 @@ contract("USDTieredSTO", accounts => { let final_STOTokenSold = await I_USDTieredSTO_Array[stoId].getTokensSold(); assert.equal( - final_TokenSupply.toNumber(), - init_TokenSupply.add(investment_Token).toNumber(), + final_TokenSupply.toString(), + init_TokenSupply.add(investment_Token).toString(), "Token Supply not changed as expected" ); assert.equal( - final_InvestorTokenBal.toNumber(), - init_InvestorTokenBal.add(investment_Token).toNumber(), + final_InvestorTokenBal.toString(), + init_InvestorTokenBal.add(investment_Token).toString(), "Investor Token Balance not changed as expected" ); assert.equal( - final_STOTokenSold.toNumber(), - init_STOTokenSold.add(investment_Token).toNumber(), + final_STOTokenSold.toString(), + init_STOTokenSold.add(investment_Token).toString(), "STO Token Sold not changed as expected" ); - // assert.equal((await I_USDTieredSTO_Array[1].getTokensMinted()).toNumber(), _tokensPerTierTotal[1].reduce((a, b) => a + b, 0).toNumber(), "STO Token Sold not changed as expected"); + // assert.equal((await I_USDTieredSTO_Array[1].getTokensMinted()).toString(), _tokensPerTierTotal[1].reduce((a, b) => a + b, 0).toString(), "STO Token Sold not changed as expected"); }); it("should fail and revert when all tiers sold out", async () => { let stoId = 1; let tierId = 4; - let investment_Token = new BigNumber(5).mul(10 ** 18); + let investment_Token = new BN(5).mul(e18); let investment_USD = await convert(stoId, tierId, false, "TOKEN", "USD", investment_Token); let investment_ETH = await convert(stoId, tierId, false, "TOKEN", "ETH", investment_Token); let investment_POLY = await convert(stoId, tierId, false, "TOKEN", "POLY", investment_Token); @@ -2983,16 +2989,16 @@ contract("USDTieredSTO", accounts => { let tierId = 4; // set new exchange rates - let high_USDETH = new BigNumber(1000).mul(10 ** 18); // 1000 USD per ETH - let high_USDPOLY = new BigNumber(50).mul(10 ** 16); // 0.5 USD per POLY - let low_USDETH = new BigNumber(250).mul(10 ** 18); // 250 USD per ETH - let low_USDPOLY = new BigNumber(20).mul(10 ** 16); // 0.2 USD per POLY + let high_USDETH = new BN(1000).mul(e18); // 1000 USD per ETH + let high_USDPOLY = new BN(50).mul(e16); // 0.5 USD per POLY + let low_USDETH = new BN(250).mul(e18); // 250 USD per ETH + let low_USDPOLY = new BN(20).mul(e16); // 0.2 USD per POLY - let investment_USD = new BigNumber(web3.utils.toWei("50")); // USD - let investment_ETH_high = investment_USD.div(high_USDETH).mul(10 ** 18); // USD / USD/ETH = ETH - let investment_POLY_high = investment_USD.div(high_USDPOLY).mul(10 ** 18); // USD / USD/POLY = POLY - let investment_ETH_low = investment_USD.div(low_USDETH).mul(10 ** 18); // USD / USD/ETH = ETH - let investment_POLY_low = investment_USD.div(low_USDPOLY).mul(10 ** 18); // USD / USD/POLY = POLY + let investment_USD = new BN(web3.utils.toWei("50")); // USD + let investment_ETH_high = investment_USD.div(high_USDETH).mul(e18); // USD / USD/ETH = ETH + let investment_POLY_high = investment_USD.div(high_USDPOLY).mul(e18); // USD / USD/POLY = POLY + let investment_ETH_low = investment_USD.div(low_USDETH).mul(e18); // USD / USD/ETH = ETH + let investment_POLY_low = investment_USD.div(low_USDPOLY).mul(e18); // USD / USD/POLY = POLY await I_PolyToken.getTokens(investment_POLY_low, NONACCREDITED1); await I_PolyToken.approve(I_USDTieredSTO_Array[stoId].address, investment_POLY_low, { from: NONACCREDITED1 }); @@ -3074,22 +3080,22 @@ contract("USDTieredSTO", accounts => { let stoId = 2; let tierId = 0; - let investment_Token = new BigNumber(5).mul(10 ** 18); + let investment_Token = new BN(5).mul(e18); let investment_USD = await convert(stoId, tierId, false, "TOKEN", "USD", investment_Token); let investment_ETH = await convert(stoId, tierId, false, "TOKEN", "ETH", investment_Token); let investment_POLY = await convert(stoId, tierId, false, "TOKEN", "POLY", investment_Token); let init_TokenSupply = await I_SecurityToken.totalSupply(); let init_InvestorTokenBal = await I_SecurityToken.balanceOf(NONACCREDITED1); - let init_InvestorETHBal = new BigNumber(await web3.eth.getBalance(NONACCREDITED1)); + let init_InvestorETHBal = new BN(await web3.eth.getBalance(NONACCREDITED1)); let init_InvestorPOLYBal = await I_PolyToken.balanceOf(NONACCREDITED1); let init_STOTokenSold = await I_USDTieredSTO_Array[stoId].getTokensSold(); - let init_STOETHBal = new BigNumber(await web3.eth.getBalance(I_USDTieredSTO_Array[stoId].address)); + let init_STOETHBal = new BN(await web3.eth.getBalance(I_USDTieredSTO_Array[stoId].address)); let init_STOPOLYBal = await I_PolyToken.balanceOf(I_USDTieredSTO_Array[stoId].address); let init_RaisedUSD = await I_USDTieredSTO_Array[stoId].fundsRaisedUSD.call(); let init_RaisedETH = await I_USDTieredSTO_Array[stoId].fundsRaised.call(ETH); let init_RaisedPOLY = await I_USDTieredSTO_Array[stoId].fundsRaised.call(POLY); - let init_WalletETHBal = new BigNumber(await web3.eth.getBalance(WALLET)); + let init_WalletETHBal = new BN(await web3.eth.getBalance(WALLET)); let init_WalletPOLYBal = await I_PolyToken.balanceOf(WALLET); let tx1 = await web3.eth.sendTransaction({ @@ -3097,99 +3103,99 @@ contract("USDTieredSTO", accounts => { to: I_USDTieredSTO_Array[stoId].address, value: investment_ETH, gasPrice: GAS_PRICE, - gas: 1000000 + gas: 7000000 }); - let gasCost1 = new BigNumber(GAS_PRICE).mul(tx1.gasUsed); - console.log(" Gas fallback purchase: ".grey + tx1.gasUsed.toString().grey); + let gasCost1 = new BN(GAS_PRICE).mul(new BN(tx1.gasUsed)); + console.log(" Gas fallback purchase: ".grey + new BN(tx1.gasUsed).toString().grey); let final_TokenSupply = await I_SecurityToken.totalSupply(); let final_InvestorTokenBal = await I_SecurityToken.balanceOf(NONACCREDITED1); - let final_InvestorETHBal = new BigNumber(await web3.eth.getBalance(NONACCREDITED1)); + let final_InvestorETHBal = new BN(await web3.eth.getBalance(NONACCREDITED1)); let final_InvestorPOLYBal = await I_PolyToken.balanceOf(NONACCREDITED1); let final_STOTokenSold = await I_USDTieredSTO_Array[stoId].getTokensSold(); - let final_STOETHBal = new BigNumber(await web3.eth.getBalance(I_USDTieredSTO_Array[stoId].address)); + let final_STOETHBal = new BN(await web3.eth.getBalance(I_USDTieredSTO_Array[stoId].address)); let final_STOPOLYBal = await I_PolyToken.balanceOf(I_USDTieredSTO_Array[stoId].address); let final_RaisedUSD = await I_USDTieredSTO_Array[stoId].fundsRaisedUSD.call(); let final_RaisedETH = await I_USDTieredSTO_Array[stoId].fundsRaised.call(ETH); let final_RaisedPOLY = await I_USDTieredSTO_Array[stoId].fundsRaised.call(POLY); - let final_WalletETHBal = new BigNumber(await web3.eth.getBalance(WALLET)); + let final_WalletETHBal = new BN(await web3.eth.getBalance(WALLET)); let final_WalletPOLYBal = await I_PolyToken.balanceOf(WALLET); assert.equal( - final_TokenSupply.toNumber(), - init_TokenSupply.add(investment_Token).toNumber(), + final_TokenSupply.toString(), + init_TokenSupply.add(investment_Token).toString(), "Token Supply not changed as expected" ); assert.equal( - final_InvestorTokenBal.toNumber(), - init_InvestorTokenBal.add(investment_Token).toNumber(), + final_InvestorTokenBal.toString(), + init_InvestorTokenBal.add(investment_Token).toString(), "Investor Token Balance not changed as expected" ); assert.equal( - final_InvestorETHBal.toNumber(), + final_InvestorETHBal.toString(), init_InvestorETHBal .sub(gasCost1) .sub(investment_ETH) - .toNumber(), + .toString(), "Investor ETH Balance not changed as expected" ); assert.equal( - final_InvestorPOLYBal.toNumber(), - init_InvestorPOLYBal.toNumber(), + final_InvestorPOLYBal.toString(), + init_InvestorPOLYBal.toString(), "Investor POLY Balance not changed as expected" ); assert.equal( - final_STOTokenSold.toNumber(), - init_STOTokenSold.add(investment_Token).toNumber(), + final_STOTokenSold.toString(), + init_STOTokenSold.add(investment_Token).toString(), "STO Token Sold not changed as expected" ); - assert.equal(final_STOETHBal.toNumber(), init_STOETHBal.toNumber(), "STO ETH Balance not changed as expected"); - assert.equal(final_STOPOLYBal.toNumber(), init_STOPOLYBal.toNumber(), "STO POLY Balance not changed as expected"); - assert.equal(final_RaisedUSD.toNumber(), init_RaisedUSD.add(investment_USD).toNumber(), "Raised USD not changed as expected"); - assert.equal(final_RaisedETH.toNumber(), init_RaisedETH.add(investment_ETH).toNumber(), "Raised ETH not changed as expected"); - assert.equal(final_RaisedPOLY.toNumber(), init_RaisedPOLY.toNumber(), "Raised POLY not changed as expected"); + assert.equal(final_STOETHBal.toString(), init_STOETHBal.toString(), "STO ETH Balance not changed as expected"); + assert.equal(final_STOPOLYBal.toString(), init_STOPOLYBal.toString(), "STO POLY Balance not changed as expected"); + assert.equal(final_RaisedUSD.toString(), init_RaisedUSD.add(investment_USD).toString(), "Raised USD not changed as expected"); + assert.equal(final_RaisedETH.toString(), init_RaisedETH.add(investment_ETH).toString(), "Raised ETH not changed as expected"); + assert.equal(final_RaisedPOLY.toString(), init_RaisedPOLY.toString(), "Raised POLY not changed as expected"); assert.equal( - final_WalletETHBal.toNumber(), - init_WalletETHBal.add(investment_ETH).toNumber(), + final_WalletETHBal.toString(), + init_WalletETHBal.add(investment_ETH).toString(), "Wallet ETH Balance not changed as expected" ); - assert.equal(final_WalletPOLYBal.toNumber(), init_WalletPOLYBal.toNumber(), "Wallet POLY Balance not changed as expected"); + assert.equal(final_WalletPOLYBal.toString(), init_WalletPOLYBal.toString(), "Wallet POLY Balance not changed as expected"); // Additional checks on getters - assert.equal((await I_USDTieredSTO_Array[stoId].investorCount.call()).toNumber(), 1, "Investor count not changed as expected"); + assert.equal((await I_USDTieredSTO_Array[stoId].investorCount.call()).toString(), 1, "Investor count not changed as expected"); assert.equal( - (await I_USDTieredSTO_Array[stoId].getTokensSold()).toNumber(), - investment_Token.toNumber(), + (await I_USDTieredSTO_Array[stoId].getTokensSold()).toString(), + investment_Token.toString(), "getTokensSold not changed as expected" ); assert.equal( - (await I_USDTieredSTO_Array[stoId].getTokensMinted()).toNumber(), - investment_Token.toNumber(), + (await I_USDTieredSTO_Array[stoId].getTokensMinted()).toString(), + investment_Token.toString(), "getTokensMinted not changed as expected" ); assert.equal( - (await I_USDTieredSTO_Array[stoId].getTokensSoldFor(ETH)).toNumber(), - investment_Token.toNumber(), + (await I_USDTieredSTO_Array[stoId].getTokensSoldFor(ETH)).toString(), + investment_Token.toString(), "getTokensSoldForETH not changed as expected" ); assert.equal( - (await I_USDTieredSTO_Array[stoId].getTokensSoldFor(POLY)).toNumber(), - 0, + (await I_USDTieredSTO_Array[stoId].getTokensSoldFor(POLY)).toString(), + new BN(0), "getTokensSoldForPOLY not changed as expected" ); assert.equal( - (await I_USDTieredSTO_Array[stoId].investorInvestedUSD.call(NONACCREDITED1)).toNumber(), - investment_USD.toNumber(), + (await I_USDTieredSTO_Array[stoId].investorInvestedUSD.call(NONACCREDITED1)).toString(), + investment_USD.toString(), "investorInvestedUSD not changed as expected" ); assert.equal( - (await I_USDTieredSTO_Array[stoId].investorInvested.call(NONACCREDITED1, ETH)).toNumber(), - investment_ETH.toNumber(), + (await I_USDTieredSTO_Array[stoId].investorInvested.call(NONACCREDITED1, ETH)).toString(), + investment_ETH.toString(), "investorInvestedETH not changed as expected" ); assert.equal( - (await I_USDTieredSTO_Array[stoId].investorInvested.call(NONACCREDITED1, POLY)).toNumber(), - 0, + (await I_USDTieredSTO_Array[stoId].investorInvested.call(NONACCREDITED1, POLY)).toString(), + new BN(0), "investorInvestedPOLY not changed as expected" ); }); @@ -3198,21 +3204,21 @@ contract("USDTieredSTO", accounts => { let stoId = 2; let tierId = 0; - let investment_Token = new BigNumber(5).mul(10 ** 18); + let investment_Token = new BN(5).mul(e18); let investment_USD = await convert(stoId, tierId, false, "TOKEN", "USD", investment_Token); let investment_ETH = await convert(stoId, tierId, false, "TOKEN", "ETH", investment_Token); let investment_POLY = await convert(stoId, tierId, false, "TOKEN", "POLY", investment_Token); let init_TokenSupply = await I_SecurityToken.totalSupply(); let init_InvestorTokenBal = await I_SecurityToken.balanceOf(NONACCREDITED1); - let init_InvestorETHBal = new BigNumber(await web3.eth.getBalance(NONACCREDITED1)); + let init_InvestorETHBal = new BN(await web3.eth.getBalance(NONACCREDITED1)); let init_InvestorPOLYBal = await I_PolyToken.balanceOf(NONACCREDITED1); let init_STOTokenSold = await I_USDTieredSTO_Array[stoId].getTokensSold(); - let init_STOETHBal = new BigNumber(await web3.eth.getBalance(I_USDTieredSTO_Array[stoId].address)); + let init_STOETHBal = new BN(await web3.eth.getBalance(I_USDTieredSTO_Array[stoId].address)); let init_STOPOLYBal = await I_PolyToken.balanceOf(I_USDTieredSTO_Array[stoId].address); let init_RaisedETH = await I_USDTieredSTO_Array[stoId].fundsRaised.call(ETH); let init_RaisedPOLY = await I_USDTieredSTO_Array[stoId].fundsRaised.call(POLY); - let init_WalletETHBal = new BigNumber(await web3.eth.getBalance(WALLET)); + let init_WalletETHBal = new BN(await web3.eth.getBalance(WALLET)); let init_WalletPOLYBal = await I_PolyToken.balanceOf(WALLET); let tx1 = await I_USDTieredSTO_Array[stoId].buyWithETH(NONACCREDITED1, { @@ -3220,66 +3226,66 @@ contract("USDTieredSTO", accounts => { value: investment_ETH, gasPrice: GAS_PRICE }); - let gasCost1 = new BigNumber(GAS_PRICE).mul(tx1.receipt.gasUsed); - console.log(" Gas buyWithETH: ".grey + tx1.receipt.gasUsed.toString().grey); + let gasCost1 = new BN(GAS_PRICE).mul(new BN(tx1.receipt.gasUsed)); + console.log(" Gas buyWithETH: ".grey + new BN(tx1.receipt.gasUsed).toString().grey); let final_TokenSupply = await I_SecurityToken.totalSupply(); let final_InvestorTokenBal = await I_SecurityToken.balanceOf(NONACCREDITED1); - let final_InvestorETHBal = new BigNumber(await web3.eth.getBalance(NONACCREDITED1)); + let final_InvestorETHBal = new BN(await web3.eth.getBalance(NONACCREDITED1)); let final_InvestorPOLYBal = await I_PolyToken.balanceOf(NONACCREDITED1); let final_STOTokenSold = await I_USDTieredSTO_Array[stoId].getTokensSold(); - let final_STOETHBal = new BigNumber(await web3.eth.getBalance(I_USDTieredSTO_Array[stoId].address)); + let final_STOETHBal = new BN(await web3.eth.getBalance(I_USDTieredSTO_Array[stoId].address)); let final_STOPOLYBal = await I_PolyToken.balanceOf(I_USDTieredSTO_Array[stoId].address); let final_RaisedETH = await I_USDTieredSTO_Array[stoId].fundsRaised.call(ETH); let final_RaisedPOLY = await I_USDTieredSTO_Array[stoId].fundsRaised.call(POLY); - let final_WalletETHBal = new BigNumber(await web3.eth.getBalance(WALLET)); + let final_WalletETHBal = new BN(await web3.eth.getBalance(WALLET)); let final_WalletPOLYBal = await I_PolyToken.balanceOf(WALLET); assert.equal( - final_TokenSupply.toNumber(), - init_TokenSupply.add(investment_Token).toNumber(), + final_TokenSupply.toString(), + init_TokenSupply.add(investment_Token).toString(), "Token Supply not changed as expected" ); assert.equal( - final_InvestorTokenBal.toNumber(), - init_InvestorTokenBal.add(investment_Token).toNumber(), + final_InvestorTokenBal.toString(), + init_InvestorTokenBal.add(investment_Token).toString(), "Investor Token Balance not changed as expected" ); assert.equal( - final_InvestorETHBal.toNumber(), + final_InvestorETHBal.toString(), init_InvestorETHBal .sub(gasCost1) .sub(investment_ETH) - .toNumber(), + .toString(), "Investor ETH Balance not changed as expected" ); assert.equal( - final_InvestorPOLYBal.toNumber(), - init_InvestorPOLYBal.toNumber(), + final_InvestorPOLYBal.toString(), + init_InvestorPOLYBal.toString(), "Investor POLY Balance not changed as expected" ); assert.equal( - final_STOTokenSold.toNumber(), - init_STOTokenSold.add(investment_Token).toNumber(), + final_STOTokenSold.toString(), + init_STOTokenSold.add(investment_Token).toString(), "STO Token Sold not changed as expected" ); - assert.equal(final_STOETHBal.toNumber(), init_STOETHBal.toNumber(), "STO ETH Balance not changed as expected"); - assert.equal(final_STOPOLYBal.toNumber(), init_STOPOLYBal.toNumber(), "STO POLY Balance not changed as expected"); - assert.equal(final_RaisedETH.toNumber(), init_RaisedETH.add(investment_ETH).toNumber(), "Raised ETH not changed as expected"); - assert.equal(final_RaisedPOLY.toNumber(), init_RaisedPOLY.toNumber(), "Raised POLY not changed as expected"); + assert.equal(final_STOETHBal.toString(), init_STOETHBal.toString(), "STO ETH Balance not changed as expected"); + assert.equal(final_STOPOLYBal.toString(), init_STOPOLYBal.toString(), "STO POLY Balance not changed as expected"); + assert.equal(final_RaisedETH.toString(), init_RaisedETH.add(investment_ETH).toString(), "Raised ETH not changed as expected"); + assert.equal(final_RaisedPOLY.toString(), init_RaisedPOLY.toString(), "Raised POLY not changed as expected"); assert.equal( - final_WalletETHBal.toNumber(), - init_WalletETHBal.add(investment_ETH).toNumber(), + final_WalletETHBal.toString(), + init_WalletETHBal.add(investment_ETH).toString(), "Wallet ETH Balance not changed as expected" ); - assert.equal(final_WalletPOLYBal.toNumber(), init_WalletPOLYBal.toNumber(), "Wallet POLY Balance not changed as expected"); + assert.equal(final_WalletPOLYBal.toString(), init_WalletPOLYBal.toString(), "Wallet POLY Balance not changed as expected"); }); it("should successfully buy using buyWithPOLY at tier 0 for NONACCREDITED1", async () => { let stoId = 2; let tierId = 0; - let investment_Token = new BigNumber(5).mul(10 ** 18); + let investment_Token = new BN(5).mul(e18); let investment_USD = await convert(stoId, tierId, true, "TOKEN", "USD", investment_Token); let investment_ETH = await convert(stoId, tierId, true, "TOKEN", "ETH", investment_Token); let investment_POLY = await convert(stoId, tierId, true, "TOKEN", "POLY", investment_Token); @@ -3289,14 +3295,14 @@ contract("USDTieredSTO", accounts => { let init_TokenSupply = await I_SecurityToken.totalSupply(); let init_InvestorTokenBal = await I_SecurityToken.balanceOf(NONACCREDITED1); - let init_InvestorETHBal = new BigNumber(await web3.eth.getBalance(NONACCREDITED1)); + let init_InvestorETHBal = new BN(await web3.eth.getBalance(NONACCREDITED1)); let init_InvestorPOLYBal = await I_PolyToken.balanceOf(NONACCREDITED1); let init_STOTokenSold = await I_USDTieredSTO_Array[stoId].getTokensSold(); - let init_STOETHBal = new BigNumber(await web3.eth.getBalance(I_USDTieredSTO_Array[stoId].address)); + let init_STOETHBal = new BN(await web3.eth.getBalance(I_USDTieredSTO_Array[stoId].address)); let init_STOPOLYBal = await I_PolyToken.balanceOf(I_USDTieredSTO_Array[stoId].address); let init_RaisedETH = await I_USDTieredSTO_Array[stoId].fundsRaised.call(ETH); let init_RaisedPOLY = await I_USDTieredSTO_Array[stoId].fundsRaised.call(POLY); - let init_WalletETHBal = new BigNumber(await web3.eth.getBalance(WALLET)); + let init_WalletETHBal = new BN(await web3.eth.getBalance(WALLET)); let init_WalletPOLYBal = await I_PolyToken.balanceOf(WALLET); // Buy With POLY @@ -3304,58 +3310,58 @@ contract("USDTieredSTO", accounts => { from: NONACCREDITED1, gasPrice: GAS_PRICE }); - let gasCost2 = new BigNumber(GAS_PRICE).mul(tx2.receipt.gasUsed); - console.log(" Gas buyWithPOLY: ".grey + tx2.receipt.gasUsed.toString().grey); + let gasCost2 = new BN(GAS_PRICE).mul(new BN(tx2.receipt.gasUsed)); + console.log(" Gas buyWithPOLY: ".grey + new BN(tx2.receipt.gasUsed).toString().grey); let final_TokenSupply = await I_SecurityToken.totalSupply(); let final_InvestorTokenBal = await I_SecurityToken.balanceOf(NONACCREDITED1); - let final_InvestorETHBal = new BigNumber(await web3.eth.getBalance(NONACCREDITED1)); + let final_InvestorETHBal = new BN(await web3.eth.getBalance(NONACCREDITED1)); let final_InvestorPOLYBal = await I_PolyToken.balanceOf(NONACCREDITED1); let final_STOTokenSold = await I_USDTieredSTO_Array[stoId].getTokensSold(); - let final_STOETHBal = new BigNumber(await web3.eth.getBalance(I_USDTieredSTO_Array[stoId].address)); + let final_STOETHBal = new BN(await web3.eth.getBalance(I_USDTieredSTO_Array[stoId].address)); let final_STOPOLYBal = await I_PolyToken.balanceOf(I_USDTieredSTO_Array[stoId].address); let final_RaisedETH = await I_USDTieredSTO_Array[stoId].fundsRaised.call(ETH); let final_RaisedPOLY = await I_USDTieredSTO_Array[stoId].fundsRaised.call(POLY); - let final_WalletETHBal = new BigNumber(await web3.eth.getBalance(WALLET)); + let final_WalletETHBal = new BN(await web3.eth.getBalance(WALLET)); let final_WalletPOLYBal = await I_PolyToken.balanceOf(WALLET); assert.equal( - final_TokenSupply.toNumber(), - init_TokenSupply.add(investment_Token).toNumber(), + final_TokenSupply.toString(), + init_TokenSupply.add(investment_Token).toString(), "Token Supply not changed as expected" ); assert.equal( - final_InvestorTokenBal.toNumber(), - init_InvestorTokenBal.add(investment_Token).toNumber(), + final_InvestorTokenBal.toString(), + init_InvestorTokenBal.add(investment_Token).toString(), "Investor Token Balance not changed as expected" ); assert.equal( - final_InvestorETHBal.toNumber(), - init_InvestorETHBal.sub(gasCost2).toNumber(), + final_InvestorETHBal.toString(), + init_InvestorETHBal.sub(gasCost2).toString(), "Investor ETH Balance not changed as expected" ); assert.equal( - final_InvestorPOLYBal.toNumber(), - init_InvestorPOLYBal.sub(investment_POLY).toNumber(), + final_InvestorPOLYBal.toString(), + init_InvestorPOLYBal.sub(investment_POLY).toString(), "Investor POLY Balance not changed as expected" ); assert.equal( - final_STOTokenSold.toNumber(), - init_STOTokenSold.add(investment_Token).toNumber(), + final_STOTokenSold.toString(), + init_STOTokenSold.add(investment_Token).toString(), "STO Token Sold not changed as expected" ); - assert.equal(final_STOETHBal.toNumber(), init_STOETHBal.toNumber(), "STO ETH Balance not changed as expected"); - assert.equal(final_STOPOLYBal.toNumber(), init_STOPOLYBal.toNumber(), "STO POLY Balance not changed as expected"); - assert.equal(final_RaisedETH.toNumber(), init_RaisedETH.toNumber(), "Raised ETH not changed as expected"); + assert.equal(final_STOETHBal.toString(), init_STOETHBal.toString(), "STO ETH Balance not changed as expected"); + assert.equal(final_STOPOLYBal.toString(), init_STOPOLYBal.toString(), "STO POLY Balance not changed as expected"); + assert.equal(final_RaisedETH.toString(), init_RaisedETH.toString(), "Raised ETH not changed as expected"); assert.equal( - final_RaisedPOLY.toNumber(), - init_RaisedPOLY.add(investment_POLY).toNumber(), + final_RaisedPOLY.toString(), + init_RaisedPOLY.add(investment_POLY).toString(), "Raised POLY not changed as expected" ); - assert.equal(final_WalletETHBal.toNumber(), init_WalletETHBal.toNumber(), "Wallet ETH Balance not changed as expected"); + assert.equal(final_WalletETHBal.toString(), init_WalletETHBal.toString(), "Wallet ETH Balance not changed as expected"); assert.equal( - final_WalletPOLYBal.toNumber(), - init_WalletPOLYBal.add(investment_POLY).toNumber(), + final_WalletPOLYBal.toString(), + init_WalletPOLYBal.add(investment_POLY).toString(), "Wallet POLY Balance not changed as expected" ); }); @@ -3366,21 +3372,21 @@ contract("USDTieredSTO", accounts => { await I_USDTieredSTO_Array[stoId].changeAccredited([ACCREDITED1], [true], { from: ISSUER }); - let investment_Token = new BigNumber(5).mul(10 ** 18); + let investment_Token = new BN(5).mul(e18); let investment_USD = await convert(stoId, tierId, false, "TOKEN", "USD", investment_Token); let investment_ETH = await convert(stoId, tierId, false, "TOKEN", "ETH", investment_Token); let investment_POLY = await convert(stoId, tierId, false, "TOKEN", "POLY", investment_Token); let init_TokenSupply = await I_SecurityToken.totalSupply(); let init_InvestorTokenBal = await I_SecurityToken.balanceOf(ACCREDITED1); - let init_InvestorETHBal = new BigNumber(await web3.eth.getBalance(ACCREDITED1)); + let init_InvestorETHBal = new BN(await web3.eth.getBalance(ACCREDITED1)); let init_InvestorPOLYBal = await I_PolyToken.balanceOf(ACCREDITED1); let init_STOTokenSold = await I_USDTieredSTO_Array[stoId].getTokensSold(); - let init_STOETHBal = new BigNumber(await web3.eth.getBalance(I_USDTieredSTO_Array[stoId].address)); + let init_STOETHBal = new BN(await web3.eth.getBalance(I_USDTieredSTO_Array[stoId].address)); let init_STOPOLYBal = await I_PolyToken.balanceOf(I_USDTieredSTO_Array[stoId].address); let init_RaisedETH = await I_USDTieredSTO_Array[stoId].fundsRaised.call(ETH); let init_RaisedPOLY = await I_USDTieredSTO_Array[stoId].fundsRaised.call(POLY); - let init_WalletETHBal = new BigNumber(await web3.eth.getBalance(WALLET)); + let init_WalletETHBal = new BN(await web3.eth.getBalance(WALLET)); let init_WalletPOLYBal = await I_PolyToken.balanceOf(WALLET); let tx1 = await web3.eth.sendTransaction({ @@ -3388,82 +3394,82 @@ contract("USDTieredSTO", accounts => { to: I_USDTieredSTO_Array[stoId].address, value: investment_ETH, gasPrice: GAS_PRICE, - gas: 1000000 + gas: 7000000 }); - let gasCost1 = new BigNumber(GAS_PRICE).mul(tx1.gasUsed); - console.log(" Gas fallback purchase: ".grey + tx1.gasUsed.toString().grey); + let gasCost1 = new BN(GAS_PRICE).mul(new BN(tx1.gasUsed)); + console.log(" Gas fallback purchase: ".grey + new BN(tx1.gasUsed).toString().grey); let final_TokenSupply = await I_SecurityToken.totalSupply(); let final_InvestorTokenBal = await I_SecurityToken.balanceOf(ACCREDITED1); - let final_InvestorETHBal = new BigNumber(await web3.eth.getBalance(ACCREDITED1)); + let final_InvestorETHBal = new BN(await web3.eth.getBalance(ACCREDITED1)); let final_InvestorPOLYBal = await I_PolyToken.balanceOf(ACCREDITED1); let final_STOTokenSold = await I_USDTieredSTO_Array[stoId].getTokensSold(); - let final_STOETHBal = new BigNumber(await web3.eth.getBalance(I_USDTieredSTO_Array[stoId].address)); + let final_STOETHBal = new BN(await web3.eth.getBalance(I_USDTieredSTO_Array[stoId].address)); let final_STOPOLYBal = await I_PolyToken.balanceOf(I_USDTieredSTO_Array[stoId].address); let final_RaisedETH = await I_USDTieredSTO_Array[stoId].fundsRaised.call(ETH); let final_RaisedPOLY = await I_USDTieredSTO_Array[stoId].fundsRaised.call(POLY); - let final_WalletETHBal = new BigNumber(await web3.eth.getBalance(WALLET)); + let final_WalletETHBal = new BN(await web3.eth.getBalance(WALLET)); let final_WalletPOLYBal = await I_PolyToken.balanceOf(WALLET); assert.equal( - final_TokenSupply.toNumber(), - init_TokenSupply.add(investment_Token).toNumber(), + final_TokenSupply.toString(), + init_TokenSupply.add(investment_Token).toString(), "Token Supply not changed as expected" ); assert.equal( - final_InvestorTokenBal.toNumber(), - init_InvestorTokenBal.add(investment_Token).toNumber(), + final_InvestorTokenBal.toString(), + init_InvestorTokenBal.add(investment_Token).toString(), "Investor Token Balance not changed as expected" ); assert.equal( - final_InvestorETHBal.toNumber(), + final_InvestorETHBal.toString(), init_InvestorETHBal .sub(gasCost1) .sub(investment_ETH) - .toNumber(), + .toString(), "Investor ETH Balance not changed as expected" ); assert.equal( - final_InvestorPOLYBal.toNumber(), - init_InvestorPOLYBal.toNumber(), + final_InvestorPOLYBal.toString(), + init_InvestorPOLYBal.toString(), "Investor POLY Balance not changed as expected" ); assert.equal( - final_STOTokenSold.toNumber(), - init_STOTokenSold.add(investment_Token).toNumber(), + final_STOTokenSold.toString(), + init_STOTokenSold.add(investment_Token).toString(), "STO Token Sold not changed as expected" ); - assert.equal(final_STOETHBal.toNumber(), init_STOETHBal.toNumber(), "STO ETH Balance not changed as expected"); - assert.equal(final_STOPOLYBal.toNumber(), init_STOPOLYBal.toNumber(), "STO POLY Balance not changed as expected"); - assert.equal(final_RaisedETH.toNumber(), init_RaisedETH.add(investment_ETH).toNumber(), "Raised ETH not changed as expected"); - assert.equal(final_RaisedPOLY.toNumber(), init_RaisedPOLY.toNumber(), "Raised POLY not changed as expected"); + assert.equal(final_STOETHBal.toString(), init_STOETHBal.toString(), "STO ETH Balance not changed as expected"); + assert.equal(final_STOPOLYBal.toString(), init_STOPOLYBal.toString(), "STO POLY Balance not changed as expected"); + assert.equal(final_RaisedETH.toString(), init_RaisedETH.add(investment_ETH).toString(), "Raised ETH not changed as expected"); + assert.equal(final_RaisedPOLY.toString(), init_RaisedPOLY.toString(), "Raised POLY not changed as expected"); assert.equal( - final_WalletETHBal.toNumber(), - init_WalletETHBal.add(investment_ETH).toNumber(), + final_WalletETHBal.toString(), + init_WalletETHBal.add(investment_ETH).toString(), "Wallet ETH Balance not changed as expected" ); - assert.equal(final_WalletPOLYBal.toNumber(), init_WalletPOLYBal.toNumber(), "Wallet POLY Balance not changed as expected"); + assert.equal(final_WalletPOLYBal.toString(), init_WalletPOLYBal.toString(), "Wallet POLY Balance not changed as expected"); }); it("should successfully buy using buyWithETH at tier 0 for ACCREDITED1", async () => { let stoId = 2; let tierId = 0; - let investment_Token = new BigNumber(5).mul(10 ** 18); + let investment_Token = new BN(5).mul(e18); let investment_USD = await convert(stoId, tierId, false, "TOKEN", "USD", investment_Token); let investment_ETH = await convert(stoId, tierId, false, "TOKEN", "ETH", investment_Token); let investment_POLY = await convert(stoId, tierId, false, "TOKEN", "POLY", investment_Token); let init_TokenSupply = await I_SecurityToken.totalSupply(); let init_InvestorTokenBal = await I_SecurityToken.balanceOf(ACCREDITED1); - let init_InvestorETHBal = new BigNumber(await web3.eth.getBalance(ACCREDITED1)); + let init_InvestorETHBal = new BN(await web3.eth.getBalance(ACCREDITED1)); let init_InvestorPOLYBal = await I_PolyToken.balanceOf(ACCREDITED1); let init_STOTokenSold = await I_USDTieredSTO_Array[stoId].getTokensSold(); - let init_STOETHBal = new BigNumber(await web3.eth.getBalance(I_USDTieredSTO_Array[stoId].address)); + let init_STOETHBal = new BN(await web3.eth.getBalance(I_USDTieredSTO_Array[stoId].address)); let init_STOPOLYBal = await I_PolyToken.balanceOf(I_USDTieredSTO_Array[stoId].address); let init_RaisedETH = await I_USDTieredSTO_Array[stoId].fundsRaised.call(ETH); let init_RaisedPOLY = await I_USDTieredSTO_Array[stoId].fundsRaised.call(POLY); - let init_WalletETHBal = new BigNumber(await web3.eth.getBalance(WALLET)); + let init_WalletETHBal = new BN(await web3.eth.getBalance(WALLET)); let init_WalletPOLYBal = await I_PolyToken.balanceOf(WALLET); let tx1 = await I_USDTieredSTO_Array[stoId].buyWithETH(ACCREDITED1, { @@ -3471,66 +3477,66 @@ contract("USDTieredSTO", accounts => { value: investment_ETH, gasPrice: GAS_PRICE }); - let gasCost1 = new BigNumber(GAS_PRICE).mul(tx1.receipt.gasUsed); - console.log(" Gas buyWithETH: ".grey + tx1.receipt.gasUsed.toString().grey); + let gasCost1 = new BN(GAS_PRICE).mul(new BN(tx1.receipt.gasUsed)); + console.log(" Gas buyWithETH: ".grey + new BN(tx1.receipt.gasUsed).toString().grey); let final_TokenSupply = await I_SecurityToken.totalSupply(); let final_InvestorTokenBal = await I_SecurityToken.balanceOf(ACCREDITED1); - let final_InvestorETHBal = new BigNumber(await web3.eth.getBalance(ACCREDITED1)); + let final_InvestorETHBal = new BN(await web3.eth.getBalance(ACCREDITED1)); let final_InvestorPOLYBal = await I_PolyToken.balanceOf(ACCREDITED1); let final_STOTokenSold = await I_USDTieredSTO_Array[stoId].getTokensSold(); - let final_STOETHBal = new BigNumber(await web3.eth.getBalance(I_USDTieredSTO_Array[stoId].address)); + let final_STOETHBal = new BN(await web3.eth.getBalance(I_USDTieredSTO_Array[stoId].address)); let final_STOPOLYBal = await I_PolyToken.balanceOf(I_USDTieredSTO_Array[stoId].address); let final_RaisedETH = await I_USDTieredSTO_Array[stoId].fundsRaised.call(ETH); let final_RaisedPOLY = await I_USDTieredSTO_Array[stoId].fundsRaised.call(POLY); - let final_WalletETHBal = new BigNumber(await web3.eth.getBalance(WALLET)); + let final_WalletETHBal = new BN(await web3.eth.getBalance(WALLET)); let final_WalletPOLYBal = await I_PolyToken.balanceOf(WALLET); assert.equal( - final_TokenSupply.toNumber(), - init_TokenSupply.add(investment_Token).toNumber(), + final_TokenSupply.toString(), + init_TokenSupply.add(investment_Token).toString(), "Token Supply not changed as expected" ); assert.equal( - final_InvestorTokenBal.toNumber(), - init_InvestorTokenBal.add(investment_Token).toNumber(), + final_InvestorTokenBal.toString(), + init_InvestorTokenBal.add(investment_Token).toString(), "Investor Token Balance not changed as expected" ); assert.equal( - final_InvestorETHBal.toNumber(), + final_InvestorETHBal.toString(), init_InvestorETHBal .sub(gasCost1) .sub(investment_ETH) - .toNumber(), + .toString(), "Investor ETH Balance not changed as expected" ); assert.equal( - final_InvestorPOLYBal.toNumber(), - init_InvestorPOLYBal.toNumber(), + final_InvestorPOLYBal.toString(), + init_InvestorPOLYBal.toString(), "Investor POLY Balance not changed as expected" ); assert.equal( - final_STOTokenSold.toNumber(), - init_STOTokenSold.add(investment_Token).toNumber(), + final_STOTokenSold.toString(), + init_STOTokenSold.add(investment_Token).toString(), "STO Token Sold not changed as expected" ); - assert.equal(final_STOETHBal.toNumber(), init_STOETHBal.toNumber(), "STO ETH Balance not changed as expected"); - assert.equal(final_STOPOLYBal.toNumber(), init_STOPOLYBal.toNumber(), "STO POLY Balance not changed as expected"); - assert.equal(final_RaisedETH.toNumber(), init_RaisedETH.add(investment_ETH).toNumber(), "Raised ETH not changed as expected"); - assert.equal(final_RaisedPOLY.toNumber(), init_RaisedPOLY.toNumber(), "Raised POLY not changed as expected"); + assert.equal(final_STOETHBal.toString(), init_STOETHBal.toString(), "STO ETH Balance not changed as expected"); + assert.equal(final_STOPOLYBal.toString(), init_STOPOLYBal.toString(), "STO POLY Balance not changed as expected"); + assert.equal(final_RaisedETH.toString(), init_RaisedETH.add(investment_ETH).toString(), "Raised ETH not changed as expected"); + assert.equal(final_RaisedPOLY.toString(), init_RaisedPOLY.toString(), "Raised POLY not changed as expected"); assert.equal( - final_WalletETHBal.toNumber(), - init_WalletETHBal.add(investment_ETH).toNumber(), + final_WalletETHBal.toString(), + init_WalletETHBal.add(investment_ETH).toString(), "Wallet ETH Balance not changed as expected" ); - assert.equal(final_WalletPOLYBal.toNumber(), init_WalletPOLYBal.toNumber(), "Wallet POLY Balance not changed as expected"); + assert.equal(final_WalletPOLYBal.toString(), init_WalletPOLYBal.toString(), "Wallet POLY Balance not changed as expected"); }); it("should successfully buy using buyWithPOLY at tier 0 for ACCREDITED1", async () => { let stoId = 2; let tierId = 0; - let investment_Token = new BigNumber(5).mul(10 ** 18); + let investment_Token = new BN(5).mul(e18); let investment_USD = await convert(stoId, tierId, true, "TOKEN", "USD", investment_Token); let investment_ETH = await convert(stoId, tierId, true, "TOKEN", "ETH", investment_Token); let investment_POLY = await convert(stoId, tierId, true, "TOKEN", "POLY", investment_Token); @@ -3549,14 +3555,14 @@ contract("USDTieredSTO", accounts => { let init_TokenSupply = await I_SecurityToken.totalSupply(); let init_InvestorTokenBal = await I_SecurityToken.balanceOf(ACCREDITED1); - let init_InvestorETHBal = new BigNumber(await web3.eth.getBalance(ACCREDITED1)); + let init_InvestorETHBal = new BN(await web3.eth.getBalance(ACCREDITED1)); let init_InvestorPOLYBal = await I_PolyToken.balanceOf(ACCREDITED1); let init_STOTokenSold = await I_USDTieredSTO_Array[stoId].getTokensSold(); - let init_STOETHBal = new BigNumber(await web3.eth.getBalance(I_USDTieredSTO_Array[stoId].address)); + let init_STOETHBal = new BN(await web3.eth.getBalance(I_USDTieredSTO_Array[stoId].address)); let init_STOPOLYBal = await I_PolyToken.balanceOf(I_USDTieredSTO_Array[stoId].address); let init_RaisedETH = await I_USDTieredSTO_Array[stoId].fundsRaised.call(ETH); let init_RaisedPOLY = await I_USDTieredSTO_Array[stoId].fundsRaised.call(POLY); - let init_WalletETHBal = new BigNumber(await web3.eth.getBalance(WALLET)); + let init_WalletETHBal = new BN(await web3.eth.getBalance(WALLET)); let init_WalletPOLYBal = await I_PolyToken.balanceOf(WALLET); // Buy With POLY @@ -3564,96 +3570,96 @@ contract("USDTieredSTO", accounts => { from: ACCREDITED1, gasPrice: GAS_PRICE }); - let gasCost2 = new BigNumber(GAS_PRICE).mul(tx2.receipt.gasUsed); - console.log(" Gas buyWithPOLY: ".grey + tx2.receipt.gasUsed.toString().grey); + let gasCost2 = new BN(GAS_PRICE).mul(new BN(tx2.receipt.gasUsed)); + console.log(" Gas buyWithPOLY: ".grey + new BN(tx2.receipt.gasUsed).toString().grey); let final_TokenSupply = await I_SecurityToken.totalSupply(); let final_InvestorTokenBal = await I_SecurityToken.balanceOf(ACCREDITED1); - let final_InvestorETHBal = new BigNumber(await web3.eth.getBalance(ACCREDITED1)); + let final_InvestorETHBal = new BN(await web3.eth.getBalance(ACCREDITED1)); let final_InvestorPOLYBal = await I_PolyToken.balanceOf(ACCREDITED1); let final_STOTokenSold = await I_USDTieredSTO_Array[stoId].getTokensSold(); - let final_STOETHBal = new BigNumber(await web3.eth.getBalance(I_USDTieredSTO_Array[stoId].address)); + let final_STOETHBal = new BN(await web3.eth.getBalance(I_USDTieredSTO_Array[stoId].address)); let final_STOPOLYBal = await I_PolyToken.balanceOf(I_USDTieredSTO_Array[stoId].address); let final_RaisedETH = await I_USDTieredSTO_Array[stoId].fundsRaised.call(ETH); let final_RaisedPOLY = await I_USDTieredSTO_Array[stoId].fundsRaised.call(POLY); - let final_WalletETHBal = new BigNumber(await web3.eth.getBalance(WALLET)); + let final_WalletETHBal = new BN(await web3.eth.getBalance(WALLET)); let final_WalletPOLYBal = await I_PolyToken.balanceOf(WALLET); assert.equal( - final_TokenSupply.toNumber(), - init_TokenSupply.add(investment_Token).toNumber(), + final_TokenSupply.toString(), + init_TokenSupply.add(investment_Token).toString(), "Token Supply not changed as expected" ); assert.equal( - final_InvestorTokenBal.toNumber(), - init_InvestorTokenBal.add(investment_Token).toNumber(), + final_InvestorTokenBal.toString(), + init_InvestorTokenBal.add(investment_Token).toString(), "Investor Token Balance not changed as expected" ); assert.equal( - final_InvestorETHBal.toNumber(), - init_InvestorETHBal.sub(gasCost2).toNumber(), + final_InvestorETHBal.toString(), + init_InvestorETHBal.sub(gasCost2).toString(), "Investor ETH Balance not changed as expected" ); assert.equal( - final_InvestorPOLYBal.toNumber(), - init_InvestorPOLYBal.sub(investment_POLY).toNumber(), + final_InvestorPOLYBal.toString(), + init_InvestorPOLYBal.sub(investment_POLY).toString(), "Investor POLY Balance not changed as expected" ); assert.equal( - final_STOTokenSold.toNumber(), - init_STOTokenSold.add(investment_Token).toNumber(), + final_STOTokenSold.toString(), + init_STOTokenSold.add(investment_Token).toString(), "STO Token Sold not changed as expected" ); - assert.equal(final_STOETHBal.toNumber(), init_STOETHBal.toNumber(), "STO ETH Balance not changed as expected"); - assert.equal(final_STOPOLYBal.toNumber(), init_STOPOLYBal.toNumber(), "STO POLY Balance not changed as expected"); - assert.equal(final_RaisedETH.toNumber(), init_RaisedETH.toNumber(), "Raised ETH not changed as expected"); + assert.equal(final_STOETHBal.toString(), init_STOETHBal.toString(), "STO ETH Balance not changed as expected"); + assert.equal(final_STOPOLYBal.toString(), init_STOPOLYBal.toString(), "STO POLY Balance not changed as expected"); + assert.equal(final_RaisedETH.toString(), init_RaisedETH.toString(), "Raised ETH not changed as expected"); assert.equal( - final_RaisedPOLY.toNumber(), - init_RaisedPOLY.add(investment_POLY).toNumber(), + final_RaisedPOLY.toString(), + init_RaisedPOLY.add(investment_POLY).toString(), "Raised POLY not changed as expected" ); - assert.equal(final_WalletETHBal.toNumber(), init_WalletETHBal.toNumber(), "Wallet ETH Balance not changed as expected"); + assert.equal(final_WalletETHBal.toString(), init_WalletETHBal.toString(), "Wallet ETH Balance not changed as expected"); assert.equal( - final_WalletPOLYBal.toNumber(), - init_WalletPOLYBal.add(investment_POLY).toNumber(), + final_WalletPOLYBal.toString(), + init_WalletPOLYBal.add(investment_POLY).toString(), "Wallet POLY Balance not changed as expected" ); // Additional checks on getters - assert.equal((await I_USDTieredSTO_Array[stoId].investorCount.call()).toNumber(), 2, "Investor count not changed as expected"); + assert.equal((await I_USDTieredSTO_Array[stoId].investorCount.call()).toString(), 2, "Investor count not changed as expected"); assert.equal( - (await I_USDTieredSTO_Array[stoId].getTokensSold()).toNumber(), - init_getTokensSold.add(investment_Token).toNumber(), + (await I_USDTieredSTO_Array[stoId].getTokensSold()).toString(), + init_getTokensSold.add(investment_Token).toString(), "getTokensSold not changed as expected" ); assert.equal( - (await I_USDTieredSTO_Array[stoId].getTokensMinted()).toNumber(), - init_getTokensMinted.add(investment_Token).toNumber(), + (await I_USDTieredSTO_Array[stoId].getTokensMinted()).toString(), + init_getTokensMinted.add(investment_Token).toString(), "getTokensMinted not changed as expected" ); assert.equal( - (await I_USDTieredSTO_Array[stoId].getTokensSoldFor(ETH)).toNumber(), - init_getTokensSoldForETH.toNumber(), + (await I_USDTieredSTO_Array[stoId].getTokensSoldFor(ETH)).toString(), + init_getTokensSoldForETH.toString(), "getTokensSoldForETH not changed as expected" ); assert.equal( - (await I_USDTieredSTO_Array[stoId].getTokensSoldFor(POLY)).toNumber(), - init_getTokensSoldForPOLY.add(investment_Token).toNumber(), + (await I_USDTieredSTO_Array[stoId].getTokensSoldFor(POLY)).toString(), + init_getTokensSoldForPOLY.add(investment_Token).toString(), "getTokensSoldForPOLY not changed as expected" ); assert.equal( - (await I_USDTieredSTO_Array[stoId].investorInvestedUSD.call(ACCREDITED1)).toNumber(), - init_investorInvestedUSD.add(investment_USD).toNumber(), + (await I_USDTieredSTO_Array[stoId].investorInvestedUSD.call(ACCREDITED1)).toString(), + init_investorInvestedUSD.add(investment_USD).toString(), "investorInvestedUSD not changed as expected" ); assert.equal( - (await I_USDTieredSTO_Array[stoId].investorInvested.call(ACCREDITED1, ETH)).toNumber(), - init_investorInvestedETH.toNumber(), + (await I_USDTieredSTO_Array[stoId].investorInvested.call(ACCREDITED1, ETH)).toString(), + init_investorInvestedETH.toString(), "investorInvestedETH not changed as expected" ); assert.equal( - (await I_USDTieredSTO_Array[stoId].investorInvested.call(ACCREDITED1, POLY)).toNumber(), - init_investorInvestedPOLY.add(investment_POLY).toNumber(), + (await I_USDTieredSTO_Array[stoId].investorInvested.call(ACCREDITED1, POLY)).toString(), + init_investorInvestedPOLY.add(investment_POLY).toString(), "investorInvestedPOLY not changed as expected" ); }); @@ -3677,14 +3683,14 @@ contract("USDTieredSTO", accounts => { let init_TokenSupply = await I_SecurityToken.totalSupply(); let init_InvestorTokenBal = await I_SecurityToken.balanceOf(NONACCREDITED1); - let init_InvestorETHBal = new BigNumber(await web3.eth.getBalance(NONACCREDITED1)); + let init_InvestorETHBal = new BN(await web3.eth.getBalance(NONACCREDITED1)); let init_InvestorPOLYBal = await I_PolyToken.balanceOf(NONACCREDITED1); let init_STOTokenSold = await I_USDTieredSTO_Array[stoId].getTokensSold(); - let init_STOETHBal = new BigNumber(await web3.eth.getBalance(I_USDTieredSTO_Array[stoId].address)); + let init_STOETHBal = new BN(await web3.eth.getBalance(I_USDTieredSTO_Array[stoId].address)); let init_STOPOLYBal = await I_PolyToken.balanceOf(I_USDTieredSTO_Array[stoId].address); let init_RaisedETH = await I_USDTieredSTO_Array[stoId].fundsRaised.call(ETH); let init_RaisedPOLY = await I_USDTieredSTO_Array[stoId].fundsRaised.call(POLY); - let init_WalletETHBal = new BigNumber(await web3.eth.getBalance(WALLET)); + let init_WalletETHBal = new BN(await web3.eth.getBalance(WALLET)); let init_WalletPOLYBal = await I_PolyToken.balanceOf(WALLET); // Buy With POLY @@ -3692,89 +3698,89 @@ contract("USDTieredSTO", accounts => { from: NONACCREDITED1, gasPrice: GAS_PRICE }); - let gasCost2 = new BigNumber(GAS_PRICE).mul(tx2.receipt.gasUsed); - console.log(" Gas buyWithPOLY: ".grey + tx2.receipt.gasUsed.toString().grey); + let gasCost2 = new BN(GAS_PRICE).mul(new BN(tx2.receipt.gasUsed)); + console.log(" Gas buyWithPOLY: ".grey + new BN(tx2.receipt.gasUsed).toString().grey); let final_TokenSupply = await I_SecurityToken.totalSupply(); let final_InvestorTokenBal = await I_SecurityToken.balanceOf(NONACCREDITED1); - let final_InvestorETHBal = new BigNumber(await web3.eth.getBalance(NONACCREDITED1)); + let final_InvestorETHBal = new BN(await web3.eth.getBalance(NONACCREDITED1)); let final_InvestorPOLYBal = await I_PolyToken.balanceOf(NONACCREDITED1); let final_STOTokenSold = await I_USDTieredSTO_Array[stoId].getTokensSold(); - let final_STOETHBal = new BigNumber(await web3.eth.getBalance(I_USDTieredSTO_Array[stoId].address)); + let final_STOETHBal = new BN(await web3.eth.getBalance(I_USDTieredSTO_Array[stoId].address)); let final_STOPOLYBal = await I_PolyToken.balanceOf(I_USDTieredSTO_Array[stoId].address); let final_RaisedETH = await I_USDTieredSTO_Array[stoId].fundsRaised.call(ETH); let final_RaisedPOLY = await I_USDTieredSTO_Array[stoId].fundsRaised.call(POLY); - let final_WalletETHBal = new BigNumber(await web3.eth.getBalance(WALLET)); + let final_WalletETHBal = new BN(await web3.eth.getBalance(WALLET)); let final_WalletPOLYBal = await I_PolyToken.balanceOf(WALLET); assert.equal( - final_TokenSupply.toNumber(), + final_TokenSupply.toString(), init_TokenSupply .add(investment_Token) .sub(refund_Token) - .toNumber(), + .toString(), "Token Supply not changed as expected" ); assert.equal( - final_InvestorTokenBal.toNumber(), + final_InvestorTokenBal.toString(), init_InvestorTokenBal .add(investment_Token) .sub(refund_Token) - .toNumber(), + .toString(), "Investor Token Balance not changed as expected" ); assert.equal( - final_InvestorETHBal.toNumber(), - init_InvestorETHBal.sub(gasCost2).toNumber(), + final_InvestorETHBal.toString(), + init_InvestorETHBal.sub(gasCost2).toString(), "Investor ETH Balance not changed as expected" ); assert.equal( - final_InvestorPOLYBal.toNumber(), + final_InvestorPOLYBal.toString(), init_InvestorPOLYBal .sub(investment_POLY) .add(refund_POLY) - .toNumber(), + .toString(), "Investor POLY Balance not changed as expected" ); assert.equal( - final_STOTokenSold.toNumber(), + final_STOTokenSold.toString(), init_STOTokenSold .add(investment_Token) .sub(refund_Token) - .toNumber(), + .toString(), "STO Token Sold not changed as expected" ); - assert.equal(final_STOETHBal.toNumber(), init_STOETHBal.toNumber(), "STO ETH Balance not changed as expected"); - assert.equal(final_STOPOLYBal.toNumber(), init_STOPOLYBal.toNumber(), "STO POLY Balance not changed as expected"); - assert.equal(final_RaisedETH.toNumber(), init_RaisedETH.toNumber(), "Raised ETH not changed as expected"); + assert.equal(final_STOETHBal.toString(), init_STOETHBal.toString(), "STO ETH Balance not changed as expected"); + assert.equal(final_STOPOLYBal.toString(), init_STOPOLYBal.toString(), "STO POLY Balance not changed as expected"); + assert.equal(final_RaisedETH.toString(), init_RaisedETH.toString(), "Raised ETH not changed as expected"); assert.equal( - final_RaisedPOLY.toNumber(), + final_RaisedPOLY.toString(), init_RaisedPOLY .add(investment_POLY) .sub(refund_POLY) - .toNumber(), + .toString(), "Raised POLY not changed as expected" ); - assert.equal(final_WalletETHBal.toNumber(), init_WalletETHBal.toNumber(), "Wallet ETH Balance not changed as expected"); + assert.equal(final_WalletETHBal.toString(), init_WalletETHBal.toString(), "Wallet ETH Balance not changed as expected"); assert.equal( - final_WalletPOLYBal.toNumber(), + final_WalletPOLYBal.toString(), init_WalletPOLYBal .add(investment_POLY) .sub(refund_POLY) - .toNumber(), + .toString(), "Wallet POLY Balance not changed as expected" ); }); it("should successfully buy a granular amount and refund balance when buying indivisible token with POLY", async () => { - await I_SecurityToken.changeGranularity(10 ** 18, {from: ISSUER}); + await I_SecurityToken.changeGranularity(e18, { from: ISSUER }); let stoId = 4; let tierId = 0; await I_USDTieredSTO_Array[stoId].changeAccredited([ACCREDITED1], [true], { from: ISSUER }); - let investment_Tokens = (new BigNumber(10.5)).mul(10 ** 18); + let investment_Tokens = new BN(1050).mul(e16); let investment_POLY = await convert(stoId, tierId, true, "TOKEN", "POLY", investment_Tokens); - let refund_Tokens = (new BigNumber(0.5)).mul(10 ** 18); + let refund_Tokens = new BN(50).mul(e16); let refund_POLY = await convert(stoId, tierId, true, "TOKEN", "POLY", refund_Tokens); await I_PolyToken.getTokens(investment_POLY, ACCREDITED1); @@ -3782,185 +3788,187 @@ contract("USDTieredSTO", accounts => { let init_TokenSupply = await I_SecurityToken.totalSupply(); let init_InvestorTokenBal = await I_SecurityToken.balanceOf(ACCREDITED1); - let init_InvestorETHBal = BigNumber(await web3.eth.getBalance(ACCREDITED1)); + let init_InvestorETHBal = new BN(await web3.eth.getBalance(ACCREDITED1)); let init_InvestorPOLYBal = await I_PolyToken.balanceOf(ACCREDITED1); let init_STOTokenSold = await I_USDTieredSTO_Array[stoId].getTokensSold(); - let init_STOETHBal = BigNumber(await web3.eth.getBalance(I_USDTieredSTO_Array[stoId].address)); + let init_STOETHBal = new BN(await web3.eth.getBalance(I_USDTieredSTO_Array[stoId].address)); let init_STOPOLYBal = await I_PolyToken.balanceOf(I_USDTieredSTO_Array[stoId].address); let init_RaisedETH = await I_USDTieredSTO_Array[stoId].fundsRaised.call(ETH); let init_RaisedPOLY = await I_USDTieredSTO_Array[stoId].fundsRaised.call(POLY); - let init_WalletETHBal = BigNumber(await web3.eth.getBalance(WALLET)); + let init_WalletETHBal = new BN(await web3.eth.getBalance(WALLET)); let init_WalletPOLYBal = await I_PolyToken.balanceOf(WALLET); - let tokensToMint = (await I_USDTieredSTO_Array[stoId].buyTokensView(ACCREDITED1, investment_POLY,POLY))[2]; + let tokensToMint = (await I_USDTieredSTO_Array[stoId].buyTokensView(ACCREDITED1, investment_POLY, POLY))[2]; // Buy With POLY let tx2 = await I_USDTieredSTO_Array[stoId].buyWithPOLY(ACCREDITED1, investment_POLY, { from: ACCREDITED1, gasPrice: GAS_PRICE }); - let gasCost2 = BigNumber(GAS_PRICE).mul(tx2.receipt.gasUsed); - console.log(" Gas buyWithPOLY: ".grey + tx2.receipt.gasUsed.toString().grey); + let gasCost2 = new BN(GAS_PRICE).mul(new BN(tx2.receipt.gasUsed)); + console.log(" Gas buyWithPOLY: ".grey + new BN(tx2.receipt.gasUsed).toString().grey); let final_TokenSupply = await I_SecurityToken.totalSupply(); let final_InvestorTokenBal = await I_SecurityToken.balanceOf(ACCREDITED1); - let final_InvestorETHBal = BigNumber(await web3.eth.getBalance(ACCREDITED1)); + let final_InvestorETHBal = new BN(await web3.eth.getBalance(ACCREDITED1)); let final_InvestorPOLYBal = await I_PolyToken.balanceOf(ACCREDITED1); let final_STOTokenSold = await I_USDTieredSTO_Array[stoId].getTokensSold(); - let final_STOETHBal = BigNumber(await web3.eth.getBalance(I_USDTieredSTO_Array[stoId].address)); + let final_STOETHBal = new BN(await web3.eth.getBalance(I_USDTieredSTO_Array[stoId].address)); let final_STOPOLYBal = await I_PolyToken.balanceOf(I_USDTieredSTO_Array[stoId].address); let final_RaisedETH = await I_USDTieredSTO_Array[stoId].fundsRaised.call(ETH); let final_RaisedPOLY = await I_USDTieredSTO_Array[stoId].fundsRaised.call(POLY); - let final_WalletETHBal = BigNumber(await web3.eth.getBalance(WALLET)); + let final_WalletETHBal = new BN(await web3.eth.getBalance(WALLET)); let final_WalletPOLYBal = await I_PolyToken.balanceOf(WALLET); assert.equal( - final_TokenSupply.toNumber(), + final_TokenSupply.toString(), init_TokenSupply .add(investment_Tokens) .sub(refund_Tokens) - .toNumber(), + .toString(), "Token Supply not changed as expected" ); + assert.equal(tokensToMint.toString(), investment_Tokens.sub(refund_Tokens).toString(), "View function returned incorrect data"); assert.equal( - tokensToMint.toNumber(), - investment_Tokens.sub(refund_Tokens).toNumber(), - "View function returned incorrect data" - ); - assert.equal( - final_InvestorTokenBal.toNumber(), + final_InvestorTokenBal.toString(), init_InvestorTokenBal .add(investment_Tokens) .sub(refund_Tokens) - .toNumber(), + .toString(), "Investor Token Balance not changed as expected" ); assert.equal( - final_InvestorETHBal.toNumber(), - init_InvestorETHBal.sub(gasCost2).toNumber(), + final_InvestorETHBal.toString(), + init_InvestorETHBal.sub(gasCost2).toString(), "Investor ETH Balance not changed as expected" ); assert.equal( - final_InvestorPOLYBal.toNumber(), + final_InvestorPOLYBal.toString(), init_InvestorPOLYBal .sub(investment_POLY) .add(refund_POLY) - .toNumber(), + .toString(), "Investor POLY Balance not changed as expected" ); assert.equal( - final_STOTokenSold.toNumber(), + final_STOTokenSold.toString(), init_STOTokenSold .add(investment_Tokens) .sub(refund_Tokens) - .toNumber(), + .toString(), "STO Token Sold not changed as expected" ); - assert.equal(final_STOETHBal.toNumber(), init_STOETHBal.toNumber(), "STO ETH Balance not changed as expected"); - assert.equal(final_STOPOLYBal.toNumber(), init_STOPOLYBal.toNumber(), "STO POLY Balance not changed as expected"); - assert.equal(final_RaisedETH.toNumber(), init_RaisedETH.toNumber(), "Raised ETH not changed as expected"); + assert.equal(final_STOETHBal.toString(), init_STOETHBal.toString(), "STO ETH Balance not changed as expected"); + assert.equal(final_STOPOLYBal.toString(), init_STOPOLYBal.toString(), "STO POLY Balance not changed as expected"); + assert.equal(final_RaisedETH.toString(), init_RaisedETH.toString(), "Raised ETH not changed as expected"); assert.equal( - final_RaisedPOLY.toNumber(), + final_RaisedPOLY.toString(), init_RaisedPOLY .add(investment_POLY) .sub(refund_POLY) - .toNumber(), + .toString(), "Raised POLY not changed as expected" ); - assert.equal(final_WalletETHBal.toNumber(), init_WalletETHBal.toNumber(), "Wallet ETH Balance not changed as expected"); + assert.equal(final_WalletETHBal.toString(), init_WalletETHBal.toString(), "Wallet ETH Balance not changed as expected"); assert.equal( - final_WalletPOLYBal.toNumber(), + final_WalletPOLYBal.toString(), init_WalletPOLYBal .add(investment_POLY) .sub(refund_POLY) - .toNumber(), + .toString(), "Wallet POLY Balance not changed as expected" ); - await I_SecurityToken.changeGranularity(1, {from: ISSUER}); + await I_SecurityToken.changeGranularity(1, { from: ISSUER }); }); it("should successfully buy a granular amount and refund balance when buying indivisible token with ETH", async () => { - await I_SecurityToken.changeGranularity(10**18, {from: ISSUER}); + await I_SecurityToken.changeGranularity(e18, { from: ISSUER }); let stoId = 4; let tierId = 0; - let investment_Tokens = BigNumber(10.5).mul(10**18); + let investment_Tokens = new BN(1050).mul(e16); let investment_ETH = await convert(stoId, tierId, false, "TOKEN", "ETH", investment_Tokens); - let refund_Tokens = BigNumber(0.5).mul(10**18); + let refund_Tokens = new BN(50).mul(e16); let refund_ETH = await convert(stoId, tierId, false, "TOKEN", "ETH", refund_Tokens); let init_TokenSupply = await I_SecurityToken.totalSupply(); let init_InvestorTokenBal = await I_SecurityToken.balanceOf(ACCREDITED1); - let init_InvestorETHBal = BigNumber(await web3.eth.getBalance(ACCREDITED1)); + let init_InvestorETHBal = new BN(await web3.eth.getBalance(ACCREDITED1)); let init_STOTokenSold = await I_USDTieredSTO_Array[stoId].getTokensSold(); - let init_STOETHBal = BigNumber(await web3.eth.getBalance(I_USDTieredSTO_Array[stoId].address)); + let init_STOETHBal = new BN(await web3.eth.getBalance(I_USDTieredSTO_Array[stoId].address)); let init_STOPOLYBal = await I_PolyToken.balanceOf(I_USDTieredSTO_Array[stoId].address); let init_RaisedETH = await I_USDTieredSTO_Array[stoId].fundsRaised.call(ETH); let init_RaisedPOLY = await I_USDTieredSTO_Array[stoId].fundsRaised.call(POLY); - // Buy With ETH let tx2 = await I_USDTieredSTO_Array[stoId].buyWithETH(ACCREDITED1, { from: ACCREDITED1, gasPrice: GAS_PRICE, value: investment_ETH }); - let gasCost2 = BigNumber(GAS_PRICE).mul(tx2.receipt.gasUsed); - console.log(" Gas buyWithETH: ".grey + tx2.receipt.gasUsed.toString().grey); + let gasCost2 = new BN(GAS_PRICE).mul(new BN(tx2.receipt.gasUsed)); + console.log(" Gas buyWithETH: ".grey + new BN(tx2.receipt.gasUsed).toString().grey); let final_TokenSupply = await I_SecurityToken.totalSupply(); let final_InvestorTokenBal = await I_SecurityToken.balanceOf(ACCREDITED1); - let final_InvestorETHBal = BigNumber(await web3.eth.getBalance(ACCREDITED1)); + let final_InvestorETHBal = new BN(await web3.eth.getBalance(ACCREDITED1)); let final_STOTokenSold = await I_USDTieredSTO_Array[stoId].getTokensSold(); - let final_STOETHBal = BigNumber(await web3.eth.getBalance(I_USDTieredSTO_Array[stoId].address)); + let final_STOETHBal = new BN(await web3.eth.getBalance(I_USDTieredSTO_Array[stoId].address)); let final_STOPOLYBal = await I_PolyToken.balanceOf(I_USDTieredSTO_Array[stoId].address); let final_RaisedETH = await I_USDTieredSTO_Array[stoId].fundsRaised.call(ETH); let final_RaisedPOLY = await I_USDTieredSTO_Array[stoId].fundsRaised.call(POLY); assert.equal( - final_TokenSupply.toNumber(), + final_TokenSupply.toString(), init_TokenSupply .add(investment_Tokens) .sub(refund_Tokens) - .toNumber(), + .toString(), "Token Supply not changed as expected" ); assert.equal( - final_InvestorTokenBal.toNumber(), + final_InvestorTokenBal.toString(), init_InvestorTokenBal .add(investment_Tokens) .sub(refund_Tokens) - .toNumber(), + .toString(), "Investor Token Balance not changed as expected" ); assert.equal( - final_InvestorETHBal.toNumber(), - init_InvestorETHBal.sub(investment_ETH).sub(gasCost2).add(refund_ETH).toNumber(), + final_InvestorETHBal.toString(), + init_InvestorETHBal + .sub(investment_ETH) + .sub(gasCost2) + .add(refund_ETH) + .toString(), "Investor ETH Balance not changed as expected" ); assert.equal( - final_STOTokenSold.toNumber(), + final_STOTokenSold.toString(), init_STOTokenSold .add(investment_Tokens) .sub(refund_Tokens) - .toNumber(), + .toString(), "STO Token Sold not changed as expected" ); - assert.equal(final_STOETHBal.toNumber(), init_STOETHBal.toNumber(), "STO ETH Balance not changed as expected"); - assert.equal(final_STOPOLYBal.toNumber(), init_STOPOLYBal.toNumber(), "STO POLY Balance not changed as expected"); - assert.equal(final_RaisedETH.toNumber(), init_RaisedETH.add(investment_ETH).sub(refund_ETH).toNumber(), "Raised ETH not changed as expected"); + assert.equal(final_STOETHBal.toString(), init_STOETHBal.toString(), "STO ETH Balance not changed as expected"); + assert.equal(final_STOPOLYBal.toString(), init_STOPOLYBal.toString(), "STO POLY Balance not changed as expected"); assert.equal( - final_RaisedPOLY.toNumber(), - init_RaisedPOLY, - "Raised POLY not changed as expected" + final_RaisedETH.toString(), + init_RaisedETH + .add(investment_ETH) + .sub(refund_ETH) + .toString(), + "Raised ETH not changed as expected" ); - await I_SecurityToken.changeGranularity(1, {from: ISSUER}); + assert.equal(final_RaisedPOLY.toString(), init_RaisedPOLY, "Raised POLY not changed as expected"); + await I_SecurityToken.changeGranularity(1, { from: ISSUER }); }); it("should fail and revert when NONACCREDITED cap reached", async () => { let stoId = 2; let tierId = 0; - let investment_Token = new BigNumber(5).mul(10 ** 18); + let investment_Token = new BN(5).mul(e18); let investment_USD = await convert(stoId, tierId, true, "TOKEN", "USD", investment_Token); let investment_ETH = await convert(stoId, tierId, true, "TOKEN", "ETH", investment_Token); let investment_POLY = await convert(stoId, tierId, true, "TOKEN", "POLY", investment_Token); @@ -3985,24 +3993,28 @@ contract("USDTieredSTO", accounts => { let stoId = 4; let tierId = 0; await I_USDTieredSTO_Array[stoId].changeAccredited([ACCREDITED1], [true], { from: ISSUER }); - let investment_Tokens = new BigNumber(10 ** 18); + let investment_Tokens = new BN(e18); let investment_POLY = await convert(stoId, tierId, true, "TOKEN", "POLY", investment_Tokens); let investment_ETH = await convert(stoId, tierId, true, "TOKEN", "ETH", investment_Tokens); - const minTokens = new BigNumber(10 ** 20); + const minTokens = new BN(1000).mul(e18); await I_PolyToken.getTokens(investment_POLY, ACCREDITED1); await I_PolyToken.approve(I_USDTieredSTO_Array[stoId].address, investment_POLY, { from: ACCREDITED1 }); // Buy With POLY - await catchRevert(I_USDTieredSTO_Array[stoId].buyWithPOLYRateLimited(ACCREDITED1, investment_POLY, minTokens, { - from: ACCREDITED1, - gasPrice: GAS_PRICE - })); - await catchRevert(I_USDTieredSTO_Array[stoId].buyWithETHRateLimited(ACCREDITED1, minTokens, { - from: ACCREDITED1, - gasPrice: GAS_PRICE, - value: investment_ETH - })); + await catchRevert( + I_USDTieredSTO_Array[stoId].buyWithPOLYRateLimited(ACCREDITED1, investment_POLY, minTokens, { + from: ACCREDITED1, + gasPrice: GAS_PRICE + }) + ); + await catchRevert( + I_USDTieredSTO_Array[stoId].buyWithETHRateLimited(ACCREDITED1, minTokens, { + from: ACCREDITED1, + gasPrice: GAS_PRICE, + value: investment_ETH + }) + ); }); it("should fail and revert despite oracle price change when NONACCREDITED cap reached", async () => { @@ -4010,18 +4022,18 @@ contract("USDTieredSTO", accounts => { let tierId = 0; // set new exchange rates - let high_USDETH = new BigNumber(1000).mul(10 ** 18); // 1000 USD per ETH - let high_USDPOLY = new BigNumber(50).mul(10 ** 16); // 0.5 USD per POLY - let low_USDETH = new BigNumber(250).mul(10 ** 18); // 250 USD per ETH - let low_USDPOLY = new BigNumber(20).mul(10 ** 16); // 0.2 USD per POLY + let high_USDETH = new BN(1000).mul(e18); // 1000 USD per ETH + let high_USDPOLY = new BN(50).mul(e16); // 0.5 USD per POLY + let low_USDETH = new BN(250).mul(e18); // 250 USD per ETH + let low_USDPOLY = new BN(20).mul(e16); // 0.2 USD per POLY - let investment_Token = new BigNumber(5).mul(10 ** 18); + let investment_Token = new BN(5).mul(e18); let investment_USD = await convert(stoId, tierId, true, "TOKEN", "USD", investment_Token); - let investment_ETH_high = investment_USD.div(high_USDETH).mul(10 ** 18); // USD / USD/ETH = ETH - let investment_POLY_high = investment_USD.div(high_USDPOLY).mul(10 ** 18); // USD / USD/POLY = POLY - let investment_ETH_low = investment_USD.div(low_USDETH).mul(10 ** 18); // USD / USD/ETH = ETH - let investment_POLY_low = investment_USD.div(low_USDPOLY).mul(10 ** 18); // USD / USD/POLY = POLY + let investment_ETH_high = investment_USD.div(high_USDETH).mul(e18); // USD / USD/ETH = ETH + let investment_POLY_high = investment_USD.div(high_USDPOLY).mul(e18); // USD / USD/POLY = POLY + let investment_ETH_low = investment_USD.div(low_USDETH).mul(e18); // USD / USD/ETH = ETH + let investment_POLY_low = investment_USD.div(low_USDPOLY).mul(e18); // USD / USD/POLY = POLY await I_PolyToken.getTokens(investment_POLY_low, NONACCREDITED1); await I_PolyToken.approve(I_USDTieredSTO_Array[stoId].address, investment_POLY_low, { from: NONACCREDITED1 }); @@ -4077,12 +4089,12 @@ contract("USDTieredSTO", accounts => { let endTier = 1; assert.equal( - (await I_USDTieredSTO_Array[stoId].currentTier.call()).toNumber(), + (await I_USDTieredSTO_Array[stoId].currentTier.call()).toString(), startTier, "currentTier not changed as expected" ); - let delta_Token = new BigNumber(5).mul(10 ** 18); // Token + let delta_Token = new BN(5).mul(e18); // Token let polyTier0 = await convert(stoId, startTier, true, "TOKEN", "POLY", delta_Token); let polyTier1 = await convert(stoId, endTier, true, "TOKEN", "POLY", delta_Token); let investment_Token = delta_Token.add(delta_Token); // 10 Token @@ -4101,7 +4113,7 @@ contract("USDTieredSTO", accounts => { let Tier0Token = (await I_USDTieredSTO_Array[stoId].tiers.call(startTier))[2]; let Tier0Minted = (await I_USDTieredSTO_Array[stoId].tiers.call(startTier))[4]; - assert.equal(Tier0Minted.toNumber(), Tier0Token.sub(delta_Token).toNumber()); + assert.equal(Tier0Minted.toString(), Tier0Token.sub(delta_Token).toString()); await I_PolyToken.getTokens(investment_POLY, ACCREDITED1); await I_PolyToken.approve(I_USDTieredSTO_Array[stoId].address, investment_POLY, { from: ACCREDITED1 }); @@ -4109,87 +4121,87 @@ contract("USDTieredSTO", accounts => { // Process investment let init_TokenSupply = await I_SecurityToken.totalSupply(); let init_InvestorTokenBal = await I_SecurityToken.balanceOf(ACCREDITED1); - let init_InvestorETHBal = new BigNumber(await web3.eth.getBalance(ACCREDITED1)); + let init_InvestorETHBal = new BN(await web3.eth.getBalance(ACCREDITED1)); let init_InvestorPOLYBal = await I_PolyToken.balanceOf(ACCREDITED1); let init_STOTokenSold = await I_USDTieredSTO_Array[stoId].getTokensSold(); - let init_STOETHBal = new BigNumber(await web3.eth.getBalance(I_USDTieredSTO_Array[stoId].address)); + let init_STOETHBal = new BN(await web3.eth.getBalance(I_USDTieredSTO_Array[stoId].address)); let init_STOPOLYBal = await I_PolyToken.balanceOf(I_USDTieredSTO_Array[stoId].address); let init_RaisedETH = await I_USDTieredSTO_Array[stoId].fundsRaised.call(ETH); let init_RaisedPOLY = await I_USDTieredSTO_Array[stoId].fundsRaised.call(POLY); - let init_WalletETHBal = new BigNumber(await web3.eth.getBalance(WALLET)); + let init_WalletETHBal = new BN(await web3.eth.getBalance(WALLET)); let init_WalletPOLYBal = await I_PolyToken.balanceOf(WALLET); let tx2 = await I_USDTieredSTO_Array[stoId].buyWithPOLY(ACCREDITED1, investment_POLY, { from: ACCREDITED1, gasPrice: GAS_PRICE }); - let gasCost2 = new BigNumber(GAS_PRICE).mul(tx2.receipt.gasUsed); - console.log(" Gas buyWithPOLY: ".grey + tx2.receipt.gasUsed.toString().grey); + let gasCost2 = new BN(GAS_PRICE).mul(new BN(tx2.receipt.gasUsed)); + console.log(" Gas buyWithPOLY: ".grey + new BN(tx2.receipt.gasUsed).toString().grey); let final_TokenSupply = await I_SecurityToken.totalSupply(); let final_InvestorTokenBal = await I_SecurityToken.balanceOf(ACCREDITED1); - let final_InvestorETHBal = new BigNumber(await web3.eth.getBalance(ACCREDITED1)); + let final_InvestorETHBal = new BN(await web3.eth.getBalance(ACCREDITED1)); let final_InvestorPOLYBal = await I_PolyToken.balanceOf(ACCREDITED1); let final_STOTokenSold = await I_USDTieredSTO_Array[stoId].getTokensSold(); - let final_STOETHBal = new BigNumber(await web3.eth.getBalance(I_USDTieredSTO_Array[stoId].address)); + let final_STOETHBal = new BN(await web3.eth.getBalance(I_USDTieredSTO_Array[stoId].address)); let final_STOPOLYBal = await I_PolyToken.balanceOf(I_USDTieredSTO_Array[stoId].address); let final_RaisedETH = await I_USDTieredSTO_Array[stoId].fundsRaised.call(ETH); let final_RaisedPOLY = await I_USDTieredSTO_Array[stoId].fundsRaised.call(POLY); - let final_WalletETHBal = new BigNumber(await web3.eth.getBalance(WALLET)); + let final_WalletETHBal = new BN(await web3.eth.getBalance(WALLET)); let final_WalletPOLYBal = await I_PolyToken.balanceOf(WALLET); assert.equal( - final_TokenSupply.toNumber(), - init_TokenSupply.add(investment_Token).toNumber(), + final_TokenSupply.toString(), + init_TokenSupply.add(investment_Token).toString(), "Token Supply not changed as expected" ); assert.equal( - final_InvestorTokenBal.toNumber(), - init_InvestorTokenBal.add(investment_Token).toNumber(), + final_InvestorTokenBal.toString(), + init_InvestorTokenBal.add(investment_Token).toString(), "Investor Token Balance not changed as expected" ); assert.equal( - final_InvestorETHBal.toNumber(), - init_InvestorETHBal.sub(gasCost2).toNumber(), + final_InvestorETHBal.toString(), + init_InvestorETHBal.sub(gasCost2).toString(), "Investor ETH Balance not changed as expected" ); assert.equal( - final_InvestorPOLYBal.toNumber(), - init_InvestorPOLYBal.sub(investment_POLY).toNumber(), + final_InvestorPOLYBal.toString(), + init_InvestorPOLYBal.sub(investment_POLY).toString(), "Investor POLY Balance not changed as expected" ); assert.equal( - final_STOTokenSold.toNumber(), - init_STOTokenSold.add(investment_Token).toNumber(), + final_STOTokenSold.toString(), + init_STOTokenSold.add(investment_Token).toString(), "STO Token Sold not changed as expected" ); - assert.equal(final_STOETHBal.toNumber(), init_STOETHBal.toNumber(), "STO ETH Balance not changed as expected"); - assert.equal(final_STOPOLYBal.toNumber(), init_STOPOLYBal.toNumber(), "STO POLY Balance not changed as expected"); - assert.equal(final_RaisedETH.toNumber(), init_RaisedETH.toNumber(), "Raised ETH not changed as expected"); + assert.equal(final_STOETHBal.toString(), init_STOETHBal.toString(), "STO ETH Balance not changed as expected"); + assert.equal(final_STOPOLYBal.toString(), init_STOPOLYBal.toString(), "STO POLY Balance not changed as expected"); + assert.equal(final_RaisedETH.toString(), init_RaisedETH.toString(), "Raised ETH not changed as expected"); assert.equal( - final_RaisedPOLY.toNumber(), - init_RaisedPOLY.add(investment_POLY).toNumber(), + final_RaisedPOLY.toString(), + init_RaisedPOLY.add(investment_POLY).toString(), "Raised POLY not changed as expected" ); - assert.equal(final_WalletETHBal.toNumber(), init_WalletETHBal.toNumber(), "Wallet ETH Balance not changed as expected"); + assert.equal(final_WalletETHBal.toString(), init_WalletETHBal.toString(), "Wallet ETH Balance not changed as expected"); assert.equal( - final_WalletPOLYBal.toNumber(), - init_WalletPOLYBal.add(investment_POLY).toNumber(), + final_WalletPOLYBal.toString(), + init_WalletPOLYBal.add(investment_POLY).toString(), "Wallet POLY Balance not changed as expected" ); // Additional Checks - assert.equal((await I_USDTieredSTO_Array[stoId].currentTier.call()).toNumber(), endTier, "currentTier not changed as expected"); + assert.equal((await I_USDTieredSTO_Array[stoId].currentTier.call()).toString(), endTier, "currentTier not changed as expected"); }); it("should successfully buy across the discount cap", async () => { let stoId = 2; let tierId = 1; - let discount_Token = new BigNumber(20).mul(10 ** 18); + let discount_Token = new BN(20).mul(e18); let discount_POLY = await convert(stoId, tierId, true, "TOKEN", "POLY", discount_Token); - let regular_Token = new BigNumber(10).mul(10 ** 18); + let regular_Token = new BN(10).mul(e18); let regular_POLY = await convert(stoId, tierId, false, "TOKEN", "POLY", regular_Token); let investment_Token = discount_Token.add(regular_Token); @@ -4200,14 +4212,14 @@ contract("USDTieredSTO", accounts => { let init_TokenSupply = await I_SecurityToken.totalSupply(); let init_InvestorTokenBal = await I_SecurityToken.balanceOf(ACCREDITED1); - let init_InvestorETHBal = new BigNumber(await web3.eth.getBalance(ACCREDITED1)); + let init_InvestorETHBal = new BN(await web3.eth.getBalance(ACCREDITED1)); let init_InvestorPOLYBal = await I_PolyToken.balanceOf(ACCREDITED1); let init_STOTokenSold = await I_USDTieredSTO_Array[stoId].getTokensSold(); - let init_STOETHBal = new BigNumber(await web3.eth.getBalance(I_USDTieredSTO_Array[stoId].address)); + let init_STOETHBal = new BN(await web3.eth.getBalance(I_USDTieredSTO_Array[stoId].address)); let init_STOPOLYBal = await I_PolyToken.balanceOf(I_USDTieredSTO_Array[stoId].address); let init_RaisedETH = await I_USDTieredSTO_Array[stoId].fundsRaised.call(ETH); let init_RaisedPOLY = await I_USDTieredSTO_Array[stoId].fundsRaised.call(POLY); - let init_WalletETHBal = new BigNumber(await web3.eth.getBalance(WALLET)); + let init_WalletETHBal = new BN(await web3.eth.getBalance(WALLET)); let init_WalletPOLYBal = await I_PolyToken.balanceOf(WALLET); // Buy With POLY @@ -4215,58 +4227,58 @@ contract("USDTieredSTO", accounts => { from: ACCREDITED1, gasPrice: GAS_PRICE }); - let gasCost2 = new BigNumber(GAS_PRICE).mul(tx2.receipt.gasUsed); - console.log(" Gas buyWithPOLY: ".grey + tx2.receipt.gasUsed.toString().grey); + let gasCost2 = new BN(GAS_PRICE).mul(new BN(tx2.receipt.gasUsed)); + console.log(" Gas buyWithPOLY: ".grey + new BN(tx2.receipt.gasUsed).toString().grey); let final_TokenSupply = await I_SecurityToken.totalSupply(); let final_InvestorTokenBal = await I_SecurityToken.balanceOf(ACCREDITED1); - let final_InvestorETHBal = new BigNumber(await web3.eth.getBalance(ACCREDITED1)); + let final_InvestorETHBal = new BN(await web3.eth.getBalance(ACCREDITED1)); let final_InvestorPOLYBal = await I_PolyToken.balanceOf(ACCREDITED1); let final_STOTokenSold = await I_USDTieredSTO_Array[stoId].getTokensSold(); - let final_STOETHBal = new BigNumber(await web3.eth.getBalance(I_USDTieredSTO_Array[stoId].address)); + let final_STOETHBal = new BN(await web3.eth.getBalance(I_USDTieredSTO_Array[stoId].address)); let final_STOPOLYBal = await I_PolyToken.balanceOf(I_USDTieredSTO_Array[stoId].address); let final_RaisedETH = await I_USDTieredSTO_Array[stoId].fundsRaised.call(ETH); let final_RaisedPOLY = await I_USDTieredSTO_Array[stoId].fundsRaised.call(POLY); - let final_WalletETHBal = new BigNumber(await web3.eth.getBalance(WALLET)); + let final_WalletETHBal = new BN(await web3.eth.getBalance(WALLET)); let final_WalletPOLYBal = await I_PolyToken.balanceOf(WALLET); assert.equal( - final_TokenSupply.toNumber(), - init_TokenSupply.add(investment_Token).toNumber(), + final_TokenSupply.toString(), + init_TokenSupply.add(investment_Token).toString(), "Token Supply not changed as expected" ); assert.equal( - final_InvestorTokenBal.toNumber(), - init_InvestorTokenBal.add(investment_Token).toNumber(), + final_InvestorTokenBal.toString(), + init_InvestorTokenBal.add(investment_Token).toString(), "Investor Token Balance not changed as expected" ); assert.equal( - final_InvestorETHBal.toNumber(), - init_InvestorETHBal.sub(gasCost2).toNumber(), + final_InvestorETHBal.toString(), + init_InvestorETHBal.sub(gasCost2).toString(), "Investor ETH Balance not changed as expected" ); assert.equal( - final_InvestorPOLYBal.toNumber(), - init_InvestorPOLYBal.sub(investment_POLY).toNumber(), + final_InvestorPOLYBal.toString(), + init_InvestorPOLYBal.sub(investment_POLY).toString(), "Investor POLY Balance not changed as expected" ); assert.equal( - final_STOTokenSold.toNumber(), - init_STOTokenSold.add(investment_Token).toNumber(), + final_STOTokenSold.toString(), + init_STOTokenSold.add(investment_Token).toString(), "STO Token Sold not changed as expected" ); - assert.equal(final_STOETHBal.toNumber(), init_STOETHBal.toNumber(), "STO ETH Balance not changed as expected"); - assert.equal(final_STOPOLYBal.toNumber(), init_STOPOLYBal.toNumber(), "STO POLY Balance not changed as expected"); - assert.equal(final_RaisedETH.toNumber(), init_RaisedETH.toNumber(), "Raised ETH not changed as expected"); + assert.equal(final_STOETHBal.toString(), init_STOETHBal.toString(), "STO ETH Balance not changed as expected"); + assert.equal(final_STOPOLYBal.toString(), init_STOPOLYBal.toString(), "STO POLY Balance not changed as expected"); + assert.equal(final_RaisedETH.toString(), init_RaisedETH.toString(), "Raised ETH not changed as expected"); assert.equal( - final_RaisedPOLY.toNumber(), - init_RaisedPOLY.add(investment_POLY).toNumber(), + final_RaisedPOLY.toString(), + init_RaisedPOLY.add(investment_POLY).toString(), "Raised POLY not changed as expected" ); - assert.equal(final_WalletETHBal.toNumber(), init_WalletETHBal.toNumber(), "Wallet ETH Balance not changed as expected"); + assert.equal(final_WalletETHBal.toString(), init_WalletETHBal.toString(), "Wallet ETH Balance not changed as expected"); assert.equal( - final_WalletPOLYBal.toNumber(), - init_WalletPOLYBal.add(investment_POLY).toNumber(), + final_WalletPOLYBal.toString(), + init_WalletPOLYBal.add(investment_POLY).toString(), "Wallet POLY Balance not changed as expected" ); }); @@ -4291,26 +4303,26 @@ contract("USDTieredSTO", accounts => { from: ACCREDITED1, gasPrice: GAS_PRICE }); - let gasCost2 = new BigNumber(GAS_PRICE).mul(tx2.receipt.gasUsed); - console.log(" Gas buyWithPOLY: ".grey + tx2.receipt.gasUsed.toString().grey); + let gasCost2 = new BN(GAS_PRICE).mul(new BN(tx2.receipt.gasUsed)); + console.log(" Gas buyWithPOLY: ".grey + new BN(tx2.receipt.gasUsed).toString().grey); let final_TokenSupply = await I_SecurityToken.totalSupply(); let final_InvestorTokenBal = await I_SecurityToken.balanceOf(ACCREDITED1); let final_STOTokenSold = await I_USDTieredSTO_Array[stoId].getTokensSold(); assert.equal( - final_TokenSupply.toNumber(), - init_TokenSupply.add(investment_Token).toNumber(), + final_TokenSupply.toString(), + init_TokenSupply.add(investment_Token).toString(), "Token Supply not changed as expected" ); assert.equal( - final_InvestorTokenBal.toNumber(), - init_InvestorTokenBal.add(investment_Token).toNumber(), + final_InvestorTokenBal.toString(), + init_InvestorTokenBal.add(investment_Token).toString(), "Investor Token Balance not changed as expected" ); assert.equal( - final_STOTokenSold.toNumber(), - init_STOTokenSold.add(investment_Token).toNumber(), + final_STOTokenSold.toString(), + init_STOTokenSold.add(investment_Token).toString(), "STO Token Sold not changed as expected" ); }); @@ -4319,7 +4331,7 @@ contract("USDTieredSTO", accounts => { let stoId = 2; let tierId = 1; - let investment_Token = new BigNumber(5).mul(10 ** 18); + let investment_Token = new BN(5).mul(e18); let investment_USD = await convert(stoId, tierId, false, "TOKEN", "USD", investment_Token); let investment_ETH = await convert(stoId, tierId, false, "TOKEN", "ETH", investment_Token); let investment_POLY = await convert(stoId, tierId, false, "TOKEN", "POLY", investment_Token); @@ -4359,18 +4371,18 @@ contract("USDTieredSTO", accounts => { let tierId = 1; // set new exchange rates - let high_USDETH = new BigNumber(1000).mul(10 ** 18); // 1000 USD per ETH - let high_USDPOLY = new BigNumber(50).mul(10 ** 16); // 0.5 USD per POLY - let low_USDETH = new BigNumber(250).mul(10 ** 18); // 250 USD per ETH - let low_USDPOLY = new BigNumber(20).mul(10 ** 16); // 0.2 USD per POLY + let high_USDETH = new BN(1000).mul(e18); // 1000 USD per ETH + let high_USDPOLY = new BN(50).mul(e16); // 0.5 USD per POLY + let low_USDETH = new BN(250).mul(e18); // 250 USD per ETH + let low_USDPOLY = new BN(20).mul(e16); // 0.2 USD per POLY - let investment_Token = new BigNumber(5).mul(10 ** 18); + let investment_Token = new BN(5).mul(e18); let investment_USD = await convert(stoId, tierId, true, "TOKEN", "USD", investment_Token); - let investment_ETH_high = investment_USD.div(high_USDETH).mul(10 ** 18); // USD / USD/ETH = ETH - let investment_POLY_high = investment_USD.div(high_USDPOLY).mul(10 ** 18); // USD / USD/POLY = POLY - let investment_ETH_low = investment_USD.div(low_USDETH).mul(10 ** 18); // USD / USD/ETH = ETH - let investment_POLY_low = investment_USD.div(low_USDPOLY).mul(10 ** 18); // USD / USD/POLY = POLY + let investment_ETH_high = investment_USD.div(high_USDETH).mul(e18); // USD / USD/ETH = ETH + let investment_POLY_high = investment_USD.div(high_USDPOLY).mul(e18); // USD / USD/POLY = POLY + let investment_ETH_low = investment_USD.div(low_USDETH).mul(e18); // USD / USD/ETH = ETH + let investment_POLY_low = investment_USD.div(low_USDPOLY).mul(e18); // USD / USD/POLY = POLY await I_PolyToken.getTokens(investment_POLY_low, NONACCREDITED1); await I_PolyToken.approve(I_USDTieredSTO_Array[stoId].address, investment_POLY_low, { from: NONACCREDITED1 }); @@ -4451,50 +4463,56 @@ contract("USDTieredSTO", accounts => { describe("Generic", async () => { it("should get the right number of investors", async () => { assert.equal( - (await I_USDTieredSTO_Array[0].investorCount.call()).toNumber(), - (await I_USDTieredSTO_Array[0].investorCount()).toNumber(), + (await I_USDTieredSTO_Array[0].investorCount.call()).toString(), + (await I_USDTieredSTO_Array[0].investorCount()).toString(), "Investor count not changed as expected" ); assert.equal( - (await I_USDTieredSTO_Array[1].investorCount.call()).toNumber(), - (await I_USDTieredSTO_Array[1].investorCount()).toNumber(), + (await I_USDTieredSTO_Array[1].investorCount.call()).toString(), + (await I_USDTieredSTO_Array[1].investorCount()).toString(), "Investor count not changed as expected" ); assert.equal( - (await I_USDTieredSTO_Array[2].investorCount.call()).toNumber(), - (await I_USDTieredSTO_Array[2].investorCount()).toNumber(), + (await I_USDTieredSTO_Array[2].investorCount.call()).toString(), + (await I_USDTieredSTO_Array[2].investorCount()).toString(), "Investor count not changed as expected" ); }); it("should get the right amounts invested", async () => { assert.equal( - (await I_USDTieredSTO_Array[0].fundsRaised.call(ETH)).toNumber(), - (await I_USDTieredSTO_Array[0].getRaised(0)).toNumber(), + (await I_USDTieredSTO_Array[0].fundsRaised.call(ETH)).toString(), + (await I_USDTieredSTO_Array[0].getRaised(0)).toString(), "getRaisedEther not changed as expected" ); assert.equal( - (await I_USDTieredSTO_Array[0].fundsRaised.call(POLY)).toNumber(), - (await I_USDTieredSTO_Array[0].getRaised(1)).toNumber(), + (await I_USDTieredSTO_Array[0].fundsRaised.call(POLY)).toString(), + (await I_USDTieredSTO_Array[0].getRaised(1)).toString(), "getRaisedPOLY not changed as expected" ); assert.equal( - (await I_USDTieredSTO_Array[0].fundsRaisedUSD.call()).toNumber(), - (await I_USDTieredSTO_Array[0].fundsRaisedUSD()).toNumber(), + (await I_USDTieredSTO_Array[0].fundsRaisedUSD.call()).toString(), + (await I_USDTieredSTO_Array[0].fundsRaisedUSD()).toString(), "fundsRaisedUSD not changed as expected" ); }); it("should return minted tokens in a tier", async () => { - let totalMinted = (await I_USDTieredSTO_Array[0].getTokensSoldByTier.call(0)).toNumber(); + let totalMinted = (await I_USDTieredSTO_Array[0].getTokensSoldByTier.call(0)).toString(); let individualMinted = await I_USDTieredSTO_Array[0].getTokensMintedByTier.call(0); - assert.equal(totalMinted, individualMinted[0].add(individualMinted[1]).add(individualMinted[2]).toNumber()); + assert.equal( + totalMinted, + individualMinted[0] + .add(individualMinted[1]) + .add(individualMinted[2]) + .toString() + ); }); it("should return correct tokens sold in token details", async () => { - let tokensSold = (await I_USDTieredSTO_Array[0].getTokensSold.call()).toNumber(); + let tokensSold = (await I_USDTieredSTO_Array[0].getTokensSold.call()).toString(); let tokenDetails = await I_USDTieredSTO_Array[0].getSTODetails.call(); - assert.equal(tokensSold, tokenDetails[7].toNumber()); + assert.equal(tokensSold, tokenDetails[7].toString()); }); }); @@ -4507,27 +4525,27 @@ contract("USDTieredSTO", accounts => { it("should get the right conversion for ETH to USD", async () => { // 20 ETH to 10000 USD - let ethInWei = new BigNumber(web3.utils.toWei("20", "ether")); + let ethInWei = new BN(web3.utils.toWei("20", "ether")); let usdInWei = await I_USDTieredSTO_Array[0].convertToUSD(ETH, ethInWei); assert.equal( - usdInWei.div(10 ** 18).toNumber(), + usdInWei.div(e18).toString(), ethInWei - .div(10 ** 18) - .mul(USDETH.div(10 ** 18)) - .toNumber() + .div(e18) + .mul(USDETH.div(e18)) + .toString() ); }); it("should get the right conversion for POLY to USD", async () => { // 40000 POLY to 10000 USD - let polyInWei = new BigNumber(web3.utils.toWei("40000", "ether")); + let polyInWei = new BN(web3.utils.toWei("40000", "ether")); let usdInWei = await I_USDTieredSTO_Array[0].convertToUSD(POLY, polyInWei); assert.equal( - usdInWei.div(10 ** 18).toNumber(), + usdInWei.toString(), polyInWei - .div(10 ** 18) - .mul(USDPOLY.div(10 ** 18)) - .toNumber() + .mul(USDPOLY) + .div(e18) + .toString() ); }); }); @@ -4535,27 +4553,24 @@ contract("USDTieredSTO", accounts => { describe("convertFromUSD", async () => { it("should get the right conversion for USD to ETH", async () => { // 10000 USD to 20 ETH - let usdInWei = new BigNumber(web3.utils.toWei("10000", "ether")); + let usdInWei = new BN(web3.utils.toWei("10000", "ether")); let ethInWei = await I_USDTieredSTO_Array[0].convertFromUSD(ETH, usdInWei); assert.equal( - ethInWei.div(10 ** 18).toNumber(), + ethInWei.div(e18).toString(), usdInWei - .div(10 ** 18) - .div(USDETH.div(10 ** 18)) - .toNumber() + .div(e18) + .div(USDETH.div(e18)) + .toString() ); }); it("should get the right conversion for USD to POLY", async () => { // 10000 USD to 40000 POLY - let usdInWei = new BigNumber(web3.utils.toWei("10000", "ether")); + let usdInWei = new BN(web3.utils.toWei("10000", "ether")); let polyInWei = await I_USDTieredSTO_Array[0].convertFromUSD(POLY, usdInWei); assert.equal( - polyInWei.div(10 ** 18).toNumber(), - usdInWei - .div(10 ** 18) - .div(USDPOLY.div(10 ** 18)) - .toNumber() + polyInWei.toString(), + usdInWei.mul(e18).div(USDPOLY).toString() ); }); }); @@ -4563,12 +4578,14 @@ contract("USDTieredSTO", accounts => { describe("Test cases for the USDTieredSTOFactory", async () => { it("should get the exact details of the factory", async () => { - assert.equal((await I_USDTieredSTOFactory.getSetupCost.call()).toNumber(), STOSetupCost); + assert.equal((await I_USDTieredSTOFactory.getSetupCost.call()).toString(), STOSetupCost); assert.equal((await I_USDTieredSTOFactory.getTypes.call())[0], 3); assert.equal(web3.utils.hexToString(await I_USDTieredSTOFactory.getName.call()), "USDTieredSTO", "Wrong Module added"); - assert.equal(await I_USDTieredSTOFactory.description.call(), - "It allows both accredited and non-accredited investors to contribute into the STO. Non-accredited investors will be capped at a maximum investment limit (as a default or specific to their jurisdiction). Tokens will be sold according to tiers sequentially & each tier has its own price and volume of tokens to sell. Upon receipt of funds (ETH, POLY or DAI), security tokens will automatically transfer to investor’s wallet address", - "Wrong Module added"); + assert.equal( + await I_USDTieredSTOFactory.description.call(), + "It allows both accredited and non-accredited investors to contribute into the STO. Non-accredited investors will be capped at a maximum investment limit (as a default or specific to their jurisdiction). Tokens will be sold according to tiers sequentially & each tier has its own price and volume of tokens to sell. Upon receipt of funds (ETH, POLY or DAI), security tokens will automatically transfer to investor’s wallet address", + "Wrong Module added" + ); assert.equal(await I_USDTieredSTOFactory.title.call(), "USD Tiered STO", "Wrong Module added"); assert.equal(await I_USDTieredSTOFactory.getInstructions.call(), "Initialises a USD tiered STO.", "Wrong Module added"); assert.equal(await I_USDTieredSTOFactory.version.call(), "2.1.0"); diff --git a/test/q_usd_tiered_sto_sim.js b/test/q_usd_tiered_sto_sim.js index cee19785a..2e5fd4e5f 100644 --- a/test/q_usd_tiered_sto_sim.js +++ b/test/q_usd_tiered_sto_sim.js @@ -14,12 +14,12 @@ const GeneralPermissionManager = artifacts.require("./GeneralPermissionManager") const PolyTokenFaucet = artifacts.require("./PolyTokenFaucet.sol"); const Web3 = require("web3"); -const BigNumber = require("bignumber.js"); +let BN = Web3.utils.BN; const web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545")); // Hardcoded development port -const TOLERANCE = 2; // Allow balances to be off by 2 WEI for rounding purposes +//const TOLERANCE = 2; // Allow balances to be off by 2 WEI for rounding purposes -contract("USDTieredSTO Sim", accounts => { +contract("USDTieredSTO Sim", async (accounts) => { // Accounts Variable declaration let POLYMATH; let ISSUER; @@ -70,12 +70,12 @@ contract("USDTieredSTO Sim", accounts => { const STOKEY = 3; // Initial fee for ticker registry and security token registry - const REGFEE = web3.utils.toWei("250"); + const REGFEE = new BN(web3.utils.toWei("250")); const STOSetupCost = 0; // MockOracle USD prices - const USDETH = new BigNumber(500).mul(10 ** 18); // 500 USD/ETH - const USDPOLY = new BigNumber(25).mul(10 ** 16); // 0.25 USD/POLY + const USDETH = new BN(500).mul(new BN(10).pow(new BN(18))); // 500 USD/ETH + const USDPOLY = new BN(25).mul(new BN(10).pow(new BN(16))); // 0.25 USD/POLY // STO Configuration Arrays let _startTime = []; @@ -90,6 +90,9 @@ contract("USDTieredSTO Sim", accounts => { let _wallet = []; let _reserveWallet = []; let _usdToken = []; + + const address_zero = "0x0000000000000000000000000000000000000000"; + const one_address = "0x0000000000000000000000000000000000000001"; /* function configure( uint256 _startTime, @@ -161,11 +164,23 @@ contract("USDTieredSTO Sim", accounts => { }; function getRandomInt(min, max) { - return Math.floor(Math.random() * (max - min + 1)) + min; + let random = Math.floor(Math.random() * 10 ** 10); + return new BN(random).mul(new BN(max).add(new BN(1)).sub(new BN(min))).div(new BN(10).pow(new BN(10))); } + function minBN(a, b) { + if (a.lt(b)) + return a; + else + return b; + } + + let currentTime; + let e18 = new BN(10).pow(new BN(18)); + let e16 = new BN(10).pow(new BN(16)); + before(async () => { - // Accounts setup + currentTime = new BN(await latestTime()); POLYMATH = accounts[0]; ISSUER = accounts[1]; WALLET = accounts[2]; @@ -198,14 +213,14 @@ contract("USDTieredSTO Sim", accounts => { I_STRGetter ] = instances; - I_DaiToken = await PolyTokenFaucet.new({from: POLYMATH}); + I_DaiToken = await PolyTokenFaucet.new({ from: POLYMATH }); - // STEP 5: Deploy the USDTieredSTOFactory - [I_USDTieredSTOFactory] = await deployUSDTieredSTOAndVerified(POLYMATH, I_MRProxied, STOSetupCost); + // STEP 5: Deploy the USDTieredSTOFactory + [I_USDTieredSTOFactory] = await deployUSDTieredSTOAndVerified(POLYMATH, I_MRProxied, STOSetupCost); // Step 12: Deploy & Register Mock Oracles - I_USDOracle = await MockOracle.new(0, "ETH", "USD", USDETH, { from: POLYMATH }); // 500 dollars per POLY - I_POLYOracle = await MockOracle.new(I_PolyToken.address, "POLY", "USD", USDPOLY, { from: POLYMATH }); // 25 cents per POLY + I_USDOracle = await MockOracle.new(address_zero, web3.utils.fromAscii("ETH"), web3.utils.fromAscii("USD"), USDETH, { from: POLYMATH }); // 500 dollars per POLY + I_POLYOracle = await MockOracle.new(I_PolyToken.address, web3.utils.fromAscii("POLY"), web3.utils.fromAscii("USD"), USDPOLY, { from: POLYMATH }); // 25 cents per POLY await I_PolymathRegistry.changeAddress("EthUsdOracle", I_USDOracle.address, { from: POLYMATH }); await I_PolymathRegistry.changeAddress("PolyUsdOracle", I_POLYOracle.address, { from: POLYMATH }); @@ -241,13 +256,13 @@ contract("USDTieredSTO Sim", accounts => { it("Should generate the new security token with the same symbol as registered above", async () => { await I_PolyToken.getTokens(REGFEE, ISSUER); await I_PolyToken.approve(I_STRProxied.address, REGFEE, { from: ISSUER }); - let _blockNo = latestBlock(); + let tx = await I_STRProxied.generateSecurityToken(NAME, SYMBOL, TOKENDETAILS, true, { from: ISSUER }); assert.equal(tx.logs[2].args._ticker, SYMBOL, "SecurityToken doesn't get deployed"); - I_SecurityToken = SecurityToken.at(tx.logs[2].args._securityTokenAddress); + I_SecurityToken = await SecurityToken.at(tx.logs[2].args._securityTokenAddress); - const log = await promisifyLogWatch(I_SecurityToken.ModuleAdded({ from: _blockNo }), 1); + const log = (await I_SecurityToken.getPastEvents('ModuleAdded', {filter: {transactionHash: tx.transactionHash}}))[0]; // Verify that GeneralTransferManager module get added successfully or not assert.equal(log.args._types[0].toNumber(), TMKEY); @@ -256,20 +271,20 @@ contract("USDTieredSTO Sim", accounts => { it("Should intialize the auto attached modules", async () => { let moduleData = (await I_SecurityToken.getModulesByType(TMKEY))[0]; - I_GeneralTransferManager = GeneralTransferManager.at(moduleData); + I_GeneralTransferManager = await GeneralTransferManager.at(moduleData); }); it("Should successfully attach the first STO module to the security token", async () => { let stoId = 0; - _startTime.push(latestTime() + duration.days(2)); - _endTime.push(_startTime[stoId] + duration.days(100)); - _ratePerTier.push([BigNumber(0.05 * 10 ** 18), BigNumber(0.13 * 10 ** 18), BigNumber(0.17 * 10 ** 18)]); // [ 0.05 USD/Token, 0.10 USD/Token, 0.15 USD/Token ] - _ratePerTierDiscountPoly.push([BigNumber(0.05 * 10 ** 18), BigNumber(0.08 * 10 ** 18), BigNumber(0.13 * 10 ** 18)]); // [ 0.05 USD/Token, 0.08 USD/Token, 0.13 USD/Token ] - _tokensPerTierTotal.push([BigNumber(200 * 10 ** 18), BigNumber(500 * 10 ** 18), BigNumber(300 * 10 ** 18)]); // [ 1000 Token, 2000 Token, 1500 Token ] - _tokensPerTierDiscountPoly.push([BigNumber(0), BigNumber(50 * 10 ** 18), BigNumber(300 * 10 ** 18)]); // [ 0 Token, 1000 Token, 1500 Token ] - _nonAccreditedLimitUSD.push(new BigNumber(10 * 10 ** 18)); // 20 USD - _minimumInvestmentUSD.push(new BigNumber(0)); // 1 wei USD + _startTime.push(new BN(currentTime).add(new BN(duration.days(2)))); + _endTime.push(new BN(_startTime[stoId]).add(new BN(currentTime).add(new BN(duration.days(100))))); + _ratePerTier.push([new BN(50).mul(e16), new BN(130).mul(e16), new BN(170).mul(e16)]); // [ 0.05 USD/Token, 0.10 USD/Token, 0.15 USD/Token ] + _ratePerTierDiscountPoly.push([new BN(50).mul(e16), new BN(80).mul(e16), new BN(130).mul(e16)]); // [ 0.05 USD/Token, 0.08 USD/Token, 0.13 USD/Token ] + _tokensPerTierTotal.push([new BN(200).mul(e18), new BN(500).mul(e18), new BN(300).mul(e18)]); // [ 1000 Token, 2000 Token, 1500 Token ] + _tokensPerTierDiscountPoly.push([new BN(0), new BN(50).mul(e18), new BN(300).mul(e18)]); // [ 0 Token, 1000 Token, 1500 Token ] + _nonAccreditedLimitUSD.push(new BN(10).mul(e18)); // 20 USD + _minimumInvestmentUSD.push(new BN(0)); // 1 wei USD _fundRaiseTypes.push([0, 1, 2]); _wallet.push(WALLET); _reserveWallet.push(RESERVEWALLET); @@ -291,44 +306,44 @@ contract("USDTieredSTO Sim", accounts => { ]; let bytesSTO = web3.eth.abi.encodeFunctionCall(functionSignature, config); - let tx = await I_SecurityToken.addModule(I_USDTieredSTOFactory.address, bytesSTO, 0, 0, { from: ISSUER, gasPrice: GAS_PRICE }); + let tx = await I_SecurityToken.addModule(I_USDTieredSTOFactory.address, bytesSTO, new BN(0), new BN(0), { from: ISSUER, gasPrice: GAS_PRICE }); console.log(" Gas addModule: ".grey + tx.receipt.gasUsed.toString().grey); assert.equal(tx.logs[2].args._types[0], STOKEY, "USDTieredSTO doesn't get deployed"); assert.equal(web3.utils.hexToString(tx.logs[2].args._name), "USDTieredSTO", "USDTieredSTOFactory module was not added"); - I_USDTieredSTO_Array.push(USDTieredSTO.at(tx.logs[2].args._module)); + I_USDTieredSTO_Array.push(await USDTieredSTO.at(tx.logs[2].args._module)); - assert.equal(await I_USDTieredSTO_Array[stoId].startTime.call(), _startTime[stoId], "Incorrect _startTime in config"); - assert.equal(await I_USDTieredSTO_Array[stoId].endTime.call(), _endTime[stoId], "Incorrect _endTime in config"); + assert.equal((await I_USDTieredSTO_Array[stoId].startTime.call()).toString(), _startTime[stoId].toString(), "Incorrect _startTime in config"); + assert.equal((await I_USDTieredSTO_Array[stoId].endTime.call()).toString(), _endTime[stoId].toString(), "Incorrect _endTime in config"); for (var i = 0; i < _ratePerTier[stoId].length; i++) { assert.equal( - (await I_USDTieredSTO_Array[stoId].tiers.call(i))[0].toNumber(), - _ratePerTier[stoId][i].toNumber(), + (await I_USDTieredSTO_Array[stoId].tiers.call(i))[0].toString(), + _ratePerTier[stoId][i].toString(), "Incorrect _ratePerTier in config" ); assert.equal( - (await I_USDTieredSTO_Array[stoId].tiers.call(i))[1].toNumber(), - _ratePerTierDiscountPoly[stoId][i].toNumber(), + (await I_USDTieredSTO_Array[stoId].tiers.call(i))[1].toString(), + _ratePerTierDiscountPoly[stoId][i].toString(), "Incorrect _ratePerTierDiscountPoly in config" ); assert.equal( - (await I_USDTieredSTO_Array[stoId].tiers.call(i))[2].toNumber(), - _tokensPerTierTotal[stoId][i].toNumber(), + (await I_USDTieredSTO_Array[stoId].tiers.call(i))[2].toString(), + _tokensPerTierTotal[stoId][i].toString(), "Incorrect _tokensPerTierTotal in config" ); assert.equal( - (await I_USDTieredSTO_Array[stoId].tiers.call(i))[3].toNumber(), - _tokensPerTierDiscountPoly[stoId][i].toNumber(), + (await I_USDTieredSTO_Array[stoId].tiers.call(i))[3].toString(), + _tokensPerTierDiscountPoly[stoId][i].toString(), "Incorrect _tokensPerTierDiscountPoly in config" ); } assert.equal( - (await I_USDTieredSTO_Array[stoId].nonAccreditedLimitUSD.call()).toNumber(), - _nonAccreditedLimitUSD[stoId].toNumber(), + (await I_USDTieredSTO_Array[stoId].nonAccreditedLimitUSD.call()).toString(), + _nonAccreditedLimitUSD[stoId].toString(), "Incorrect _nonAccreditedLimitUSD in config" ); assert.equal( - (await I_USDTieredSTO_Array[stoId].minimumInvestmentUSD.call()).toNumber(), - _minimumInvestmentUSD[stoId].toNumber(), + (await I_USDTieredSTO_Array[stoId].minimumInvestmentUSD.call()).toString(), + _minimumInvestmentUSD[stoId].toString(), "Incorrect _minimumInvestmentUSD in config" ); assert.equal(await I_USDTieredSTO_Array[stoId].wallet.call(), _wallet[stoId], "Incorrect _wallet in config"); @@ -342,7 +357,7 @@ contract("USDTieredSTO Sim", accounts => { _tokensPerTierTotal[stoId].length, "Incorrect number of tiers" ); - assert.equal((await I_USDTieredSTO_Array[stoId].getPermissions()).length, 0, "Incorrect number of permissions"); + assert.equal((await I_USDTieredSTO_Array[stoId].getPermissions()).length, new BN(0), "Incorrect number of permissions"); }); it("Should successfully prepare the STO", async () => { @@ -352,8 +367,8 @@ contract("USDTieredSTO Sim", accounts => { await increaseTime(duration.days(3)); // Whitelist - let fromTime = latestTime() + duration.days(15); - let toTime = latestTime() + duration.days(15); + let fromTime = await latestTime() + duration.days(15); + let toTime = await latestTime() + duration.days(15); let expiryTime = toTime + duration.days(100); let canBuyFromSTO = true; @@ -386,14 +401,15 @@ contract("USDTieredSTO Sim", accounts => { ---------------------------------------------------------- `); - let totalTokens = new BigNumber(0); + let totalTokens = new BN(0); for (var i = 0; i < _tokensPerTierTotal[stoId].length; i++) { totalTokens = totalTokens.add(_tokensPerTierTotal[stoId][i]); } - console.log("totalTokens: " + totalTokens.div(10 ** 18).toNumber()); - let tokensSold = new BigNumber(0); + let tokensSold = new BN(0); while (true) { - switch (getRandomInt(0, 5)) { + let rn = getRandomInt(0, 5); + let rno = rn.toNumber(); + switch (rno) { case 0: // ACCREDITED1 await invest(ACCREDITED1, true); break; @@ -425,8 +441,8 @@ contract("USDTieredSTO Sim", accounts => { } console.log("Next round"); tokensSold = await I_USDTieredSTO_Array[stoId].getTokensSold(); - console.log("Tokens Sold: " + tokensSold.toString()); - if (tokensSold.gte(totalTokens.sub(1 * 10 ** 18))) { + console.log("Tokens Sold: " + tokensSold.div(e18).toString()); + if (tokensSold.gte(totalTokens.sub(new BN(1)))) { console.log(`${tokensSold} tokens sold, simulation completed successfully!`.green); break; } @@ -439,33 +455,26 @@ contract("USDTieredSTO Sim", accounts => { let USD_to_date = await I_USDTieredSTO_Array[stoId].investorInvestedUSD.call(_investor); USD_remaining = _nonAccreditedLimitUSD[stoId].sub(USD_to_date); } else { - USD_remaining = totalTokens.mul(2); + USD_remaining = totalTokens.mul(new BN(2)); } let log_remaining = USD_remaining; let isPoly = Math.random() >= 0.33; let isDai = Math.random() >= 0.33; - let Token_counter = new BigNumber(getRandomInt(1 * 10 ** 10, 50 * 10 ** 10)).mul(10 ** 8); - let investment_USD = new BigNumber(0); - let investment_ETH = new BigNumber(0); - let investment_POLY = new BigNumber(0); - let investment_DAI = new BigNumber(0); - let investment_Token = new BigNumber(0); + let Token_counter = new BN(getRandomInt(new BN(1).mul(new BN(10).pow(new BN(10))), new BN(5).mul(new BN(10).pow(new BN(11))))).mul(new BN(10).pow(new BN(8))); + let investment_USD = new BN(0); + let investment_ETH = new BN(0); + let investment_POLY = new BN(0); + let investment_DAI = new BN(0); + let investment_Token = new BN(0); let Tokens_total = []; let Tokens_discount = []; for (var i = 0; i < _ratePerTier[stoId].length; i++) { - Tokens_total.push( - (await I_USDTieredSTO_Array[stoId].tiers.call(i))[2].sub( - (await I_USDTieredSTO_Array[stoId].tiers.call(i))[4] - ) - ); - Tokens_discount.push( - (await I_USDTieredSTO_Array[stoId].tiers.call(i))[3].sub( - (await I_USDTieredSTO_Array[stoId].tiers.call(i))[5] - ) - ); + let tierData = await I_USDTieredSTO_Array[stoId].tiers.call(i); + Tokens_total.push(new BN(tierData[2]).sub(tierData[4])); + Tokens_discount.push(new BN(tierData[3]).sub(tierData[5])); } let tier = 0; @@ -478,25 +487,25 @@ contract("USDTieredSTO Sim", accounts => { let USD_overflow; let Token_overflow; - while (Token_counter.gt(0)) { + while (Token_counter.gt(new BN(0))) { if (tier == _ratePerTier[stoId].length) { break; } - if (Tokens_total[tier].gt(0)) { + if (Tokens_total[tier].gt(new BN(0))) { if (isPoly) { // 1. POLY and discount (consume up to cap then move to regular) - if (Tokens_discount[tier].gt(0)) { - Token_Tier = new BigNumber.min([Tokens_total[tier], Tokens_discount[tier], Token_counter]); - USD_Tier = Token_Tier.mul(_ratePerTierDiscountPoly[stoId][tier].div(10 ** 18)); + if (Tokens_discount[tier].gt(new BN(0))) { + Token_Tier = minBN(minBN(Tokens_total[tier], Tokens_discount[tier]), Token_counter); + USD_Tier = Token_Tier.mul(_ratePerTierDiscountPoly[stoId][tier]).div(e18); if (USD_Tier.gte(USD_remaining)) { USD_overflow = USD_Tier.sub(USD_remaining); - Token_overflow = USD_overflow.mul(10 ** 18).div(_ratePerTierDiscountPoly[stoId][tier]); + Token_overflow = USD_overflow.mul(e18).div(_ratePerTierDiscountPoly[stoId][tier]); USD_Tier = USD_Tier.sub(USD_overflow); Token_Tier = Token_Tier.sub(Token_overflow); - Token_counter = new BigNumber(0); + Token_counter = new BN(0); } - POLY_Tier = new BigNumber(USD_Tier.mul(10 ** 18).toFixed(0)); - POLY_Tier = POLY_Tier.div(USDPOLY).toFixed(0); + POLY_Tier = new BN(USD_Tier.mul(e18)); + POLY_Tier = POLY_Tier.div(USDPOLY); USD_remaining = USD_remaining.sub(USD_Tier); Tokens_total[tier] = Tokens_total[tier].sub(Token_Tier); Tokens_discount[tier] = Tokens_discount[tier].sub(Token_Tier); @@ -506,18 +515,18 @@ contract("USDTieredSTO Sim", accounts => { investment_POLY = investment_POLY.add(POLY_Tier); } // 2. POLY and regular (consume up to cap then skip to next tier) - if (Tokens_total[tier].gt(0) && Token_counter.gt(0)) { - Token_Tier = new BigNumber.min([Tokens_total[tier], Token_counter]); - USD_Tier = Token_Tier.mul(_ratePerTier[stoId][tier].div(10 ** 18)); + if (Tokens_total[tier].gt(new BN(0)) && Token_counter.gt(new BN(0))) { + Token_Tier = minBN(Tokens_total[tier], Token_counter); + USD_Tier = Token_Tier.mul(_ratePerTier[stoId][tier]).div(e18); if (USD_Tier.gte(USD_remaining)) { USD_overflow = USD_Tier.sub(USD_remaining); - Token_overflow = USD_overflow.mul(10 ** 18).div(_ratePerTier[stoId][tier]); + Token_overflow = USD_overflow.mul(e18).div(_ratePerTier[stoId][tier]); USD_Tier = USD_Tier.sub(USD_overflow); Token_Tier = Token_Tier.sub(Token_overflow); - Token_counter = new BigNumber(0); + Token_counter = new BN(0); } - POLY_Tier = new BigNumber(USD_Tier.mul(10 ** 18).toFixed(0)); - POLY_Tier = POLY_Tier.div(USDPOLY).toFixed(0); + POLY_Tier = new BN(USD_Tier.mul(e18)); + POLY_Tier = POLY_Tier.div(USDPOLY); USD_remaining = USD_remaining.sub(USD_Tier); Tokens_total[tier] = Tokens_total[tier].sub(Token_Tier); Token_counter = Token_counter.sub(Token_Tier); @@ -527,16 +536,16 @@ contract("USDTieredSTO Sim", accounts => { } } else if (isDai) { // 3. DAI (consume up to cap then skip to next tier) - Token_Tier = new BigNumber.min([Tokens_total[tier], Token_counter]); - USD_Tier = Token_Tier.mul(_ratePerTier[stoId][tier].div(10 ** 18)); + Token_Tier = minBN(Tokens_total[tier], Token_counter); + USD_Tier = Token_Tier.mul(_ratePerTier[stoId][tier]).div(e18); if (USD_Tier.gte(USD_remaining)) { USD_overflow = USD_Tier.sub(USD_remaining); - Token_overflow = USD_overflow.mul(10 ** 18).div(_ratePerTier[stoId][tier]); + Token_overflow = USD_overflow.mul(e18).div(_ratePerTier[stoId][tier]); USD_Tier = USD_Tier.sub(USD_overflow); Token_Tier = Token_Tier.sub(Token_overflow); - Token_counter = new BigNumber(0); + Token_counter = new BN(0); } - DAI_Tier = USD_Tier.toFixed(0); + DAI_Tier = USD_Tier; USD_remaining = USD_remaining.sub(USD_Tier); Tokens_total[tier] = Tokens_total[tier].sub(Token_Tier); Token_counter = Token_counter.sub(Token_Tier); @@ -545,17 +554,16 @@ contract("USDTieredSTO Sim", accounts => { investment_DAI = investment_USD; } else { // 4. ETH (consume up to cap then skip to next tier) - Token_Tier = new BigNumber.min([Tokens_total[tier], Token_counter]); - USD_Tier = Token_Tier.mul(_ratePerTier[stoId][tier].div(10 ** 18)); + Token_Tier = minBN(Tokens_total[tier], Token_counter); + USD_Tier = Token_Tier.mul(_ratePerTier[stoId][tier]).div(e18); if (USD_Tier.gte(USD_remaining)) { USD_overflow = USD_Tier.sub(USD_remaining); - Token_overflow = USD_overflow.mul(10 ** 18).div(_ratePerTier[stoId][tier]); + Token_overflow = USD_overflow.mul(e18).div(_ratePerTier[stoId][tier]); USD_Tier = USD_Tier.sub(USD_overflow); Token_Tier = Token_Tier.sub(Token_overflow); - Token_counter = new BigNumber(0); + Token_counter = new BN(0); } - ETH_Tier = new BigNumber(USD_Tier.mul(10 ** 18).toFixed(0)); - ETH_Tier = ETH_Tier.div(USDETH).toFixed(0); + ETH_Tier = USD_Tier.mul(e18).div(USDETH); USD_remaining = USD_remaining.sub(USD_Tier); Tokens_total[tier] = Tokens_total[tier].sub(Token_Tier); Token_counter = Token_counter.sub(Token_Tier); @@ -564,7 +572,7 @@ contract("USDTieredSTO Sim", accounts => { investment_ETH = investment_ETH.add(ETH_Tier); } } - tier++; + tier = tier + 1; } await processInvestment( @@ -586,9 +594,9 @@ contract("USDTieredSTO Sim", accounts => { async function investFAIL(_investor) { let isPoly = Math.random() >= 0.3; let isDAI = Math.random() >= 0.3; - let investment_POLY = new BigNumber(40 * 10 ** 18); // 10 USD = 40 POLY - let investment_ETH = new BigNumber(0.02 * 10 ** 18); // 10 USD = 0.02 ETH - let investment_DAI = new BigNumber(10 * 10 ** 18); // 10 USD = DAI DAI + let investment_POLY = new BN(40).mul(e18); // 10 USD = 40 POLY + let investment_ETH = new BN(20).mul(e16); // 10 USD = 0.02 ETH + let investment_DAI = new BN(10).mul(e18); // 10 USD = DAI DAI if (isPoly) { await I_PolyToken.getTokens(investment_POLY, _investor); @@ -622,23 +630,23 @@ contract("USDTieredSTO Sim", accounts => { Tokens_discount, tokensSold ) { - investment_Token = new BigNumber(investment_Token.toFixed(0)); - investment_USD = new BigNumber(investment_USD.toFixed(0)); - investment_POLY = new BigNumber(investment_POLY.toFixed(0)); - investment_DAI = new BigNumber(investment_DAI.toFixed(0)); - investment_ETH = new BigNumber(investment_ETH.toFixed(0)); + investment_Token = new BN(investment_Token); + investment_USD = new BN(investment_USD); + investment_POLY = new BN(investment_POLY); + investment_DAI = new BN(investment_DAI); + investment_ETH = new BN(investment_ETH); console.log(` ------------------- New Investment ------------------- Investor: ${_investor} - N-A USD Remaining: ${log_remaining.div(10 ** 18)} + N-A USD Remaining: ${log_remaining} Total Cap Remaining: ${Tokens_total} Discount Cap Remaining: ${Tokens_discount} - Total Tokens Sold: ${tokensSold.div(10 ** 18)} - Token Investment: ${investment_Token.div(10 ** 18)} - USD Investment: ${investment_USD.div(10 ** 18)} - POLY Investment: ${investment_POLY.div(10 ** 18)} - DAI Investment: ${investment_DAI.div(10 ** 18)} - ETH Investment: ${investment_ETH.div(10 ** 18)} + Total Tokens Sold: ${tokensSold} + Token Investment: ${investment_Token} + USD Investment: ${investment_USD} + POLY Investment: ${investment_POLY} + DAI Investment: ${investment_DAI} + ETH Investment: ${investment_ETH} ------------------------------------------------------ `); @@ -654,69 +662,68 @@ contract("USDTieredSTO Sim", accounts => { let init_TokenSupply = await I_SecurityToken.totalSupply(); let init_InvestorTokenBal = await I_SecurityToken.balanceOf(_investor); - let init_InvestorETHBal = new BigNumber(await web3.eth.getBalance(_investor)); + let init_InvestorETHBal = new BN(await web3.eth.getBalance(_investor)); let init_InvestorPOLYBal = await I_PolyToken.balanceOf(_investor); let init_InvestorDAIBal = await I_DaiToken.balanceOf(_investor); let init_STOTokenSold = await I_USDTieredSTO_Array[stoId].getTokensSold(); - let init_STOETHBal = new BigNumber(await web3.eth.getBalance(I_USDTieredSTO_Array[stoId].address)); + let init_STOETHBal = new BN(await web3.eth.getBalance(I_USDTieredSTO_Array[stoId].address)); let init_STOPOLYBal = await I_PolyToken.balanceOf(I_USDTieredSTO_Array[stoId].address); let init_STODAIBal = await I_DaiToken.balanceOf(I_USDTieredSTO_Array[stoId].address); let init_RaisedUSD = await I_USDTieredSTO_Array[stoId].fundsRaisedUSD.call(); let init_RaisedETH = await I_USDTieredSTO_Array[stoId].fundsRaised.call(0); let init_RaisedPOLY = await I_USDTieredSTO_Array[stoId].fundsRaised.call(1); let init_RaisedDAI = await I_USDTieredSTO_Array[stoId].fundsRaised.call(2); - let init_WalletETHBal = new BigNumber(await web3.eth.getBalance(WALLET)); + let init_WalletETHBal = new BN(await web3.eth.getBalance(WALLET)); let init_WalletPOLYBal = await I_PolyToken.balanceOf(WALLET); let init_WalletDAIBal = await I_DaiToken.balanceOf(WALLET); let tx; - let gasCost = new BigNumber(0); + let gasCost = new BN(0); - if (isPoly && investment_POLY.gt(10)) { + if (isPoly && investment_POLY.gt(new BN(10))) { tx = await I_USDTieredSTO_Array[stoId].buyWithPOLY(_investor, investment_POLY, { from: _investor, gasPrice: GAS_PRICE }); - gasCost = new BigNumber(GAS_PRICE).mul(tx.receipt.gasUsed); + gasCost = new BN(GAS_PRICE).mul(new BN(tx.receipt.gasUsed)); console.log( - `buyWithPOLY: ${investment_Token.div(10 ** 18)} tokens for ${investment_POLY.div(10 ** 18)} POLY by ${_investor}` + `buyWithPOLY: ${investment_Token.div(e18)} tokens for ${investment_POLY.div(e18)} POLY by ${_investor}` .yellow ); - } else if (isDai && investment_DAI.gt(10)) { + } else if (isDai && investment_DAI.gt(new BN(10))) { tx = await I_USDTieredSTO_Array[stoId].buyWithUSD(_investor, investment_DAI, { from: _investor, gasPrice: GAS_PRICE }); - gasCost = new BigNumber(GAS_PRICE).mul(tx.receipt.gasUsed); + gasCost = new BN(GAS_PRICE).mul(new BN(tx.receipt.gasUsed)); console.log( - `buyWithUSD: ${investment_Token.div(10 ** 18)} tokens for ${investment_DAI.div(10 ** 18)} DAI by ${_investor}` + `buyWithUSD: ${investment_Token.div(e18)} tokens for ${investment_DAI.div(e18)} DAI by ${_investor}` .yellow ); - } else if (investment_ETH.gt(0)) { + } else if (investment_ETH.gt(new BN(0))) { tx = await I_USDTieredSTO_Array[stoId].buyWithETH(_investor, { from: _investor, value: investment_ETH, gasPrice: GAS_PRICE }); - gasCost = new BigNumber(GAS_PRICE).mul(tx.receipt.gasUsed); + gasCost = new BN(GAS_PRICE).mul(new BN(tx.receipt.gasUsed)); console.log( - `buyWithETH: ${investment_Token.div(10 ** 18)} tokens for ${investment_ETH.div(10 ** 18)} ETH by ${_investor}` + `buyWithETH: ${investment_Token.div(e18)} tokens for ${investment_ETH.div(e18)} ETH by ${_investor}` .yellow ); } - console.log(investment_POLY.toNumber()); let final_TokenSupply = await I_SecurityToken.totalSupply(); let final_InvestorTokenBal = await I_SecurityToken.balanceOf(_investor); - let final_InvestorETHBal = new BigNumber(await web3.eth.getBalance(_investor)); + let final_InvestorETHBal = new BN(await web3.eth.getBalance(_investor)); let final_InvestorPOLYBal = await I_PolyToken.balanceOf(_investor); let final_InvestorDAIBal = await I_DaiToken.balanceOf(_investor); let final_STOTokenSold = await I_USDTieredSTO_Array[stoId].getTokensSold(); - let final_STOETHBal = new BigNumber(await web3.eth.getBalance(I_USDTieredSTO_Array[stoId].address)); + let final_STOETHBal = new BN(await web3.eth.getBalance(I_USDTieredSTO_Array[stoId].address)); let final_STOPOLYBal = await I_PolyToken.balanceOf(I_USDTieredSTO_Array[stoId].address); let final_STODAIBal = await I_DaiToken.balanceOf(I_USDTieredSTO_Array[stoId].address); let final_RaisedUSD = await I_USDTieredSTO_Array[stoId].fundsRaisedUSD.call(); let final_RaisedETH = await I_USDTieredSTO_Array[stoId].fundsRaised.call(0); let final_RaisedPOLY = await I_USDTieredSTO_Array[stoId].fundsRaised.call(1); let final_RaisedDAI = await I_USDTieredSTO_Array[stoId].fundsRaised.call(2); - let final_WalletETHBal = new BigNumber(await web3.eth.getBalance(WALLET)); + let final_WalletETHBal = new BN(await web3.eth.getBalance(WALLET)); let final_WalletPOLYBal = await I_PolyToken.balanceOf(WALLET); let final_WalletDAIBal = await I_DaiToken.balanceOf(WALLET); @@ -724,223 +731,56 @@ contract("USDTieredSTO Sim", accounts => { // console.log('final_TokenSupply: '+final_TokenSupply.div(10**18).toNumber()); if (isPoly) { - assert.closeTo( - final_TokenSupply.toNumber(), - init_TokenSupply.add(investment_Token).toNumber(), - TOLERANCE, - "Token Supply not changed as expected" - ); - assert.closeTo( - final_InvestorTokenBal.toNumber(), - init_InvestorTokenBal.add(investment_Token).toNumber(), - TOLERANCE, - "Investor Token Balance not changed as expected" - ); - assert.closeTo( - final_InvestorETHBal.toNumber(), - init_InvestorETHBal.sub(gasCost).toNumber(), - TOLERANCE, - "Investor ETH Balance not changed as expected" - ); - assert.closeTo( - final_InvestorPOLYBal.toNumber(), - init_InvestorPOLYBal.sub(investment_POLY).toNumber(), - TOLERANCE, - "Investor POLY Balance not changed as expected" - ); - assert.closeTo( - final_STOTokenSold.toNumber(), - init_STOTokenSold.add(investment_Token).toNumber(), - TOLERANCE, - "STO Token Sold not changed as expected" - ); - assert.closeTo( - final_STOETHBal.toNumber(), - init_STOETHBal.toNumber(), - TOLERANCE, - "STO ETH Balance not changed as expected" - ); - assert.closeTo( - final_STOPOLYBal.toNumber(), - init_STOPOLYBal.toNumber(), - TOLERANCE, - "STO POLY Balance not changed as expected" - ); - assert.closeTo( - final_RaisedUSD.toNumber(), - init_RaisedUSD.add(investment_USD).toNumber(), - TOLERANCE, - "Raised USD not changed as expected" - ); - assert.closeTo(final_RaisedETH.toNumber(), init_RaisedETH.toNumber(), TOLERANCE, "Raised ETH not changed as expected"); - assert.closeTo( - final_RaisedPOLY.toNumber(), - init_RaisedPOLY.add(investment_POLY).toNumber(), - TOLERANCE, - "Raised POLY not changed as expected" - ); - assert.closeTo( - final_WalletETHBal.toNumber(), - init_WalletETHBal.toNumber(), - TOLERANCE, - "Wallet ETH Balance not changed as expected" - ); - assert.closeTo( - final_WalletPOLYBal.toNumber(), - init_WalletPOLYBal.add(investment_POLY).toNumber(), - TOLERANCE, - "Wallet POLY Balance not changed as expected" - ); - } else if (isDai) { - assert.closeTo( - final_TokenSupply.toNumber(), - init_TokenSupply.add(investment_Token).toNumber(), - TOLERANCE, - "Token Supply not changed as expected" - ); - assert.closeTo( - final_InvestorTokenBal.toNumber(), - init_InvestorTokenBal.add(investment_Token).toNumber(), - TOLERANCE, - "Investor Token Balance not changed as expected" - ); - assert.closeTo( - final_InvestorETHBal.toNumber(), - init_InvestorETHBal.sub(gasCost).toNumber(), - TOLERANCE, - "Investor ETH Balance not changed as expected" - ); - assert.closeTo( - final_InvestorDAIBal.toNumber(), - init_InvestorDAIBal.sub(investment_DAI).toNumber(), - TOLERANCE, - "Investor DAI Balance not changed as expected" - ); - assert.closeTo( - final_STOTokenSold.toNumber(), - init_STOTokenSold.add(investment_Token).toNumber(), - TOLERANCE, - "STO Token Sold not changed as expected" - ); - assert.closeTo( - final_STOETHBal.toNumber(), - init_STOETHBal.toNumber(), - TOLERANCE, - "STO ETH Balance not changed as expected" - ); - assert.closeTo( - final_STODAIBal.toNumber(), - init_STODAIBal.toNumber(), - TOLERANCE, - "STO DAI Balance not changed as expected" - ); - assert.closeTo( - final_RaisedUSD.toNumber(), - init_RaisedUSD.add(investment_USD).toNumber(), - TOLERANCE, - "Raised USD not changed as expected" - ); - assert.closeTo(final_RaisedETH.toNumber(), init_RaisedETH.toNumber(), TOLERANCE, "Raised ETH not changed as expected"); - assert.closeTo( - final_RaisedDAI.toNumber(), - init_RaisedDAI.add(investment_DAI).toNumber(), - TOLERANCE, - "Raised DAI not changed as expected" - ); - assert.closeTo( - final_WalletETHBal.toNumber(), - init_WalletETHBal.toNumber(), - TOLERANCE, - "Wallet ETH Balance not changed as expected" - ); - assert.closeTo( - final_WalletDAIBal.toNumber(), - init_WalletDAIBal.add(investment_DAI).toNumber(), - TOLERANCE, - "Wallet DAI Balance not changed as expected" - ); - } else { - assert.closeTo( - final_TokenSupply.toNumber(), - init_TokenSupply.add(investment_Token).toNumber(), - TOLERANCE, - "Token Supply not changed as expected" - ); - assert.closeTo( - final_InvestorTokenBal.toNumber(), - init_InvestorTokenBal.add(investment_Token).toNumber(), - TOLERANCE, - "Investor Token Balance not changed as expected" - ); - assert.closeTo( - final_InvestorETHBal.toNumber(), - init_InvestorETHBal - .sub(gasCost) - .sub(investment_ETH) - .toNumber(), - TOLERANCE, - "Investor ETH Balance not changed as expected" - ); - assert.closeTo( - final_InvestorPOLYBal.toNumber(), - init_InvestorPOLYBal.toNumber(), - TOLERANCE, - "Investor POLY Balance not changed as expected" - ); - assert.closeTo( - final_STOTokenSold.toNumber(), - init_STOTokenSold.add(investment_Token).toNumber(), - TOLERANCE, - "STO Token Sold not changed as expected" - ); - assert.closeTo( - final_STOETHBal.toNumber(), - init_STOETHBal.toNumber(), - TOLERANCE, - "STO ETH Balance not changed as expected" - ); - assert.closeTo( - final_STOPOLYBal.toNumber(), - init_STOPOLYBal.toNumber(), - TOLERANCE, - "STO POLY Balance not changed as expected" - ); - assert.closeTo( - final_RaisedUSD.toNumber(), - init_RaisedUSD.add(investment_USD).toNumber(), - TOLERANCE, - "Raised USD not changed as expected" - ); - assert.closeTo( - final_RaisedETH.toNumber(), - init_RaisedETH.add(investment_ETH).toNumber(), - TOLERANCE, - "Raised ETH not changed as expected" - ); - assert.closeTo( - final_RaisedPOLY.toNumber(), - init_RaisedPOLY.toNumber(), - TOLERANCE, - "Raised POLY not changed as expected" - ); - assert.closeTo( - final_WalletETHBal.toNumber(), - init_WalletETHBal.add(investment_ETH).toNumber(), - TOLERANCE, - "Wallet ETH Balance not changed as expected" - ); - assert.closeTo( - final_WalletPOLYBal.toNumber(), - init_WalletPOLYBal.toNumber(), - TOLERANCE, - "Wallet POLY Balance not changed as expected" - ); + assertIsNear(final_TokenSupply, init_TokenSupply.add(investment_Token), "Token Supply not changed as expected" ); + assertIsNear(final_InvestorTokenBal, init_InvestorTokenBal.add(investment_Token), "Investor Token Balance not changed as expected" ); + assertIsNear(final_InvestorETHBal, init_InvestorETHBal.sub(gasCost), "Investor ETH Balance not changed as expected" ); + assertIsNear(final_InvestorPOLYBal, init_InvestorPOLYBal.sub(investment_POLY), "Investor POLY Balance not changed as expected" ); + assertIsNear(final_STOTokenSold, init_STOTokenSold.add(investment_Token), "STO Token Sold not changed as expected" ); + assertIsNear(final_STOETHBal, init_STOETHBal, "STO ETH Balance not changed as expected" ); + assertIsNear(final_STOPOLYBal, init_STOPOLYBal, "STO POLY Balance not changed as expected" ); + assertIsNear(final_RaisedUSD, init_RaisedUSD.add(investment_USD), "Raised USD not changed as expected" ); + assertIsNear(final_RaisedETH, init_RaisedETH, "Raised ETH not changed as expected"); + assertIsNear(final_RaisedPOLY, init_RaisedPOLY.add(investment_POLY), "Raised POLY not changed as expected" ); + assertIsNear(final_WalletETHBal, init_WalletETHBal, "Wallet ETH Balance not changed as expected" ); + assertIsNear(final_WalletPOLYBal, init_WalletPOLYBal.add(investment_POLY), "Wallet POLY Balance not changed as expected" ); + } else if (isDai) { + assertIsNear(final_TokenSupply, init_TokenSupply.add(investment_Token), "Token Supply not changed as expected" ); + assertIsNear(final_InvestorTokenBal, init_InvestorTokenBal.add(investment_Token), "Investor Token Balance not changed as expected" ); + assertIsNear(final_InvestorETHBal, init_InvestorETHBal.sub(gasCost), "Investor ETH Balance not changed as expected" ); + assertIsNear(final_InvestorDAIBal, init_InvestorDAIBal.sub(investment_DAI), "Investor DAI Balance not changed as expected" ); + assertIsNear(final_STOTokenSold, init_STOTokenSold.add(investment_Token), "STO Token Sold not changed as expected" ); + assertIsNear(final_STOETHBal, init_STOETHBal, "STO ETH Balance not changed as expected" ); + assertIsNear(final_STODAIBal, init_STODAIBal, "STO DAI Balance not changed as expected" ); + assertIsNear(final_RaisedUSD, init_RaisedUSD.add(investment_USD), "Raised USD not changed as expected" ); + assertIsNear(final_RaisedETH, init_RaisedETH, "Raised ETH not changed as expected"); + assertIsNear(final_RaisedDAI, init_RaisedDAI.add(investment_DAI), "Raised DAI not changed as expected" ); + assertIsNear(final_WalletETHBal, init_WalletETHBal, "Wallet ETH Balance not changed as expected" ); + assertIsNear(final_WalletDAIBal, init_WalletDAIBal.add(investment_DAI), "Wallet DAI Balance not changed as expected" ); + } else { + assertIsNear(final_TokenSupply, init_TokenSupply.add(investment_Token), "Token Supply not changed as expected" ); + assertIsNear(final_InvestorTokenBal, init_InvestorTokenBal.add(investment_Token), "Investor Token Balance not changed as expected" ); + assertIsNear(final_InvestorETHBal, init_InvestorETHBal .sub(gasCost) .sub(investment_ETH) , "Investor ETH Balance not changed as expected" ); + assertIsNear(final_InvestorPOLYBal, init_InvestorPOLYBal, "Investor POLY Balance not changed as expected" ); + assertIsNear(final_STOTokenSold, init_STOTokenSold.add(investment_Token), "STO Token Sold not changed as expected" ); + assertIsNear(final_STOETHBal, init_STOETHBal, "STO ETH Balance not changed as expected" ); + assertIsNear(final_STOPOLYBal, init_STOPOLYBal, "STO POLY Balance not changed as expected" ); + assertIsNear(final_RaisedUSD, init_RaisedUSD.add(investment_USD), "Raised USD not changed as expected" ); + assertIsNear(final_RaisedETH, init_RaisedETH.add(investment_ETH), "Raised ETH not changed as expected" ); + assertIsNear(final_RaisedPOLY, init_RaisedPOLY, "Raised POLY not changed as expected" ); + assertIsNear(final_WalletETHBal, init_WalletETHBal.add(investment_ETH), "Wallet ETH Balance not changed as expected" ); + assertIsNear(final_WalletPOLYBal, init_WalletPOLYBal, "Wallet POLY Balance not changed as expected" ); } } }); }); }); -function near(x, y, message) { - assert.isAtMost(x, y); -} +function assertIsNear(a, b, reason) { + a = new BN(a); + b = new BN(b); + if (a.gt(b)) { + assert.isBelow(a.sub(b).toNumber(), 4, reason); + } else { + assert.isBelow(b.sub(a).toNumber(), 4, reason); + } +} \ No newline at end of file diff --git a/test/r_concurrent_STO.js b/test/r_concurrent_STO.js index 0c4a06add..129116c26 100644 --- a/test/r_concurrent_STO.js +++ b/test/r_concurrent_STO.js @@ -7,8 +7,7 @@ import { deployDummySTOAndVerifyed, deployCappedSTOAndVerifyed, deployPresaleSTOAndVerified - } from "./helpers/createInstances"; - +} from "./helpers/createInstances"; // Import contract ABIs const CappedSTO = artifacts.require("./CappedSTO.sol"); @@ -18,10 +17,10 @@ const SecurityToken = artifacts.require("./SecurityToken.sol"); const GeneralTransferManager = artifacts.require("./GeneralTransferManager"); const Web3 = require("web3"); -const BigNumber = require("bignumber.js"); +let BN = Web3.utils.BN; const web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545")); // Hardcoded development port -contract("Concurrent STO", accounts => { +contract("Concurrent STO", async (accounts) => { // Accounts variable declaration let account_polymath; let account_issuer; @@ -57,8 +56,8 @@ contract("Concurrent STO", accounts => { let message = "Transaction Should Fail!"; // Initial fees - const initRegFee = web3.utils.toWei("250"); - const STOSetupCost = 200 * Math.pow(10, 18); + const initRegFee = new BN(web3.utils.toWei("250")); + const STOSetupCost = web3.utils.toHex(200 * Math.pow(10, 18)); // Module keys const transferManagerKey = 2; @@ -70,8 +69,12 @@ contract("Concurrent STO", accounts => { const DummySTOParameters = ["uint256", "uint256", "uint256", "string"]; const PresaleSTOParameters = ["uint256"]; + let currentTime; + const address_zero = "0x0000000000000000000000000000000000000000"; + const one_address = "0x0000000000000000000000000000000000000001"; + before(async () => { - // Accounts setup + currentTime = new BN(await latestTime()); account_polymath = accounts[0]; account_issuer = accounts[1]; account_fundsReceiver = accounts[2]; @@ -139,13 +142,13 @@ contract("Concurrent STO", accounts => { it("Should generate the new security token with the same symbol as registered above", async () => { await I_PolyToken.getTokens(initRegFee, account_issuer); await I_PolyToken.approve(I_STRProxied.address, initRegFee, { from: account_issuer }); - let _blockNo = latestBlock(); + let tx = await I_STRProxied.generateSecurityToken(name, symbol, tokenDetails, false, { from: account_issuer }); assert.equal(tx.logs[2].args._ticker, symbol, "SecurityToken doesn't get deployed"); - I_SecurityToken = SecurityToken.at(tx.logs[2].args._securityTokenAddress); + I_SecurityToken = await SecurityToken.at(tx.logs[2].args._securityTokenAddress); - const log = await promisifyLogWatch(I_SecurityToken.ModuleAdded({ from: _blockNo }), 1); + const log = (await I_SecurityToken.getPastEvents('ModuleAdded', {filter: {transactionHash: tx.transactionHash}}))[0]; // Verify that GeneralTransferManager module get added successfully or not assert.equal(log.args._types[0].toNumber(), transferManagerKey); @@ -154,12 +157,12 @@ contract("Concurrent STO", accounts => { it("Should intialize the auto attached modules", async () => { let moduleData = (await I_SecurityToken.getModulesByType(transferManagerKey))[0]; - I_GeneralTransferManager = GeneralTransferManager.at(moduleData); + I_GeneralTransferManager = await GeneralTransferManager.at(moduleData); }); it("Should whitelist account_investor1", async () => { - let fromTime = latestTime(); - let toTime = latestTime() + duration.days(15); + let fromTime = await latestTime(); + let toTime = await latestTime() + duration.days(15); let expiryTime = toTime + duration.days(100); let canBuyFromSTO = true; @@ -175,10 +178,10 @@ contract("Concurrent STO", accounts => { describe("Add STO and verify transfer", async () => { it("Should attach STO modules up to the max number, then fail", async () => { const MAX_MODULES = 10; - const startTime = latestTime() + duration.days(1); - const endTime = latestTime() + duration.days(90); - const cap = web3.utils.toWei("10000"); - const rate = web3.utils.toWei("1000"); + const startTime = await latestTime() + duration.days(1); + const endTime = await latestTime() + duration.days(90); + const cap = new BN(web3.utils.toWei("10000")); + const rate = new BN(web3.utils.toWei("1000")); const fundRaiseType = [0]; const budget = 0; const maxCost = STOSetupCost; @@ -208,7 +211,7 @@ contract("Concurrent STO", accounts => { "CappedSTO", `Wrong STO module added at index ${STOIndex}` ); - I_STO_Array.push(CappedSTO.at(tx1.logs[3].args._module)); + I_STO_Array.push(await CappedSTO.at(tx1.logs[3].args._module)); break; case 1: // Dummy STO @@ -221,7 +224,7 @@ contract("Concurrent STO", accounts => { "DummySTO", `Wrong STO module added at index ${STOIndex}` ); - I_STO_Array.push(DummySTO.at(tx2.logs[3].args._module)); + I_STO_Array.push(await DummySTO.at(tx2.logs[3].args._module)); break; case 2: // Pre Sale STO @@ -234,7 +237,7 @@ contract("Concurrent STO", accounts => { "PreSaleSTO", `Wrong STO module added at index ${STOIndex}` ); - I_STO_Array.push(PreSaleSTO.at(tx3.logs[3].args._module)); + I_STO_Array.push(await PreSaleSTO.at(tx3.logs[3].args._module)); break; } } @@ -249,30 +252,34 @@ contract("Concurrent STO", accounts => { // Capped STO ETH await I_STO_Array[STOIndex].buyTokens(account_investor1, { from: account_investor1, - value: web3.utils.toWei("1", "ether") + value: new BN(web3.utils.toWei("1", "ether")) }); assert.equal(web3.utils.fromWei((await I_STO_Array[STOIndex].getRaised.call(0)).toString()), 1); assert.equal(await I_STO_Array[STOIndex].investorCount.call(), 1); break; case 1: // Dummy STO - await I_STO_Array[STOIndex].generateTokens(account_investor1, web3.utils.toWei("1000"), { from: account_issuer }); + await I_STO_Array[STOIndex].generateTokens(account_investor1, new BN(web3.utils.toWei("1000")), { from: account_issuer }); assert.equal(await I_STO_Array[STOIndex].investorCount.call(), 1); assert.equal( - (await I_STO_Array[STOIndex].investors.call(account_investor1)).dividedBy(new BigNumber(10).pow(18)).toNumber(), + (await I_STO_Array[STOIndex].investors.call(account_investor1)) + .div(new BN(10).pow(new BN(18))) + .toNumber(), 1000 ); break; case 2: // Pre Sale STO - await I_STO_Array[STOIndex].allocateTokens(account_investor1, web3.utils.toWei("1000"), web3.utils.toWei("1"), 0, { + await I_STO_Array[STOIndex].allocateTokens(account_investor1, new BN(web3.utils.toWei("1000")), new BN(web3.utils.toWei("1")), new BN(0), { from: account_issuer }); assert.equal(web3.utils.fromWei((await I_STO_Array[STOIndex].getRaised.call(0)).toString()), 1); assert.equal(web3.utils.fromWei((await I_STO_Array[STOIndex].getRaised.call(1)).toString()), 0); assert.equal(await I_STO_Array[STOIndex].investorCount.call(), 1); assert.equal( - (await I_STO_Array[STOIndex].investors.call(account_investor1)).dividedBy(new BigNumber(10).pow(18)).toNumber(), + (await I_STO_Array[STOIndex].investors.call(account_investor1)) + .div(new BN(10).pow(new BN(18))) + .toNumber(), 1000 ); break; diff --git a/test/s_v130_to_v140_upgrade.js b/test/s_v130_to_v140_upgrade.js index ca99abaa8..b1fe49cf8 100644 --- a/test/s_v130_to_v140_upgrade.js +++ b/test/s_v130_to_v140_upgrade.js @@ -1,6 +1,6 @@ const Web3 = require("web3"); const web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545")); // Hardcoded development port -const BigNumber = require("bignumber.js"); +let BN = Web3.utils.BN; import latestTime from "./helpers/latestTime"; import { duration } from "./helpers/utils"; @@ -18,7 +18,7 @@ const SecurityToken = artifacts.require("./SecurityToken.sol"); const PolyTokenFaucet = artifacts.require("./PolyTokenFaucet.sol"); const ManualApprovalTransferManagerFactory = artifacts.require("./ManualApprovalTransferManagerFactory.sol"); -contract("Upgrade from v1.3.0 to v1.4.0", accounts => { +contract("Upgrade from v1.3.0 to v1.4.0", async (accounts) => { // Accounts Variable declaration let POLYMATH; let ISSUER1; @@ -31,9 +31,10 @@ contract("Upgrade from v1.3.0 to v1.4.0", accounts => { let tx; // Initial fee for ticker registry and security token registry - const REGFEE = web3.utils.toWei("250"); + const REGFEE = new BN(web3.utils.toWei("250")); const STOSetupCost = 0; const address_zero = "0x0000000000000000000000000000000000000000"; + const one_address = "0x0000000000000000000000000000000000000001"; // Module key const STOKEY = 3; @@ -90,14 +91,16 @@ contract("Upgrade from v1.3.0 to v1.4.0", accounts => { const STOParameters = ["uint256", "uint256", "uint256", "uint256", "uint8[]", "address"]; // Prepare polymath network status + let currentTime; + before(async () => { - // Accounts setup + currentTime = new BN(await latestTime()); POLYMATH = accounts[0]; ISSUER1 = accounts[1]; ISSUER2 = accounts[2]; ISSUER3 = accounts[3]; MULTISIG = accounts[4]; - + I_DaiToken = await PolyTokenFaucet.new({ from: POLYMATH }); // ----------- POLYMATH NETWORK Configuration ------------ @@ -154,13 +157,13 @@ contract("Upgrade from v1.3.0 to v1.4.0", accounts => { await I_PolyToken.approve(I_STRProxied.address, REGFEE, { from: ISSUER1 }); let tx = await I_STRProxied.generateSecurityToken(name1, symbol1, tokenDetails1, false, { from: ISSUER1 }); assert.equal(tx.logs[2].args._ticker, symbol1, "SecurityToken doesn't get deployed"); - I_SecurityToken1 = SecurityToken.at(tx.logs[2].args._securityTokenAddress); + I_SecurityToken1 = await SecurityToken.at(tx.logs[2].args._securityTokenAddress); // (B) : TOK2 await I_PolyToken.approve(I_STRProxied.address, REGFEE, { from: ISSUER2 }); tx = await I_STRProxied.generateSecurityToken(name2, symbol2, tokenDetails2, false, { from: ISSUER2 }); assert.equal(tx.logs[2].args._ticker, symbol2, "SecurityToken doesn't get deployed"); - I_SecurityToken2 = SecurityToken.at(tx.logs[2].args._securityTokenAddress); + I_SecurityToken2 = await SecurityToken.at(tx.logs[2].args._securityTokenAddress); // Printing all the contract addresses console.log(` @@ -186,30 +189,17 @@ contract("Upgrade from v1.3.0 to v1.4.0", accounts => { // Step 1: Deploy Oracles // 1a - Deploy POLY Oracle it("Should successfully deploy POLY Oracle and register on PolymathRegistry", async () => { - I_POLYOracle = await PolyOracle.new({ from: POLYMATH, value: web3.utils.toWei("1") }); + I_POLYOracle = await PolyOracle.new({ from: POLYMATH, value: new BN(web3.utils.toWei("1")) }); console.log(I_POLYOracle.address); - assert.notEqual( - I_POLYOracle.address.valueOf(), - address_zero, - "POLYOracle contract was not deployed" - ); + assert.notEqual(I_POLYOracle.address.valueOf(), address_zero, "POLYOracle contract was not deployed"); tx = await I_PolymathRegistry.changeAddress("PolyUsdOracle", I_POLYOracle.address, { from: POLYMATH }); assert.equal(tx.logs[0].args._nameKey, "PolyUsdOracle"); assert.equal(tx.logs[0].args._newAddress, I_POLYOracle.address); }); // 1b - Deploy ETH Oracle it("Should successfully deploy ETH Oracle and register on PolymathRegistry", async () => { - I_USDOracle = await ETHOracle.new( - "0x216d678c14be600cb88338e763bb57755ca2b1cf", - address_zero, - "ETH", - { from: POLYMATH } - ); - assert.notEqual( - I_USDOracle.address.valueOf(), - address_zero, - "USDOracle contract was not deployed" - ); + I_USDOracle = await ETHOracle.new("0x216d678c14be600cb88338e763bb57755ca2b1cf", address_zero, "ETH", { from: POLYMATH }); + assert.notEqual(I_USDOracle.address.valueOf(), address_zero, "USDOracle contract was not deployed"); tx = await I_PolymathRegistry.changeAddress("EthUsdOracle", I_USDOracle.address, { from: POLYMATH }); assert.equal(tx.logs[0].args._nameKey, "EthUsdOracle"); assert.equal(tx.logs[0].args._newAddress, I_USDOracle.address); @@ -220,18 +210,10 @@ contract("Upgrade from v1.3.0 to v1.4.0", accounts => { // Step 1: Deploy USDTieredSTOFactory\ it("Should successfully deploy USDTieredSTOFactory", async () => { I_USDTieredSTOProxyFactory = await USDTieredSTOProxyFactory.new(); - I_USDTieredSTOFactory = await USDTieredSTOFactory.new( - STOSetupCost, - 0, - 0, - I_USDTieredSTOProxyFactory.address, - { from: POLYMATH } - ); - assert.notEqual( - I_USDTieredSTOFactory.address.valueOf(), - address_zero, - "USDTieredSTOFactory contract was not deployed" - ); + I_USDTieredSTOFactory = await USDTieredSTOFactory.new(STOSetupCost, new BN(0), new BN(0), I_USDTieredSTOProxyFactory.address, { + from: POLYMATH + }); + assert.notEqual(I_USDTieredSTOFactory.address.valueOf(), address_zero, "USDTieredSTOFactory contract was not deployed"); let setupCost = await I_USDTieredSTOFactory.setupCost({ from: POLYMATH }); assert.equal(setupCost, STOSetupCost); }); @@ -248,12 +230,8 @@ contract("Upgrade from v1.3.0 to v1.4.0", accounts => { describe("CappedSTOFactory deploy", async () => { // Step 1: Deploy new CappedSTOFactory it("Should successfully deploy CappedSTOFactory", async () => { - I_UpgradedCappedSTOFactory = await CappedSTOFactory.new(STOSetupCost, 0, 0, { from: POLYMATH }); - assert.notEqual( - I_UpgradedCappedSTOFactory.address.valueOf(), - address_zero, - "CappedSTOFactory contract was not deployed" - ); + I_UpgradedCappedSTOFactory = await CappedSTOFactory.new(STOSetupCost, new BN(0), new BN(0), { from: POLYMATH }); + assert.notEqual(I_UpgradedCappedSTOFactory.address.valueOf(), address_zero, "CappedSTOFactory contract was not deployed"); let setupCost = await I_UpgradedCappedSTOFactory.setupCost({ from: POLYMATH }); assert.equal(setupCost, STOSetupCost); }); @@ -278,7 +256,7 @@ contract("Upgrade from v1.3.0 to v1.4.0", accounts => { describe("ManualApprovalTransferManagerFactory deploy", async () => { // Step 1: Deploy new ManualApprovalTransferManager it("Should successfully deploy ManualApprovalTransferManagerFactory", async () => { - I_ManualApprovalTransferManagerFactory = await ManualApprovalTransferManagerFactory.new(0, 0, 0, { + I_ManualApprovalTransferManagerFactory = await ManualApprovalTransferManagerFactory.new(0, new BN(0), new BN(0), { from: POLYMATH }); assert.notEqual( @@ -348,14 +326,14 @@ contract("Upgrade from v1.3.0 to v1.4.0", accounts => { describe("Polymath network status post migration", async () => { // Launch STO for TOK1 it("Should successfully launch USDTieredSTO for first security token", async () => { - let _startTime = latestTime() + duration.days(1); + let _startTime = await latestTime() + duration.days(1); let _endTime = _startTime + duration.days(180); - let _ratePerTier = [BigNumber(0.1).mul(10 ** 18), BigNumber(0.15).mul(10 ** 18), BigNumber(0.2).mul(10 ** 18)]; - let _ratePerTierDiscountPoly = [BigNumber(0), BigNumber(0), BigNumber(0)]; - let _tokensPerTierTotal = [BigNumber(100).mul(10 ** 18), BigNumber(200).mul(10 ** 18), BigNumber(300).mul(10 ** 18)]; - let _tokensPerTierDiscountPoly = [BigNumber(0), BigNumber(0), BigNumber(0)]; - let _nonAccreditedLimitUSD = new BigNumber(100).mul(10 ** 18); - let _minimumInvestmentUSD = new BigNumber(5).mul(10 ** 18); + let _ratePerTier = [BN(0.1).mul(10 ** 18), BN(0.15).mul(10 ** 18), BN(0.2).mul(10 ** 18)]; + let _ratePerTierDiscountPoly = [BN(0), BN(0), BN(0)]; + let _tokensPerTierTotal = [BN(100).mul(10 ** 18), BN(200).mul(10 ** 18), BN(300).mul(10 ** 18)]; + let _tokensPerTierDiscountPoly = [BN(0), BN(0), BN(0)]; + let _nonAccreditedLimitUSD = new BN(100).mul(10 ** 18); + let _minimumInvestmentUSD = new BN(5).mul(10 ** 18); let _fundRaiseTypes = [0, 1]; let _wallet = ISSUER1; let _reserveWallet = ISSUER1; @@ -433,10 +411,10 @@ contract("Upgrade from v1.3.0 to v1.4.0", accounts => { let bytesSTO = web3.eth.abi.encodeFunctionCall(functionSignature, config); - let tx = await I_SecurityToken1.addModule(I_USDTieredSTOFactory.address, bytesSTO, 0, 0, { from: ISSUER1 }); + let tx = await I_SecurityToken1.addModule(I_USDTieredSTOFactory.address, bytesSTO, new BN(0), new BN(0), { from: ISSUER1 }); assert.equal(tx.logs[2].args._types[0], STOKEY, "USDTieredSTO doesn't get deployed"); assert.equal(web3.utils.hexToString(tx.logs[2].args._name), "USDTieredSTO", "USDTieredSTOFactory module was not added"); - I_USDTieredSTO = USDTieredSTO.at(tx.logs[2].args._module); + I_USDTieredSTO = await USDTieredSTO.at(tx.logs[2].args._module); }); /* @@ -445,36 +423,36 @@ contract("Upgrade from v1.3.0 to v1.4.0", accounts => { await I_PolyToken.approve(I_STRProxiedNew.address, REGFEE, { from: ISSUER3}); tx = await I_STRProxiedNew.generateSecurityToken(name3, symbol3, tokenDetails3, false, { from: ISSUER3 }); assert.equal(tx.logs[1].args._ticker, symbol3, "SecurityToken doesn't get deployed"); - I_SecurityToken3 = SecurityToken.at(tx.logs[1].args._securityTokenAddress); + I_SecurityToken3 = await SecurityToken.at(tx.logs[1].args._securityTokenAddress); }); */ // Launch NewCappedSTO for TOK2 it("Should successfully launch CappedSTO for third security token", async () => { - let startTime = latestTime() + duration.days(1); + let startTime = await latestTime() + duration.days(1); let endTime = startTime + duration.days(30); - let cap = web3.utils.toWei("500000"); + let cap = new BN(web3.utils.toWei("500000")); let rate = 1000; let fundRaiseType = 0; let fundsReceiver = ISSUER3; let bytesSTO = encodeModuleCall(STOParameters, [startTime, endTime, cap, rate, [fundRaiseType], fundsReceiver]); - let tx = await I_SecurityToken2.addModule(I_UpgradedCappedSTOFactory.address, bytesSTO, 0, 0, { from: ISSUER2 }); + let tx = await I_SecurityToken2.addModule(I_UpgradedCappedSTOFactory.address, bytesSTO, new BN(0), new BN(0), { from: ISSUER2 }); assert.equal(tx.logs[2].args._types[0], STOKEY, "CappedSTO doesn't get deployed"); assert.equal(web3.utils.hexToString(tx.logs[2].args._name), "CappedSTO", "CappedSTOFactory module was not added"); }); // Attach ManualApprovalTransferManager module for TOK2 it("Should successfully attach the ManualApprovalTransferManagerFactory with the second token", async () => { - const tx = await I_SecurityToken2.addModule(I_ManualApprovalTransferManagerFactory.address, "", 0, 0, { from: ISSUER2 }); + const tx = await I_SecurityToken2.addModule(I_ManualApprovalTransferManagerFactory.address, "0x0", new BN(0), new BN(0), { from: ISSUER2 }); assert.equal(tx.logs[2].args._types[0].toNumber(), TMKEY, "ManualApprovalTransferManagerFactory doesn't get deployed"); assert.equal( web3.utils.toUtf8(tx.logs[2].args._name), "ManualApprovalTransferManager", "ManualApprovalTransferManagerFactory module was not added" ); - I_ManualApprovalTransferManagerFactory = ManualApprovalTransferManagerFactory.at(tx.logs[2].args._module); + I_ManualApprovalTransferManagerFactory = await ManualApprovalTransferManagerFactory.at(tx.logs[2].args._module); }); }); }); diff --git a/test/t_security_token_registry_proxy.js b/test/t_security_token_registry_proxy.js index ab796edf3..bd4161b2f 100644 --- a/test/t_security_token_registry_proxy.js +++ b/test/t_security_token_registry_proxy.js @@ -12,10 +12,10 @@ const SecurityToken = artifacts.require("./SecurityToken.sol"); const STRGetter = artifacts.require("./STRGetter.sol"); const Web3 = require("web3"); -const BigNumber = require("bignumber.js"); +let BN = Web3.utils.BN; const web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545")); // Hardcoded development port -contract("SecurityTokenRegistryProxy", accounts => { +contract("SecurityTokenRegistryProxy", async (accounts) => { let I_SecurityTokenRegistry; let I_SecurityTokenRegistryProxy; let I_GeneralTransferManagerFactory; @@ -38,7 +38,7 @@ contract("SecurityTokenRegistryProxy", accounts => { let account_polymath_new; // Initial fee for ticker registry and security token registry - const initRegFee = web3.utils.toWei("250"); + const initRegFee = new BN(web3.utils.toWei("250")); const version = "1.0.0"; const message = "Transaction Should Fail!"; @@ -49,6 +49,9 @@ contract("SecurityTokenRegistryProxy", accounts => { const decimals = 18; const transferManagerKey = 2; + + const address_zero = "0x0000000000000000000000000000000000000000"; + const one_address = "0x0000000000000000000000000000000000000001"; const STRProxyParameters = ["address", "address", "uint256", "uint256", "address", "address"]; async function readStorage(contractAddress, slot) { @@ -83,7 +86,7 @@ contract("SecurityTokenRegistryProxy", accounts => { await I_PolymathRegistry.changeAddress("SecurityTokenRegistry", I_SecurityTokenRegistryProxy.address, { from: account_polymath }); await I_MRProxied.updateFromRegistry({ from: account_polymath }); - + // Printing all the contract addresses console.log(` --------------------- Polymath Network Smart Contracts: --------------------- @@ -104,6 +107,7 @@ contract("SecurityTokenRegistryProxy", accounts => { // __upgradeabilityOwner -- index 13 it("Should attach the implementation and version", async () => { + I_STRGetter = await STRGetter.new({from: account_polymath}); let bytesProxy = encodeProxyCall(STRProxyParameters, [ I_PolymathRegistry.address, I_STFactory.address, @@ -115,8 +119,8 @@ contract("SecurityTokenRegistryProxy", accounts => { await I_SecurityTokenRegistryProxy.upgradeToAndCall("1.0.0", I_SecurityTokenRegistry.address, bytesProxy, { from: account_polymath }); - let c = OwnedUpgradeabilityProxy.at(I_SecurityTokenRegistryProxy.address); - assert.equal(await readStorage(c.address, 12), I_SecurityTokenRegistry.address); + let c = await OwnedUpgradeabilityProxy.at(I_SecurityTokenRegistryProxy.address); + assert.equal(await readStorage(c.address, 12), I_SecurityTokenRegistry.address.toLowerCase()); assert.equal( web3.utils .toAscii(await readStorage(c.address, 11)) @@ -125,6 +129,7 @@ contract("SecurityTokenRegistryProxy", accounts => { "1.0.0" ); I_STRProxied = await SecurityTokenRegistry.at(I_SecurityTokenRegistryProxy.address); + I_STRGetter = await STRGetter.at(I_SecurityTokenRegistryProxy.address); }); it("Verify the initialize data", async () => { @@ -134,7 +139,7 @@ contract("SecurityTokenRegistryProxy", accounts => { "Should equal to 60 days" ); assert.equal( - (await I_STRProxied.getUintValues.call(web3.utils.soliditySha3("tickerRegFee"))).toNumber(), + await I_STRProxied.getUintValues.call(web3.utils.soliditySha3("tickerRegFee")), web3.utils.toWei("250") ); }); @@ -142,7 +147,7 @@ contract("SecurityTokenRegistryProxy", accounts => { describe("Feed some data in storage", async () => { it("Register the ticker", async () => { - await I_PolyToken.getTokens(web3.utils.toWei("1000"), token_owner); + await I_PolyToken.getTokens(new BN(web3.utils.toWei("1000")), token_owner); await I_PolyToken.approve(I_STRProxied.address, initRegFee, { from: token_owner }); let tx = await I_STRProxied.registerTicker(token_owner, symbol, name, { from: token_owner }); assert.equal(tx.logs[0].args._owner, token_owner, "Owner should be the same as registered with the ticker"); @@ -151,15 +156,15 @@ contract("SecurityTokenRegistryProxy", accounts => { it("Should generate the new security token with the same symbol as registered above", async () => { await I_PolyToken.approve(I_STRProxied.address, initRegFee, { from: token_owner }); - let _blockNo = latestBlock(); + let tx = await I_STRProxied.generateSecurityToken(name, symbol, tokenDetails, false, { from: token_owner }); // Verify the successful generation of the security token assert.equal(tx.logs[2].args._ticker, symbol, "SecurityToken doesn't get deployed"); - I_SecurityToken = SecurityToken.at(tx.logs[2].args._securityTokenAddress); + I_SecurityToken = await SecurityToken.at(tx.logs[2].args._securityTokenAddress); - const log = await promisifyLogWatch(I_SecurityToken.ModuleAdded({ from: _blockNo }), 1); + const log = (await I_SecurityToken.getPastEvents('ModuleAdded', {filter: {transactionHash: tx.transactionHash}}))[0]; // Verify that GeneralTransferManager module get added successfully or not assert.equal(log.args._types[0].toNumber(), transferManagerKey); @@ -179,7 +184,7 @@ contract("SecurityTokenRegistryProxy", accounts => { it("Should upgrade the version and implementation address -- Implemenation address should not be 0x", async () => { await catchRevert( - I_SecurityTokenRegistryProxy.upgradeTo("1.1.0", "0x00000000000000000000000000000000000000", { from: account_polymath }) + I_SecurityTokenRegistryProxy.upgradeTo("1.1.0", address_zero, { from: account_polymath }) ); }); @@ -199,7 +204,7 @@ contract("SecurityTokenRegistryProxy", accounts => { it("Should upgrade the version and the implementation address successfully", async () => { await I_SecurityTokenRegistryProxy.upgradeTo("1.1.0", I_SecurityTokenRegistryMock.address, { from: account_polymath }); - let c = OwnedUpgradeabilityProxy.at(I_SecurityTokenRegistryProxy.address); + let c = await OwnedUpgradeabilityProxy.at(I_SecurityTokenRegistryProxy.address); assert.equal( web3.utils .toAscii(await readStorage(c.address, 11)) @@ -208,7 +213,7 @@ contract("SecurityTokenRegistryProxy", accounts => { "1.1.0", "Version mis-match" ); - assert.equal(await readStorage(c.address, 12), I_SecurityTokenRegistryMock.address, "Implemnted address is not matched"); + assert.equal(await readStorage(c.address, 12), I_SecurityTokenRegistryMock.address.toLowerCase(), "Implemnted address is not matched"); I_STRProxied = await SecurityTokenRegistryMock.at(I_SecurityTokenRegistryProxy.address); I_Getter = await STRGetter.at(I_SecurityTokenRegistryProxy.address); }); @@ -238,7 +243,7 @@ contract("SecurityTokenRegistryProxy", accounts => { it("Should change the ownership of the contract -- new address should not be 0x", async () => { await catchRevert( - I_SecurityTokenRegistryProxy.transferProxyOwnership("0x00000000000000000000000000000000000000", { from: account_polymath }) + I_SecurityTokenRegistryProxy.transferProxyOwnership(address_zero, { from: account_polymath }) ); }); @@ -251,7 +256,7 @@ contract("SecurityTokenRegistryProxy", accounts => { it("Should change the implementation contract and version by the new owner", async () => { I_SecurityTokenRegistry = await SecurityTokenRegistry.new({ from: account_polymath }); await I_SecurityTokenRegistryProxy.upgradeTo("1.2.0", I_SecurityTokenRegistry.address, { from: account_polymath_new }); - let c = OwnedUpgradeabilityProxy.at(I_SecurityTokenRegistryProxy.address); + let c = await OwnedUpgradeabilityProxy.at(I_SecurityTokenRegistryProxy.address); assert.equal( web3.utils .toAscii(await readStorage(c.address, 11)) @@ -260,16 +265,19 @@ contract("SecurityTokenRegistryProxy", accounts => { "1.2.0", "Version mis-match" ); - assert.equal(await readStorage(c.address, 12), I_SecurityTokenRegistry.address, "Implemnted address is not matched"); + assert.equal(await readStorage(c.address, 12), I_SecurityTokenRegistry.address.toLowerCase(), "Implemnted address is not matched"); I_STRProxied = await SecurityTokenRegistry.at(I_SecurityTokenRegistryProxy.address); }); - it("Should get the version", async() => { + it("Should get the version", async () => { assert.equal(await I_SecurityTokenRegistryProxy.version.call({ from: account_polymath_new }), "1.2.0"); }); - it("Should get the implementation address", async() => { - assert.equal(await I_SecurityTokenRegistryProxy.implementation.call({ from: account_polymath_new }), I_SecurityTokenRegistry.address); - }) + it("Should get the implementation address", async () => { + assert.equal( + await I_SecurityTokenRegistryProxy.implementation.call({ from: account_polymath_new }), + I_SecurityTokenRegistry.address + ); + }); }); }); diff --git a/test/u_module_registry_proxy.js b/test/u_module_registry_proxy.js index 88a22af93..19ddab75b 100644 --- a/test/u_module_registry_proxy.js +++ b/test/u_module_registry_proxy.js @@ -15,10 +15,10 @@ const GeneralPermissionManagerFactory = artifacts.require("./GeneralPermissionMa const GeneralPermissionManager = artifacts.require("./GeneralPermissionManager.sol"); const Web3 = require("web3"); -const BigNumber = require("bignumber.js"); +let BN = Web3.utils.BN; const web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545")); // Hardcoded development port -contract("ModuleRegistryProxy", accounts => { +contract("ModuleRegistryProxy", async (accounts) => { let I_SecurityTokenRegistry; let I_SecurityTokenRegistryProxy; let I_GeneralTransferManagerFactory; @@ -42,10 +42,11 @@ contract("ModuleRegistryProxy", accounts => { let account_polymath_new; // Initial fee for ticker registry and security token registry - const initRegFee = web3.utils.toWei("250"); + const initRegFee = new BN(web3.utils.toWei("250")); const version = "1.0.0"; const message = "Transaction Should Fail!"; const address_zero = "0x0000000000000000000000000000000000000000"; + const one_address = "0x0000000000000000000000000000000000000001"; // SecurityToken Details for funds raise Type ETH const name = "Team"; const symbol = "SAP"; @@ -111,8 +112,8 @@ contract("ModuleRegistryProxy", accounts => { it("Should attach the MR implementation and version", async () => { let bytesProxy = encodeProxyCall(MRProxyParameters, [I_PolymathRegistry.address, account_polymath]); await I_ModuleRegistryProxy.upgradeToAndCall("1.0.0", I_ModuleRegistry.address, bytesProxy, { from: account_polymath }); - let c = OwnedUpgradeabilityProxy.at(I_ModuleRegistryProxy.address); - assert.equal(await readStorage(c.address, 12), I_ModuleRegistry.address); + let c = await OwnedUpgradeabilityProxy.at(I_ModuleRegistryProxy.address); + assert.equal(await readStorage(c.address, 12), I_ModuleRegistry.address.toLowerCase()); assert.equal( web3.utils .toAscii(await readStorage(c.address, 11)) @@ -127,9 +128,13 @@ contract("ModuleRegistryProxy", accounts => { await I_MRProxied.updateFromRegistry({ from: account_polymath }); // STEP 4: Deploy the GeneralTransferManagerFactory - let I_GeneralTransferManagerLogic = await GeneralTransferManagerLogic.new("0x0000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000", { from: account_polymath }); + let I_GeneralTransferManagerLogic = await GeneralTransferManagerLogic.new( + "0x0000000000000000000000000000000000000000", + "0x0000000000000000000000000000000000000000", + { from: account_polymath } + ); - I_GeneralTransferManagerFactory = await GeneralTransferManagerFactory.new(0, 0, 0, I_GeneralTransferManagerLogic.address, { + I_GeneralTransferManagerFactory = await GeneralTransferManagerFactory.new(0, new BN(0), new BN(0), I_GeneralTransferManagerLogic.address, { from: account_polymath }); @@ -148,11 +153,7 @@ contract("ModuleRegistryProxy", accounts => { // Step 3: Deploy the STFactory contract I_STFactory = await STFactory.new(I_GeneralTransferManagerFactory.address, { from: account_polymath }); - assert.notEqual( - I_STFactory.address.valueOf(), - address_zero, - "STFactory contract was not deployed" - ); + assert.notEqual(I_STFactory.address.valueOf(), address_zero, "STFactory contract was not deployed"); }); it("Verify the initialize data", async () => { @@ -168,7 +169,7 @@ contract("ModuleRegistryProxy", accounts => { describe("Feed some data in storage", async () => { it("Register and verify the new module", async () => { I_GeneralPermissionManagerLogic = await GeneralPermissionManager.new("0x0000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000", { from: account_polymath }); - I_GeneralPermissionManagerfactory = await GeneralPermissionManagerFactory.new(0, 0, 0, I_GeneralPermissionManagerLogic.address, { + I_GeneralPermissionManagerfactory = await GeneralPermissionManagerFactory.new(0, new BN(0), new BN(0), I_GeneralPermissionManagerLogic.address, { from: account_polymath }); @@ -195,7 +196,7 @@ contract("ModuleRegistryProxy", accounts => { it("Should upgrade the version and implementation address -- Implemenation address should not be 0x", async () => { await catchRevert( - I_ModuleRegistryProxy.upgradeTo("1.1.0", "0x00000000000000000000000000000000000000", { from: account_polymath }) + I_ModuleRegistryProxy.upgradeTo("1.1.0", address_zero, { from: account_polymath }) ); }); @@ -213,7 +214,7 @@ contract("ModuleRegistryProxy", accounts => { it("Should upgrade the version and the implementation address successfully", async () => { await I_ModuleRegistryProxy.upgradeTo("1.1.0", I_MockModuleRegistry.address, { from: account_polymath }); - let c = OwnedUpgradeabilityProxy.at(I_ModuleRegistryProxy.address); + let c = await OwnedUpgradeabilityProxy.at(I_ModuleRegistryProxy.address); assert.equal( web3.utils .toAscii(await readStorage(c.address, 11)) @@ -222,7 +223,7 @@ contract("ModuleRegistryProxy", accounts => { "1.1.0", "Version mis-match" ); - assert.equal(await readStorage(c.address, 12), I_MockModuleRegistry.address, "Implemnted address is not matched"); + assert.equal(await readStorage(c.address, 12), I_MockModuleRegistry.address.toLowerCase(), "Implemnted address is not matched"); I_MRProxied = await MockModuleRegistry.at(I_ModuleRegistryProxy.address); }); }); @@ -230,7 +231,7 @@ contract("ModuleRegistryProxy", accounts => { describe("Execute functionality of the implementation contract on the earlier storage", async () => { it("Should get the previous data", async () => { let _data = await I_MRProxied.getReputationByFactory.call(I_GeneralTransferManagerFactory.address); - assert.equal(_data.length, 0, "Should give the original length"); + assert.equal(_data.length, new BN(0), "Should give the original length"); }); it("Should alter the old storage", async () => { @@ -249,7 +250,7 @@ contract("ModuleRegistryProxy", accounts => { it("Should change the ownership of the contract -- new address should not be 0x", async () => { await catchRevert( - I_ModuleRegistryProxy.transferProxyOwnership("0x00000000000000000000000000000000000000", { from: account_polymath }) + I_ModuleRegistryProxy.transferProxyOwnership(address_zero, { from: account_polymath }) ); }); @@ -262,7 +263,7 @@ contract("ModuleRegistryProxy", accounts => { it("Should change the implementation contract and version by the new owner", async () => { I_ModuleRegistry = await ModuleRegistry.new({ from: account_polymath }); await I_ModuleRegistryProxy.upgradeTo("1.2.0", I_ModuleRegistry.address, { from: account_polymath_new }); - let c = OwnedUpgradeabilityProxy.at(I_ModuleRegistryProxy.address); + let c = await OwnedUpgradeabilityProxy.at(I_ModuleRegistryProxy.address); assert.equal( web3.utils .toAscii(await readStorage(c.address, 11)) @@ -271,7 +272,7 @@ contract("ModuleRegistryProxy", accounts => { "1.2.0", "Version mis-match" ); - assert.equal(await readStorage(c.address, 12), I_ModuleRegistry.address, "Implemnted address is not matched"); + assert.equal(await readStorage(c.address, 12), I_ModuleRegistry.address.toLowerCase(), "Implemnted address is not matched"); I_MRProxied = await ModuleRegistry.at(I_ModuleRegistryProxy.address); }); }); diff --git a/test/v_tracked_redemptions.js b/test/v_tracked_redemptions.js index 5059388a0..28ccaded7 100644 --- a/test/v_tracked_redemptions.js +++ b/test/v_tracked_redemptions.js @@ -1,9 +1,8 @@ import latestTime from "./helpers/latestTime"; -import { duration, promisifyLogWatch, latestBlock } from "./helpers/utils"; -import takeSnapshot, { increaseTime, revertToSnapshot } from "./helpers/time"; -import { encodeProxyCall } from "./helpers/encodeCall"; -import { catchRevert } from "./helpers/exceptions"; -import { setUpPolymathNetwork, deployRedemptionAndVerifyed } from "./helpers/createInstances"; +import {duration, promisifyLogWatch} from "./helpers/utils"; +import takeSnapshot, {increaseTime, revertToSnapshot} from "./helpers/time"; +import {catchRevert} from "./helpers/exceptions"; +import {deployRedemptionAndVerifyed, setUpPolymathNetwork} from "./helpers/createInstances"; const SecurityToken = artifacts.require("./SecurityToken.sol"); const GeneralTransferManager = artifacts.require("./GeneralTransferManager"); @@ -11,10 +10,10 @@ const TrackedRedemption = artifacts.require("./TrackedRedemption"); const GeneralPermissionManager = artifacts.require("./GeneralPermissionManager"); const Web3 = require("web3"); -const BigNumber = require("bignumber.js"); +let BN = Web3.utils.BN; const web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545")); // Hardcoded development port -contract("TrackedRedemption", accounts => { +contract("TrackedRedemption", async (accounts) => { // Accounts Variable declaration let account_polymath; let account_issuer; @@ -25,11 +24,6 @@ contract("TrackedRedemption", accounts => { let account_investor4; let account_temp; - // investor Details - let fromTime = latestTime(); - let toTime = latestTime(); - let expiryTime = toTime + duration.days(15); - let message = "Transaction Should Fail!"; // Contract Instance Declaration @@ -69,10 +63,14 @@ contract("TrackedRedemption", accounts => { const burnKey = 5; // Initial fee for ticker registry and security token registry - const initRegFee = web3.utils.toWei("250"); + const initRegFee = new BN(web3.utils.toWei("250")); + + let currentTime; + const address_zero = "0x0000000000000000000000000000000000000000"; + const one_address = "0x0000000000000000000000000000000000000001"; before(async () => { - // Accounts setup + currentTime = new BN(await latestTime()); account_polymath = accounts[0]; account_issuer = accounts[1]; @@ -107,7 +105,7 @@ contract("TrackedRedemption", accounts => { // STEP 4: Deploy the TrackedRedemption [I_TrackedRedemptionFactory] = await deployRedemptionAndVerifyed(account_polymath, I_MRProxied, 0); - [P_TrackedRedemptionFactory] = await deployRedemptionAndVerifyed(account_polymath, I_MRProxied, web3.utils.toWei("500")); + [P_TrackedRedemptionFactory] = await deployRedemptionAndVerifyed(account_polymath, I_MRProxied, new BN(web3.utils.toWei("500"))); // Printing all the contract addresses console.log(` @@ -137,15 +135,15 @@ contract("TrackedRedemption", accounts => { it("Should generate the new security token with the same symbol as registered above", async () => { await I_PolyToken.approve(I_STRProxied.address, initRegFee, { from: token_owner }); - let _blockNo = latestBlock(); + let tx = await I_STRProxied.generateSecurityToken(name, symbol, tokenDetails, false, { from: token_owner }); // Verify the successful generation of the security token assert.equal(tx.logs[2].args._ticker, symbol.toUpperCase(), "SecurityToken doesn't get deployed"); - I_SecurityToken = SecurityToken.at(tx.logs[2].args._securityTokenAddress); + I_SecurityToken = await SecurityToken.at(tx.logs[2].args._securityTokenAddress); - const log = await promisifyLogWatch(I_SecurityToken.ModuleAdded({ from: _blockNo }), 1); + const log = (await I_SecurityToken.getPastEvents('ModuleAdded', {filter: {transactionHash: tx.transactionHash}}))[0]; // Verify that GeneralTransferManager module get added successfully or not assert.equal(log.args._types[0].toNumber(), 2); @@ -154,32 +152,34 @@ contract("TrackedRedemption", accounts => { it("Should intialize the auto attached modules", async () => { let moduleData = (await I_SecurityToken.getModulesByType(2))[0]; - I_GeneralTransferManager = GeneralTransferManager.at(moduleData); + I_GeneralTransferManager = await GeneralTransferManager.at(moduleData); }); it("Should successfully attach the paid TrackedRedemption with the security token", async () => { let snapId = await takeSnapshot(); - await I_PolyToken.getTokens(web3.utils.toWei("500"), I_SecurityToken.address); - const tx = await I_SecurityToken.addModule(P_TrackedRedemptionFactory.address, "", web3.utils.toWei("500"), 0, { from: token_owner }); + await I_PolyToken.getTokens(new BN(web3.utils.toWei("500")), I_SecurityToken.address); + const tx = await I_SecurityToken.addModule(P_TrackedRedemptionFactory.address, "0x0", new BN(web3.utils.toWei("500")), new BN(0), { + from: token_owner + }); assert.equal(tx.logs[3].args._types[0].toNumber(), burnKey, "TrackedRedemption doesn't get deployed"); assert.equal( web3.utils.toAscii(tx.logs[3].args._name).replace(/\u0000/g, ""), "TrackedRedemption", "TrackedRedemption module was not added" ); - I_TrackedRedemption = TrackedRedemption.at(tx.logs[3].args._module); + I_TrackedRedemption = await TrackedRedemption.at(tx.logs[3].args._module); await revertToSnapshot(snapId); }); it("Should successfully attach the TrackedRedemption with the security token", async () => { - const tx = await I_SecurityToken.addModule(I_TrackedRedemptionFactory.address, "", 0, 0, { from: token_owner }); + const tx = await I_SecurityToken.addModule(I_TrackedRedemptionFactory.address, "0x0", new BN(0), new BN(0), { from: token_owner }); assert.equal(tx.logs[2].args._types[0].toNumber(), burnKey, "TrackedRedemption doesn't get deployed"); assert.equal( web3.utils.toAscii(tx.logs[2].args._name).replace(/\u0000/g, ""), "TrackedRedemption", "TrackedRedemption module was not added" ); - I_TrackedRedemption = TrackedRedemption.at(tx.logs[2].args._module); + I_TrackedRedemption = await TrackedRedemption.at(tx.logs[2].args._module); }); }); @@ -189,9 +189,9 @@ contract("TrackedRedemption", accounts => { let tx = await I_GeneralTransferManager.modifyWhitelist( account_investor1, - latestTime(), - latestTime(), - latestTime() + duration.days(30), + currentTime, + currentTime, + currentTime.add(new BN(duration.days(30))), true, { from: account_issuer, @@ -209,9 +209,9 @@ contract("TrackedRedemption", accounts => { await increaseTime(5000); // Mint some tokens - await I_SecurityToken.mint(account_investor1, web3.utils.toWei("1", "ether"), { from: token_owner }); + await I_SecurityToken.mint(account_investor1, new BN(web3.utils.toWei("1", "ether")), { from: token_owner }); - assert.equal((await I_SecurityToken.balanceOf(account_investor1)).toNumber(), web3.utils.toWei("1", "ether")); + assert.equal((await I_SecurityToken.balanceOf(account_investor1)).toString(), new BN(web3.utils.toWei("1", "ether")).toString()); }); it("Buy some tokens for account_investor2 (2 ETH)", async () => { @@ -219,9 +219,9 @@ contract("TrackedRedemption", accounts => { let tx = await I_GeneralTransferManager.modifyWhitelist( account_investor2, - latestTime(), - latestTime(), - latestTime() + duration.days(30), + currentTime, + currentTime, + currentTime.add(new BN(duration.days(30))), true, { from: account_issuer, @@ -236,23 +236,23 @@ contract("TrackedRedemption", accounts => { ); // Mint some tokens - await I_SecurityToken.mint(account_investor2, web3.utils.toWei("2", "ether"), { from: token_owner }); + await I_SecurityToken.mint(account_investor2, new BN(web3.utils.toWei("2", "ether")), { from: token_owner }); - assert.equal((await I_SecurityToken.balanceOf(account_investor2)).toNumber(), web3.utils.toWei("2", "ether")); + assert.equal((await I_SecurityToken.balanceOf(account_investor2)).toString(), new BN(web3.utils.toWei("2", "ether")).toString()); }); it("Redeem some tokens - fail insufficient allowance", async () => { await I_GeneralTransferManager.changeAllowAllBurnTransfers(true, { from: token_owner }); - await catchRevert(I_TrackedRedemption.redeemTokens(web3.utils.toWei("1", "ether"), { from: account_investor1 })); + await catchRevert(I_TrackedRedemption.redeemTokens(new BN(web3.utils.toWei("1", "ether")), { from: account_investor1 })); }); it("Redeem some tokens", async () => { - await I_SecurityToken.approve(I_TrackedRedemption.address, web3.utils.toWei("1", "ether"), { from: account_investor1 }); - let tx = await I_TrackedRedemption.redeemTokens(web3.utils.toWei("1", "ether"), { from: account_investor1 }); + await I_SecurityToken.approve(I_TrackedRedemption.address, new BN(web3.utils.toWei("1", "ether")), { from: account_investor1 }); + let tx = await I_TrackedRedemption.redeemTokens(new BN(web3.utils.toWei("1", "ether")), { from: account_investor1 }); console.log(JSON.stringify(tx.logs)); assert.equal(tx.logs[0].args._investor.toLowerCase(), account_investor1.toLowerCase(), "Mismatch address"); - assert.equal(tx.logs[0].args._value, web3.utils.toWei("1", "ether"), "Wrong value"); + assert.equal(web3.utils.fromWei(web3.utils.toBN(tx.logs[0].args._value)), 1, "Wrong value"); }); it("Get the init data", async () => { diff --git a/test/w_lockup_volume_restriction_transfer_manager.js b/test/w_lockup_volume_restriction_transfer_manager.js index 00419b1d8..5b2a4f8e8 100644 --- a/test/w_lockup_volume_restriction_transfer_manager.js +++ b/test/w_lockup_volume_restriction_transfer_manager.js @@ -1,21 +1,20 @@ -import latestTime from './helpers/latestTime'; -import { duration, promisifyLogWatch, latestBlock } from './helpers/utils'; -import takeSnapshot, { increaseTime, revertToSnapshot } from './helpers/time'; -import { encodeProxyCall } from './helpers/encodeCall'; +import latestTime from "./helpers/latestTime"; +import { duration, promisifyLogWatch, latestBlock } from "./helpers/utils"; +import takeSnapshot, { increaseTime, revertToSnapshot } from "./helpers/time"; +import { encodeProxyCall } from "./helpers/encodeCall"; import { setUpPolymathNetwork, deployLockupVolumeRTMAndVerified } from "./helpers/createInstances"; import { catchRevert } from "./helpers/exceptions"; -const SecurityToken = artifacts.require('./SecurityToken.sol'); -const GeneralTransferManager = artifacts.require('./GeneralTransferManager'); -const VolumeRestrictionTransferManager = artifacts.require('./LockupVolumeRestrictionTM'); -const GeneralPermissionManager = artifacts.require('./GeneralPermissionManager'); +const SecurityToken = artifacts.require("./SecurityToken.sol"); +const GeneralTransferManager = artifacts.require("./GeneralTransferManager"); +const VolumeRestrictionTransferManager = artifacts.require("./LockupVolumeRestrictionTM"); +const GeneralPermissionManager = artifacts.require("./GeneralPermissionManager"); -const Web3 = require('web3'); -const BigNumber = require('bignumber.js'); -const web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545")) // Hardcoded development port - -contract('LockupVolumeRestrictionTransferManager', accounts => { +const Web3 = require("web3"); +let BN = Web3.utils.BN; +const web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545")); // Hardcoded development port +contract("LockupVolumeRestrictionTransferManager", async (accounts) => { // Accounts Variable declaration let account_polymath; let account_issuer; @@ -25,11 +24,6 @@ contract('LockupVolumeRestrictionTransferManager', accounts => { let account_investor3; let account_investor4; - // investor Details - let fromTime = latestTime(); - let toTime = latestTime(); - let expiryTime = toTime + duration.days(15); - let message = "Transaction Should Fail!"; // Contract Instance Declaration @@ -66,10 +60,14 @@ contract('LockupVolumeRestrictionTransferManager', accounts => { const stoKey = 3; // Initial fee for ticker registry and security token registry - const initRegFee = web3.utils.toWei("250"); + const initRegFee = new BN(web3.utils.toWei("250")); - before(async() => { - // Accounts setup + let currentTime; + const address_zero = "0x0000000000000000000000000000000000000000"; + const one_address = "0x0000000000000000000000000000000000000001"; + + before(async () => { + currentTime = new BN(await latestTime()); account_polymath = accounts[0]; account_issuer = accounts[1]; @@ -99,7 +97,11 @@ contract('LockupVolumeRestrictionTransferManager', accounts => { // STEP 4(c): Deploy the VolumeRestrictionTransferManager [I_VolumeRestrictionTransferManagerFactory] = await deployLockupVolumeRTMAndVerified(account_polymath, I_MRProxied, 0); // STEP 4(d): Deploy the VolumeRestrictionTransferManager - [P_VolumeRestrictionTransferManagerFactory] = await deployLockupVolumeRTMAndVerified(account_polymath, I_MRProxied, web3.utils.toWei("500")); + [P_VolumeRestrictionTransferManagerFactory] = await deployLockupVolumeRTMAndVerified( + account_polymath, + I_MRProxied, + new BN(web3.utils.toWei("500")) + ); // Printing all the contract addresses console.log(` @@ -120,288 +122,291 @@ contract('LockupVolumeRestrictionTransferManager', accounts => { `); }); - describe("Generate the SecurityToken", async() => { - + describe("Generate the SecurityToken", async () => { it("Should register the ticker before the generation of the security token", async () => { await I_PolyToken.approve(I_STRProxied.address, initRegFee, { from: token_owner }); - let tx = await I_STRProxied.registerTicker(token_owner, symbol, contact, { from : token_owner }); + let tx = await I_STRProxied.registerTicker(token_owner, symbol, contact, { from: token_owner }); assert.equal(tx.logs[0].args._owner, token_owner); assert.equal(tx.logs[0].args._ticker, symbol.toUpperCase()); }); it("Should generate the new security token with the same symbol as registered above", async () => { await I_PolyToken.approve(I_STRProxied.address, initRegFee, { from: token_owner }); - let _blockNo = latestBlock(); + let tx = await I_STRProxied.generateSecurityToken(name, symbol, tokenDetails, false, { from: token_owner }); // Verify the successful generation of the security token assert.equal(tx.logs[2].args._ticker, symbol.toUpperCase(), "SecurityToken doesn't get deployed"); - I_SecurityToken = SecurityToken.at(tx.logs[2].args._securityTokenAddress); + I_SecurityToken = await SecurityToken.at(tx.logs[2].args._securityTokenAddress); - const log = await promisifyLogWatch(I_SecurityToken.ModuleAdded({from: _blockNo}), 1); + const log = (await I_SecurityToken.getPastEvents('ModuleAdded', {filter: {transactionHash: tx.transactionHash}}))[0]; // Verify that GeneralTransferManager module get added successfully or not assert.equal(log.args._types[0].toNumber(), 2); - assert.equal( - web3.utils.toAscii(log.args._name) - .replace(/\u0000/g, ''), - "GeneralTransferManager" - ); + assert.equal(web3.utils.toAscii(log.args._name).replace(/\u0000/g, ""), "GeneralTransferManager"); }); it("Should intialize the auto attached modules", async () => { - let moduleData = (await I_SecurityToken.getModulesByType(2))[0]; - I_GeneralTransferManager = GeneralTransferManager.at(moduleData); + let moduleData = (await I_SecurityToken.getModulesByType(2))[0]; + I_GeneralTransferManager = await GeneralTransferManager.at(moduleData); }); - }); - describe("Buy tokens using on-chain whitelist and test locking them up and attempting to transfer", async() => { - - it("Should Buy the tokens", async() => { + describe("Buy tokens using on-chain whitelist and test locking them up and attempting to transfer", async () => { + it("Should Buy the tokens", async () => { // Add the Investor in to the whitelist let tx = await I_GeneralTransferManager.modifyWhitelist( account_investor1, - latestTime(), - latestTime(), - latestTime() + duration.days(10), + currentTime, + currentTime, + currentTime.add(new BN(duration.days(10))), true, { from: account_issuer - }); + } + ); - assert.equal(tx.logs[0].args._investor.toLowerCase(), account_investor1.toLowerCase(), "Failed in adding the investor in whitelist"); + assert.equal( + tx.logs[0].args._investor.toLowerCase(), + account_investor1.toLowerCase(), + "Failed in adding the investor in whitelist" + ); // Jump time await increaseTime(5000); // Mint some tokens - await I_SecurityToken.mint(account_investor1, web3.utils.toWei('2', 'ether'), { from: token_owner }); + await I_SecurityToken.mint(account_investor1, new BN(web3.utils.toWei("2", "ether")), { from: token_owner }); - assert.equal( - (await I_SecurityToken.balanceOf(account_investor1)).toNumber(), - web3.utils.toWei('2', 'ether') - ); + assert.equal((await I_SecurityToken.balanceOf(account_investor1)).toString(), new BN(web3.utils.toWei("2", "ether")).toString()); }); - it("Should Buy some more tokens", async() => { + it("Should Buy some more tokens", async () => { // Add the Investor in to the whitelist let tx = await I_GeneralTransferManager.modifyWhitelist( account_investor2, - latestTime(), - latestTime(), - latestTime() + duration.days(10), + currentTime, + currentTime, + currentTime.add(new BN(duration.days(10))), true, { from: account_issuer - }); + } + ); - assert.equal(tx.logs[0].args._investor.toLowerCase(), account_investor2.toLowerCase(), "Failed in adding the investor in whitelist"); + assert.equal( + tx.logs[0].args._investor.toLowerCase(), + account_investor2.toLowerCase(), + "Failed in adding the investor in whitelist" + ); // Mint some tokens - await I_SecurityToken.mint(account_investor2, web3.utils.toWei('10', 'ether'), { from: token_owner }); + await I_SecurityToken.mint(account_investor2, new BN(web3.utils.toWei("10", "ether")), { from: token_owner }); - assert.equal( - (await I_SecurityToken.balanceOf(account_investor2)).toNumber(), - web3.utils.toWei('10', 'ether') - ); + assert.equal((await I_SecurityToken.balanceOf(account_investor2)).toString(), new BN(web3.utils.toWei("10", "ether")).toString()); }); it("Should unsuccessfully attach the VolumeRestrictionTransferManager factory with the security token -- failed because Token is not paid", async () => { - await I_PolyToken.getTokens(web3.utils.toWei("500", "ether"), token_owner); + await I_PolyToken.getTokens(new BN(web3.utils.toWei("500", "ether")), token_owner); await catchRevert( - I_SecurityToken.addModule(P_VolumeRestrictionTransferManagerFactory.address, 0, web3.utils.toWei("500", "ether"), 0, { from: token_owner }) - ) + I_SecurityToken.addModule(P_VolumeRestrictionTransferManagerFactory.address, new BN(0), new BN(web3.utils.toWei("500", "ether")), new BN(0), { + from: token_owner + }) + ); }); it("Should successfully attach the VolumeRestrictionTransferManager factory with the security token", async () => { let snapId = await takeSnapshot(); - await I_PolyToken.transfer(I_SecurityToken.address, web3.utils.toWei("500", "ether"), {from: token_owner}); - const tx = await I_SecurityToken.addModule(P_VolumeRestrictionTransferManagerFactory.address, 0, web3.utils.toWei("500", "ether"), 0, { from: token_owner }); - assert.equal(tx.logs[3].args._types[0].toNumber(), transferManagerKey, "VolumeRestrictionTransferManagerFactory doesn't get deployed"); + await I_PolyToken.transfer(I_SecurityToken.address, new BN(web3.utils.toWei("500", "ether")), { from: token_owner }); + const tx = await I_SecurityToken.addModule( + P_VolumeRestrictionTransferManagerFactory.address, + new BN(0), + new BN(web3.utils.toWei("500", "ether")), + new BN(0), + { from: token_owner } + ); + assert.equal( + tx.logs[3].args._types[0].toNumber(), + transferManagerKey, + "VolumeRestrictionTransferManagerFactory doesn't get deployed" + ); assert.equal( - web3.utils.toAscii(tx.logs[3].args._name) - .replace(/\u0000/g, ''), + web3.utils.toAscii(tx.logs[3].args._name).replace(/\u0000/g, ""), "LockupVolumeRestrictionTM", "VolumeRestrictionTransferManagerFactory module was not added" ); - P_VolumeRestrictionTransferManager = VolumeRestrictionTransferManager.at(tx.logs[3].args._module); + P_VolumeRestrictionTransferManager = await VolumeRestrictionTransferManager.at(tx.logs[3].args._module); await revertToSnapshot(snapId); }); it("Should successfully attach the VolumeRestrictionTransferManager with the security token", async () => { - const tx = await I_SecurityToken.addModule(I_VolumeRestrictionTransferManagerFactory.address, 0, 0, 0, { from: token_owner }); + const tx = await I_SecurityToken.addModule(I_VolumeRestrictionTransferManagerFactory.address, new BN(0), new BN(0), new BN(0), { from: token_owner }); assert.equal(tx.logs[2].args._types[0].toNumber(), transferManagerKey, "VolumeRestrictionTransferManager doesn't get deployed"); assert.equal( - web3.utils.toAscii(tx.logs[2].args._name) - .replace(/\u0000/g, ''), + web3.utils.toAscii(tx.logs[2].args._name).replace(/\u0000/g, ""), "LockupVolumeRestrictionTM", "VolumeRestrictionTransferManager module was not added" ); - I_VolumeRestrictionTransferManager = VolumeRestrictionTransferManager.at(tx.logs[2].args._module); + I_VolumeRestrictionTransferManager = await VolumeRestrictionTransferManager.at(tx.logs[2].args._module); }); - it("Add a new token holder", async() => { - + it("Add a new token holder", async () => { let tx = await I_GeneralTransferManager.modifyWhitelist( account_investor3, - latestTime(), - latestTime(), - latestTime() + duration.days(10), + currentTime, + currentTime, + currentTime.add(new BN(duration.days(10))), true, { from: account_issuer - }); + } + ); - assert.equal(tx.logs[0].args._investor.toLowerCase(), account_investor3.toLowerCase(), "Failed in adding the investor in whitelist"); + assert.equal( + tx.logs[0].args._investor.toLowerCase(), + account_investor3.toLowerCase(), + "Failed in adding the investor in whitelist" + ); // Add the Investor in to the whitelist // Mint some tokens - await I_SecurityToken.mint(account_investor3, web3.utils.toWei('10', 'ether'), { from: token_owner }); + await I_SecurityToken.mint(account_investor3, new BN(web3.utils.toWei("10", "ether")), { from: token_owner }); - assert.equal( - (await I_SecurityToken.balanceOf(account_investor3)).toNumber(), - web3.utils.toWei('10', 'ether') - ); + assert.equal((await I_SecurityToken.balanceOf(account_investor3)).toString(), new BN(web3.utils.toWei("10", "ether")).toString()); }); - it("Should pause the tranfers at transferManager level", async() => { - let tx = await I_VolumeRestrictionTransferManager.pause({from: token_owner}); + it("Should pause the tranfers at transferManager level", async () => { + let tx = await I_VolumeRestrictionTransferManager.pause({ from: token_owner }); }); - it("Should still be able to transfer between existing token holders up to limit", async() => { + it("Should still be able to transfer between existing token holders up to limit", async () => { // Add the Investor in to the whitelist // Mint some tokens - await I_SecurityToken.transfer(account_investor1, web3.utils.toWei('1', 'ether'), { from: account_investor2 }); + await I_SecurityToken.transfer(account_investor1, new BN(web3.utils.toWei("1", "ether")), { from: account_investor2 }); - assert.equal( - (await I_SecurityToken.balanceOf(account_investor1)).toNumber(), - web3.utils.toWei('3', 'ether') - ); + assert.equal((await I_SecurityToken.balanceOf(account_investor1)).toString(), new BN(web3.utils.toWei("3", "ether")).toString()); }); - it("Should unpause the tranfers at transferManager level", async() => { - await I_VolumeRestrictionTransferManager.unpause({from: token_owner}); + it("Should unpause the tranfers at transferManager level", async () => { + await I_VolumeRestrictionTransferManager.unpause({ from: token_owner }); }); - it("Should prevent the creation of a lockup with bad parameters where the totalAmount is zero", async() => { + it("Should prevent the creation of a lockup with bad parameters where the totalAmount is zero", async () => { // create a lockup // this will generate an exception because the totalAmount is zero - await catchRevert( - I_VolumeRestrictionTransferManager.addLockUp(account_investor2, 16, 4, 0, 0, { from: token_owner }) - ) + await catchRevert(I_VolumeRestrictionTransferManager.addLockUp(account_investor2, 16, 4, new BN(0), new BN(0), { from: token_owner })); }); - it("Should prevent the creation of a lockup with bad parameters where the releaseFrequencySeconds is zero", async() => { + it("Should prevent the creation of a lockup with bad parameters where the releaseFrequencySeconds is zero", async () => { // create a lockup // this will generate an exception because the releaseFrequencySeconds is zero await catchRevert( - I_VolumeRestrictionTransferManager.addLockUp(account_investor2, 16, 0, 0, web3.utils.toWei('1', 'ether'), { from: token_owner }) + I_VolumeRestrictionTransferManager.addLockUp(account_investor2, 16, new BN(0), new BN(0), new BN(web3.utils.toWei("1", "ether")), { + from: token_owner + }) ); }); - it("Should prevent the creation of a lockup with bad parameters where the lockUpPeriodSeconds is zero", async() => { + it("Should prevent the creation of a lockup with bad parameters where the lockUpPeriodSeconds is zero", async () => { // create a lockup // this will generate an exception because the lockUpPeriodSeconds is zero await catchRevert( - I_VolumeRestrictionTransferManager.addLockUp(account_investor2, 0, 4, 0, web3.utils.toWei('1', 'ether'), { from: token_owner }) + I_VolumeRestrictionTransferManager.addLockUp(account_investor2, new BN(0), 4, new BN(0), new BN(web3.utils.toWei("1", "ether")), { + from: token_owner + }) ); }); - - it("Should prevent the creation of a lockup with bad parameters where the total amount to be released is more granular than allowed by the token", async() => { + it("Should prevent the creation of a lockup with bad parameters where the total amount to be released is more granular than allowed by the token", async () => { // create a lockup // this will generate an exception because we're locking up 5e17 tokens but the granularity is 5e18 tokens await catchRevert( - I_VolumeRestrictionTransferManager.addLockUp(account_investor2, 16, 4, 0, web3.utils.toWei('0.5', 'ether'), { from: token_owner }) + I_VolumeRestrictionTransferManager.addLockUp(account_investor2, 16, 4, new BN(0), new BN(web3.utils.toWei("0.5", "ether")), { + from: token_owner + }) ); }); - it("Should prevent the creation of a lockup with bad parameters where the lockUpPeriodSeconds is not evenly divisible by releaseFrequencySeconds", async() => { - + it("Should prevent the creation of a lockup with bad parameters where the lockUpPeriodSeconds is not evenly divisible by releaseFrequencySeconds", async () => { // balance should be 9000000000000000000 here (9 eth) - let balance = await I_SecurityToken.balanceOf(account_investor2) - + let balance = await I_SecurityToken.balanceOf(account_investor2); // create a lockup // over 17 seconds total, with 4 periods. // this will generate an exception because 17 is not evenly divisble by 4. - await catchRevert( - I_VolumeRestrictionTransferManager.addLockUp(account_investor2, 17, 4, 0, balance, { from: token_owner }) - ); + await catchRevert(I_VolumeRestrictionTransferManager.addLockUp(account_investor2, 17, 4, new BN(0), balance, { from: token_owner })); }); - it("Should prevent the creation of a lockup with bad parameters where the total amount being locked up isn't evenly divisible by the number of total periods", async() => { - + it("Should prevent the creation of a lockup with bad parameters where the total amount being locked up isn't evenly divisible by the number of total periods", async () => { // create a lockup for a balance of 1 eth // over 16e18 seconds total, with 4e18 periods of 4 seconds each. // this will generate an exception because 16e18 / 4e18 = 4e18 but the token granularity is 1e18 and 1e18 % 4e18 != 0 await catchRevert( - I_VolumeRestrictionTransferManager.addLockUp(account_investor2, web3.utils.toWei('16', 'ether'), 4, 0, web3.utils.toWei('1', 'ether'), { from: token_owner }) + I_VolumeRestrictionTransferManager.addLockUp( + account_investor2, + new BN(web3.utils.toWei("16", "ether")), + 4, + new BN(0), + new BN(web3.utils.toWei("1", "ether")), + { from: token_owner } + ) ); }); - it("Should prevent the creation of a lockup with bad parameters where the amount to be released per period is too granular for the token", async() => { - + it("Should prevent the creation of a lockup with bad parameters where the amount to be released per period is too granular for the token", async () => { // balance should be 9000000000000000000 here (9 eth) - let balance = await I_SecurityToken.balanceOf(account_investor2) + let balance = await I_SecurityToken.balanceOf(account_investor2); // create a lockup for their entire balance // over 16 seconds total, with 4 periods of 4 seconds each. // this will generate an exception because 9000000000000000000 / 4 = 2250000000000000000 but the token granularity is 1000000000000000000 - await catchRevert( - I_VolumeRestrictionTransferManager.addLockUp(account_investor2, 16, 4, 0, balance, { from: token_owner }) - ); - + await catchRevert(I_VolumeRestrictionTransferManager.addLockUp(account_investor2, 16, 4, new BN(0), balance, { from: token_owner })); }); - it("Should prevent the transfer of tokens in a lockup", async() => { - - let balance = await I_SecurityToken.balanceOf(account_investor2) - console.log("balance", balance.dividedBy(new BigNumber(1).times(new BigNumber(10).pow(18))).toNumber()); + it("Should prevent the transfer of tokens in a lockup", async () => { + let balance = await I_SecurityToken.balanceOf(account_investor2); + console.log("balance", balance.div(new BN(1).mul(new BN(10).pow(new BN(18)))).toNumber()); // create a lockup for their entire balance // over 12 seconds total, with 3 periods of 4 seconds each. - await I_VolumeRestrictionTransferManager.addLockUp(account_investor2, 12, 4, 0, balance, { from: token_owner }); + await I_VolumeRestrictionTransferManager.addLockUp(account_investor2, 12, 4, new BN(0), balance, { from: token_owner }); // read only - check if transfer will pass. it should return INVALID - let result = await I_VolumeRestrictionTransferManager.verifyTransfer.call(account_investor2, account_investor1, web3.utils.toWei('1', 'ether'), 0, false) + let result = await I_VolumeRestrictionTransferManager.verifyTransfer.call( + account_investor2, + account_investor1, + new BN(web3.utils.toWei("1", "ether")), + new BN(0), + false + ); // enum Result {INVALID, NA, VALID, FORCE_VALID} and we want VALID so it should be 2 - assert.equal(result.toString(), '0') + assert.equal(result.toString(), "0"); - await catchRevert( - I_SecurityToken.transfer(account_investor1, web3.utils.toWei('1', 'ether'), { from: account_investor2 }) - ); + await catchRevert(I_SecurityToken.transfer(account_investor1, new BN(web3.utils.toWei("1", "ether")), { from: account_investor2 })); }); - it("Should allow the transfer of tokens in a lockup if a period has passed", async() => { - + it("Should allow the transfer of tokens in a lockup if a period has passed", async () => { // wait 4 seconds await increaseTime(duration.seconds(4)); - await I_SecurityToken.transfer(account_investor1, web3.utils.toWei('3', 'ether'), { from: account_investor2 }); + await I_SecurityToken.transfer(account_investor1, new BN(web3.utils.toWei("3", "ether")), { from: account_investor2 }); }); - it("Should prevent the transfer of tokens if the amount is larger than the amount allowed by lockups", async() => { - - await catchRevert( - I_SecurityToken.transfer(account_investor1, web3.utils.toWei('4', 'ether'), { from: account_investor2 }) - ); + it("Should prevent the transfer of tokens if the amount is larger than the amount allowed by lockups", async () => { + await catchRevert(I_SecurityToken.transfer(account_investor1, new BN(web3.utils.toWei("4", "ether")), { from: account_investor2 })); }); - it("Should allow the transfer of more tokens in a lockup if another period has passed", async() => { - + it("Should allow the transfer of more tokens in a lockup if another period has passed", async () => { // wait 4 more seconds await increaseTime(4000); - await I_SecurityToken.transfer(account_investor1, web3.utils.toWei('3', 'ether'), { from: account_investor2 }); + await I_SecurityToken.transfer(account_investor1, new BN(web3.utils.toWei("3", "ether")), { from: account_investor2 }); }); - it("Should allow the transfer of all tokens in a lockup if the entire lockup has passed", async() => { - - let balance = await I_SecurityToken.balanceOf(account_investor2) + it("Should allow the transfer of all tokens in a lockup if the entire lockup has passed", async () => { + let balance = await I_SecurityToken.balanceOf(account_investor2); // wait 4 more seconds await increaseTime(4000); @@ -409,118 +414,101 @@ contract('LockupVolumeRestrictionTransferManager', accounts => { await I_SecurityToken.transfer(account_investor1, balance, { from: account_investor2 }); }); - it("Should prevent the transfer of tokens in an edited lockup", async() => { - - + it("Should prevent the transfer of tokens in an edited lockup", async () => { // balance here should be 12000000000000000000 (12e18 or 12 eth) - let balance = await I_SecurityToken.balanceOf(account_investor1) + let balance = await I_SecurityToken.balanceOf(account_investor1); // create a lockup for their entire balance // over 16 seconds total, with 4 periods of 4 seconds each. - await I_VolumeRestrictionTransferManager.addLockUp(account_investor1, 16, 4, 0, balance, { from: token_owner }); + await I_VolumeRestrictionTransferManager.addLockUp(account_investor1, 16, 4, new BN(0), balance, { from: token_owner }); // let blockNumber = await web3.eth.getBlockNumber(); // console.log('blockNumber',blockNumber) - let now = (await web3.eth.getBlock('latest')).timestamp + let now = (await web3.eth.getBlock("latest")).timestamp; - await catchRevert( - I_SecurityToken.transfer(account_investor2, web3.utils.toWei('1', 'ether'), { from: account_investor1 }) - ); + await catchRevert(I_SecurityToken.transfer(account_investor2, new BN(web3.utils.toWei("1", "ether")), { from: account_investor1 })); // check and get the lockup let lockUpCount = await I_VolumeRestrictionTransferManager.getLockUpsLength(account_investor1); - assert.equal(lockUpCount, 1) + assert.equal(lockUpCount, 1); let lockUp = await I_VolumeRestrictionTransferManager.getLockUp(account_investor1, 0); // console.log(lockUp); // elements in lockup array are uint lockUpPeriodSeconds, uint releaseFrequencySeconds, uint startTime, uint totalAmount - assert.equal(lockUp[0].toString(), '16'); - assert.equal(lockUp[1].toString(), '4'); + assert.equal(lockUp[0].toString(), "16"); + assert.equal(lockUp[1].toString(), "4"); assert.equal(lockUp[2].toNumber(), now); assert.equal(lockUp[3].toString(), balance.toString()); // edit the lockup - await I_VolumeRestrictionTransferManager.modifyLockUp(account_investor1, 0, 8, 4, 0, balance, { from: token_owner }); + await I_VolumeRestrictionTransferManager.modifyLockUp(account_investor1, new BN(0), 8, 4, new BN(0), balance, { from: token_owner }); // attempt a transfer - await catchRevert( - I_SecurityToken.transfer(account_investor2, web3.utils.toWei('6', 'ether'), { from: account_investor1 }) - ); + await catchRevert(I_SecurityToken.transfer(account_investor2, new BN(web3.utils.toWei("6", "ether")), { from: account_investor1 })); // wait 4 seconds await new Promise(resolve => setTimeout(resolve, 4000)); // transfer should succeed - await I_SecurityToken.transfer(account_investor2, web3.utils.toWei('6', 'ether'), { from: account_investor1 }); - + await I_SecurityToken.transfer(account_investor2, new BN(web3.utils.toWei("6", "ether")), { from: account_investor1 }); }); - it("Should succesfully modify the lockup - fail because array index out of bound", async() => { + it("Should succesfully modify the lockup - fail because array index out of bound", async () => { // balance here should be 12000000000000000000 (12e18 or 12 eth) let balance = await I_SecurityToken.balanceOf(account_investor1); await catchRevert( - I_VolumeRestrictionTransferManager.modifyLockUp(account_investor1, 8, 8, 4, 0, balance, { from: token_owner }) + I_VolumeRestrictionTransferManager.modifyLockUp(account_investor1, 8, 8, 4, new BN(0), balance, { from: token_owner }) ); - }) - - it("Should succesfully get the lockup - fail because array index out of bound", async() => { - await catchRevert( - I_VolumeRestrictionTransferManager.getLockUp(account_investor1, 9) - ); - }) + }); - it("Should be possible to remove a lockup -- couldn't transfer because of lock up", async() => { + it("Should succesfully get the lockup - fail because array index out of bound", async () => { + await catchRevert(I_VolumeRestrictionTransferManager.getLockUp(account_investor1, 9)); + }); - let acct1Balance = await I_SecurityToken.balanceOf(account_investor1) + it("Should be possible to remove a lockup -- couldn't transfer because of lock up", async () => { + let acct1Balance = await I_SecurityToken.balanceOf(account_investor1); - await catchRevert( - I_SecurityToken.transfer(account_investor2, acct1Balance, { from: account_investor1 }) - ); + await catchRevert(I_SecurityToken.transfer(account_investor2, acct1Balance, { from: account_investor1 })); // check and get the lockup let lockUpCount = await I_VolumeRestrictionTransferManager.getLockUpsLength(account_investor1); - assert.equal(lockUpCount, 1) + assert.equal(lockUpCount, 1); // remove the lockup - await I_VolumeRestrictionTransferManager.removeLockUp(account_investor1, 0, { from: token_owner }); + await I_VolumeRestrictionTransferManager.removeLockUp(account_investor1, new BN(0), { from: token_owner }); - lockUpCount = await I_VolumeRestrictionTransferManager.getLockUpsLength(account_investor1); - assert.equal(lockUpCount, 0) + lockUpCount = await I_VolumeRestrictionTransferManager.getLockUpsLength(account_investor1); + assert.equal(lockUpCount, 0); - let acct2BalanceBefore = await I_SecurityToken.balanceOf(account_investor2) + let acct2BalanceBefore = await I_SecurityToken.balanceOf(account_investor2); await I_SecurityToken.transfer(account_investor2, acct1Balance, { from: account_investor1 }); - let acct2BalanceAfter = await I_SecurityToken.balanceOf(account_investor2) + let acct2BalanceAfter = await I_SecurityToken.balanceOf(account_investor2); - assert.equal(acct2BalanceAfter.sub(acct2BalanceBefore).toString(), acct1Balance.toString()) + assert.equal(acct2BalanceAfter.sub(acct2BalanceBefore).toString(), acct1Balance.toString()); }); - it("Should try to remove the lockup --failed because of index is out of bounds", async() => { - await catchRevert( - I_VolumeRestrictionTransferManager.removeLockUp(account_investor2, 7, { from: token_owner }) - ); - }) - - it("Should be possible to create multiple lockups at once", async() => { + it("Should try to remove the lockup --failed because of index is out of bounds", async () => { + await catchRevert(I_VolumeRestrictionTransferManager.removeLockUp(account_investor2, 7, { from: token_owner })); + }); - let balancesBefore = {} + it("Should be possible to create multiple lockups at once", async () => { + let balancesBefore = {}; // should be 12000000000000000000 - balancesBefore[account_investor2] = await I_SecurityToken.balanceOf(account_investor2) - + balancesBefore[account_investor2] = await I_SecurityToken.balanceOf(account_investor2); // should be 10000000000000000000 - balancesBefore[account_investor3] = await I_SecurityToken.balanceOf(account_investor3) - + balancesBefore[account_investor3] = await I_SecurityToken.balanceOf(account_investor3); - let lockUpCountsBefore = {} + let lockUpCountsBefore = {}; // get lockups for acct 2 lockUpCountsBefore[account_investor2] = await I_VolumeRestrictionTransferManager.getLockUpsLength(account_investor2); - assert.equal(lockUpCountsBefore[account_investor2], 1) // there's one old, expired lockup on acct already + assert.equal(lockUpCountsBefore[account_investor2], 1); // there's one old, expired lockup on acct already // get lockups for acct 3 lockUpCountsBefore[account_investor3] = await I_VolumeRestrictionTransferManager.getLockUpsLength(account_investor3); - assert.equal(lockUpCountsBefore[account_investor3], 0) + assert.equal(lockUpCountsBefore[account_investor3], 0); // create lockups for their entire balances await I_VolumeRestrictionTransferManager.addLockUpMulti( @@ -532,22 +520,18 @@ contract('LockupVolumeRestrictionTransferManager', accounts => { { from: token_owner } ); - await catchRevert( - I_SecurityToken.transfer(account_investor1, web3.utils.toWei('2', 'ether'), { from: account_investor2 }) - ); + await catchRevert(I_SecurityToken.transfer(account_investor1, new BN(web3.utils.toWei("2", "ether")), { from: account_investor2 })); - await catchRevert( - I_SecurityToken.transfer(account_investor1, web3.utils.toWei('5', 'ether'), { from: account_investor3 }) - ); + await catchRevert(I_SecurityToken.transfer(account_investor1, new BN(web3.utils.toWei("5", "ether")), { from: account_investor3 })); - let balancesAfter = {} - balancesAfter[account_investor2] = await I_SecurityToken.balanceOf(account_investor2) - assert.equal(balancesBefore[account_investor2].toString(), balancesAfter[account_investor2].toString()) + let balancesAfter = {}; + balancesAfter[account_investor2] = await I_SecurityToken.balanceOf(account_investor2); + assert.equal(balancesBefore[account_investor2].toString(), balancesAfter[account_investor2].toString()); - balancesAfter[account_investor3] = await I_SecurityToken.balanceOf(account_investor3) - assert.equal(balancesBefore[account_investor3].toString(), balancesAfter[account_investor3].toString()) + balancesAfter[account_investor3] = await I_SecurityToken.balanceOf(account_investor3); + assert.equal(balancesBefore[account_investor3].toString(), balancesAfter[account_investor3].toString()); - let lockUpCountsAfter = {} + let lockUpCountsAfter = {}; // get lockups for acct 2 lockUpCountsAfter[account_investor2] = await I_VolumeRestrictionTransferManager.getLockUpsLength(account_investor2); @@ -561,250 +545,249 @@ contract('LockupVolumeRestrictionTransferManager', accounts => { await increaseTime(4000); // try transfers again - await I_SecurityToken.transfer(account_investor1, web3.utils.toWei('2', 'ether'), { from: account_investor2 }); - await I_SecurityToken.transfer(account_investor1, web3.utils.toWei('5', 'ether'), { from: account_investor3 }); + await I_SecurityToken.transfer(account_investor1, new BN(web3.utils.toWei("2", "ether")), { from: account_investor2 }); + await I_SecurityToken.transfer(account_investor1, new BN(web3.utils.toWei("5", "ether")), { from: account_investor3 }); + balancesAfter[account_investor2] = await I_SecurityToken.balanceOf(account_investor2); + assert.equal( + balancesBefore[account_investor2].sub(new BN(web3.utils.toWei("2", "ether"))).toString(), + balancesAfter[account_investor2].toString() + ); - balancesAfter[account_investor2] = await I_SecurityToken.balanceOf(account_investor2) - assert.equal(balancesBefore[account_investor2].sub(web3.utils.toWei('2', 'ether')).toString(), balancesAfter[account_investor2].toString()) - - balancesAfter[account_investor3] = await I_SecurityToken.balanceOf(account_investor3) - assert.equal(balancesBefore[account_investor3].sub(web3.utils.toWei('5', 'ether')).toString(), balancesAfter[account_investor3].toString()) - + balancesAfter[account_investor3] = await I_SecurityToken.balanceOf(account_investor3); + assert.equal( + balancesBefore[account_investor3].sub(new BN(web3.utils.toWei("5", "ether"))).toString(), + balancesAfter[account_investor3].toString() + ); }); - it("Should revert if the parameters are bad when creating multiple lockups", async() => { - + it("Should revert if the parameters are bad when creating multiple lockups", async () => { await catchRevert( // pass in the wrong number of params. txn should revert - I_VolumeRestrictionTransferManager.addLockUpMulti( - [account_investor2, account_investor3], - [16, 8], - [2], // this array should have 2 elements but it has 1, which should cause a revert - [0, 0], - [web3.utils.toWei('1', 'ether'), web3.utils.toWei('1', 'ether')], - { from: token_owner } - ) + I_VolumeRestrictionTransferManager.addLockUpMulti( + [account_investor2, account_investor3], + [16, 8], + [2], // this array should have 2 elements but it has 1, which should cause a revert + [0, 0], + [new BN(web3.utils.toWei("1", "ether")), new BN(web3.utils.toWei("1", "ether"))], + { from: token_owner } + ) ); }); - it("Should be possible to create a lockup with a specific start time in the future", async() => { - + it("Should be possible to create a lockup with a specific start time in the future", async () => { // remove all lockups for account 2 let lockUpsLength = await I_VolumeRestrictionTransferManager.getLockUpsLength(account_investor2); assert.equal(lockUpsLength, 2); - await I_VolumeRestrictionTransferManager.removeLockUp(account_investor2, 0, { from: token_owner }); - await I_VolumeRestrictionTransferManager.removeLockUp(account_investor2, 0, { from: token_owner }); + await I_VolumeRestrictionTransferManager.removeLockUp(account_investor2, new BN(0), { from: token_owner }); + await I_VolumeRestrictionTransferManager.removeLockUp(account_investor2, new BN(0), { from: token_owner }); lockUpsLength = await I_VolumeRestrictionTransferManager.getLockUpsLength(account_investor2); assert.equal(lockUpsLength, 0); - let now = latestTime(); + let now = await latestTime(); // balance here should be 10000000000000000000 - let balance = await I_SecurityToken.balanceOf(account_investor2) + let balance = await I_SecurityToken.balanceOf(account_investor2); - await I_VolumeRestrictionTransferManager.addLockUp(account_investor2, 100, 10, now + duration.seconds(4), balance, { from: token_owner }); + await I_VolumeRestrictionTransferManager.addLockUp(account_investor2, 100, 10, now + duration.seconds(4), balance, { + from: token_owner + }); // wait 4 seconds for the lockup to begin await increaseTime(duration.seconds(4)); // try another transfer. it should also fail because the lockup has just begun - await catchRevert( - I_SecurityToken.transfer(account_investor1, web3.utils.toWei('1', 'ether'), { from: account_investor2 }) - ); - + await catchRevert(I_SecurityToken.transfer(account_investor1, new BN(web3.utils.toWei("1", "ether")), { from: account_investor2 })); }); - it("Should be possible to edit a lockup with a specific start time in the future", async() => { - + it("Should be possible to edit a lockup with a specific start time in the future", async () => { // edit the lockup - let now = latestTime(); + let now = await latestTime(); // should be 10000000000000000000 - let balance = await I_SecurityToken.balanceOf(account_investor2) + let balance = await I_SecurityToken.balanceOf(account_investor2); // check and get the lockup let lockUpCount = await I_VolumeRestrictionTransferManager.getLockUpsLength(account_investor2); - assert.equal(lockUpCount, 1) + assert.equal(lockUpCount, 1); let lockUp = await I_VolumeRestrictionTransferManager.getLockUp(account_investor2, 0); // elements in lockup array are uint lockUpPeriodSeconds, uint releaseFrequencySeconds, uint startTime, uint totalAmount - assert.equal(lockUp[0].toString(), '100'); - assert.equal(lockUp[1].toString(), '10'); + assert.equal(lockUp[0].toString(), "100"); + assert.equal(lockUp[1].toString(), "10"); assert.isAtMost(lockUp[2].toNumber(), now); assert.equal(lockUp[3].toString(), balance.toString()); // edit the lockup - await I_VolumeRestrictionTransferManager.modifyLockUp(account_investor2, 0, 8, 4, now + duration.seconds(4), balance, { from: token_owner }); + await I_VolumeRestrictionTransferManager.modifyLockUp(account_investor2, new BN(0), 8, 4, now + duration.seconds(4), balance, { + from: token_owner + }); // check and get the lockup again lockUpCount = await I_VolumeRestrictionTransferManager.getLockUpsLength(account_investor2); - assert.equal(lockUpCount, 1) + assert.equal(lockUpCount, 1); lockUp = await I_VolumeRestrictionTransferManager.getLockUp(account_investor2, 0); // elements in lockup array are uint lockUpPeriodSeconds, uint releaseFrequencySeconds, uint startTime, uint totalAmount - assert.equal(lockUp[0].toString(), '8'); - assert.equal(lockUp[1].toString(), '4'); + assert.equal(lockUp[0].toString(), "8"); + assert.equal(lockUp[1].toString(), "4"); assert.isAtMost(lockUp[2].toNumber(), now + 4); assert.equal(lockUp[3].toString(), balance.toString()); // try a transfer. it should fail because again, the lockup hasn't started yet. - await catchRevert( - I_SecurityToken.transfer(account_investor1, web3.utils.toWei('1', 'ether'), { from: account_investor2 }) - ); + await catchRevert(I_SecurityToken.transfer(account_investor1, new BN(web3.utils.toWei("1", "ether")), { from: account_investor2 })); // wait 4 seconds for the lockup to begin await increaseTime(duration.seconds(4)); // try another transfer. it should fail because the lockup has just begun - await catchRevert( - I_SecurityToken.transfer(account_investor1, web3.utils.toWei('1', 'ether'), { from: account_investor2 }) - ); + await catchRevert(I_SecurityToken.transfer(account_investor1, new BN(web3.utils.toWei("1", "ether")), { from: account_investor2 })); // wait 4 seconds for the lockup's first period to elapse await increaseTime(duration.seconds(4)); // try another transfer. it should pass - await I_SecurityToken.transfer(account_investor1, web3.utils.toWei('5', 'ether'), { from: account_investor2 }); - + await I_SecurityToken.transfer(account_investor1, new BN(web3.utils.toWei("5", "ether")), { from: account_investor2 }); // try another transfer without waiting for another period to pass. it should fail - await catchRevert( - I_SecurityToken.transfer(account_investor1, web3.utils.toWei('5', 'ether'), { from: account_investor2 }) - ); + await catchRevert(I_SecurityToken.transfer(account_investor1, new BN(web3.utils.toWei("5", "ether")), { from: account_investor2 })); // wait 4 seconds for the lockup's first period to elapse await increaseTime(duration.seconds(4)); let lockUpBeforeVerify = await I_VolumeRestrictionTransferManager.getLockUp(account_investor2, 0); // check if transfer will pass in read-only operation - let result = await I_VolumeRestrictionTransferManager.verifyTransfer.call(account_investor2, account_investor1, web3.utils.toWei('5', 'ether'), 0, false) + let result = await I_VolumeRestrictionTransferManager.verifyTransfer.call( + account_investor2, + account_investor1, + new BN(web3.utils.toWei("5", "ether")), + new BN(0), + false + ); // enum Result {INVALID, NA, VALID, FORCE_VALID} and we want VALID so it should be 2 - assert.equal(result.toString(), '2') + assert.equal(result.toString(), "2"); let lockUpAfterVerify = await I_VolumeRestrictionTransferManager.getLockUp(account_investor2, 0); - assert.equal(lockUpBeforeVerify[4].toString(), lockUpAfterVerify[4].toString()) + assert.equal(lockUpBeforeVerify[4].toString(), lockUpAfterVerify[4].toString()); // try another transfer. it should pass - await I_SecurityToken.transfer(account_investor1, web3.utils.toWei('5', 'ether'), { from: account_investor2 }); + await I_SecurityToken.transfer(account_investor1, new BN(web3.utils.toWei("5", "ether")), { from: account_investor2 }); // wait 4 seconds for the lockup's first period to elapse. but, we are all out of periods. await increaseTime(duration.seconds(4)); // try one final transfer. this should fail because the user has already withdrawn their entire balance - await catchRevert( - I_SecurityToken.transfer(account_investor1, web3.utils.toWei('1', 'ether'), { from: account_investor2 }) - ); + await catchRevert(I_SecurityToken.transfer(account_investor1, new BN(web3.utils.toWei("1", "ether")), { from: account_investor2 })); }); - it("Should be possible to stack lockups", async() => { + it("Should be possible to stack lockups", async () => { // should be 17000000000000000000 - let balance = await I_SecurityToken.balanceOf(account_investor1) + let balance = await I_SecurityToken.balanceOf(account_investor1); // check and make sure that acct1 has no lockups so far let lockUpCount = await I_VolumeRestrictionTransferManager.getLockUpsLength(account_investor1); - assert.equal(lockUpCount.toString(), 0) + assert.equal(lockUpCount.toString(), 0); - await I_VolumeRestrictionTransferManager.addLockUp(account_investor1, 12, 4, 0, web3.utils.toWei('6', 'ether'), { from: token_owner }); + await I_VolumeRestrictionTransferManager.addLockUp(account_investor1, 12, 4, new BN(0), new BN(web3.utils.toWei("6", "ether")), { + from: token_owner + }); // try to transfer 11 tokens that aren't locked up yet be locked up. should succeed - await I_SecurityToken.transfer(account_investor2, web3.utils.toWei('11', 'ether'), { from: account_investor1 }); + await I_SecurityToken.transfer(account_investor2, new BN(web3.utils.toWei("11", "ether")), { from: account_investor1 }); // try a transfer. it should fail because it's locked up from the first lockups - await catchRevert( - I_SecurityToken.transfer(account_investor2, web3.utils.toWei('1', 'ether'), { from: account_investor1 }) - ); + await catchRevert(I_SecurityToken.transfer(account_investor2, new BN(web3.utils.toWei("1", "ether")), { from: account_investor1 })); // wait 4 seconds for the lockup's first period to elapse. await increaseTime(duration.seconds(4)); // should succeed - await I_SecurityToken.transfer(account_investor2, web3.utils.toWei('2', 'ether'), { from: account_investor1 }); + await I_SecurityToken.transfer(account_investor2, new BN(web3.utils.toWei("2", "ether")), { from: account_investor1 }); // send 8 back to investor1 so that we can lock them up - await I_SecurityToken.transfer(account_investor1, web3.utils.toWei('8', 'ether'), { from: account_investor2 }); + await I_SecurityToken.transfer(account_investor1, new BN(web3.utils.toWei("8", "ether")), { from: account_investor2 }); // let's add another lockup to stack them - await I_VolumeRestrictionTransferManager.addLockUp(account_investor1, 16, 4, 0, web3.utils.toWei('8', 'ether'), { from: token_owner }); + await I_VolumeRestrictionTransferManager.addLockUp(account_investor1, 16, 4, new BN(0), new BN(web3.utils.toWei("8", "ether")), { + from: token_owner + }); // try a transfer. it should fail because it's locked up from both lockups - await catchRevert( - I_SecurityToken.transfer(account_investor2, web3.utils.toWei('1', 'ether'), { from: account_investor1 }) - ); + await catchRevert(I_SecurityToken.transfer(account_investor2, new BN(web3.utils.toWei("1", "ether")), { from: account_investor1 })); // wait 4 seconds for the 1st lockup's second period to elapse, and the 2nd lockup's first period to elapse await increaseTime(duration.seconds(4)); // should now be able to transfer 4, because of 2 allowed from the 1st lockup and 2 from the 2nd - await I_SecurityToken.transfer(account_investor2, web3.utils.toWei('4', 'ether'), { from: account_investor1 }); + await I_SecurityToken.transfer(account_investor2, new BN(web3.utils.toWei("4", "ether")), { from: account_investor1 }); // try aother transfer. it should fail because it's locked up from both lockups again - await catchRevert( - I_SecurityToken.transfer(account_investor2, web3.utils.toWei('1', 'ether'), { from: account_investor1 }) - ); + await catchRevert(I_SecurityToken.transfer(account_investor2, new BN(web3.utils.toWei("1", "ether")), { from: account_investor1 })); // wait 4 seconds for the 1st lockup's final period to elapse, and the 2nd lockup's second period to elapse await increaseTime(duration.seconds(4)); // should now be able to transfer 4, because of 2 allowed from the 1st lockup and 2 from the 2nd - await I_SecurityToken.transfer(account_investor2, web3.utils.toWei('4', 'ether'), { from: account_investor1 }); + await I_SecurityToken.transfer(account_investor2, new BN(web3.utils.toWei("4", "ether")), { from: account_investor1 }); // wait 8 seconds for 2nd lockup's third and fourth periods to elapse await increaseTime(duration.seconds(8)); // should now be able to transfer 4, because there are 2 allowed per period in the 2nd lockup, and 2 periods have elapsed - await I_SecurityToken.transfer(account_investor2, web3.utils.toWei('4', 'ether'), { from: account_investor1 }); + await I_SecurityToken.transfer(account_investor2, new BN(web3.utils.toWei("4", "ether")), { from: account_investor1 }); // send the 3 back from acct2 that we sent over in the beginning of this test - await I_SecurityToken.transfer(account_investor1, web3.utils.toWei('3', 'ether'), { from: account_investor2 }); + await I_SecurityToken.transfer(account_investor1, new BN(web3.utils.toWei("3", "ether")), { from: account_investor2 }); // try another transfer. it should pass because both lockups have been entirely used - await I_SecurityToken.transfer(account_investor2, web3.utils.toWei('1', 'ether'), { from: account_investor1 }); + await I_SecurityToken.transfer(account_investor2, new BN(web3.utils.toWei("1", "ether")), { from: account_investor1 }); - balance = await I_SecurityToken.balanceOf(account_investor1) - assert.equal(balance.toString(), web3.utils.toWei('2', 'ether')) + balance = await I_SecurityToken.balanceOf(account_investor1); + assert.equal(balance.toString(), new BN(web3.utils.toWei("2", "ether"))); }); - - it("Should get configuration function signature", async() => { + it("Should get configuration function signature", async () => { let sig = await I_VolumeRestrictionTransferManager.getInitFunction.call(); assert.equal(web3.utils.hexToNumber(sig), 0); }); - - it("Should get the permission", async() => { + it("Should get the permission", async () => { let perm = await I_VolumeRestrictionTransferManager.getPermissions.call(); assert.equal(perm.length, 1); // console.log(web3.utils.toAscii(perm[0]).replace(/\u0000/g, '')) - assert.equal(web3.utils.toAscii(perm[0]).replace(/\u0000/g, ''), "ADMIN") + assert.equal(web3.utils.toAscii(perm[0]).replace(/\u0000/g, ""), "ADMIN"); }); - }); - describe("VolumeRestriction Transfer Manager Factory test cases", async() => { - - it("Should get the exact details of the factory", async() => { - assert.equal(await I_VolumeRestrictionTransferManagerFactory.getSetupCost.call(),0); - assert.equal((await I_VolumeRestrictionTransferManagerFactory.getTypes.call())[0],2); - assert.equal(web3.utils.toAscii(await I_VolumeRestrictionTransferManagerFactory.getName.call()) - .replace(/\u0000/g, ''), - "LockupVolumeRestrictionTM", - "Wrong Module added"); - assert.equal(await I_VolumeRestrictionTransferManagerFactory.description.call(), - "Manage transfers using lock ups over time", - "Wrong Module added"); - assert.equal(await I_VolumeRestrictionTransferManagerFactory.title.call(), - "Lockup Volume Restriction Transfer Manager", - "Wrong Module added"); - assert.equal(await I_VolumeRestrictionTransferManagerFactory.getInstructions.call(), - "Allows an issuer to set lockup periods for user addresses, with funds distributed over time. Init function takes no parameters.", - "Wrong Module added"); + describe("VolumeRestriction Transfer Manager Factory test cases", async () => { + it("Should get the exact details of the factory", async () => { + assert.equal(await I_VolumeRestrictionTransferManagerFactory.getSetupCost.call(), 0); + assert.equal((await I_VolumeRestrictionTransferManagerFactory.getTypes.call())[0], 2); + assert.equal( + web3.utils.toAscii(await I_VolumeRestrictionTransferManagerFactory.getName.call()).replace(/\u0000/g, ""), + "LockupVolumeRestrictionTM", + "Wrong Module added" + ); + assert.equal( + await I_VolumeRestrictionTransferManagerFactory.description.call(), + "Manage transfers using lock ups over time", + "Wrong Module added" + ); + assert.equal( + await I_VolumeRestrictionTransferManagerFactory.title.call(), + "Lockup Volume Restriction Transfer Manager", + "Wrong Module added" + ); + assert.equal( + await I_VolumeRestrictionTransferManagerFactory.getInstructions.call(), + "Allows an issuer to set lockup periods for user addresses, with funds distributed over time. Init function takes no parameters.", + "Wrong Module added" + ); assert.equal(await I_VolumeRestrictionTransferManagerFactory.version.call(), "1.0.0"); }); - it("Should get the tags of the factory", async() => { + it("Should get the tags of the factory", async () => { let tags = await I_VolumeRestrictionTransferManagerFactory.getTags.call(); - assert.equal(web3.utils.toAscii(tags[0]).replace(/\u0000/g, ''), "Volume"); + assert.equal(web3.utils.toAscii(tags[0]).replace(/\u0000/g, ""), "Volume"); }); }); - }); diff --git a/test/y_scheduled_checkpoints.js b/test/y_scheduled_checkpoints.js index 4829eec5f..aa490f32e 100644 --- a/test/y_scheduled_checkpoints.js +++ b/test/y_scheduled_checkpoints.js @@ -1,20 +1,18 @@ -import latestTime from './helpers/latestTime'; -import { duration, promisifyLogWatch, latestBlock } from './helpers/utils'; -import takeSnapshot, { increaseTime, revertToSnapshot } from './helpers/time'; -import { encodeProxyCall, encodeModuleCall } from './helpers/encodeCall'; +import latestTime from "./helpers/latestTime"; +import { duration, promisifyLogWatch, latestBlock } from "./helpers/utils"; +import takeSnapshot, { increaseTime, revertToSnapshot } from "./helpers/time"; +import { encodeProxyCall, encodeModuleCall } from "./helpers/encodeCall"; import { setUpPolymathNetwork, deployScheduleCheckpointAndVerified } from "./helpers/createInstances"; -const SecurityToken = artifacts.require('./SecurityToken.sol'); -const GeneralTransferManager = artifacts.require('./GeneralTransferManager'); -const ScheduledCheckpoint = artifacts.require('./ScheduledCheckpoint.sol'); +const SecurityToken = artifacts.require("./SecurityToken.sol"); +const GeneralTransferManager = artifacts.require("./GeneralTransferManager"); +const ScheduledCheckpoint = artifacts.require("./ScheduledCheckpoint.sol"); +const Web3 = require("web3"); +let BN = Web3.utils.BN; +const web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545")); // Hardcoded development port -const Web3 = require('web3'); -const BigNumber = require('bignumber.js'); -const web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545")) // Hardcoded development port - -contract('ScheduledCheckpoint', accounts => { - +contract("ScheduledCheckpoint", async (accounts) => { // Accounts Variable declaration let account_polymath; let account_issuer; @@ -24,11 +22,6 @@ contract('ScheduledCheckpoint', accounts => { let account_investor3; let account_investor4; - // investor Details - let fromTime = latestTime(); - let toTime = latestTime(); - let expiryTime = toTime + duration.days(15); - let message = "Transaction Should Fail!"; // Contract Instance Declaration @@ -63,10 +56,14 @@ contract('ScheduledCheckpoint', accounts => { const stoKey = 3; // Initial fee for ticker registry and security token registry - const initRegFee = web3.utils.toWei("250"); + const initRegFee = new BN(web3.utils.toWei("250")); - before(async() => { - // Accounts setup + let currentTime; + const address_zero = "0x0000000000000000000000000000000000000000"; + const one_address = "0x0000000000000000000000000000000000000001"; + + before(async () => { + currentTime = new BN(await latestTime()); account_polymath = accounts[0]; account_issuer = accounts[1]; @@ -115,264 +112,274 @@ contract('ScheduledCheckpoint', accounts => { `); }); - describe("Generate the SecurityToken", async() => { - + describe("Generate the SecurityToken", async () => { it("Should register the ticker before the generation of the security token", async () => { await I_PolyToken.approve(I_STRProxied.address, initRegFee, { from: token_owner }); - let tx = await I_STRProxied.registerTicker(token_owner, symbol, contact, { from : token_owner }); + let tx = await I_STRProxied.registerTicker(token_owner, symbol, contact, { from: token_owner }); assert.equal(tx.logs[0].args._owner, token_owner); assert.equal(tx.logs[0].args._ticker, symbol.toUpperCase()); }); it("Should generate the new security token with the same symbol as registered above", async () => { await I_PolyToken.approve(I_STRProxied.address, initRegFee, { from: token_owner }); - let _blockNo = latestBlock(); + let tx = await I_STRProxied.generateSecurityToken(name, symbol, tokenDetails, false, { from: token_owner }); // Verify the successful generation of the security token assert.equal(tx.logs[2].args._ticker, symbol.toUpperCase(), "SecurityToken doesn't get deployed"); - I_SecurityToken = SecurityToken.at(tx.logs[2].args._securityTokenAddress); + I_SecurityToken = await SecurityToken.at(tx.logs[2].args._securityTokenAddress); - const log = await promisifyLogWatch(I_SecurityToken.ModuleAdded({from: _blockNo}), 1); + const log = (await I_SecurityToken.getPastEvents('ModuleAdded', {filter: {transactionHash: tx.transactionHash}}))[0]; // Verify that GeneralTransferManager module get added successfully or not assert.equal(log.args._types[0].toNumber(), 2); - assert.equal( - web3.utils.toAscii(log.args._name) - .replace(/\u0000/g, ''), - "GeneralTransferManager" - ); + assert.equal(web3.utils.toAscii(log.args._name).replace(/\u0000/g, ""), "GeneralTransferManager"); }); it("Should intialize the auto attached modules", async () => { - let moduleData = (await I_SecurityToken.getModulesByType(2))[0]; - I_GeneralTransferManager = GeneralTransferManager.at(moduleData); - + let moduleData = (await I_SecurityToken.getModulesByType(2))[0]; + I_GeneralTransferManager = await GeneralTransferManager.at(moduleData); }); - }); - describe("Buy tokens using on-chain whitelist", async() => { - + describe("Buy tokens using on-chain whitelist", async () => { it("Should successfully attach the ScheduledCheckpoint with the security token", async () => { - await I_SecurityToken.changeGranularity(1, {from: token_owner}); - const tx = await I_SecurityToken.addModule(I_ScheduledCheckpointFactory.address, "", 0, 0, { from: token_owner }); + await I_SecurityToken.changeGranularity(1, { from: token_owner }); + const tx = await I_SecurityToken.addModule(I_ScheduledCheckpointFactory.address, "0x0", new BN(0), new BN(0), { from: token_owner }); assert.equal(tx.logs[2].args._types[0].toNumber(), 4, "ScheduledCheckpoint doesn't get deployed"); assert.equal(tx.logs[2].args._types[1].toNumber(), 2, "ScheduledCheckpoint doesn't get deployed"); assert.equal( - web3.utils.toAscii(tx.logs[2].args._name) - .replace(/\u0000/g, ''), + web3.utils.toAscii(tx.logs[2].args._name).replace(/\u0000/g, ""), "ScheduledCheckpoint", "ScheduledCheckpoint module was not added" ); - I_ScheduledCheckpoint = ScheduledCheckpoint.at(tx.logs[2].args._module); + I_ScheduledCheckpoint = await ScheduledCheckpoint.at(tx.logs[2].args._module); }); let startTime; let interval; it("Should create a daily checkpoint", async () => { - startTime = latestTime() + 100; + startTime = await latestTime() + 100; interval = 24 * 60 * 60; console.log("Creating scheduled CP: " + startTime, interval); - await I_ScheduledCheckpoint.addSchedule("CP1", startTime, interval, {from: token_owner}); - console.log("2: " + latestTime()); + await I_ScheduledCheckpoint.addSchedule(web3.utils.fromAscii("CP1"), startTime, interval, { from: token_owner }); + console.log("2: " + await latestTime()); }); it("Remove (temp) daily checkpoint", async () => { let snap_Id = await takeSnapshot(); - await I_ScheduledCheckpoint.removeSchedule("CP1", {from: token_owner}); + await I_ScheduledCheckpoint.removeSchedule(web3.utils.fromAscii("CP1"), { from: token_owner }); await revertToSnapshot(snap_Id); }); - it("Should Buy the tokens for account_investor1", async() => { + it("Should Buy the tokens for account_investor1", async () => { // Add the Investor in to the whitelist - console.log("3: " + latestTime()); + console.log("3: " + await latestTime()); let tx = await I_GeneralTransferManager.modifyWhitelist( account_investor1, - latestTime(), - latestTime(), - latestTime() + duration.days(10), + currentTime, + currentTime, + currentTime.add(new BN(duration.days(10))), true, { from: account_issuer, gas: 6000000 - }); + } + ); - assert.equal(tx.logs[0].args._investor.toLowerCase(), account_investor1.toLowerCase(), "Failed in adding the investor in whitelist"); + assert.equal( + tx.logs[0].args._investor.toLowerCase(), + account_investor1.toLowerCase(), + "Failed in adding the investor in whitelist" + ); // Jump time - console.log("4: " + latestTime()); + console.log("4: " + await latestTime()); await increaseTime(5000); // We should be after the first scheduled checkpoint, and before the second - console.log("5: " + latestTime()); + console.log("5: " + await latestTime()); - assert.isTrue(latestTime() > startTime); - assert.isTrue(latestTime() <= startTime + interval); - console.log("6: " + latestTime()); + assert.isTrue(await latestTime() > startTime); + assert.isTrue(await latestTime() <= startTime + interval); + console.log("6: " + await latestTime()); // Mint some tokens - await I_SecurityToken.mint(account_investor1, web3.utils.toWei('1', 'ether'), { from: token_owner }); + await I_SecurityToken.mint(account_investor1, new BN(web3.utils.toWei("1", "ether")), { from: token_owner }); - assert.equal( - (await I_SecurityToken.balanceOf(account_investor1)).toNumber(), - web3.utils.toWei('1', 'ether') - ); + assert.equal((await I_SecurityToken.balanceOf(account_investor1)).toString(), new BN(web3.utils.toWei("1", "ether")).toString()); }); - it("Should have checkpoint created with correct balances", async() => { - let cp1 = await I_ScheduledCheckpoint.getSchedule("CP1"); + it("Should have checkpoint created with correct balances", async () => { + let cp1 = await I_ScheduledCheckpoint.getSchedule(web3.utils.fromAscii("CP1")); checkSchedule(cp1, "CP1", startTime, startTime + interval, interval, [1], [startTime], [1]); assert.equal((await I_SecurityToken.balanceOfAt(account_investor1, 0)).toNumber(), 0); assert.equal((await I_SecurityToken.balanceOfAt(account_investor1, 1)).toNumber(), 0); }); - it("Should Buy some more tokens for account_investor2", async() => { + it("Should Buy some more tokens for account_investor2", async () => { // Add the Investor in to the whitelist let tx = await I_GeneralTransferManager.modifyWhitelist( account_investor2, - latestTime(), - latestTime(), - latestTime() + duration.days(10), + currentTime, + currentTime, + currentTime.add(new BN(duration.days(10))), true, { from: account_issuer, gas: 6000000 - }); + } + ); - assert.equal(tx.logs[0].args._investor.toLowerCase(), account_investor2.toLowerCase(), "Failed in adding the investor in whitelist"); + assert.equal( + tx.logs[0].args._investor.toLowerCase(), + account_investor2.toLowerCase(), + "Failed in adding the investor in whitelist" + ); // We should be after the first scheduled checkpoint, and before the second - assert.isTrue(latestTime() > startTime); - assert.isTrue(latestTime() <= startTime + interval); + assert.isTrue(await latestTime() > startTime); + assert.isTrue(await latestTime() <= startTime + interval); // Mint some tokens - await I_SecurityToken.mint(account_investor2, web3.utils.toWei('1', 'ether'), { from: token_owner }); + await I_SecurityToken.mint(account_investor2, new BN(web3.utils.toWei("1", "ether")), { from: token_owner }); - assert.equal( - (await I_SecurityToken.balanceOf(account_investor2)).toNumber(), - web3.utils.toWei('1', 'ether') - ); + assert.equal((await I_SecurityToken.balanceOf(account_investor2)).toString(), new BN(web3.utils.toWei("1", "ether")).toString()); }); - it("No additional checkpoints created", async() => { - let cp1 = await I_ScheduledCheckpoint.getSchedule("CP1"); + it("No additional checkpoints created", async () => { + let cp1 = await I_ScheduledCheckpoint.getSchedule(web3.utils.fromAscii("CP1")); checkSchedule(cp1, "CP1", startTime, startTime + interval, interval, [1], [startTime], [1]); assert.equal((await I_SecurityToken.balanceOfAt(account_investor2, 0)).toNumber(), 0); assert.equal((await I_SecurityToken.balanceOfAt(account_investor2, 1)).toNumber(), 0); }); - it("Add a new token holder - account_investor3", async() => { - + it("Add a new token holder - account_investor3", async () => { let tx = await I_GeneralTransferManager.modifyWhitelist( account_investor3, - latestTime(), - latestTime(), - latestTime() + duration.days(10), + currentTime, + currentTime, + currentTime.add(new BN(duration.days(10))), true, { from: account_issuer, gas: 6000000 - }); + } + ); - assert.equal(tx.logs[0].args._investor.toLowerCase(), account_investor3.toLowerCase(), "Failed in adding the investor in whitelist"); + assert.equal( + tx.logs[0].args._investor.toLowerCase(), + account_investor3.toLowerCase(), + "Failed in adding the investor in whitelist" + ); // Jump time await increaseTime(interval); // We should be after the first scheduled checkpoint, and before the second - assert.isTrue(latestTime() > startTime + interval); - assert.isTrue(latestTime() <= startTime + (2 * interval)); + assert.isTrue(await latestTime() > startTime + interval); + assert.isTrue(await latestTime() <= startTime + 2 * interval); // Add the Investor in to the whitelist // Mint some tokens - await I_SecurityToken.mint(account_investor3, web3.utils.toWei('1', 'ether'), { from: token_owner }); + await I_SecurityToken.mint(account_investor3, new BN(web3.utils.toWei("1", "ether")), { from: token_owner }); - assert.equal( - (await I_SecurityToken.balanceOf(account_investor3)).toNumber(), - web3.utils.toWei('1', 'ether') - ); + assert.equal((await I_SecurityToken.balanceOf(account_investor3)).toString(), new BN(web3.utils.toWei("1", "ether")).toString()); }); - it("Should have new checkpoint created with correct balances", async() => { - let cp1 = await I_ScheduledCheckpoint.getSchedule("CP1"); - checkSchedule(cp1, "CP1", startTime, startTime + (2 * interval), interval, [1, 2], [startTime, startTime + interval], [1, 1]); + it("Should have new checkpoint created with correct balances", async () => { + let cp1 = await I_ScheduledCheckpoint.getSchedule(web3.utils.fromAscii("CP1")); + checkSchedule(cp1, "CP1", startTime, startTime + 2 * interval, interval, [1, 2], [startTime, startTime + interval], [1, 1]); assert.equal((await I_SecurityToken.balanceOfAt(account_investor3, 0)).toNumber(), 0); assert.equal((await I_SecurityToken.balanceOfAt(account_investor3, 1)).toNumber(), 0); assert.equal((await I_SecurityToken.balanceOfAt(account_investor3, 2)).toNumber(), 0); assert.equal((await I_SecurityToken.balanceOfAt(account_investor2, 0)).toNumber(), 0); assert.equal((await I_SecurityToken.balanceOfAt(account_investor2, 1)).toNumber(), 0); - assert.equal((await I_SecurityToken.balanceOfAt(account_investor2, 2)).toNumber(), web3.utils.toWei('1', 'ether')); + assert.equal((await I_SecurityToken.balanceOfAt(account_investor2, 2)).toString(), new BN(web3.utils.toWei("1", "ether")).toString()); assert.equal((await I_SecurityToken.balanceOfAt(account_investor1, 0)).toNumber(), 0); assert.equal((await I_SecurityToken.balanceOfAt(account_investor1, 1)).toNumber(), 0); - assert.equal((await I_SecurityToken.balanceOfAt(account_investor1, 2)).toNumber(), web3.utils.toWei('1', 'ether')); + assert.equal((await I_SecurityToken.balanceOfAt(account_investor1, 2)).toString(), new BN(web3.utils.toWei("1", "ether")).toString()); }); - it("Should have correct balances for investor 3 after new checkpoint", async() => { + it("Should have correct balances for investor 3 after new checkpoint", async () => { // Jump time await increaseTime(2 * interval); // We should be after the first scheduled checkpoint, and before the second - assert.isTrue(latestTime() > startTime + (3 * interval)); - assert.isTrue(latestTime() <= startTime + (4 * interval)); - await I_SecurityToken.transfer(account_investor3, web3.utils.toWei('0.5', 'ether'), { from: account_investor1 }); - let cp1 = await I_ScheduledCheckpoint.getSchedule("CP1"); - checkSchedule(cp1, "CP1", startTime, startTime + (4 * interval), interval, [1, 2, 3], [startTime, startTime + interval, startTime + (2 * interval)], [1, 1, 2]); + assert.isTrue(await latestTime() > startTime + 3 * interval); + assert.isTrue(await latestTime() <= startTime + 4 * interval); + await I_SecurityToken.transfer(account_investor3, new BN(web3.utils.toWei("0.5", "ether")), { from: account_investor1 }); + let cp1 = await I_ScheduledCheckpoint.getSchedule(web3.utils.fromAscii("CP1")); + checkSchedule( + cp1, + "CP1", + startTime, + startTime + 4 * interval, + interval, + [1, 2, 3], + [startTime, startTime + interval, startTime + 2 * interval], + [1, 1, 2] + ); assert.equal((await I_SecurityToken.balanceOfAt(account_investor3, 0)).toNumber(), 0); assert.equal((await I_SecurityToken.balanceOfAt(account_investor3, 1)).toNumber(), 0); assert.equal((await I_SecurityToken.balanceOfAt(account_investor3, 2)).toNumber(), 0); - assert.equal((await I_SecurityToken.balanceOfAt(account_investor3, 3)).toNumber(), web3.utils.toWei('1', 'ether')); + assert.equal((await I_SecurityToken.balanceOfAt(account_investor3, 3)).toString(), new BN(web3.utils.toWei("1", "ether")).toString()); assert.equal((await I_SecurityToken.balanceOfAt(account_investor2, 0)).toNumber(), 0); assert.equal((await I_SecurityToken.balanceOfAt(account_investor2, 1)).toNumber(), 0); - assert.equal((await I_SecurityToken.balanceOfAt(account_investor2, 2)).toNumber(), web3.utils.toWei('1', 'ether')); - assert.equal((await I_SecurityToken.balanceOfAt(account_investor2, 3)).toNumber(), web3.utils.toWei('1', 'ether')); + assert.equal((await I_SecurityToken.balanceOfAt(account_investor2, 2)).toString(), new BN(web3.utils.toWei("1", "ether")).toString()); + assert.equal((await I_SecurityToken.balanceOfAt(account_investor2, 3)).toString(), new BN(web3.utils.toWei("1", "ether")).toString()); assert.equal((await I_SecurityToken.balanceOfAt(account_investor1, 0)).toNumber(), 0); assert.equal((await I_SecurityToken.balanceOfAt(account_investor1, 1)).toNumber(), 0); - assert.equal((await I_SecurityToken.balanceOfAt(account_investor1, 2)).toNumber(), web3.utils.toWei('1', 'ether')); - assert.equal((await I_SecurityToken.balanceOfAt(account_investor1, 3)).toNumber(), web3.utils.toWei('1', 'ether')); - + assert.equal((await I_SecurityToken.balanceOfAt(account_investor1, 2)).toString(), new BN(web3.utils.toWei("1", "ether")).toString()); + assert.equal((await I_SecurityToken.balanceOfAt(account_investor1, 3)).toString(), new BN(web3.utils.toWei("1", "ether")).toString()); }); - it("Manually update checkpoints", async() => { + it("Manually update checkpoints", async () => { await increaseTime(interval); - await I_ScheduledCheckpoint.updateAll({from: token_owner}); - - let cp1 = await I_ScheduledCheckpoint.getSchedule("CP1"); - checkSchedule(cp1, "CP1", startTime, startTime + (5 * interval), interval, [1, 2, 3, 4], [startTime, startTime + interval, startTime + (2 * interval), startTime + (4 * interval)], [1, 1, 2, 1]); + await I_ScheduledCheckpoint.updateAll({ from: token_owner }); + + let cp1 = await I_ScheduledCheckpoint.getSchedule(web3.utils.fromAscii("CP1")); + checkSchedule( + cp1, + "CP1", + startTime, + startTime + 5 * interval, + interval, + [1, 2, 3, 4], + [startTime, startTime + interval, startTime + 2 * interval, startTime + 4 * interval], + [1, 1, 2, 1] + ); assert.equal((await I_SecurityToken.balanceOfAt(account_investor3, 0)).toNumber(), 0); assert.equal((await I_SecurityToken.balanceOfAt(account_investor3, 1)).toNumber(), 0); assert.equal((await I_SecurityToken.balanceOfAt(account_investor3, 2)).toNumber(), 0); - assert.equal((await I_SecurityToken.balanceOfAt(account_investor3, 3)).toNumber(), web3.utils.toWei('1', 'ether')); - assert.equal((await I_SecurityToken.balanceOfAt(account_investor3, 4)).toNumber(), web3.utils.toWei('1.5', 'ether')); + assert.equal((await I_SecurityToken.balanceOfAt(account_investor3, 3)).toString(), new BN(web3.utils.toWei("1", "ether")).toString()); + assert.equal((await I_SecurityToken.balanceOfAt(account_investor3, 4)).toString(), new BN(web3.utils.toWei("1.5", "ether")).toString()); assert.equal((await I_SecurityToken.balanceOfAt(account_investor2, 0)).toNumber(), 0); assert.equal((await I_SecurityToken.balanceOfAt(account_investor2, 1)).toNumber(), 0); - assert.equal((await I_SecurityToken.balanceOfAt(account_investor2, 2)).toNumber(), web3.utils.toWei('1', 'ether')); - assert.equal((await I_SecurityToken.balanceOfAt(account_investor2, 3)).toNumber(), web3.utils.toWei('1', 'ether')); - assert.equal((await I_SecurityToken.balanceOfAt(account_investor2, 4)).toNumber(), web3.utils.toWei('1', 'ether')); + assert.equal((await I_SecurityToken.balanceOfAt(account_investor2, 2)).toString(), new BN(web3.utils.toWei("1", "ether")).toString()); + assert.equal((await I_SecurityToken.balanceOfAt(account_investor2, 3)).toString(), new BN(web3.utils.toWei("1", "ether")).toString()); + assert.equal((await I_SecurityToken.balanceOfAt(account_investor2, 4)).toString(), new BN(web3.utils.toWei("1", "ether")).toString()); assert.equal((await I_SecurityToken.balanceOfAt(account_investor1, 0)).toNumber(), 0); assert.equal((await I_SecurityToken.balanceOfAt(account_investor1, 1)).toNumber(), 0); - assert.equal((await I_SecurityToken.balanceOfAt(account_investor1, 2)).toNumber(), web3.utils.toWei('1', 'ether')); - assert.equal((await I_SecurityToken.balanceOfAt(account_investor1, 3)).toNumber(), web3.utils.toWei('1', 'ether')); - assert.equal((await I_SecurityToken.balanceOfAt(account_investor1, 4)).toNumber(), web3.utils.toWei('0.5', 'ether')); - + assert.equal((await I_SecurityToken.balanceOfAt(account_investor1, 2)).toString(), new BN(web3.utils.toWei("1", "ether")).toString()); + assert.equal((await I_SecurityToken.balanceOfAt(account_investor1, 3)).toString(), new BN(web3.utils.toWei("1", "ether")).toString()); + assert.equal((await I_SecurityToken.balanceOfAt(account_investor1, 4)).toString(), new BN(web3.utils.toWei("0.5", "ether")).toString()); }); - it("Should get the permission", async() => { + it("Should get the permission", async () => { let perm = await I_ScheduledCheckpoint.getPermissions.call(); assert.equal(perm.length, 0); }); - }); - }); function checkSchedule(schedule, name, startTime, nextTime, interval, checkpoints, timestamps, periods) { - assert.equal(web3.utils.toAscii(schedule[0]).replace(/\u0000/g, ''), name); + assert.equal(web3.utils.toAscii(schedule[0]).replace(/\u0000/g, ""), name); assert.equal(schedule[1].toNumber(), startTime); assert.equal(schedule[2].toNumber(), nextTime); assert.equal(schedule[3].toNumber(), interval); diff --git a/test/z_general_permission_manager_fuzzer.js b/test/z_general_permission_manager_fuzzer.js index 6bff3ee24..2614e6d5d 100644 --- a/test/z_general_permission_manager_fuzzer.js +++ b/test/z_general_permission_manager_fuzzer.js @@ -1,32 +1,32 @@ -import latestTime from './helpers/latestTime'; -import {signData} from './helpers/signData'; -import { pk } from './helpers/testprivateKey'; -import { duration, promisifyLogWatch, latestBlock } from './helpers/utils'; -import { takeSnapshot, increaseTime, revertToSnapshot } from './helpers/time'; +import latestTime from "./helpers/latestTime"; +import { signData } from "./helpers/signData"; +import { pk } from "./helpers/testprivateKey"; +import { duration, promisifyLogWatch, latestBlock } from "./helpers/utils"; +import { takeSnapshot, increaseTime, revertToSnapshot } from "./helpers/time"; import { catchRevert } from "./helpers/exceptions"; -import { setUpPolymathNetwork, - deployGPMAndVerifyed, - deployCountTMAndVerifyed, - deployLockupVolumeRTMAndVerified, - deployPercentageTMAndVerified, - deployManualApprovalTMAndVerifyed +import { + setUpPolymathNetwork, + deployGPMAndVerifyed, + deployCountTMAndVerifyed, + deployLockupVolumeRTMAndVerified, + deployPercentageTMAndVerified, + deployManualApprovalTMAndVerifyed } from "./helpers/createInstances"; import { encodeModuleCall } from "./helpers/encodeCall"; -const SecurityToken = artifacts.require('./SecurityToken.sol'); -const GeneralTransferManager = artifacts.require('./GeneralTransferManager'); -const GeneralPermissionManager = artifacts.require('./GeneralPermissionManager'); +const SecurityToken = artifacts.require("./SecurityToken.sol"); +const GeneralTransferManager = artifacts.require("./GeneralTransferManager"); +const GeneralPermissionManager = artifacts.require("./GeneralPermissionManager"); const CountTransferManager = artifacts.require("./CountTransferManager"); -const VolumeRestrictionTransferManager = artifacts.require('./LockupVolumeRestrictionTM'); -const PercentageTransferManager = artifacts.require('./PercentageTransferManager'); -const ManualApprovalTransferManager = artifacts.require('./ManualApprovalTransferManager'); +const VolumeRestrictionTransferManager = artifacts.require("./LockupVolumeRestrictionTM"); +const PercentageTransferManager = artifacts.require("./PercentageTransferManager"); +const ManualApprovalTransferManager = artifacts.require("./ManualApprovalTransferManager"); -const Web3 = require('web3'); -const BigNumber = require('bignumber.js'); -const web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545")) // Hardcoded development port - -contract('GeneralPermissionManager Fuzz', accounts => { +const Web3 = require("web3"); +let BN = Web3.utils.BN; +const web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545")); // Hardcoded development port +contract("GeneralPermissionManager Fuzz", async (accounts) => { // Accounts Variable declaration let account_polymath; let account_issuer; @@ -38,10 +38,6 @@ contract('GeneralPermissionManager Fuzz', accounts => { let account_investor4; let account_delegate; let account_delegate2; - // investor Details - let fromTime = latestTime(); - let toTime = latestTime(); - let expiryTime = toTime + duration.days(15); let message = "Transaction Should Fail!"; @@ -85,7 +81,7 @@ contract('GeneralPermissionManager Fuzz', accounts => { const tokenDetails = "This is equity type of issuance"; const decimals = 18; const contact = "team@polymath.network"; - const delegateDetails = "Hello I am legit delegate"; + const managerDetails = web3.utils.fromAscii("Hello"); const STVRParameters = ["bool", "uint256", "bool"]; // Module key @@ -94,21 +90,25 @@ contract('GeneralPermissionManager Fuzz', accounts => { const stoKey = 3; // Initial fee for ticker registry and security token registry - const initRegFee = web3.utils.toWei("250"); + const initRegFee = new BN(web3.utils.toWei("250")); // CountTransferManager details - const holderCount = 2; // Maximum number of token holders - let bytesSTO = encodeModuleCall(["uint256"], [holderCount]); + const holderCount = 2; // Maximum number of token holders + let bytesSTO = encodeModuleCall(["uint256"], [holderCount]); - let _details = "details holding for test"; + let _details = "details holding for test"; let testRepeat = 20; - // permission manager fuzz test - let perms = ['ADMIN','WHITELIST', 'FLAGS', 'TRANSFER_APPROVAL']; - let totalPerms = perms.length; + // permission manager fuzz test + let perms = ["ADMIN", "WHITELIST", "FLAGS", "TRANSFER_APPROVAL"]; + let totalPerms = perms.length; + + let currentTime; + const address_zero = "0x0000000000000000000000000000000000000000"; + const one_address = "0x0000000000000000000000000000000000000001"; before(async () => { - // Accounts setup + currentTime = new BN(await latestTime()); account_polymath = accounts[0]; account_issuer = accounts[1]; @@ -122,7 +122,6 @@ contract('GeneralPermissionManager Fuzz', accounts => { account_delegate = accounts[7]; // account_delegate2 = accounts[6]; - // Step 1: Deploy the genral PM ecosystem let instances = await setUpPolymathNetwork(account_polymath, token_owner); @@ -144,9 +143,9 @@ contract('GeneralPermissionManager Fuzz', accounts => { // STEP 5: Deploy the GeneralDelegateManagerFactory [I_GeneralPermissionManagerFactory] = await deployGPMAndVerifyed(account_polymath, I_MRProxied, 0); // STEP 6: Deploy the GeneralDelegateManagerFactory - [P_GeneralPermissionManagerFactory] = await deployGPMAndVerifyed(account_polymath, I_MRProxied, web3.utils.toWei("500")); + [P_GeneralPermissionManagerFactory] = await deployGPMAndVerifyed(account_polymath, I_MRProxied, new BN(web3.utils.toWei("500"))); - // Deploy Modules + // Deploy Modules [I_CountTransferManagerFactory] = await deployCountTMAndVerifyed(account_polymath, I_MRProxied, 0); [I_VolumeRestrictionTransferManagerFactory] = await deployLockupVolumeRTMAndVerified(account_polymath, I_MRProxied, 0); @@ -182,15 +181,15 @@ contract('GeneralPermissionManager Fuzz', accounts => { it("Should generate the new security token with the same symbol as registered above", async () => { await I_PolyToken.approve(I_STRProxied.address, initRegFee, { from: token_owner }); - let _blockNo = latestBlock(); + let tx = await I_STRProxied.generateSecurityToken(name, symbol, tokenDetails, false, { from: token_owner }); // Verify the successful generation of the security token assert.equal(tx.logs[2].args._ticker, symbol.toUpperCase(), "SecurityToken doesn't get deployed"); - I_SecurityToken = SecurityToken.at(tx.logs[2].args._securityTokenAddress); + I_SecurityToken = await SecurityToken.at(tx.logs[2].args._securityTokenAddress); - const log = await promisifyLogWatch(I_SecurityToken.ModuleAdded({ from: _blockNo }), 1); + const log = (await I_SecurityToken.getPastEvents('ModuleAdded', {filter: {transactionHash: tx.transactionHash}}))[0]; // Verify that GeneralTransferManager module get added successfully or not assert.equal(log.args._types[0].toNumber(), 2); @@ -199,25 +198,27 @@ contract('GeneralPermissionManager Fuzz', accounts => { it("Should intialize the auto attached modules", async () => { let moduleData = (await I_SecurityToken.getModulesByType(2))[0]; - I_GeneralTransferManager = GeneralTransferManager.at(moduleData); + I_GeneralTransferManager = await GeneralTransferManager.at(moduleData); }); it("Should successfully attach the General permission manager factory with the security token -- failed because Token is not paid", async () => { let errorThrown = false; - await I_PolyToken.getTokens(web3.utils.toWei("500", "ether"), token_owner); + await I_PolyToken.getTokens(new BN(web3.utils.toWei("500", "ether")), token_owner); await catchRevert( - I_SecurityToken.addModule(P_GeneralPermissionManagerFactory.address, "0x", web3.utils.toWei("500", "ether"), 0, { from: token_owner }) + I_SecurityToken.addModule(P_GeneralPermissionManagerFactory.address, "0x", new BN(web3.utils.toWei("500", "ether")), new BN(0), { + from: token_owner + }) ); }); it("Should successfully attach the General permission manager factory with the security token - paid module", async () => { let snapId = await takeSnapshot(); - await I_PolyToken.transfer(I_SecurityToken.address, web3.utils.toWei("500", "ether"), { from: token_owner }); + await I_PolyToken.transfer(I_SecurityToken.address, new BN(web3.utils.toWei("500", "ether")), { from: token_owner }); const tx = await I_SecurityToken.addModule( P_GeneralPermissionManagerFactory.address, "0x", - web3.utils.toWei("500", "ether"), - 0, + new BN(web3.utils.toWei("500", "ether")), + new BN(0), { from: token_owner } ); assert.equal(tx.logs[3].args._types[0].toNumber(), delegateManagerKey, "General Permission Manager doesn't get deployed"); @@ -226,204 +227,285 @@ contract('GeneralPermissionManager Fuzz', accounts => { "GeneralPermissionManager", "GeneralPermissionManagerFactory module was not added" ); - P_GeneralPermissionManager = GeneralPermissionManager.at(tx.logs[3].args._module); + P_GeneralPermissionManager = await GeneralPermissionManager.at(tx.logs[3].args._module); await revertToSnapshot(snapId); }); it("Should successfully attach the General permission manager factory with the security token - free module", async () => { - const tx = await I_SecurityToken.addModule(I_GeneralPermissionManagerFactory.address, "0x", 0, 0, { from: token_owner }); + const tx = await I_SecurityToken.addModule(I_GeneralPermissionManagerFactory.address, "0x", new BN(0), new BN(0), { from: token_owner }); assert.equal(tx.logs[2].args._types[0].toNumber(), delegateManagerKey, "General Permission Manager doesn't get deployed"); assert.equal( web3.utils.toAscii(tx.logs[2].args._name).replace(/\u0000/g, ""), "GeneralPermissionManager", "GeneralPermissionManagerFactory module was not added" ); - I_GeneralPermissionManager = GeneralPermissionManager.at(tx.logs[2].args._module); + I_GeneralPermissionManager = await GeneralPermissionManager.at(tx.logs[2].args._module); }); }); describe("fuzz test for general transfer manager", async () => { - it("should pass fuzz test for changeIssuanceAddress(), changeSigningAddress() ", async () => { - console.log("1"); // fuzz test loop over total times of testRepeat, inside each loop, we use a variable j to randomly choose an account out of the 10 default accounts for (var i = 2; i < testRepeat; i++) { var j = Math.floor(Math.random() * 10); - if (j === 1 || j === 0) { j = 2 }; // exclude account 1 & 0 because they might come with default perms + if (j === 1 || j === 0) { + j = 2; + } // exclude account 1 & 0 because they might come with default perms // add account as a Delegate if it is not - if (await I_GeneralPermissionManager.checkDelegate(accounts[j]) !== true) { - await I_GeneralPermissionManager.addDelegate(accounts[j], _details, { from: token_owner }); + if ((await I_GeneralPermissionManager.checkDelegate(accounts[j])) !== true) { + await I_GeneralPermissionManager.addDelegate(accounts[j], web3.utils.fromAscii(_details), { from: token_owner }); } // target permission should alaways be false for each test before assigning - if (await I_GeneralPermissionManager.checkPermission(accounts[j], I_GeneralTransferManager.address, 'FLAGS') === true) { - await I_GeneralPermissionManager.changePermission(accounts[j], I_GeneralTransferManager.address, 'FLAGS', false, { from: token_owner }); - } else if (await I_GeneralPermissionManager.checkPermission(accounts[j], I_GeneralTransferManager.address, 'WHITELIST') === true) { - await I_GeneralPermissionManager.changePermission(accounts[j], I_GeneralTransferManager.address, 'WHITELIST', false, { from: token_owner }); + if ((await I_GeneralPermissionManager.checkPermission(accounts[j], I_GeneralTransferManager.address, web3.utils.fromAscii("FLAGS"))) === true) { + await I_GeneralPermissionManager.changePermission(accounts[j], I_GeneralTransferManager.address, web3.utils.fromAscii("FLAGS"), false, { + from: token_owner + }); + } else if ( + (await I_GeneralPermissionManager.checkPermission(accounts[j], I_GeneralTransferManager.address, web3.utils.fromAscii("WHITELIST"))) === true + ) { + await I_GeneralPermissionManager.changePermission(accounts[j], I_GeneralTransferManager.address, web3.utils.fromAscii("WHITELIST"), false, { + from: token_owner + }); } // assign a random perm let randomPerms = perms[Math.floor(Math.random() * Math.floor(totalPerms))]; - let fromTime = latestTime(); - let toTime = latestTime() + duration.days(20); + let fromTime = await latestTime(); + let toTime = await latestTime() + duration.days(20); let expiryTime = toTime + duration.days(10); - await I_GeneralPermissionManager.changePermission(accounts[j], I_GeneralTransferManager.address, randomPerms, true, { from: token_owner }); + await I_GeneralPermissionManager.changePermission(accounts[j], I_GeneralTransferManager.address, web3.utils.fromAscii(randomPerms), true, { + from: token_owner + }); - let currentAllowAllTransferStats = await I_GeneralTransferManager.allowAllTransfers(); - let currentAllowAllWhitelistTransfersStats = await I_GeneralTransferManager.allowAllWhitelistTransfers(); - let currentAllowAllWhitelistIssuancesStats = await I_GeneralTransferManager.allowAllWhitelistIssuances(); - let currentAllowAllBurnTransfersStats = await I_GeneralTransferManager.allowAllBurnTransfers(); + let currentAllowAllTransferStats = await I_GeneralTransferManager.allowAllTransfers(); + let currentAllowAllWhitelistTransfersStats = await I_GeneralTransferManager.allowAllWhitelistTransfers(); + let currentAllowAllWhitelistIssuancesStats = await I_GeneralTransferManager.allowAllWhitelistIssuances(); + let currentAllowAllBurnTransfersStats = await I_GeneralTransferManager.allowAllBurnTransfers(); console.log("2"); // let userPerm = await I_GeneralPermissionManager.checkPermission(accounts[j], I_GeneralTransferManager.address, 'FLAGS'); - if (randomPerms === 'FLAGS') { - console.log("Test number " + i + " with account " + j + " and perm " + randomPerms + " about to start") - await I_GeneralTransferManager.changeIssuanceAddress( accounts[j], { from: accounts[j] }); + if (randomPerms === "FLAGS") { + console.log("Test number " + i + " with account " + j + " and perm " + randomPerms + " about to start"); + await I_GeneralTransferManager.changeIssuanceAddress(accounts[j], { from: accounts[j] }); assert.equal(await I_GeneralTransferManager.issuanceAddress(), accounts[j]); - await I_GeneralTransferManager.changeSigningAddress( accounts[j], { from: accounts[j] }); + await I_GeneralTransferManager.changeSigningAddress(accounts[j], { from: accounts[j] }); assert.equal(await I_GeneralTransferManager.signingAddress(), accounts[j]); await I_GeneralTransferManager.changeAllowAllTransfers(!currentAllowAllTransferStats, { from: accounts[j] }); assert.equal(await I_GeneralTransferManager.allowAllTransfers(), !currentAllowAllTransferStats); - await I_GeneralTransferManager.changeAllowAllWhitelistTransfers(!currentAllowAllWhitelistTransfersStats, { from: accounts[j] }); + await I_GeneralTransferManager.changeAllowAllWhitelistTransfers(!currentAllowAllWhitelistTransfersStats, { + from: accounts[j] + }); assert.equal(await I_GeneralTransferManager.allowAllWhitelistTransfers(), !currentAllowAllWhitelistTransfersStats); - await I_GeneralTransferManager.changeAllowAllWhitelistIssuances(!currentAllowAllWhitelistIssuancesStats, { from: accounts[j] }); + await I_GeneralTransferManager.changeAllowAllWhitelistIssuances(!currentAllowAllWhitelistIssuancesStats, { + from: accounts[j] + }); assert.equal(await I_GeneralTransferManager.allowAllWhitelistIssuances(), !currentAllowAllWhitelistIssuancesStats); await I_GeneralTransferManager.changeAllowAllBurnTransfers(!currentAllowAllBurnTransfersStats, { from: accounts[j] }); assert.equal(await I_GeneralTransferManager.allowAllBurnTransfers(), !currentAllowAllBurnTransfersStats); - console.log("Test number " + i + " with account " + j + " and perm " + randomPerms + " for functions with require perm FLAGS passed") + console.log( + "Test number " + + i + + " with account " + + j + + " and perm " + + randomPerms + + " for functions with require perm FLAGS passed" + ); } else { - await catchRevert(I_GeneralTransferManager.changeIssuanceAddress( accounts[j], { from: accounts[j] })); - await catchRevert(I_GeneralTransferManager.changeSigningAddress( accounts[j], { from: accounts[j] })); - await catchRevert(I_GeneralTransferManager.changeAllowAllTransfers( !currentAllowAllTransferStats, { from: accounts[j] })); - await catchRevert(I_GeneralTransferManager.changeAllowAllWhitelistTransfers( !currentAllowAllWhitelistTransfersStats, { from: accounts[j] })); - await catchRevert(I_GeneralTransferManager.changeAllowAllWhitelistIssuances( !currentAllowAllWhitelistIssuancesStats, { from: accounts[j] })); - await catchRevert(I_GeneralTransferManager.changeAllowAllBurnTransfers( !currentAllowAllBurnTransfersStats, { from: accounts[j] })); - console.log("Test number " + i + " with account " + j + " and perm " + randomPerms + " for functions require perm FLAGS failed as expected"); + await catchRevert(I_GeneralTransferManager.changeIssuanceAddress(accounts[j], { from: accounts[j] })); + await catchRevert(I_GeneralTransferManager.changeSigningAddress(accounts[j], { from: accounts[j] })); + await catchRevert( + I_GeneralTransferManager.changeAllowAllTransfers(!currentAllowAllTransferStats, { from: accounts[j] }) + ); + await catchRevert( + I_GeneralTransferManager.changeAllowAllWhitelistTransfers(!currentAllowAllWhitelistTransfersStats, { + from: accounts[j] + }) + ); + await catchRevert( + I_GeneralTransferManager.changeAllowAllWhitelistIssuances(!currentAllowAllWhitelistIssuancesStats, { + from: accounts[j] + }) + ); + await catchRevert( + I_GeneralTransferManager.changeAllowAllBurnTransfers(!currentAllowAllBurnTransfersStats, { from: accounts[j] }) + ); + console.log( + "Test number " + + i + + " with account " + + j + + " and perm " + + randomPerms + + " for functions require perm FLAGS failed as expected" + ); } console.log("3"); - if (randomPerms === 'WHITELIST') { - let tx = await I_GeneralTransferManager.modifyWhitelist(accounts[j], fromTime, toTime, expiryTime, 1, { from: accounts[j] }); + if (randomPerms === "WHITELIST") { + let tx = await I_GeneralTransferManager.modifyWhitelist(accounts[j], fromTime, toTime, expiryTime, 1, { + from: accounts[j] + }); assert.equal(tx.logs[0].args._investor, accounts[j]); console.log("3.1"); - let tx2 = await I_GeneralTransferManager.modifyWhitelistMulti([accounts[3], accounts[4]], [fromTime, fromTime], [toTime, toTime], [expiryTime, expiryTime], [1, 1], { from: accounts[j] }); + let tx2 = await I_GeneralTransferManager.modifyWhitelistMulti( + [accounts[3], accounts[4]], + [fromTime, fromTime], + [toTime, toTime], + [expiryTime, expiryTime], + [1, 1], + { from: accounts[j] } + ); console.log(tx2.logs[1].args); assert.equal(tx2.logs[1].args._investor, accounts[4]); console.log("3.2"); } else { console.log("3.3"); - await catchRevert(I_GeneralTransferManager.modifyWhitelist(accounts[j], fromTime, toTime, expiryTime, 1, { from: accounts[j] })); + await catchRevert( + I_GeneralTransferManager.modifyWhitelist(accounts[j], fromTime, toTime, expiryTime, 1, { from: accounts[j] }) + ); console.log("3.4"); - await catchRevert(I_GeneralTransferManager.modifyWhitelistMulti([accounts[3], accounts[4]], [fromTime, fromTime], [toTime, toTime], [expiryTime, expiryTime], [1, 1], { from: accounts[j] })); + await catchRevert( + I_GeneralTransferManager.modifyWhitelistMulti( + [accounts[3], accounts[4]], + [fromTime, fromTime], + [toTime, toTime], + [expiryTime, expiryTime], + [1, 1], + { from: accounts[j] } + ) + ); console.log("3.5"); } } console.log("4"); await I_GeneralTransferManager.changeIssuanceAddress("0x0000000000000000000000000000000000000000", { from: token_owner }); - }) + }); }); - describe("fuzz test for count transfer manager", async () => { - - it("Should successfully attach the CountTransferManager with the security token", async () => { - const tx = await I_SecurityToken.addModule(I_CountTransferManagerFactory.address, bytesSTO, 0, 0, { from: token_owner }); + describe("fuzz test for count transfer manager", async () => { + it("Should successfully attach the CountTransferManager with the security token", async () => { + const tx = await I_SecurityToken.addModule(I_CountTransferManagerFactory.address, bytesSTO, new BN(0), new BN(0), { from: token_owner }); assert.equal(tx.logs[2].args._types[0].toNumber(), transferManagerKey, "CountTransferManager doesn't get deployed"); assert.equal( web3.utils.toAscii(tx.logs[2].args._name).replace(/\u0000/g, ""), "CountTransferManager", "CountTransferManager module was not added" ); - I_CountTransferManager = CountTransferManager.at(tx.logs[2].args._module); + I_CountTransferManager = await CountTransferManager.at(tx.logs[2].args._module); }); it("should pass fuzz test for changeHolderCount()", async () => { // fuzz test loop over total times of testRepeat, inside each loop, we use a variable j to randomly choose an account out of the 10 default accounts - for (var i = 2; i < testRepeat; i++) { - var j = Math.floor(Math.random() * 10); - if (j === 1 || j === 0) { j = 2 }; // exclude account 1 & 0 because they might come with default perms + for (var i = 2; i < testRepeat; i++) { + var j = Math.floor(Math.random() * 10); + if (j === 1 || j === 0) { + j = 2; + } // exclude account 1 & 0 because they might come with default perms // add account as a Delegate if it is not - if (await I_GeneralPermissionManager.checkDelegate(accounts[j]) !== true) { - await I_GeneralPermissionManager.addDelegate(accounts[j], _details, { from: token_owner }); - } + if ((await I_GeneralPermissionManager.checkDelegate(accounts[j])) !== true) { + await I_GeneralPermissionManager.addDelegate(accounts[j], web3.utils.fromAscii(_details), { from: token_owner }); + } // target permission should alaways be false for each test before assigning - if (await I_GeneralPermissionManager.checkPermission(accounts[j], I_CountTransferManager.address, 'ADMIN') === true) { - await I_GeneralPermissionManager.changePermission(accounts[j], I_CountTransferManager.address, 'ADMIN', false, { from: token_owner }); + if ((await I_GeneralPermissionManager.checkPermission(accounts[j], I_CountTransferManager.address, web3.utils.fromAscii("ADMIN"))) === true) { + await I_GeneralPermissionManager.changePermission(accounts[j], I_CountTransferManager.address, web3.utils.fromAscii("ADMIN"), false, { + from: token_owner + }); } - // assign a random perm + // assign a random perm let randomPerms = perms[Math.floor(Math.random() * Math.floor(totalPerms))]; - await I_GeneralPermissionManager.changePermission(accounts[j], I_CountTransferManager.address, randomPerms, true, { from: token_owner }); - if (randomPerms === 'ADMIN') { + await I_GeneralPermissionManager.changePermission(accounts[j], I_CountTransferManager.address, web3.utils.fromAscii(randomPerms), true, { + from: token_owner + }); + if (randomPerms === "ADMIN") { // console.log("Test number " + i + " with account " + j + " and perm " + randomPerms + " should pass"); - await I_CountTransferManager.changeHolderCount(i + 1, { from: accounts[j] }); - assert.equal((await I_CountTransferManager.maxHolderCount()).toNumber(), i + 1); - console.log("Test number " + i + " with account " + j + " and perm " + randomPerms + " passed"); - } else { + await I_CountTransferManager.changeHolderCount(i + 1, { from: accounts[j] }); + assert.equal((await I_CountTransferManager.maxHolderCount()).toNumber(), i + 1); + console.log("Test number " + i + " with account " + j + " and perm " + randomPerms + " passed"); + } else { // console.log("Test number " + i + " with account " + j + " and perm " + randomPerms + " should failed"); - await catchRevert(I_CountTransferManager.changeHolderCount(i+1, { from: accounts[j] })); - console.log("Test number " + i + " with account " + j + " and perm " + randomPerms + " failed as expected"); - } - } + await catchRevert(I_CountTransferManager.changeHolderCount(i + 1, { from: accounts[j] })); + console.log("Test number " + i + " with account " + j + " and perm " + randomPerms + " failed as expected"); + } + } }); - }); - + }); describe("fuzz test for percentage transfer manager", async () => { - // PercentageTransferManager details - const holderPercentage = 70 * 10**16; // Maximum number of token holders - - let bytesSTO = web3.eth.abi.encodeFunctionCall({ - name: 'configure', - type: 'function', - inputs: [{ - type: 'uint256', - name: '_maxHolderPercentage' - },{ - type: 'bool', - name: '_allowPrimaryIssuance' - } - ] - }, [holderPercentage, false]); - - it("Should successfully attach the percentage transfer manager with the security token", async () => { + const holderPercentage = 70 * 10 ** 16; // Maximum number of token holders + + let bytesSTO = web3.eth.abi.encodeFunctionCall( + { + name: "configure", + type: "function", + inputs: [ + { + type: "uint256", + name: "_maxHolderPercentage" + }, + { + type: "bool", + name: "_allowPrimaryIssuance" + } + ] + }, + [holderPercentage, false] + ); + + it("Should successfully attach the percentage transfer manager with the security token", async () => { console.log("1"); - const tx = await I_SecurityToken.addModule(I_PercentageTransferManagerFactory.address, bytesSTO, 0, 0, { from: token_owner }); - I_PercentageTransferManager = PercentageTransferManager.at(tx.logs[2].args._module); + const tx = await I_SecurityToken.addModule(I_PercentageTransferManagerFactory.address, bytesSTO, new BN(0), new BN(0), { from: token_owner }); + I_PercentageTransferManager = await PercentageTransferManager.at(tx.logs[2].args._module); }); it("should pass fuzz test for modifyWhitelist with perm WHITELIST", async () => { // fuzz test loop over total times of testRepeat, inside each loop, we use a variable j to randomly choose an account out of the 10 default accounts for (var i = 2; i < testRepeat; i++) { var j = Math.floor(Math.random() * 10); - if (j === 1 || j === 0) { j = 2 }; // exclude account 1 & 0 because they might come with default perms + if (j === 1 || j === 0) { + j = 2; + } // exclude account 1 & 0 because they might come with default perms // add account as a Delegate if it is not - if (await I_GeneralPermissionManager.checkDelegate(accounts[j]) !== true) { - await I_GeneralPermissionManager.addDelegate(accounts[j], _details, { from: token_owner }); + if ((await I_GeneralPermissionManager.checkDelegate(accounts[j])) !== true) { + await I_GeneralPermissionManager.addDelegate(accounts[j], web3.utils.fromAscii(_details), { from: token_owner }); } // target permission should alaways be false for each test before assigning - if (await I_GeneralPermissionManager.checkPermission(accounts[j], I_PercentageTransferManager.address, 'WHITELIST') === true) { - await I_GeneralPermissionManager.changePermission(accounts[j], I_PercentageTransferManager.address, 'WHITELIST', false, { from: token_owner }); + if ( + (await I_GeneralPermissionManager.checkPermission(accounts[j], I_PercentageTransferManager.address, web3.utils.fromAscii("WHITELIST"))) === + true + ) { + await I_GeneralPermissionManager.changePermission( + accounts[j], + I_PercentageTransferManager.address, + web3.utils.fromAscii("WHITELIST"), + false, + { from: token_owner } + ); } // assign a random perm let randomPerms = perms[Math.floor(Math.random() * Math.floor(totalPerms))]; - await I_GeneralPermissionManager.changePermission(accounts[j], I_PercentageTransferManager.address, randomPerms, true, { from: token_owner }); + await I_GeneralPermissionManager.changePermission(accounts[j], I_PercentageTransferManager.address, web3.utils.fromAscii(randomPerms), true, { + from: token_owner + }); //try add multi lock ups - if (randomPerms === 'WHITELIST') { + if (randomPerms === "WHITELIST") { // console.log("Test number " + i + " with account " + j + " and perm " + randomPerms + " should pass"); await I_PercentageTransferManager.modifyWhitelist(account_investor3, 1, { from: accounts[j] }); console.log("Test number " + i + " with account " + j + " and perm WHITELIST passed as expected"); @@ -437,70 +519,93 @@ contract('GeneralPermissionManager Fuzz', accounts => { it("should pass fuzz test for modifyWhitelistMulti with perm WHITELIST", async () => { // fuzz test loop over total times of testRepeat, inside each loop, we use a variable j to randomly choose an account out of the 10 default accounts - for (var i = 2; i < testRepeat; i++) { + for (var i = 2; i < testRepeat; i++) { var j = Math.floor(Math.random() * 10); - if (j === 1 || j === 0) { j = 2 }; // exclude account 1 & 0 because they might come with default perms + if (j === 1 || j === 0) { + j = 2; + } // exclude account 1 & 0 because they might come with default perms // add account as a Delegate if it is not - if (await I_GeneralPermissionManager.checkDelegate(accounts[j]) !== true) { - await I_GeneralPermissionManager.addDelegate(accounts[j], _details, { from: token_owner }); + if ((await I_GeneralPermissionManager.checkDelegate(accounts[j])) !== true) { + await I_GeneralPermissionManager.addDelegate(accounts[j], web3.utils.fromAscii(_details), { from: token_owner }); } // target permission should alaways be false for each test before assigning - if (await I_GeneralPermissionManager.checkPermission(accounts[j], I_PercentageTransferManager.address, 'WHITELIST') === true) { - await I_GeneralPermissionManager.changePermission(accounts[j], I_PercentageTransferManager.address, 'WHITELIST', false, { from: token_owner }); + if ( + (await I_GeneralPermissionManager.checkPermission(accounts[j], I_PercentageTransferManager.address, web3.utils.fromAscii("WHITELIST"))) === + true + ) { + await I_GeneralPermissionManager.changePermission( + accounts[j], + I_PercentageTransferManager.address, + web3.utils.fromAscii("WHITELIST"), + false, + { from: token_owner } + ); } // assign a random perm let randomPerms = perms[Math.floor(Math.random() * Math.floor(totalPerms))]; - await I_GeneralPermissionManager.changePermission(accounts[j], I_PercentageTransferManager.address, randomPerms, true, { from: token_owner }); + await I_GeneralPermissionManager.changePermission(accounts[j], I_PercentageTransferManager.address, web3.utils.fromAscii(randomPerms), true, { + from: token_owner + }); - if (randomPerms === 'WHITELIST') { + if (randomPerms === "WHITELIST") { // console.log("Test number " + i + " with account " + j + " and perm " + randomPerms + " should pass"); - await I_PercentageTransferManager.modifyWhitelistMulti([account_investor3, account_investor4], [0, 1], { from: accounts[j] }); - console.log("Test number " + i + " with account " + j + " and perm WHITELIST passed as expected"); - + await I_PercentageTransferManager.modifyWhitelistMulti([account_investor3, account_investor4], [0, 1], { + from: accounts[j] + }); + console.log("Test number " + i + " with account " + j + " and perm WHITELIST passed as expected"); } else { // console.log("Test number " + i + " with account " + j + " and perm " + randomPerms + " should failed"); - await catchRevert( I_PercentageTransferManager.modifyWhitelistMulti([account_investor3, account_investor4], [0, 1], { from: accounts[j] })); + await catchRevert( + I_PercentageTransferManager.modifyWhitelistMulti([account_investor3, account_investor4], [0, 1], { + from: accounts[j] + }) + ); console.log("Test number " + i + " with account " + j + " and perm " + randomPerms + " failed as expected"); } } }); it("should pass fuzz test for setAllowPrimaryIssuance with perm ADMIN", async () => { - - // let snapId = await takeSnapshot(); + // let snapId = await takeSnapshot(); // fuzz test loop over total times of testRepeat, inside each loop, we use a variable j to randomly choose an account out of the 10 default accounts - for (var i = 2; i < testRepeat; i++) { - + for (var i = 2; i < testRepeat; i++) { var j = Math.floor(Math.random() * 10); - if (j === 1 || j === 0) { j = 2 }; // exclude account 1 & 0 because they might come with default perms + if (j === 1 || j === 0) { + j = 2; + } // exclude account 1 & 0 because they might come with default perms // add account as a Delegate if it is not - if (await I_GeneralPermissionManager.checkDelegate(accounts[j]) !== true) { - await I_GeneralPermissionManager.addDelegate(accounts[j], _details, { from: token_owner }); + if ((await I_GeneralPermissionManager.checkDelegate(accounts[j])) !== true) { + await I_GeneralPermissionManager.addDelegate(accounts[j], web3.utils.fromAscii(_details), { from: token_owner }); } // target permission should alaways be false for each test before assigning - if (await I_GeneralPermissionManager.checkPermission(accounts[j], I_PercentageTransferManager.address, 'ADMIN') === true) { - await I_GeneralPermissionManager.changePermission(accounts[j], I_PercentageTransferManager.address, 'ADMIN', false, { from: token_owner }); + if ( + (await I_GeneralPermissionManager.checkPermission(accounts[j], I_PercentageTransferManager.address, web3.utils.fromAscii("ADMIN"))) === true + ) { + await I_GeneralPermissionManager.changePermission(accounts[j], I_PercentageTransferManager.address, web3.utils.fromAscii("ADMIN"), false, { + from: token_owner + }); } // assign a random perm let randomPerms = perms[Math.floor(Math.random() * Math.floor(totalPerms))]; - await I_GeneralPermissionManager.changePermission(accounts[j], I_PercentageTransferManager.address, randomPerms, true, { from: token_owner }); + await I_GeneralPermissionManager.changePermission(accounts[j], I_PercentageTransferManager.address, web3.utils.fromAscii(randomPerms), true, { + from: token_owner + }); let primaryIssuanceStat = await I_PercentageTransferManager.allowPrimaryIssuance({ from: token_owner }); - if (randomPerms === 'ADMIN') { - console.log("Test number " + i + " with account " + j + " and perm " + randomPerms + " should pass"); - await I_PercentageTransferManager.setAllowPrimaryIssuance(!primaryIssuanceStat, { from: accounts[j] }); - console.log("Test number " + i + " with account " + j + " and perm ADMIN passed as expected"); - + if (randomPerms === "ADMIN") { + console.log("Test number " + i + " with account " + j + " and perm " + randomPerms + " should pass"); + await I_PercentageTransferManager.setAllowPrimaryIssuance(!primaryIssuanceStat, { from: accounts[j] }); + console.log("Test number " + i + " with account " + j + " and perm ADMIN passed as expected"); } else { console.log("Test number " + i + " with account " + j + " and perm " + randomPerms + " should failed"); - await catchRevert( I_PercentageTransferManager.setAllowPrimaryIssuance(!primaryIssuanceStat, { from: accounts[j] })); + await catchRevert(I_PercentageTransferManager.setAllowPrimaryIssuance(!primaryIssuanceStat, { from: accounts[j] })); console.log("Test number " + i + " with account " + j + " and perm " + randomPerms + " failed as expected"); } // await revertToSnapshot(snapId); @@ -508,53 +613,65 @@ contract('GeneralPermissionManager Fuzz', accounts => { }); }); - describe("fuzz test for manual approval transfer manager", async () => { - it("Should successfully attach the ManualApprovalTransferManager with the security token", async () => { - const tx = await I_SecurityToken.addModule(I_ManualApprovalTransferManagerFactory.address, "", 0, 0, { from: token_owner }); + const tx = await I_SecurityToken.addModule(I_ManualApprovalTransferManagerFactory.address, "0x0", new BN(0), new BN(0), { from: token_owner }); assert.equal(tx.logs[2].args._types[0].toNumber(), transferManagerKey, "ManualApprovalTransferManager doesn't get deployed"); assert.equal( web3.utils.toUtf8(tx.logs[2].args._name), "ManualApprovalTransferManager", "ManualApprovalTransferManager module was not added" ); - I_ManualApprovalTransferManager = ManualApprovalTransferManager.at(tx.logs[2].args._module); + I_ManualApprovalTransferManager = await ManualApprovalTransferManager.at(tx.logs[2].args._module); }); it("should pass fuzz test for addManualApproval & revokeManualApproval with perm TRANSFER_APPROVAL", async () => { - let tx; // fuzz test loop over total times of testRepeat, inside each loop, we use a variable j to randomly choose an account out of the 10 default accounts for (var i = 2; i < testRepeat; i++) { - let snapId = await takeSnapshot(); - var j = Math.floor(Math.random() * 10); - if (j === 1 || j === 0) { j = 2 }; // exclude account 1 & 0 because they might come with default perms + if (j === 1 || j === 0) { + j = 2; + } // exclude account 1 & 0 because they might come with default perms // add account as a Delegate if it is not - if (await I_GeneralPermissionManager.checkDelegate(accounts[j]) !== true) { - await I_GeneralPermissionManager.addDelegate(accounts[j], _details, { from: token_owner }); + if ((await I_GeneralPermissionManager.checkDelegate(accounts[j])) !== true) { + await I_GeneralPermissionManager.addDelegate(accounts[j], web3.utils.fromAscii(_details), { from: token_owner }); } // target permission should alaways be false for each test before assigning - if (await I_GeneralPermissionManager.checkPermission(accounts[j], I_ManualApprovalTransferManager.address, 'TRANSFER_APPROVAL') === true) { - await I_GeneralPermissionManager.changePermission(accounts[j], I_ManualApprovalTransferManager.address, 'TRANSFER_APPROVAL', false, { from: token_owner }); + if ( + (await I_GeneralPermissionManager.checkPermission( + accounts[j], + I_ManualApprovalTransferManager.address, + web3.utils.fromAscii("TRANSFER_APPROVAL") + )) === true + ) { + await I_GeneralPermissionManager.changePermission( + accounts[j], + I_ManualApprovalTransferManager.address, + web3.utils.fromAscii("TRANSFER_APPROVAL"), + false, + { from: token_owner } + ); } // assign a random perm let randomPerms = perms[Math.floor(Math.random() * Math.floor(totalPerms))]; - await I_GeneralPermissionManager.changePermission(accounts[j], I_ManualApprovalTransferManager.address, randomPerms, true, { from: token_owner }); + await I_GeneralPermissionManager.changePermission(accounts[j], I_ManualApprovalTransferManager.address, web3.utils.fromAscii(randomPerms), true, { + from: token_owner + }); - if (randomPerms === "TRANSFER_APPROVAL" ) { + if (randomPerms === "TRANSFER_APPROVAL") { console.log("Test number " + i + " with account " + j + " and perm TRANSFER_APPROVAL " + " should pass"); + let nextTime = await latestTime() + duration.days(1); await I_ManualApprovalTransferManager.addManualApproval( account_investor1, account_investor4, - web3.utils.toWei("2", "ether"), - latestTime() + duration.days(1), + new BN(web3.utils.toWei("2", "ether")), + nextTime, { from: accounts[j] } ); @@ -570,42 +687,42 @@ contract('GeneralPermissionManager Fuzz', accounts => { console.log("Test number " + i + " with account " + j + " and perm TRANSFER_APPROVAL passed as expected"); } else { console.log("Test number " + i + " with account " + j + " and perm " + randomPerms + " should failed"); + let nextTime = await latestTime() + duration.days(1); await catchRevert( I_ManualApprovalTransferManager.addManualApproval( account_investor1, account_investor4, - web3.utils.toWei("2", "ether"), - latestTime() + duration.days(1), + new BN(web3.utils.toWei("2", "ether")), + nextTime, { from: accounts[j] } ) ); + nextTime = await latestTime() + duration.days(1); await I_ManualApprovalTransferManager.addManualApproval( account_investor1, account_investor4, - web3.utils.toWei("2", "ether"), - latestTime() + duration.days(1), + new BN(web3.utils.toWei("2", "ether")), + nextTime, { from: token_owner } ); - await catchRevert(I_ManualApprovalTransferManager.revokeManualApproval(account_investor1, account_investor4, { - from: accounts[j] - }) + await catchRevert( + I_ManualApprovalTransferManager.revokeManualApproval(account_investor1, account_investor4, { + from: accounts[j] + }) ); - console.log("Test number " + i + " with account " + j + " and perm " + randomPerms + " failed as expected"); } await revertToSnapshot(snapId); - }; - - + } }); it("should pass fuzz test for addManualBlocking and revokeManualBlocking with perm TRANSFER_APPROVAL", async () => { console.log("1"); - await I_ManualApprovalTransferManager.addManualBlocking(account_investor1, account_investor2, latestTime() + duration.days(1), { + await I_ManualApprovalTransferManager.addManualBlocking(account_investor1, account_investor2, currentTime.add(new BN(duration.days(1))), { from: token_owner }); console.log("2"); @@ -614,31 +731,52 @@ contract('GeneralPermissionManager Fuzz', accounts => { // fuzz test loop over total times of testRepeat, inside each loop, we use a variable j to randomly choose an account out of the 10 default accounts for (var i = 2; i < testRepeat; i++) { - let snapId = await takeSnapshot(); var j = Math.floor(Math.random() * 10); - if (j === 1 || j === 0) { j = 2 }; // exclude account 1 & 0 because they might come with default perms + if (j === 1 || j === 0) { + j = 2; + } // exclude account 1 & 0 because they might come with default perms // add account as a Delegate if it is not - if (await I_GeneralPermissionManager.checkDelegate(accounts[j]) !== true) { - await I_GeneralPermissionManager.addDelegate(accounts[j], _details, { from: token_owner }); + if ((await I_GeneralPermissionManager.checkDelegate(accounts[j])) !== true) { + await I_GeneralPermissionManager.addDelegate(accounts[j], web3.utils.fromAscii(_details), { from: token_owner }); } // target permission should alaways be false for each test before assigning - if (await I_GeneralPermissionManager.checkPermission(accounts[j], I_ManualApprovalTransferManager.address, 'TRANSFER_APPROVAL') === true) { - await I_GeneralPermissionManager.changePermission(accounts[j], I_ManualApprovalTransferManager.address, 'TRANSFER_APPROVAL', false, { from: token_owner }); + if ( + (await I_GeneralPermissionManager.checkPermission( + accounts[j], + I_ManualApprovalTransferManager.address, + web3.utils.fromAscii("TRANSFER_APPROVAL") + )) === true + ) { + await I_GeneralPermissionManager.changePermission( + accounts[j], + I_ManualApprovalTransferManager.address, + web3.utils.fromAscii("TRANSFER_APPROVAL"), + false, + { from: token_owner } + ); } // assign a random perm let randomPerms = perms[Math.floor(Math.random() * Math.floor(totalPerms))]; - await I_GeneralPermissionManager.changePermission(accounts[j], I_ManualApprovalTransferManager.address, randomPerms, true, { from: token_owner }); + await I_GeneralPermissionManager.changePermission(accounts[j], I_ManualApprovalTransferManager.address, web3.utils.fromAscii(randomPerms), true, { + from: token_owner + }); if (randomPerms === "TRANSFER_APPROVAL") { console.log("Test number " + i + " with account " + j + " and perm TRANSFER_APPROVAL " + " should pass"); - await I_ManualApprovalTransferManager.addManualBlocking(account_investor1, account_investor2, latestTime() + duration.days(1), { - from: accounts[j] - }); + let nextTime = new BN(await latestTime()).add(new BN(duration.days(1))); + await I_ManualApprovalTransferManager.addManualBlocking( + account_investor1, + account_investor2, + nextTime, + { + from: accounts[j] + } + ); console.log("2"); await I_ManualApprovalTransferManager.revokeManualBlocking(account_investor1, account_investor2, { from: accounts[j] }); @@ -646,15 +784,27 @@ contract('GeneralPermissionManager Fuzz', accounts => { console.log("Test number " + i + " with account " + j + " and perm TRANSFER_APPROVAL passed as expected"); } else { console.log("Test number " + i + " with account " + j + " and perm " + randomPerms + " should failed"); + let nextTime = new BN(await latestTime()).add(new BN(duration.days(1))); await catchRevert( - I_ManualApprovalTransferManager.addManualBlocking(account_investor1, account_investor2, latestTime() + duration.days(1), { - from: accounts[j] - }) + I_ManualApprovalTransferManager.addManualBlocking( + account_investor1, + account_investor2, + nextTime, + { + from: accounts[j] + } + ) ); - await I_ManualApprovalTransferManager.addManualBlocking(account_investor1, account_investor2, latestTime() + duration.days(1), { - from: token_owner - }); + nextTime = new BN(await latestTime()).add(new BN(duration.days(1))); + await I_ManualApprovalTransferManager.addManualBlocking( + account_investor1, + account_investor2, + nextTime, + { + from: token_owner + } + ); await catchRevert( I_ManualApprovalTransferManager.revokeManualBlocking(account_investor1, account_investor2, { from: accounts[j] }) @@ -664,8 +814,7 @@ contract('GeneralPermissionManager Fuzz', accounts => { } await revertToSnapshot(snapId); - }; + } }); }); - }); diff --git a/truffle-ci.js b/truffle-ci.js index f427eb332..008baa8ec 100644 --- a/truffle-ci.js +++ b/truffle-ci.js @@ -17,11 +17,16 @@ module.exports = { gasPrice: 0x01 // <-- Use this low gas price } }, - solc: { - optimizer: { - enabled: true, - runs: 200, - }, + compilers: { + solc: { + version: "native", + settings: { + optimizer: { + enabled: true, + runs: 200 + } + } + } }, mocha: { enableTimeouts: false, diff --git a/truffle-config.js b/truffle-config.js index c993327ea..c6d636e97 100644 --- a/truffle-config.js +++ b/truffle-config.js @@ -53,15 +53,20 @@ module.exports = { host: "localhost", network_id: "*", port: 8545, // <-- If you change this, also set the port option in .solcover.js. - gas: 0xfffffffffff, // <-- Use this high gas value + gas: 0xfffffffff , // <-- Use this high gas value gasPrice: 0x01 // <-- Use this low gas price } }, - solc: { - optimizer: { - enabled: true, - runs: 200, - }, + compilers: { + solc: { + version: "native", + settings: { + optimizer: { + enabled: true, + runs: 200 + } + } + } }, mocha: { enableTimeouts: false diff --git a/upgrade.js b/upgrade.js new file mode 100644 index 000000000..af0561dac --- /dev/null +++ b/upgrade.js @@ -0,0 +1,19 @@ +const fs = require('fs'); +const glob = require("glob"); + +let regex = new RegExp('((const|let|var) (.*) = artifacts.require(.)*)', 'gi'); +let m; + +glob("test/**/*.js", function (er, files) { + files.forEach(function(filename) { + fs.readFile(filename, 'utf-8', function(err, content) { + if (err) { + return console.log(err); + } + content = content.replace(regex, '$1\n$3.numberFormat = "BN";'); + fs.writeFile(filename, content, 'utf8', function (err) { + if (err) return console.log(err); + }); + }); + }); +}) \ No newline at end of file diff --git a/yarn.lock b/yarn.lock index 74912abd4..fbe3ccc99 100644 --- a/yarn.lock +++ b/yarn.lock @@ -19,10 +19,12 @@ "@soldoc/markdown@^0.1.0": version "0.1.0" resolved "https://registry.yarnpkg.com/@soldoc/markdown/-/markdown-0.1.0.tgz#9f85be75049af9721b5129f133d52dafbf5f671e" + integrity sha512-V0UnvVVJ1qDzpuKLMuh7oHG94puwi8BI3t99Vrr7dQgIHuJdfZJ4SbGuWuFV/fSthyH++WY4ePO3d6gxfZ2//w== "@soldoc/soldoc@^0.4.3": version "0.4.3" resolved "https://registry.yarnpkg.com/@soldoc/soldoc/-/soldoc-0.4.3.tgz#24ffee9264228e1c3edd61fd3162d63587954933" + integrity sha1-JP/ukmQijhw+3WH9MWLWNYeVSTM= dependencies: "@soldoc/markdown" "^0.1.0" chalk "^2.3.1" @@ -40,26 +42,31 @@ abbrev@1: version "1.1.1" resolved "https://registry.yarnpkg.com/abbrev/-/abbrev-1.1.1.tgz#f8f2c887ad10bf67f634f005b6987fed3179aac8" + integrity sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q== abbrev@1.0.x: version "1.0.9" resolved "https://registry.yarnpkg.com/abbrev/-/abbrev-1.0.9.tgz#91b4792588a7738c25f35dd6f63752a2f8776135" + integrity sha1-kbR5JYinc4wl813W9jdSovh3YTU= abstract-leveldown@~2.6.0: version "2.6.3" resolved "https://registry.yarnpkg.com/abstract-leveldown/-/abstract-leveldown-2.6.3.tgz#1c5e8c6a5ef965ae8c35dfb3a8770c476b82c4b8" + integrity sha512-2++wDf/DYqkPR3o5tbfdhF96EfMApo1GpPfzOsR/ZYXdkSmELlvOOEAl9iKkRsktMPHdGjO4rtkBpf2I7TiTeA== dependencies: xtend "~4.0.0" abstract-leveldown@~2.7.1: version "2.7.2" resolved "https://registry.yarnpkg.com/abstract-leveldown/-/abstract-leveldown-2.7.2.tgz#87a44d7ebebc341d59665204834c8b7e0932cc93" + integrity sha512-+OVvxH2rHVEhWLdbudP6p0+dNMXu8JA1CbhP19T8paTYAcX7oJ4OVjT+ZUVpv7mITxXHqDMej+GdqXBmXkw09w== dependencies: xtend "~4.0.0" accepts@~1.3.5: version "1.3.5" resolved "https://registry.yarnpkg.com/accepts/-/accepts-1.3.5.tgz#eb777df6011723a3b14e8a72c0805c8e86746bd2" + integrity sha1-63d99gEXI6OxTopywIBcjoZ0a9I= dependencies: mime-types "~2.1.18" negotiator "0.6.1" @@ -67,6 +74,7 @@ accepts@~1.3.5: acorn-dynamic-import@^2.0.0: version "2.0.2" resolved "https://registry.yarnpkg.com/acorn-dynamic-import/-/acorn-dynamic-import-2.0.2.tgz#c752bd210bef679501b6c6cb7fc84f8f47158cc4" + integrity sha1-x1K9IQvvZ5UBtsbLf8hPj0cVjMQ= dependencies: acorn "^4.0.3" @@ -77,10 +85,12 @@ acorn-jsx@^5.0.0: acorn@^4.0.3: version "4.0.13" resolved "https://registry.yarnpkg.com/acorn/-/acorn-4.0.13.tgz#105495ae5361d697bd195c825192e1ad7f253787" + integrity sha1-EFSVrlNh1pe9GVyCUZLhrX8lN4c= acorn@^5.0.0: version "5.7.3" resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.7.3.tgz#67aa231bf8812974b85235a96771eb6bd07ea279" + integrity sha512-T/zvzYRfbVojPWahDsE5evJdHb3oJoQfFbsrKM7w5Zcs++Tr257tia3BmMP8XYVjp1S9RZXQMh7gao96BlqZOw== acorn@^6.0.2: version "6.0.4" @@ -89,18 +99,22 @@ acorn@^6.0.2: aes-js@3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/aes-js/-/aes-js-3.0.0.tgz#e21df10ad6c2053295bcbb8dab40b09dbea87e4d" + integrity sha1-4h3xCtbCBTKVvLuNq0Cwnb6ofk0= aes-js@^3.1.1: - version "3.1.1" - resolved "https://registry.yarnpkg.com/aes-js/-/aes-js-3.1.1.tgz#89fd1f94ae51b4c72d62466adc1a7323ff52f072" + version "3.1.2" + resolved "https://registry.yarnpkg.com/aes-js/-/aes-js-3.1.2.tgz#db9aabde85d5caabbfc0d4f2a4446960f627146a" + integrity sha512-e5pEa2kBnBOgR4Y/p20pskXI74UEz7de8ZGVo58asOtvSVG5YAbJeELPZxOmt+Bnz3rX753YKhfIn4X4l1PPRQ== ajv-keywords@^3.1.0: version "3.2.0" resolved "https://registry.yarnpkg.com/ajv-keywords/-/ajv-keywords-3.2.0.tgz#e86b819c602cf8821ad637413698f1dec021847a" + integrity sha1-6GuBnGAs+IIa1jdBNpjx3sAhhHo= -ajv@^5.1.1, ajv@^5.2.2, ajv@^5.3.0: +ajv@^5.1.1, ajv@^5.2.2: version "5.5.2" resolved "https://registry.yarnpkg.com/ajv/-/ajv-5.5.2.tgz#73b5eeca3fab653e3d3f9422b341ad42205dc965" + integrity sha1-c7Xuyj+rZT49P5Qis0GtQiBdyWU= dependencies: co "^4.6.0" fast-deep-equal "^1.0.0" @@ -125,9 +139,20 @@ ajv@^6.5.3: json-schema-traverse "^0.4.1" uri-js "^4.2.2" +ajv@^6.5.5, ajv@^6.6.1: + version "6.6.2" + resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.6.2.tgz#caceccf474bf3fc3ce3b147443711a24063cc30d" + integrity sha512-FBHEW6Jf5TB9MGBgUUA9XHkTbjXYfAUjY43ACMfmdMRHniyoMHjHjzD50OK8LGDWQwp4rWEsIq5kEqq7rvIM1g== + dependencies: + fast-deep-equal "^2.0.1" + fast-json-stable-stringify "^2.0.0" + json-schema-traverse "^0.4.1" + uri-js "^4.2.2" + align-text@^0.1.1, align-text@^0.1.3: version "0.1.4" resolved "https://registry.yarnpkg.com/align-text/-/align-text-0.1.4.tgz#0cd90a561093f35d0a99256c22b7069433fad117" + integrity sha1-DNkKVhCT810KmSVsIrcGlDP60Rc= dependencies: kind-of "^3.0.2" longest "^1.0.1" @@ -136,6 +161,7 @@ align-text@^0.1.1, align-text@^0.1.3: ambi@^2.2.0: version "2.5.0" resolved "https://registry.yarnpkg.com/ambi/-/ambi-2.5.0.tgz#7c8e372be48891157e7cea01cb6f9143d1f74220" + integrity sha1-fI43K+SIkRV+fOoBy2+RQ9H3QiA= dependencies: editions "^1.1.1" typechecker "^4.3.0" @@ -143,36 +169,49 @@ ambi@^2.2.0: amdefine@>=0.0.4: version "1.0.1" resolved "https://registry.yarnpkg.com/amdefine/-/amdefine-1.0.1.tgz#4a5282ac164729e93619bcfd3ad151f817ce91f5" + integrity sha1-SlKCrBZHKek2Gbz9OtFR+BfOkfU= ansi-escapes@^3.0.0: version "3.1.0" resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-3.1.0.tgz#f73207bb81207d75fd6c83f125af26eea378ca30" + integrity sha512-UgAb8H9D41AQnu/PbWlCofQVcnV4Gs2bBJi9eZPxfU/hgglFh3SMDMENRIqdr7H6XFnXdoknctFByVsCOotTVw== ansi-regex@^2.0.0, ansi-regex@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-2.1.1.tgz#c3b33ab5ee360d86e0e628f0468ae7ef27d654df" + integrity sha1-w7M6te42DYbg5ijwRorn7yfWVN8= ansi-regex@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-3.0.0.tgz#ed0317c322064f79466c02966bddb605ab37d998" + integrity sha1-7QMXwyIGT3lGbAKWa922Bas32Zg= + +ansi-regex@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-4.0.0.tgz#70de791edf021404c3fd615aa89118ae0432e5a9" + integrity sha512-iB5Dda8t/UqpPI/IjsejXu5jOGDrzn41wJyljwPH65VCIbk6+1BzFIMJGFwTNrYXT1CrD+B4l19U7awiQ8rk7w== ansi-styles@^2.2.1: version "2.2.1" resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-2.2.1.tgz#b432dd3358b634cf75e1e4664368240533c1ddbe" + integrity sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4= -ansi-styles@^3.2.1: +ansi-styles@^3.2.0, ansi-styles@^3.2.1: version "3.2.1" resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.2.1.tgz#41fbb20243e50b12be0f04b8dedbf07520ce841d" + integrity sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA== dependencies: color-convert "^1.9.0" any-promise@1.3.0, any-promise@^1.0.0, any-promise@^1.3.0: version "1.3.0" resolved "https://registry.yarnpkg.com/any-promise/-/any-promise-1.3.0.tgz#abc6afeedcea52e809cdc0376aed3ce39635d17f" + integrity sha1-q8av7tzqUugJzcA3au0845Y10X8= anymatch@^1.3.0: version "1.3.2" resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-1.3.2.tgz#553dcb8f91e3c889845dfdba34c77721b90b9d7a" + integrity sha512-0XNayC8lTHQ2OI8aljNCN3sSx6hsr/1+rlcDAotXJR7C1oZZHCNsfpbKwMjRA3Uqb5tF1Rae2oloTr4xpq+WjA== dependencies: micromatch "^2.1.5" normalize-path "^2.0.0" @@ -180,17 +219,25 @@ anymatch@^1.3.0: anymatch@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-2.0.0.tgz#bcb24b4f37934d9aa7ac17b4adaf89e7c76ef2eb" + integrity sha512-5teOsQWABXHHBFP9y3skS5P3d/WfWXpv3FUpy+LorMrNYaT9pI4oLMQX7jzQ2KklNpGpWHzdCXTDT2Y3XGlZBw== dependencies: micromatch "^3.1.4" normalize-path "^2.1.1" +app-module-path@^2.2.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/app-module-path/-/app-module-path-2.2.0.tgz#641aa55dfb7d6a6f0a8141c4b9c0aa50b6c24dd5" + integrity sha1-ZBqlXft9am8KgUHEucCqULbCTdU= + aproba@^1.0.3: version "1.2.0" resolved "https://registry.yarnpkg.com/aproba/-/aproba-1.2.0.tgz#6802e6264efd18c790a1b0d517f0f2627bf2c94a" + integrity sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw== are-we-there-yet@~1.1.2: version "1.1.5" resolved "https://registry.yarnpkg.com/are-we-there-yet/-/are-we-there-yet-1.1.5.tgz#4b35c2944f062a8bfcda66410760350fe9ddfc21" + integrity sha512-5hYdAkZlcG8tOLujVDTgCT+uPX0VnpAH28gWsLfzpXYm7wP6mp5Q/gYyR7YQ0cKVJcXJnl3j2kpBan13PtQf6w== dependencies: delegates "^1.0.0" readable-stream "^2.0.6" @@ -198,22 +245,26 @@ are-we-there-yet@~1.1.2: argparse@^1.0.7: version "1.0.10" resolved "https://registry.yarnpkg.com/argparse/-/argparse-1.0.10.tgz#bcd6791ea5ae09725e17e5ad988134cd40b3d911" + integrity sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg== dependencies: sprintf-js "~1.0.2" arr-diff@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/arr-diff/-/arr-diff-2.0.0.tgz#8f3b827f955a8bd669697e4a4256ac3ceae356cf" + integrity sha1-jzuCf5Vai9ZpaX5KQlasPOrjVs8= dependencies: arr-flatten "^1.0.1" arr-diff@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/arr-diff/-/arr-diff-4.0.0.tgz#d6461074febfec71e7e15235761a329a5dc7c520" + integrity sha1-1kYQdP6/7HHn4VI1dhoyml3HxSA= arr-flatten@^1.0.1, arr-flatten@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/arr-flatten/-/arr-flatten-1.1.0.tgz#36048bbff4e7b47e136644316c99669ea5ae91f1" + integrity sha512-L3hKV5R/p5o81R7O02IGnwpDmkp6E982XhtbuwSe3O4qOtMMMtodicASA1Cny2U+aCXcNpml+m4dPsvsJ3jatg== arr-union@^3.1.0: version "3.1.0" @@ -222,32 +273,22 @@ arr-union@^3.1.0: array-flatten@1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/array-flatten/-/array-flatten-1.1.1.tgz#9a5f699051b1e7073328f2a008968b64ea2955d2" - -array-union@^1.0.1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/array-union/-/array-union-1.0.2.tgz#9a34410e4f4e3da23dea375be5be70f24778ec39" - dependencies: - array-uniq "^1.0.1" - -array-uniq@^1.0.1: - version "1.0.3" - resolved "https://registry.yarnpkg.com/array-uniq/-/array-uniq-1.0.3.tgz#af6ac877a25cc7f74e058894753858dfdb24fdb6" + integrity sha1-ml9pkFGx5wczKPKgCJaLZOopVdI= array-unique@^0.2.1: version "0.2.1" resolved "https://registry.yarnpkg.com/array-unique/-/array-unique-0.2.1.tgz#a1d97ccafcbc2625cc70fadceb36a50c58b01a53" + integrity sha1-odl8yvy8JiXMcPrc6zalDFiwGlM= array-unique@^0.3.2: version "0.3.2" resolved "https://registry.yarnpkg.com/array-unique/-/array-unique-0.3.2.tgz#a894b75d4bc4f6cd679ef3244a9fd8f46ae2d428" - -arrify@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/arrify/-/arrify-1.0.1.tgz#898508da2226f380df904728456849c1501a4b0d" + integrity sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg= asn1.js@^4.0.0: version "4.10.1" resolved "https://registry.yarnpkg.com/asn1.js/-/asn1.js-4.10.1.tgz#b9c2bf5805f1e64aadeed6df3a2bfafb5a73f5a0" + integrity sha512-p32cOF5q0Zqs9uBiONKYLm6BClCoBCM5O9JfeUSlnQLBTxYdTK+pW+nXflm8UkKd2UYlEbYz5qEi0JuZR9ckSw== dependencies: bn.js "^4.0.0" inherits "^2.0.1" @@ -256,30 +297,41 @@ asn1.js@^4.0.0: asn1@~0.2.3: version "0.2.4" resolved "https://registry.yarnpkg.com/asn1/-/asn1-0.2.4.tgz#8d2475dfab553bb33e77b54e59e880bb8ce23136" + integrity sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg== dependencies: safer-buffer "~2.1.0" assert-plus@1.0.0, assert-plus@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/assert-plus/-/assert-plus-1.0.0.tgz#f12e0f3c5d77b0b1cdd9146942e4e96c1e4dd525" + integrity sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU= assert@^1.1.1: version "1.4.1" resolved "https://registry.yarnpkg.com/assert/-/assert-1.4.1.tgz#99912d591836b5a6f5b345c0f07eefc08fc65d91" + integrity sha1-mZEtWRg2tab1s0XA8H7vwI/GXZE= dependencies: util "0.10.3" assign-symbols@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/assign-symbols/-/assign-symbols-1.0.0.tgz#59667f41fadd4f20ccbc2bb96b8d4f7f78ec0367" + integrity sha1-WWZ/QfrdTyDMvCu5a41Pf3jsA2c= + +astral-regex@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/astral-regex/-/astral-regex-1.0.0.tgz#6c8c3fb827dd43ee3918f27b82782ab7658a6fd9" + integrity sha512-+Ryf6g3BKoRc7jfp7ad8tM4TtMiaWvbF/1/sQcZPkkS7ag3D5nMBCe2UfOTONtAkaG0tO0ij3C5Lwmf1EiyjHg== async-each@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/async-each/-/async-each-1.0.1.tgz#19d386a1d9edc6e7c1c85d388aedbcc56d33602d" + integrity sha1-GdOGodntxufByF04iu28xW0zYC0= async-eventemitter@^0.2.2: version "0.2.4" resolved "https://registry.yarnpkg.com/async-eventemitter/-/async-eventemitter-0.2.4.tgz#f5e7c8ca7d3e46aab9ec40a292baf686a0bafaca" + integrity sha512-pd20BwL7Yt1zwDFy+8MX8F1+WCT8aQeKj0kQnTrH9WaeRETlRamVhD0JtRPmrV4GfOJ2F9CvdQkZeZhnh2TuHw== dependencies: async "^2.4.0" @@ -292,44 +344,54 @@ async-eventemitter@ahultgren/async-eventemitter#fa06e39e56786ba541c180061dbf2c0a async-limiter@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/async-limiter/-/async-limiter-1.0.0.tgz#78faed8c3d074ab81f22b4e985d79e8738f720f8" + integrity sha512-jp/uFnooOiO+L211eZOoSyzpOITMXx1rBITauYykG3BRYPu8h0UcxsPNB04RR5vo4Tyz3+ay17tR6JVf9qzYWg== async@1.x, async@^1.4.2, async@~1.5.2: version "1.5.2" resolved "https://registry.yarnpkg.com/async/-/async-1.5.2.tgz#ec6a61ae56480c0c3cb241c95618e20892f9672a" + integrity sha1-7GphrlZIDAw8skHJVhjiCJL5Zyo= async@^2.0.1, async@^2.1.2, async@^2.4.0, async@^2.4.1, async@^2.5.0: version "2.6.1" resolved "https://registry.yarnpkg.com/async/-/async-2.6.1.tgz#b245a23ca71930044ec53fa46aa00a3e87c6a610" + integrity sha512-fNEiL2+AZt6AlAw/29Cr0UDe4sRAHCpEHh54WMz+Bb7QfNcFw4h3loofyJpLeQs4Yx7yuqu/2dLgM5hKOs6HlQ== dependencies: lodash "^4.17.10" async@~0.9.0: version "0.9.2" - resolved "http://registry.npmjs.org/async/-/async-0.9.2.tgz#aea74d5e61c1f899613bf64bda66d4c78f2fd17d" + resolved "https://registry.yarnpkg.com/async/-/async-0.9.2.tgz#aea74d5e61c1f899613bf64bda66d4c78f2fd17d" + integrity sha1-rqdNXmHB+JlhO/ZL2mbUx48v0X0= async@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/async/-/async-1.0.0.tgz#f8fc04ca3a13784ade9e1641af98578cfbd647a9" + integrity sha1-+PwEyjoTeErenhZBr5hXjPvWR6k= asynckit@^0.4.0: version "0.4.0" resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79" + integrity sha1-x57Zf380y48robyXkLzDZkdLS3k= atob@^2.1.1: version "2.1.2" resolved "https://registry.yarnpkg.com/atob/-/atob-2.1.2.tgz#6d9517eb9e030d2436666651e86bd9f6f13533c9" + integrity sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg== aws-sign2@~0.7.0: version "0.7.0" resolved "https://registry.yarnpkg.com/aws-sign2/-/aws-sign2-0.7.0.tgz#b46e890934a9591f2d2f6f86d7e6a9f1b3fe76a8" + integrity sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg= aws4@^1.8.0: version "1.8.0" resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.8.0.tgz#f0e003d9ca9e7f59c7a508945d7b2ef9a04a542f" + integrity sha512-ReZxvNHIOv88FlT7rxcXIIC0fPt4KZqZbOlivyWtXLt8ESx84zd3kMC6iK5jVeS2qt+g7ftS7ye4fi06X5rtRQ== babel-code-frame@^6.26.0: version "6.26.0" resolved "https://registry.yarnpkg.com/babel-code-frame/-/babel-code-frame-6.26.0.tgz#63fd43f7dc1e3bb7ce35947db8fe369a3f58c74b" + integrity sha1-Y/1D99weO7fONZR9uP42mj9Yx0s= dependencies: chalk "^1.1.3" esutils "^2.0.2" @@ -338,6 +400,7 @@ babel-code-frame@^6.26.0: babel-core@^6.0.14, babel-core@^6.26.0: version "6.26.3" resolved "https://registry.yarnpkg.com/babel-core/-/babel-core-6.26.3.tgz#b2e2f09e342d0f0c88e2f02e067794125e75c207" + integrity sha512-6jyFLuDmeidKmUEb3NM+/yawG0M2bDZ9Z1qbZP59cyHLz8kYGKYwpJP0UwUKKUiTRNvxfLesJnTedqczP7cTDA== dependencies: babel-code-frame "^6.26.0" babel-generator "^6.26.0" @@ -362,6 +425,7 @@ babel-core@^6.0.14, babel-core@^6.26.0: babel-generator@^6.26.0: version "6.26.1" resolved "https://registry.yarnpkg.com/babel-generator/-/babel-generator-6.26.1.tgz#1844408d3b8f0d35a404ea7ac180f087a601bd90" + integrity sha512-HyfwY6ApZj7BYTcJURpM5tznulaBvyio7/0d4zFOeMPUmfxkCjHocCuoLa2SAGzBI8AREcH3eP3758F672DppA== dependencies: babel-messages "^6.23.0" babel-runtime "^6.26.0" @@ -375,6 +439,7 @@ babel-generator@^6.26.0: babel-helper-bindify-decorators@^6.24.1: version "6.24.1" resolved "https://registry.yarnpkg.com/babel-helper-bindify-decorators/-/babel-helper-bindify-decorators-6.24.1.tgz#14c19e5f142d7b47f19a52431e52b1ccbc40a330" + integrity sha1-FMGeXxQte0fxmlJDHlKxzLxAozA= dependencies: babel-runtime "^6.22.0" babel-traverse "^6.24.1" @@ -383,6 +448,7 @@ babel-helper-bindify-decorators@^6.24.1: babel-helper-builder-binary-assignment-operator-visitor@^6.24.1: version "6.24.1" resolved "https://registry.yarnpkg.com/babel-helper-builder-binary-assignment-operator-visitor/-/babel-helper-builder-binary-assignment-operator-visitor-6.24.1.tgz#cce4517ada356f4220bcae8a02c2b346f9a56664" + integrity sha1-zORReto1b0IgvK6KAsKzRvmlZmQ= dependencies: babel-helper-explode-assignable-expression "^6.24.1" babel-runtime "^6.22.0" @@ -391,6 +457,7 @@ babel-helper-builder-binary-assignment-operator-visitor@^6.24.1: babel-helper-call-delegate@^6.24.1: version "6.24.1" resolved "https://registry.yarnpkg.com/babel-helper-call-delegate/-/babel-helper-call-delegate-6.24.1.tgz#ece6aacddc76e41c3461f88bfc575bd0daa2df8d" + integrity sha1-7Oaqzdx25Bw0YfiL/Fdb0Nqi340= dependencies: babel-helper-hoist-variables "^6.24.1" babel-runtime "^6.22.0" @@ -400,6 +467,7 @@ babel-helper-call-delegate@^6.24.1: babel-helper-define-map@^6.24.1: version "6.26.0" resolved "https://registry.yarnpkg.com/babel-helper-define-map/-/babel-helper-define-map-6.26.0.tgz#a5f56dab41a25f97ecb498c7ebaca9819f95be5f" + integrity sha1-pfVtq0GiX5fstJjH66ypgZ+Vvl8= dependencies: babel-helper-function-name "^6.24.1" babel-runtime "^6.26.0" @@ -409,6 +477,7 @@ babel-helper-define-map@^6.24.1: babel-helper-explode-assignable-expression@^6.24.1: version "6.24.1" resolved "https://registry.yarnpkg.com/babel-helper-explode-assignable-expression/-/babel-helper-explode-assignable-expression-6.24.1.tgz#f25b82cf7dc10433c55f70592d5746400ac22caa" + integrity sha1-8luCz33BBDPFX3BZLVdGQArCLKo= dependencies: babel-runtime "^6.22.0" babel-traverse "^6.24.1" @@ -417,6 +486,7 @@ babel-helper-explode-assignable-expression@^6.24.1: babel-helper-explode-class@^6.24.1: version "6.24.1" resolved "https://registry.yarnpkg.com/babel-helper-explode-class/-/babel-helper-explode-class-6.24.1.tgz#7dc2a3910dee007056e1e31d640ced3d54eaa9eb" + integrity sha1-fcKjkQ3uAHBW4eMdZAztPVTqqes= dependencies: babel-helper-bindify-decorators "^6.24.1" babel-runtime "^6.22.0" @@ -426,6 +496,7 @@ babel-helper-explode-class@^6.24.1: babel-helper-function-name@^6.24.1: version "6.24.1" resolved "https://registry.yarnpkg.com/babel-helper-function-name/-/babel-helper-function-name-6.24.1.tgz#d3475b8c03ed98242a25b48351ab18399d3580a9" + integrity sha1-00dbjAPtmCQqJbSDUasYOZ01gKk= dependencies: babel-helper-get-function-arity "^6.24.1" babel-runtime "^6.22.0" @@ -436,6 +507,7 @@ babel-helper-function-name@^6.24.1: babel-helper-get-function-arity@^6.24.1: version "6.24.1" resolved "https://registry.yarnpkg.com/babel-helper-get-function-arity/-/babel-helper-get-function-arity-6.24.1.tgz#8f7782aa93407c41d3aa50908f89b031b1b6853d" + integrity sha1-j3eCqpNAfEHTqlCQj4mwMbG2hT0= dependencies: babel-runtime "^6.22.0" babel-types "^6.24.1" @@ -443,6 +515,7 @@ babel-helper-get-function-arity@^6.24.1: babel-helper-hoist-variables@^6.24.1: version "6.24.1" resolved "https://registry.yarnpkg.com/babel-helper-hoist-variables/-/babel-helper-hoist-variables-6.24.1.tgz#1ecb27689c9d25513eadbc9914a73f5408be7a76" + integrity sha1-HssnaJydJVE+rbyZFKc/VAi+enY= dependencies: babel-runtime "^6.22.0" babel-types "^6.24.1" @@ -450,6 +523,7 @@ babel-helper-hoist-variables@^6.24.1: babel-helper-optimise-call-expression@^6.24.1: version "6.24.1" resolved "https://registry.yarnpkg.com/babel-helper-optimise-call-expression/-/babel-helper-optimise-call-expression-6.24.1.tgz#f7a13427ba9f73f8f4fa993c54a97882d1244257" + integrity sha1-96E0J7qfc/j0+pk8VKl4gtEkQlc= dependencies: babel-runtime "^6.22.0" babel-types "^6.24.1" @@ -457,6 +531,7 @@ babel-helper-optimise-call-expression@^6.24.1: babel-helper-regex@^6.24.1: version "6.26.0" resolved "https://registry.yarnpkg.com/babel-helper-regex/-/babel-helper-regex-6.26.0.tgz#325c59f902f82f24b74faceed0363954f6495e72" + integrity sha1-MlxZ+QL4LyS3T6zu0DY5VPZJXnI= dependencies: babel-runtime "^6.26.0" babel-types "^6.26.0" @@ -465,6 +540,7 @@ babel-helper-regex@^6.24.1: babel-helper-remap-async-to-generator@^6.24.1: version "6.24.1" resolved "https://registry.yarnpkg.com/babel-helper-remap-async-to-generator/-/babel-helper-remap-async-to-generator-6.24.1.tgz#5ec581827ad723fecdd381f1c928390676e4551b" + integrity sha1-XsWBgnrXI/7N04HxySg5BnbkVRs= dependencies: babel-helper-function-name "^6.24.1" babel-runtime "^6.22.0" @@ -475,6 +551,7 @@ babel-helper-remap-async-to-generator@^6.24.1: babel-helper-replace-supers@^6.24.1: version "6.24.1" resolved "https://registry.yarnpkg.com/babel-helper-replace-supers/-/babel-helper-replace-supers-6.24.1.tgz#bf6dbfe43938d17369a213ca8a8bf74b6a90ab1a" + integrity sha1-v22/5Dk40XNpohPKiov3S2qQqxo= dependencies: babel-helper-optimise-call-expression "^6.24.1" babel-messages "^6.23.0" @@ -486,6 +563,7 @@ babel-helper-replace-supers@^6.24.1: babel-helpers@^6.24.1: version "6.24.1" resolved "https://registry.yarnpkg.com/babel-helpers/-/babel-helpers-6.24.1.tgz#3471de9caec388e5c850e597e58a26ddf37602b2" + integrity sha1-NHHenK7DiOXIUOWX5Yom3fN2ArI= dependencies: babel-runtime "^6.22.0" babel-template "^6.24.1" @@ -493,50 +571,61 @@ babel-helpers@^6.24.1: babel-messages@^6.23.0: version "6.23.0" resolved "https://registry.yarnpkg.com/babel-messages/-/babel-messages-6.23.0.tgz#f3cdf4703858035b2a2951c6ec5edf6c62f2630e" + integrity sha1-8830cDhYA1sqKVHG7F7fbGLyYw4= dependencies: babel-runtime "^6.22.0" babel-plugin-check-es2015-constants@^6.22.0: version "6.22.0" resolved "https://registry.yarnpkg.com/babel-plugin-check-es2015-constants/-/babel-plugin-check-es2015-constants-6.22.0.tgz#35157b101426fd2ffd3da3f75c7d1e91835bbf8a" + integrity sha1-NRV7EBQm/S/9PaP3XH0ekYNbv4o= dependencies: babel-runtime "^6.22.0" babel-plugin-syntax-async-functions@^6.8.0: version "6.13.0" resolved "https://registry.yarnpkg.com/babel-plugin-syntax-async-functions/-/babel-plugin-syntax-async-functions-6.13.0.tgz#cad9cad1191b5ad634bf30ae0872391e0647be95" + integrity sha1-ytnK0RkbWtY0vzCuCHI5HgZHvpU= babel-plugin-syntax-async-generators@^6.5.0: version "6.13.0" resolved "https://registry.yarnpkg.com/babel-plugin-syntax-async-generators/-/babel-plugin-syntax-async-generators-6.13.0.tgz#6bc963ebb16eccbae6b92b596eb7f35c342a8b9a" + integrity sha1-a8lj67FuzLrmuStZbrfzXDQqi5o= babel-plugin-syntax-class-properties@^6.8.0: version "6.13.0" resolved "https://registry.yarnpkg.com/babel-plugin-syntax-class-properties/-/babel-plugin-syntax-class-properties-6.13.0.tgz#d7eb23b79a317f8543962c505b827c7d6cac27de" + integrity sha1-1+sjt5oxf4VDlixQW4J8fWysJ94= babel-plugin-syntax-decorators@^6.13.0: version "6.13.0" resolved "https://registry.yarnpkg.com/babel-plugin-syntax-decorators/-/babel-plugin-syntax-decorators-6.13.0.tgz#312563b4dbde3cc806cee3e416cceeaddd11ac0b" + integrity sha1-MSVjtNvePMgGzuPkFszurd0RrAs= babel-plugin-syntax-dynamic-import@^6.18.0: version "6.18.0" resolved "https://registry.yarnpkg.com/babel-plugin-syntax-dynamic-import/-/babel-plugin-syntax-dynamic-import-6.18.0.tgz#8d6a26229c83745a9982a441051572caa179b1da" + integrity sha1-jWomIpyDdFqZgqRBBRVyyqF5sdo= babel-plugin-syntax-exponentiation-operator@^6.8.0: version "6.13.0" resolved "https://registry.yarnpkg.com/babel-plugin-syntax-exponentiation-operator/-/babel-plugin-syntax-exponentiation-operator-6.13.0.tgz#9ee7e8337290da95288201a6a57f4170317830de" + integrity sha1-nufoM3KQ2pUoggGmpX9BcDF4MN4= babel-plugin-syntax-object-rest-spread@^6.8.0: version "6.13.0" resolved "https://registry.yarnpkg.com/babel-plugin-syntax-object-rest-spread/-/babel-plugin-syntax-object-rest-spread-6.13.0.tgz#fd6536f2bce13836ffa3a5458c4903a597bb3bf5" + integrity sha1-/WU28rzhODb/o6VFjEkDpZe7O/U= babel-plugin-syntax-trailing-function-commas@^6.22.0: version "6.22.0" resolved "https://registry.yarnpkg.com/babel-plugin-syntax-trailing-function-commas/-/babel-plugin-syntax-trailing-function-commas-6.22.0.tgz#ba0360937f8d06e40180a43fe0d5616fff532cf3" + integrity sha1-ugNgk3+NBuQBgKQ/4NVhb/9TLPM= babel-plugin-transform-async-generator-functions@^6.24.1: version "6.24.1" resolved "https://registry.yarnpkg.com/babel-plugin-transform-async-generator-functions/-/babel-plugin-transform-async-generator-functions-6.24.1.tgz#f058900145fd3e9907a6ddf28da59f215258a5db" + integrity sha1-8FiQAUX9PpkHpt3yjaWfIVJYpds= dependencies: babel-helper-remap-async-to-generator "^6.24.1" babel-plugin-syntax-async-generators "^6.5.0" @@ -545,6 +634,7 @@ babel-plugin-transform-async-generator-functions@^6.24.1: babel-plugin-transform-async-to-generator@^6.22.0, babel-plugin-transform-async-to-generator@^6.24.1: version "6.24.1" resolved "https://registry.yarnpkg.com/babel-plugin-transform-async-to-generator/-/babel-plugin-transform-async-to-generator-6.24.1.tgz#6536e378aff6cb1d5517ac0e40eb3e9fc8d08761" + integrity sha1-ZTbjeK/2yx1VF6wOQOs+n8jQh2E= dependencies: babel-helper-remap-async-to-generator "^6.24.1" babel-plugin-syntax-async-functions "^6.8.0" @@ -553,6 +643,7 @@ babel-plugin-transform-async-to-generator@^6.22.0, babel-plugin-transform-async- babel-plugin-transform-class-properties@^6.24.1: version "6.24.1" resolved "https://registry.yarnpkg.com/babel-plugin-transform-class-properties/-/babel-plugin-transform-class-properties-6.24.1.tgz#6a79763ea61d33d36f37b611aa9def81a81b46ac" + integrity sha1-anl2PqYdM9NvN7YRqp3vgagbRqw= dependencies: babel-helper-function-name "^6.24.1" babel-plugin-syntax-class-properties "^6.8.0" @@ -562,6 +653,7 @@ babel-plugin-transform-class-properties@^6.24.1: babel-plugin-transform-decorators@^6.24.1: version "6.24.1" resolved "https://registry.yarnpkg.com/babel-plugin-transform-decorators/-/babel-plugin-transform-decorators-6.24.1.tgz#788013d8f8c6b5222bdf7b344390dfd77569e24d" + integrity sha1-eIAT2PjGtSIr33s0Q5Df13Vp4k0= dependencies: babel-helper-explode-class "^6.24.1" babel-plugin-syntax-decorators "^6.13.0" @@ -572,18 +664,21 @@ babel-plugin-transform-decorators@^6.24.1: babel-plugin-transform-es2015-arrow-functions@^6.22.0: version "6.22.0" resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-arrow-functions/-/babel-plugin-transform-es2015-arrow-functions-6.22.0.tgz#452692cb711d5f79dc7f85e440ce41b9f244d221" + integrity sha1-RSaSy3EdX3ncf4XkQM5BufJE0iE= dependencies: babel-runtime "^6.22.0" babel-plugin-transform-es2015-block-scoped-functions@^6.22.0: version "6.22.0" resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-block-scoped-functions/-/babel-plugin-transform-es2015-block-scoped-functions-6.22.0.tgz#bbc51b49f964d70cb8d8e0b94e820246ce3a6141" + integrity sha1-u8UbSflk1wy42OC5ToICRs46YUE= dependencies: babel-runtime "^6.22.0" babel-plugin-transform-es2015-block-scoping@^6.23.0, babel-plugin-transform-es2015-block-scoping@^6.24.1: version "6.26.0" resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-block-scoping/-/babel-plugin-transform-es2015-block-scoping-6.26.0.tgz#d70f5299c1308d05c12f463813b0a09e73b1895f" + integrity sha1-1w9SmcEwjQXBL0Y4E7CgnnOxiV8= dependencies: babel-runtime "^6.26.0" babel-template "^6.26.0" @@ -594,6 +689,7 @@ babel-plugin-transform-es2015-block-scoping@^6.23.0, babel-plugin-transform-es20 babel-plugin-transform-es2015-classes@^6.23.0, babel-plugin-transform-es2015-classes@^6.24.1: version "6.24.1" resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-classes/-/babel-plugin-transform-es2015-classes-6.24.1.tgz#5a4c58a50c9c9461e564b4b2a3bfabc97a2584db" + integrity sha1-WkxYpQyclGHlZLSyo7+ryXolhNs= dependencies: babel-helper-define-map "^6.24.1" babel-helper-function-name "^6.24.1" @@ -608,6 +704,7 @@ babel-plugin-transform-es2015-classes@^6.23.0, babel-plugin-transform-es2015-cla babel-plugin-transform-es2015-computed-properties@^6.22.0, babel-plugin-transform-es2015-computed-properties@^6.24.1: version "6.24.1" resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-computed-properties/-/babel-plugin-transform-es2015-computed-properties-6.24.1.tgz#6fe2a8d16895d5634f4cd999b6d3480a308159b3" + integrity sha1-b+Ko0WiV1WNPTNmZttNICjCBWbM= dependencies: babel-runtime "^6.22.0" babel-template "^6.24.1" @@ -615,12 +712,14 @@ babel-plugin-transform-es2015-computed-properties@^6.22.0, babel-plugin-transfor babel-plugin-transform-es2015-destructuring@^6.22.0, babel-plugin-transform-es2015-destructuring@^6.23.0: version "6.23.0" resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-destructuring/-/babel-plugin-transform-es2015-destructuring-6.23.0.tgz#997bb1f1ab967f682d2b0876fe358d60e765c56d" + integrity sha1-mXux8auWf2gtKwh2/jWNYOdlxW0= dependencies: babel-runtime "^6.22.0" babel-plugin-transform-es2015-duplicate-keys@^6.22.0, babel-plugin-transform-es2015-duplicate-keys@^6.24.1: version "6.24.1" resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-duplicate-keys/-/babel-plugin-transform-es2015-duplicate-keys-6.24.1.tgz#73eb3d310ca969e3ef9ec91c53741a6f1576423e" + integrity sha1-c+s9MQypaePvnskcU3QabxV2Qj4= dependencies: babel-runtime "^6.22.0" babel-types "^6.24.1" @@ -628,12 +727,14 @@ babel-plugin-transform-es2015-duplicate-keys@^6.22.0, babel-plugin-transform-es2 babel-plugin-transform-es2015-for-of@^6.22.0, babel-plugin-transform-es2015-for-of@^6.23.0: version "6.23.0" resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-for-of/-/babel-plugin-transform-es2015-for-of-6.23.0.tgz#f47c95b2b613df1d3ecc2fdb7573623c75248691" + integrity sha1-9HyVsrYT3x0+zC/bdXNiPHUkhpE= dependencies: babel-runtime "^6.22.0" babel-plugin-transform-es2015-function-name@^6.22.0, babel-plugin-transform-es2015-function-name@^6.24.1: version "6.24.1" resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-function-name/-/babel-plugin-transform-es2015-function-name-6.24.1.tgz#834c89853bc36b1af0f3a4c5dbaa94fd8eacaa8b" + integrity sha1-g0yJhTvDaxrw86TF26qU/Y6sqos= dependencies: babel-helper-function-name "^6.24.1" babel-runtime "^6.22.0" @@ -642,12 +743,14 @@ babel-plugin-transform-es2015-function-name@^6.22.0, babel-plugin-transform-es20 babel-plugin-transform-es2015-literals@^6.22.0: version "6.22.0" resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-literals/-/babel-plugin-transform-es2015-literals-6.22.0.tgz#4f54a02d6cd66cf915280019a31d31925377ca2e" + integrity sha1-T1SgLWzWbPkVKAAZox0xklN3yi4= dependencies: babel-runtime "^6.22.0" babel-plugin-transform-es2015-modules-amd@^6.22.0, babel-plugin-transform-es2015-modules-amd@^6.24.1: version "6.24.1" resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-modules-amd/-/babel-plugin-transform-es2015-modules-amd-6.24.1.tgz#3b3e54017239842d6d19c3011c4bd2f00a00d154" + integrity sha1-Oz5UAXI5hC1tGcMBHEvS8AoA0VQ= dependencies: babel-plugin-transform-es2015-modules-commonjs "^6.24.1" babel-runtime "^6.22.0" @@ -656,6 +759,7 @@ babel-plugin-transform-es2015-modules-amd@^6.22.0, babel-plugin-transform-es2015 babel-plugin-transform-es2015-modules-commonjs@^6.23.0, babel-plugin-transform-es2015-modules-commonjs@^6.24.1: version "6.26.2" resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-modules-commonjs/-/babel-plugin-transform-es2015-modules-commonjs-6.26.2.tgz#58a793863a9e7ca870bdc5a881117ffac27db6f3" + integrity sha512-CV9ROOHEdrjcwhIaJNBGMBCodN+1cfkwtM1SbUHmvyy35KGT7fohbpOxkE2uLz1o6odKK2Ck/tz47z+VqQfi9Q== dependencies: babel-plugin-transform-strict-mode "^6.24.1" babel-runtime "^6.26.0" @@ -665,6 +769,7 @@ babel-plugin-transform-es2015-modules-commonjs@^6.23.0, babel-plugin-transform-e babel-plugin-transform-es2015-modules-systemjs@^6.23.0, babel-plugin-transform-es2015-modules-systemjs@^6.24.1: version "6.24.1" resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-modules-systemjs/-/babel-plugin-transform-es2015-modules-systemjs-6.24.1.tgz#ff89a142b9119a906195f5f106ecf305d9407d23" + integrity sha1-/4mhQrkRmpBhlfXxBuzzBdlAfSM= dependencies: babel-helper-hoist-variables "^6.24.1" babel-runtime "^6.22.0" @@ -673,6 +778,7 @@ babel-plugin-transform-es2015-modules-systemjs@^6.23.0, babel-plugin-transform-e babel-plugin-transform-es2015-modules-umd@^6.23.0, babel-plugin-transform-es2015-modules-umd@^6.24.1: version "6.24.1" resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-modules-umd/-/babel-plugin-transform-es2015-modules-umd-6.24.1.tgz#ac997e6285cd18ed6176adb607d602344ad38468" + integrity sha1-rJl+YoXNGO1hdq22B9YCNErThGg= dependencies: babel-plugin-transform-es2015-modules-amd "^6.24.1" babel-runtime "^6.22.0" @@ -681,6 +787,7 @@ babel-plugin-transform-es2015-modules-umd@^6.23.0, babel-plugin-transform-es2015 babel-plugin-transform-es2015-object-super@^6.22.0, babel-plugin-transform-es2015-object-super@^6.24.1: version "6.24.1" resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-object-super/-/babel-plugin-transform-es2015-object-super-6.24.1.tgz#24cef69ae21cb83a7f8603dad021f572eb278f8d" + integrity sha1-JM72muIcuDp/hgPa0CH1cusnj40= dependencies: babel-helper-replace-supers "^6.24.1" babel-runtime "^6.22.0" @@ -688,6 +795,7 @@ babel-plugin-transform-es2015-object-super@^6.22.0, babel-plugin-transform-es201 babel-plugin-transform-es2015-parameters@^6.23.0, babel-plugin-transform-es2015-parameters@^6.24.1: version "6.24.1" resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-parameters/-/babel-plugin-transform-es2015-parameters-6.24.1.tgz#57ac351ab49caf14a97cd13b09f66fdf0a625f2b" + integrity sha1-V6w1GrScrxSpfNE7CfZv3wpiXys= dependencies: babel-helper-call-delegate "^6.24.1" babel-helper-get-function-arity "^6.24.1" @@ -699,6 +807,7 @@ babel-plugin-transform-es2015-parameters@^6.23.0, babel-plugin-transform-es2015- babel-plugin-transform-es2015-shorthand-properties@^6.22.0, babel-plugin-transform-es2015-shorthand-properties@^6.24.1: version "6.24.1" resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-shorthand-properties/-/babel-plugin-transform-es2015-shorthand-properties-6.24.1.tgz#24f875d6721c87661bbd99a4622e51f14de38aa0" + integrity sha1-JPh11nIch2YbvZmkYi5R8U3jiqA= dependencies: babel-runtime "^6.22.0" babel-types "^6.24.1" @@ -706,12 +815,14 @@ babel-plugin-transform-es2015-shorthand-properties@^6.22.0, babel-plugin-transfo babel-plugin-transform-es2015-spread@^6.22.0: version "6.22.0" resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-spread/-/babel-plugin-transform-es2015-spread-6.22.0.tgz#d6d68a99f89aedc4536c81a542e8dd9f1746f8d1" + integrity sha1-1taKmfia7cRTbIGlQujdnxdG+NE= dependencies: babel-runtime "^6.22.0" babel-plugin-transform-es2015-sticky-regex@^6.22.0, babel-plugin-transform-es2015-sticky-regex@^6.24.1: version "6.24.1" resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-sticky-regex/-/babel-plugin-transform-es2015-sticky-regex-6.24.1.tgz#00c1cdb1aca71112cdf0cf6126c2ed6b457ccdbc" + integrity sha1-AMHNsaynERLN8M9hJsLta0V8zbw= dependencies: babel-helper-regex "^6.24.1" babel-runtime "^6.22.0" @@ -720,18 +831,21 @@ babel-plugin-transform-es2015-sticky-regex@^6.22.0, babel-plugin-transform-es201 babel-plugin-transform-es2015-template-literals@^6.22.0: version "6.22.0" resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-template-literals/-/babel-plugin-transform-es2015-template-literals-6.22.0.tgz#a84b3450f7e9f8f1f6839d6d687da84bb1236d8d" + integrity sha1-qEs0UPfp+PH2g51taH2oS7EjbY0= dependencies: babel-runtime "^6.22.0" babel-plugin-transform-es2015-typeof-symbol@^6.22.0, babel-plugin-transform-es2015-typeof-symbol@^6.23.0: version "6.23.0" resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-typeof-symbol/-/babel-plugin-transform-es2015-typeof-symbol-6.23.0.tgz#dec09f1cddff94b52ac73d505c84df59dcceb372" + integrity sha1-3sCfHN3/lLUqxz1QXITfWdzOs3I= dependencies: babel-runtime "^6.22.0" babel-plugin-transform-es2015-unicode-regex@^6.22.0, babel-plugin-transform-es2015-unicode-regex@^6.24.1: version "6.24.1" resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-unicode-regex/-/babel-plugin-transform-es2015-unicode-regex-6.24.1.tgz#d38b12f42ea7323f729387f18a7c5ae1faeb35e9" + integrity sha1-04sS9C6nMj9yk4fxinxa4frrNek= dependencies: babel-helper-regex "^6.24.1" babel-runtime "^6.22.0" @@ -740,6 +854,7 @@ babel-plugin-transform-es2015-unicode-regex@^6.22.0, babel-plugin-transform-es20 babel-plugin-transform-exponentiation-operator@^6.22.0, babel-plugin-transform-exponentiation-operator@^6.24.1: version "6.24.1" resolved "https://registry.yarnpkg.com/babel-plugin-transform-exponentiation-operator/-/babel-plugin-transform-exponentiation-operator-6.24.1.tgz#2ab0c9c7f3098fa48907772bb813fe41e8de3a0e" + integrity sha1-KrDJx/MJj6SJB3cruBP+QejeOg4= dependencies: babel-helper-builder-binary-assignment-operator-visitor "^6.24.1" babel-plugin-syntax-exponentiation-operator "^6.8.0" @@ -748,6 +863,7 @@ babel-plugin-transform-exponentiation-operator@^6.22.0, babel-plugin-transform-e babel-plugin-transform-object-rest-spread@^6.22.0: version "6.26.0" resolved "https://registry.yarnpkg.com/babel-plugin-transform-object-rest-spread/-/babel-plugin-transform-object-rest-spread-6.26.0.tgz#0f36692d50fef6b7e2d4b3ac1478137a963b7b06" + integrity sha1-DzZpLVD+9rfi1LOsFHgTepY7ewY= dependencies: babel-plugin-syntax-object-rest-spread "^6.8.0" babel-runtime "^6.26.0" @@ -755,12 +871,14 @@ babel-plugin-transform-object-rest-spread@^6.22.0: babel-plugin-transform-regenerator@^6.22.0, babel-plugin-transform-regenerator@^6.24.1: version "6.26.0" resolved "https://registry.yarnpkg.com/babel-plugin-transform-regenerator/-/babel-plugin-transform-regenerator-6.26.0.tgz#e0703696fbde27f0a3efcacf8b4dca2f7b3a8f2f" + integrity sha1-4HA2lvveJ/Cj78rPi03KL3s6jy8= dependencies: regenerator-transform "^0.10.0" babel-plugin-transform-strict-mode@^6.24.1: version "6.24.1" resolved "https://registry.yarnpkg.com/babel-plugin-transform-strict-mode/-/babel-plugin-transform-strict-mode-6.24.1.tgz#d5faf7aa578a65bbe591cf5edae04a0c67020758" + integrity sha1-1fr3qleKZbvlkc9e2uBKDGcCB1g= dependencies: babel-runtime "^6.22.0" babel-types "^6.24.1" @@ -768,6 +886,7 @@ babel-plugin-transform-strict-mode@^6.24.1: babel-polyfill@6.26.0: version "6.26.0" resolved "https://registry.yarnpkg.com/babel-polyfill/-/babel-polyfill-6.26.0.tgz#379937abc67d7895970adc621f284cd966cf2153" + integrity sha1-N5k3q8Z9eJWXCtxiHyhM2WbPIVM= dependencies: babel-runtime "^6.26.0" core-js "^2.5.0" @@ -776,6 +895,7 @@ babel-polyfill@6.26.0: babel-preset-env@^1.7.0: version "1.7.0" resolved "https://registry.yarnpkg.com/babel-preset-env/-/babel-preset-env-1.7.0.tgz#dea79fa4ebeb883cd35dab07e260c1c9c04df77a" + integrity sha512-9OR2afuKDneX2/q2EurSftUYM0xGu4O2D9adAhVfADDhrYDaxXV0rBbevVYoY9n6nyX1PmQW/0jtpJvUNr9CHg== dependencies: babel-plugin-check-es2015-constants "^6.22.0" babel-plugin-syntax-trailing-function-commas "^6.22.0" @@ -811,6 +931,7 @@ babel-preset-env@^1.7.0: babel-preset-es2015@6.24.1: version "6.24.1" resolved "https://registry.yarnpkg.com/babel-preset-es2015/-/babel-preset-es2015-6.24.1.tgz#d44050d6bc2c9feea702aaf38d727a0210538939" + integrity sha1-1EBQ1rwsn+6nAqrzjXJ6AhBTiTk= dependencies: babel-plugin-check-es2015-constants "^6.22.0" babel-plugin-transform-es2015-arrow-functions "^6.22.0" @@ -840,6 +961,7 @@ babel-preset-es2015@6.24.1: babel-preset-stage-2@6.24.1: version "6.24.1" resolved "https://registry.yarnpkg.com/babel-preset-stage-2/-/babel-preset-stage-2-6.24.1.tgz#d9e2960fb3d71187f0e64eec62bc07767219bdc1" + integrity sha1-2eKWD7PXEYfw5k7sYrwHdnIZvcE= dependencies: babel-plugin-syntax-dynamic-import "^6.18.0" babel-plugin-transform-class-properties "^6.24.1" @@ -849,6 +971,7 @@ babel-preset-stage-2@6.24.1: babel-preset-stage-3@6.24.1, babel-preset-stage-3@^6.24.1: version "6.24.1" resolved "https://registry.yarnpkg.com/babel-preset-stage-3/-/babel-preset-stage-3-6.24.1.tgz#836ada0a9e7a7fa37cb138fb9326f87934a48395" + integrity sha1-g2raCp56f6N8sTj7kyb4eTSkg5U= dependencies: babel-plugin-syntax-trailing-function-commas "^6.22.0" babel-plugin-transform-async-generator-functions "^6.24.1" @@ -859,6 +982,7 @@ babel-preset-stage-3@6.24.1, babel-preset-stage-3@^6.24.1: babel-register@6.26.0, babel-register@^6.26.0: version "6.26.0" resolved "https://registry.yarnpkg.com/babel-register/-/babel-register-6.26.0.tgz#6ed021173e2fcb486d7acb45c6009a856f647071" + integrity sha1-btAhFz4vy0htestFxgCahW9kcHE= dependencies: babel-core "^6.26.0" babel-runtime "^6.26.0" @@ -871,6 +995,7 @@ babel-register@6.26.0, babel-register@^6.26.0: babel-runtime@^6.18.0, babel-runtime@^6.22.0, babel-runtime@^6.26.0: version "6.26.0" resolved "https://registry.yarnpkg.com/babel-runtime/-/babel-runtime-6.26.0.tgz#965c7058668e82b55d7bfe04ff2337bc8b5647fe" + integrity sha1-llxwWGaOgrVde/4E/yM3vItWR/4= dependencies: core-js "^2.4.0" regenerator-runtime "^0.11.0" @@ -878,6 +1003,7 @@ babel-runtime@^6.18.0, babel-runtime@^6.22.0, babel-runtime@^6.26.0: babel-template@^6.24.1, babel-template@^6.26.0: version "6.26.0" resolved "https://registry.yarnpkg.com/babel-template/-/babel-template-6.26.0.tgz#de03e2d16396b069f46dd9fff8521fb1a0e35e02" + integrity sha1-3gPi0WOWsGn0bdn/+FIfsaDjXgI= dependencies: babel-runtime "^6.26.0" babel-traverse "^6.26.0" @@ -888,6 +1014,7 @@ babel-template@^6.24.1, babel-template@^6.26.0: babel-traverse@^6.24.1, babel-traverse@^6.26.0: version "6.26.0" resolved "https://registry.yarnpkg.com/babel-traverse/-/babel-traverse-6.26.0.tgz#46a9cbd7edcc62c8e5c064e2d2d8d0f4035766ee" + integrity sha1-RqnL1+3MYsjlwGTi0tjQ9ANXZu4= dependencies: babel-code-frame "^6.26.0" babel-messages "^6.23.0" @@ -902,6 +1029,7 @@ babel-traverse@^6.24.1, babel-traverse@^6.26.0: babel-types@^6.19.0, babel-types@^6.24.1, babel-types@^6.26.0: version "6.26.0" resolved "https://registry.yarnpkg.com/babel-types/-/babel-types-6.26.0.tgz#a3b073f94ab49eb6fa55cd65227a334380632497" + integrity sha1-o7Bz+Uq0nrb6Vc1lInozQ4BjJJc= dependencies: babel-runtime "^6.26.0" esutils "^2.0.2" @@ -911,6 +1039,7 @@ babel-types@^6.19.0, babel-types@^6.24.1, babel-types@^6.26.0: babelify@^7.3.0: version "7.3.0" resolved "https://registry.yarnpkg.com/babelify/-/babelify-7.3.0.tgz#aa56aede7067fd7bd549666ee16dc285087e88e5" + integrity sha1-qlau3nBn/XvVSWZu4W3ChQh+iOU= dependencies: babel-core "^6.0.14" object-assign "^4.0.0" @@ -918,28 +1047,34 @@ babelify@^7.3.0: babylon@^6.18.0: version "6.18.0" resolved "https://registry.yarnpkg.com/babylon/-/babylon-6.18.0.tgz#af2f3b88fa6f5c1e4c634d1a0f8eac4f55b395e3" + integrity sha512-q/UEjfGJ2Cm3oKV71DJz9d25TPnq5rhBVL2Q4fA5wcC3jcrdn7+SssEybFIxwAvvP+YCsCYNKughoF33GxgycQ== balanced-match@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767" + integrity sha1-ibTRmasr7kneFk6gK4nORi1xt2c= base-x@^3.0.2: - version "3.0.4" - resolved "https://registry.yarnpkg.com/base-x/-/base-x-3.0.4.tgz#94c1788736da065edb1d68808869e357c977fa77" + version "3.0.5" + resolved "https://registry.yarnpkg.com/base-x/-/base-x-3.0.5.tgz#d3ada59afed05b921ab581ec3112e6444ba0795a" + integrity sha512-C3picSgzPSLE+jW3tcBzJoGwitOtazb5B+5YmAxZm2ybmTi9LNgAtDO/jjVEBZwHoXmDBZ9m/IELj3elJVRBcA== dependencies: safe-buffer "^5.0.1" base64-js@0.0.8: version "0.0.8" resolved "https://registry.yarnpkg.com/base64-js/-/base64-js-0.0.8.tgz#1101e9544f4a76b1bc3b26d452ca96d7a35e7978" + integrity sha1-EQHpVE9KdrG8OybUUsqW16NeeXg= base64-js@^1.0.2: version "1.3.0" resolved "https://registry.yarnpkg.com/base64-js/-/base64-js-1.3.0.tgz#cab1e6118f051095e58b5281aea8c1cd22bfc0e3" + integrity sha512-ccav/yGvoa80BQDljCxsmmQ3Xvx60/UpBIij5QN21W3wBi/hhIC9OoO+KLpu9IJTS9j4DRVJ3aDDF9cMSoa2lw== base@^0.11.1: version "0.11.2" resolved "https://registry.yarnpkg.com/base/-/base-0.11.2.tgz#7bde5ced145b6d551a90db87f83c558b4eb48a8f" + integrity sha512-5T6P4xPgpp0YDFvSWwEZ4NoE3aM4QBQXDzmVbraCkFj8zHM+mba8SyqB5DbZWyR7mYHo6Y7BdQo3MoA4m0TeQg== dependencies: cache-base "^1.0.1" class-utils "^0.3.5" @@ -952,12 +1087,14 @@ base@^0.11.1: bcrypt-pbkdf@^1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz#a4301d389b6a43f9b67ff3ca11a3f6637e360e9e" + integrity sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4= dependencies: tweetnacl "^0.14.3" big.js@^3.1.3: version "3.2.0" resolved "https://registry.yarnpkg.com/big.js/-/big.js-3.2.0.tgz#a5fc298b81b9e0dca2e458824784b65c52ba588e" + integrity sha512-+hN/Zh2D08Mx65pZ/4g5bsmNiZUuChDiQfTUQ7qJr4/kuopCr88xZsAXv6mBoZEsUI4OuGHlX59qE94K2mMW8Q== bignumber.js@5.0.0: version "5.0.0" @@ -966,10 +1103,12 @@ bignumber.js@5.0.0: bignumber.js@^4.0.2: version "4.1.0" resolved "https://registry.yarnpkg.com/bignumber.js/-/bignumber.js-4.1.0.tgz#db6f14067c140bd46624815a7916c92d9b6c24b1" + integrity sha512-eJzYkFYy9L4JzXsbymsFn3p54D+llV27oTQ+ziJG7WFRheJcNZilgVXMG0LoZtlQSKBsJdWtLFqOD0u+U0jZKA== -bignumber.js@^6.0.0: - version "6.0.0" - resolved "https://registry.yarnpkg.com/bignumber.js/-/bignumber.js-6.0.0.tgz#bbfa047644609a5af093e9cbd83b0461fa3f6002" +bignumber.js@^7.2.1: + version "7.2.1" + resolved "https://registry.yarnpkg.com/bignumber.js/-/bignumber.js-7.2.1.tgz#80c048759d826800807c4bfd521e50edbba57a5f" + integrity sha512-S4XzBk5sMB+Rcb/LNcpzXr57VRTxgAvaAEDAl1AwRx27j00hT84O6OkteE7u8UB3NuaaygCRrEpqox4uDOrbdQ== "bignumber.js@git+https://github.com/debris/bignumber.js#master": version "2.0.7" @@ -986,20 +1125,24 @@ bignumber.js@^6.0.0: binary-extensions@^1.0.0: version "1.12.0" resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-1.12.0.tgz#c2d780f53d45bba8317a8902d4ceeaf3a6385b14" + integrity sha512-DYWGk01lDcxeS/K9IHPGWfT8PsJmbXRtRd2Sx72Tnb8pcYZQFF1oSDb8hJtS1vhp212q1Rzi5dUf9+nq0o9UIg== bindings@^1.2.1: - version "1.3.0" - resolved "https://registry.yarnpkg.com/bindings/-/bindings-1.3.0.tgz#b346f6ecf6a95f5a815c5839fc7cdb22502f1ed7" + version "1.3.1" + resolved "https://registry.yarnpkg.com/bindings/-/bindings-1.3.1.tgz#21fc7c6d67c18516ec5aaa2815b145ff77b26ea5" + integrity sha512-i47mqjF9UbjxJhxGf+pZ6kSxrnI3wBLlnGI2ArWJ4r0VrvDS7ZYXkprq/pLaBWYq4GM0r4zdHY+NNRqEMU7uew== bip66@^1.1.3: version "1.1.5" resolved "https://registry.yarnpkg.com/bip66/-/bip66-1.1.5.tgz#01fa8748785ca70955d5011217d1b3139969ca22" + integrity sha1-AfqHSHhcpwlV1QESF9GzE5lpyiI= dependencies: safe-buffer "^5.0.1" bitcore-lib@^0.15.0: version "0.15.0" resolved "https://registry.yarnpkg.com/bitcore-lib/-/bitcore-lib-0.15.0.tgz#f924be13869f2aab7e04aeec5642ad3359b6cec2" + integrity sha512-AeXLWhiivF6CDFzrABZHT4jJrflyylDWTi32o30rF92HW9msfuKpjzrHtFKYGa9w0kNVv5HABQjCB3OEav4PhQ== dependencies: bn.js "=4.11.8" bs58 "=4.0.1" @@ -1008,16 +1151,30 @@ bitcore-lib@^0.15.0: inherits "=2.0.1" lodash "=4.17.4" +bitcore-lib@^0.16.0: + version "0.16.0" + resolved "https://registry.yarnpkg.com/bitcore-lib/-/bitcore-lib-0.16.0.tgz#a2c3ec1108cdb90386f728282ab833e0c77c9533" + integrity sha512-CEtcrPAH2gwgaMN+OPMJc18TBEak1+TtzMyafrqrIbK9PIa3kat195qBJhC0liJSHRiRr6IE2eLcXeIFFs+U8w== + dependencies: + bn.js "=4.11.8" + bs58 "=4.0.1" + buffer-compare "=1.1.1" + elliptic "=6.4.0" + inherits "=2.0.1" + lodash "=4.17.11" + bitcore-mnemonic@^1.5.0: - version "1.5.0" - resolved "https://registry.yarnpkg.com/bitcore-mnemonic/-/bitcore-mnemonic-1.5.0.tgz#c7e785beb6bf0616ed4992785dc3658670425a39" + version "1.7.0" + resolved "https://registry.yarnpkg.com/bitcore-mnemonic/-/bitcore-mnemonic-1.7.0.tgz#253295a773135e1a0b455871de614996afc8f5e1" + integrity sha512-1JV1okgz9Vv+Y4fG2m3ToR+BGdKA6tSoqjepIxA95BZjW6YaeopVW4iOe/dY9dnkZH4+LA2AJ4YbDE6H3ih3Yw== dependencies: - bitcore-lib "^0.15.0" - unorm "^1.3.3" + bitcore-lib "^0.16.0" + unorm "^1.4.1" bl@^1.0.0: version "1.2.2" resolved "https://registry.yarnpkg.com/bl/-/bl-1.2.2.tgz#a160911717103c07410cef63ef51b397c025af9c" + integrity sha512-e8tQYnZodmebYDWGH7KMRvtzKXaJHx3BbilrgZCfvyLUYdKpK1t5PSPmpkny/SgiTSCnjfLW7v5rlONXVFkQEA== dependencies: readable-stream "^2.3.5" safe-buffer "^5.1.1" @@ -1025,32 +1182,39 @@ bl@^1.0.0: block-stream@*: version "0.0.9" resolved "https://registry.yarnpkg.com/block-stream/-/block-stream-0.0.9.tgz#13ebfe778a03205cfe03751481ebb4b3300c126a" + integrity sha1-E+v+d4oDIFz+A3UUgeu0szAMEmo= dependencies: inherits "~2.0.0" bluebird@^2.9.34: version "2.11.0" resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-2.11.0.tgz#534b9033c022c9579c56ba3b3e5a5caafbb650e1" + integrity sha1-U0uQM8AiyVecVro7Plpcqvu2UOE= -bluebird@^3.4.6, bluebird@^3.5.0: - version "3.5.2" - resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.5.2.tgz#1be0908e054a751754549c270489c1505d4ab15a" +bluebird@^3.4.6, bluebird@^3.5.0, bluebird@^3.5.3: + version "3.5.3" + resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.5.3.tgz#7d01c6f9616c9a51ab0f8c549a79dfe6ec33efa7" + integrity sha512-/qKPUQlaW1OyR51WeCPBvRnAlnZFUJkCSG5HzGnuIqhgyJtF+T94lFnn33eiazjRm2LAHVy2guNnaq48X9SJuw== bn.js@4.11.6: version "4.11.6" resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-4.11.6.tgz#53344adb14617a13f6e8dd2ce28905d1c0ba3215" + integrity sha1-UzRK2xRhehP26N0s4okF0cC6MhU= -bn.js@=4.11.8, bn.js@^4.0.0, bn.js@^4.1.0, bn.js@^4.1.1, bn.js@^4.10.0, bn.js@^4.11.0, bn.js@^4.11.3, bn.js@^4.11.6, bn.js@^4.4.0, bn.js@^4.8.0: +bn.js@4.11.8, bn.js@=4.11.8, bn.js@^4.0.0, bn.js@^4.1.0, bn.js@^4.1.1, bn.js@^4.10.0, bn.js@^4.11.0, bn.js@^4.11.3, bn.js@^4.11.6, bn.js@^4.4.0, bn.js@^4.8.0: version "4.11.8" resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-4.11.8.tgz#2cde09eb5ee341f484746bb0309b3253b1b1442f" + integrity sha512-ItfYfPLkWHUjckQCk8xC+LwxgK8NYcXywGigJgSwOP8Y2iyWT4f2vsZnoOXTTbo+o5yXmIUJ4gn5538SO5S3gA== bn.js@^2.0.3: version "2.2.0" resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-2.2.0.tgz#12162bc2ae71fc40a5626c33438f3a875cd37625" + integrity sha1-EhYrwq5x/EClYmwzQ486h1zTdiU= body-parser@1.18.3, body-parser@^1.16.0: version "1.18.3" resolved "https://registry.yarnpkg.com/body-parser/-/body-parser-1.18.3.tgz#5b292198ffdd553b3a0f20ded0592b956955c8b4" + integrity sha1-WykhmP/dVTs6DyDe0FkrlWlVyLQ= dependencies: bytes "3.0.0" content-type "~1.0.4" @@ -1064,10 +1228,11 @@ body-parser@1.18.3, body-parser@^1.16.0: type-is "~1.6.16" borc@^2.0.2: - version "2.0.3" - resolved "https://registry.yarnpkg.com/borc/-/borc-2.0.3.tgz#08845ea73a6d3211120928ee3929f8dc2de9f52e" + version "2.0.4" + resolved "https://registry.yarnpkg.com/borc/-/borc-2.0.4.tgz#52926dc561137188c6ca9fe01c9542576529a689" + integrity sha512-SCVjto/dbKfduyl+LDQ1Km28ly2aTIXtJbrYZWHFQAxkHph96I/zXTrTQXWuJobG8lQZjIA/dw9z7hmJHJhjMg== dependencies: - bignumber.js "^6.0.0" + bignumber.js "^7.2.1" commander "^2.15.0" ieee754 "^1.1.8" json-text-sequence "^0.1" @@ -1075,6 +1240,7 @@ borc@^2.0.2: brace-expansion@^1.1.7: version "1.1.11" resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd" + integrity sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA== dependencies: balanced-match "^1.0.0" concat-map "0.0.1" @@ -1082,6 +1248,7 @@ brace-expansion@^1.1.7: braces@^1.8.2: version "1.8.5" resolved "https://registry.yarnpkg.com/braces/-/braces-1.8.5.tgz#ba77962e12dff969d6b76711e914b737857bf6a7" + integrity sha1-uneWLhLf+WnWt2cR6RS3N4V79qc= dependencies: expand-range "^1.8.1" preserve "^0.2.0" @@ -1090,6 +1257,7 @@ braces@^1.8.2: braces@^2.3.0, braces@^2.3.1: version "2.3.2" resolved "https://registry.yarnpkg.com/braces/-/braces-2.3.2.tgz#5979fd3f14cd531565e5fa2df1abfff1dfaee729" + integrity sha512-aNdbnj9P8PjdXU4ybaWLK2IF3jc/EoDYbC7AazW6to3TRsfXxscC9UXOB5iDiEQrkyIbWp2SLQda4+QAa7nc3w== dependencies: arr-flatten "^1.1.0" array-unique "^0.3.2" @@ -1105,18 +1273,22 @@ braces@^2.3.0, braces@^2.3.1: brorand@^1.0.1: version "1.1.0" resolved "https://registry.yarnpkg.com/brorand/-/brorand-1.1.0.tgz#12c25efe40a45e3c323eb8675a0a0ce57b22371f" + integrity sha1-EsJe/kCkXjwyPrhnWgoM5XsiNx8= browser-stdout@1.3.0: version "1.3.0" resolved "https://registry.yarnpkg.com/browser-stdout/-/browser-stdout-1.3.0.tgz#f351d32969d32fa5d7a5567154263d928ae3bd1f" + integrity sha1-81HTKWnTL6XXpVZxVCY9korjvR8= browser-stdout@1.3.1: version "1.3.1" resolved "https://registry.yarnpkg.com/browser-stdout/-/browser-stdout-1.3.1.tgz#baa559ee14ced73452229bad7326467c61fabd60" + integrity sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw== browserify-aes@^1.0.0, browserify-aes@^1.0.4, browserify-aes@^1.0.6: version "1.2.0" resolved "https://registry.yarnpkg.com/browserify-aes/-/browserify-aes-1.2.0.tgz#326734642f403dabc3003209853bb70ad428ef48" + integrity sha512-+7CHXqGuspUn/Sl5aO7Ea0xWGAtETPXNSAjHo48JfLdPWcMng33Xe4znFvQweqc/uzk5zSOI3H52CYnjCfb5hA== dependencies: buffer-xor "^1.0.3" cipher-base "^1.0.0" @@ -1128,6 +1300,7 @@ browserify-aes@^1.0.0, browserify-aes@^1.0.4, browserify-aes@^1.0.6: browserify-cipher@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/browserify-cipher/-/browserify-cipher-1.0.1.tgz#8d6474c1b870bfdabcd3bcfcc1934a10e94f15f0" + integrity sha512-sPhkz0ARKbf4rRQt2hTpAHqn47X3llLkUGn+xEJzLjwY8LRs2p0v7ljvI5EyoRO/mexrNunNECisZs+gw2zz1w== dependencies: browserify-aes "^1.0.4" browserify-des "^1.0.0" @@ -1136,6 +1309,7 @@ browserify-cipher@^1.0.0: browserify-des@^1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/browserify-des/-/browserify-des-1.0.2.tgz#3af4f1f59839403572f1c66204375f7a7f703e9c" + integrity sha512-BioO1xf3hFwz4kc6iBhI3ieDFompMhrMlnDFC4/0/vd5MokpuAc3R+LYbwTA9A5Yc9pq9UYPqffKpW2ObuwX5A== dependencies: cipher-base "^1.0.1" des.js "^1.0.0" @@ -1145,6 +1319,7 @@ browserify-des@^1.0.0: browserify-rsa@^4.0.0: version "4.0.1" resolved "https://registry.yarnpkg.com/browserify-rsa/-/browserify-rsa-4.0.1.tgz#21e0abfaf6f2029cf2fafb133567a701d4135524" + integrity sha1-IeCr+vbyApzy+vsTNWenAdQTVSQ= dependencies: bn.js "^4.1.0" randombytes "^2.0.1" @@ -1152,12 +1327,14 @@ browserify-rsa@^4.0.0: browserify-sha3@^0.0.1: version "0.0.1" resolved "https://registry.yarnpkg.com/browserify-sha3/-/browserify-sha3-0.0.1.tgz#3ff34a3006ef15c0fb3567e541b91a2340123d11" + integrity sha1-P/NKMAbvFcD7NWflQbkaI0ASPRE= dependencies: js-sha3 "^0.3.1" browserify-sign@^4.0.0: version "4.0.4" resolved "https://registry.yarnpkg.com/browserify-sign/-/browserify-sign-4.0.4.tgz#aa4eb68e5d7b658baa6bf6a57e630cbd7a93d298" + integrity sha1-qk62jl17ZYuqa/alfmMMvXqT0pg= dependencies: bn.js "^4.1.1" browserify-rsa "^4.0.0" @@ -1170,12 +1347,14 @@ browserify-sign@^4.0.0: browserify-zlib@^0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/browserify-zlib/-/browserify-zlib-0.2.0.tgz#2869459d9aa3be245fe8fe2ca1f46e2e7f54d73f" + integrity sha512-Z942RysHXmJrhqk88FmKBVq/v5tqmSkDz7p54G/MGyjMnCFFnC79XWNbg+Vta8W6Wb2qtSZTSxIGkJrRpCFEiA== dependencies: pako "~1.0.5" browserslist@^3.2.6: version "3.2.8" resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-3.2.8.tgz#b0005361d6471f0f5952797a76fc985f1f978fc6" + integrity sha512-WHVocJYavUwVgVViC0ORikPHQquXwVh939TaelZ4WDqpWgTX/FsGhl/+P4qBUAGcRvtOgDgC+xftNWWp2RUTAQ== dependencies: caniuse-lite "^1.0.30000844" electron-to-chromium "^1.3.47" @@ -1183,16 +1362,19 @@ browserslist@^3.2.6: bs58@=4.0.1, bs58@^4.0.0, bs58@^4.0.1: version "4.0.1" resolved "https://registry.yarnpkg.com/bs58/-/bs58-4.0.1.tgz#be161e76c354f6f788ae4071f63f34e8c4f0a42a" + integrity sha1-vhYedsNU9veIrkBx9j806MTwpCo= dependencies: base-x "^3.0.2" bs58@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/bs58/-/bs58-2.0.1.tgz#55908d58f1982aba2008fa1bed8f91998a29bf8d" + integrity sha1-VZCNWPGYKrogCPob7Y+RmYopv40= bs58check@^2.1.2: version "2.1.2" resolved "https://registry.yarnpkg.com/bs58check/-/bs58check-2.1.2.tgz#53b018291228d82a5aa08e7d796fdafda54aebfc" + integrity sha512-0TS1jicxdU09dwJMNZtVAfzPi6Q6QeN0pM1Fkzrjn+XYHvzMKPU3pHVpva+769iNVSfIYWf7LJ6WR+BuuMf8cA== dependencies: bs58 "^4.0.0" create-hash "^1.1.0" @@ -1201,14 +1383,17 @@ bs58check@^2.1.2: bson@^1.0.4: version "1.1.0" resolved "https://registry.yarnpkg.com/bson/-/bson-1.1.0.tgz#bee57d1fb6a87713471af4e32bcae36de814b5b0" + integrity sha512-9Aeai9TacfNtWXOYarkFJRW2CWo+dRon+fuLZYJmvLV3+MiUp0bEI6IAZfXEIg7/Pl/7IWlLaDnhzTsD81etQA== buffer-alloc-unsafe@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/buffer-alloc-unsafe/-/buffer-alloc-unsafe-1.1.0.tgz#bd7dc26ae2972d0eda253be061dba992349c19f0" + integrity sha512-TEM2iMIEQdJ2yjPJoSIsldnleVaAk1oW3DBVUykyOLsEsFmEc9kn+SFFPz+gl54KQNxlDnAwCXosOS9Okx2xAg== buffer-alloc@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/buffer-alloc/-/buffer-alloc-1.2.0.tgz#890dd90d923a873e08e10e5fd51a57e5b7cce0ec" + integrity sha512-CFsHQgjtW1UChdXgbyJGtnm+O/uLQeZdtbDo8mfUgYXCHSM1wgrVxXm6bSyrUuErEb+4sYVGCzASBRot7zyrow== dependencies: buffer-alloc-unsafe "^1.1.0" buffer-fill "^1.0.0" @@ -1216,30 +1401,37 @@ buffer-alloc@^1.2.0: buffer-compare@=1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/buffer-compare/-/buffer-compare-1.1.1.tgz#5be7be853af89198d1f4ddc090d1d66a48aef596" + integrity sha1-W+e+hTr4kZjR9N3AkNHWakiu9ZY= buffer-crc32@~0.2.3: version "0.2.13" resolved "https://registry.yarnpkg.com/buffer-crc32/-/buffer-crc32-0.2.13.tgz#0d333e3f00eac50aa1454abd30ef8c2a5d9a7242" + integrity sha1-DTM+PwDqxQqhRUq9MO+MKl2ackI= buffer-fill@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/buffer-fill/-/buffer-fill-1.0.0.tgz#f8f78b76789888ef39f205cd637f68e702122b2c" + integrity sha1-+PeLdniYiO858gXNY39o5wISKyw= buffer-from@^1.0.0: version "1.1.1" resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.1.tgz#32713bc028f75c02fdb710d7c7bcec1f2c6070ef" + integrity sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A== buffer-to-arraybuffer@^0.0.5: version "0.0.5" resolved "https://registry.yarnpkg.com/buffer-to-arraybuffer/-/buffer-to-arraybuffer-0.0.5.tgz#6064a40fa76eb43c723aba9ef8f6e1216d10511a" + integrity sha1-YGSkD6dutDxyOrqe+PbhIW0QURo= buffer-xor@^1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/buffer-xor/-/buffer-xor-1.0.3.tgz#26e61ed1422fb70dd42e6e36729ed51d855fe8d9" + integrity sha1-JuYe0UIvtw3ULm42cp7VHYVf6Nk= buffer@^3.0.1: version "3.6.0" resolved "https://registry.yarnpkg.com/buffer/-/buffer-3.6.0.tgz#a72c936f77b96bf52f5f7e7b467180628551defb" + integrity sha1-pyyTb3e5a/UvX357RnGAYoVR3vs= dependencies: base64-js "0.0.8" ieee754 "^1.1.4" @@ -1248,6 +1440,7 @@ buffer@^3.0.1: buffer@^4.3.0, buffer@^4.9.0: version "4.9.1" resolved "https://registry.yarnpkg.com/buffer/-/buffer-4.9.1.tgz#6d1bb601b07a4efced97094132093027c95bc298" + integrity sha1-bRu2AbB6TvztlwlBMgkwJ8lbwpg= dependencies: base64-js "^1.0.2" ieee754 "^1.1.4" @@ -1256,6 +1449,7 @@ buffer@^4.3.0, buffer@^4.9.0: buffer@^5.0.5: version "5.2.1" resolved "https://registry.yarnpkg.com/buffer/-/buffer-5.2.1.tgz#dd57fa0f109ac59c602479044dca7b8b3d0b71d6" + integrity sha512-c+Ko0loDaFfuPWiL02ls9Xd3GO3cPVmUobQ6t3rXNUk304u6hGq+8N/kFi+QEIKhzK3uwolVhLzszmfLmMLnqg== dependencies: base64-js "^1.0.2" ieee754 "^1.1.4" @@ -1263,18 +1457,22 @@ buffer@^5.0.5: builtin-modules@^1.0.0: version "1.1.1" resolved "https://registry.yarnpkg.com/builtin-modules/-/builtin-modules-1.1.1.tgz#270f076c5a72c02f5b65a47df94c5fe3a278892f" + integrity sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8= builtin-status-codes@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/builtin-status-codes/-/builtin-status-codes-3.0.0.tgz#85982878e21b98e1c66425e03d0174788f569ee8" + integrity sha1-hZgoeOIbmOHGZCXgPQF0eI9Wnug= bytes@3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/bytes/-/bytes-3.0.0.tgz#d32815404d689699f85a4ea4fa8755dd13a96048" + integrity sha1-0ygVQE1olpn4Wk6k+odV3ROpYEg= cache-base@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/cache-base/-/cache-base-1.0.1.tgz#0a7f46416831c8b662ee36fe4e7c59d76f666ab2" + integrity sha512-AKcdTnFSWATd5/GCPRxr2ChwIJ85CeyrEyjRHlKxQ56d4XJMGym0uAiKn0xbLOGOl3+yRpOTi484dVCEc5AUzQ== dependencies: collection-visit "^1.0.0" component-emitter "^1.2.1" @@ -1289,43 +1487,52 @@ cache-base@^1.0.1: caller-path@^0.1.0: version "0.1.0" resolved "https://registry.yarnpkg.com/caller-path/-/caller-path-0.1.0.tgz#94085ef63581ecd3daa92444a8fe94e82577751f" + integrity sha1-lAhe9jWB7NPaqSREqP6U6CV3dR8= dependencies: callsites "^0.2.0" callsites@^0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/callsites/-/callsites-0.2.0.tgz#afab96262910a7f33c19a5775825c69f34e350ca" + integrity sha1-r6uWJikQp/M8GaV3WCXGnzTjUMo= camelcase@^1.0.2: version "1.2.1" resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-1.2.1.tgz#9bb5304d2e0b56698b2c758b08a3eaa9daa58a39" + integrity sha1-m7UwTS4LVmmLLHWLCKPqqdqlijk= camelcase@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-3.0.0.tgz#32fc4b9fcdaf845fcdf7e73bb97cac2261f0ab0a" + integrity sha1-MvxLn82vhF/N9+c7uXysImHwqwo= camelcase@^4.1.0: version "4.1.0" resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-4.1.0.tgz#d545635be1e33c542649c69173e5de6acfae34dd" + integrity sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0= caminte@0.3.7: version "0.3.7" resolved "https://registry.yarnpkg.com/caminte/-/caminte-0.3.7.tgz#ec1ec0457664a0f092643b7c646c457d5cd6f693" + integrity sha1-7B7ARXZkoPCSZDt8ZGxFfVzW9pM= dependencies: bluebird "^3.4.6" uuid "^3.0.1" caniuse-lite@^1.0.30000844: - version "1.0.30000890" - resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30000890.tgz#86a18ffcc65d79ec6a437e985761b8bf1c4efeaf" + version "1.0.30000921" + resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30000921.tgz#7a607c1623444b22351d834e093aedda3c42fbe8" + integrity sha512-Bu09ciy0lMWLgpYC77I0YGuI8eFRBPPzaSOYJK1jTI64txCphYCqnWbxJYjHABYVt/TYX/p3jNjLBR87u1Bfpw== caseless@~0.12.0: version "0.12.0" resolved "https://registry.yarnpkg.com/caseless/-/caseless-0.12.0.tgz#1b681c21ff84033c826543090689420d187151dc" + integrity sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw= center-align@^0.1.1: version "0.1.3" resolved "https://registry.yarnpkg.com/center-align/-/center-align-0.1.3.tgz#aa0d32629b6ee972200411cbd4461c907bc2b7ad" + integrity sha1-qg0yYptu6XIgBBHL1EYckHvCt60= dependencies: align-text "^0.1.3" lazy-cache "^1.0.3" @@ -1333,6 +1540,7 @@ center-align@^0.1.1: chalk@^1.1.3: version "1.1.3" resolved "https://registry.yarnpkg.com/chalk/-/chalk-1.1.3.tgz#a8115c55e4a702fe4d150abd3872822a7e09fc98" + integrity sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg= dependencies: ansi-styles "^2.2.1" escape-string-regexp "^1.0.2" @@ -1343,6 +1551,7 @@ chalk@^1.1.3: chalk@^2.0.0, chalk@^2.1.0, chalk@^2.3.1, chalk@^2.4.1: version "2.4.1" resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.1.tgz#18c49ab16a037b6eb0152cc83e3471338215b66e" + integrity sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ== dependencies: ansi-styles "^3.2.1" escape-string-regexp "^1.0.5" @@ -1359,12 +1568,14 @@ charenc@~0.0.1: checkpoint-store@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/checkpoint-store/-/checkpoint-store-1.1.0.tgz#04e4cb516b91433893581e6d4601a78e9552ea06" + integrity sha1-BOTLUWuRQziTWB5tRgGnjpVS6gY= dependencies: functional-red-black-tree "^1.0.1" chokidar@^1.6.0: version "1.7.0" resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-1.7.0.tgz#798e689778151c8076b4b360e5edd28cda2bb468" + integrity sha1-eY5ol3gVHIB2tLNg5e3SjNortGg= dependencies: anymatch "^1.3.0" async-each "^1.0.0" @@ -1380,6 +1591,7 @@ chokidar@^1.6.0: chokidar@^2.0.2: version "2.0.4" resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-2.0.4.tgz#356ff4e2b0e8e43e322d18a372460bbcf3accd26" + integrity sha512-z9n7yt9rOvIJrMhvDtDictKrkFHeihkNl6uWMmZlmL6tJtX9Cs+87oK+teBx+JIgzvbX3yZHT3eF8vpbDxHJXQ== dependencies: anymatch "^2.0.0" async-each "^1.0.0" @@ -1396,13 +1608,15 @@ chokidar@^2.0.2: optionalDependencies: fsevents "^1.2.2" -chownr@^1.0.1: +chownr@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/chownr/-/chownr-1.1.1.tgz#54726b8b8fff4df053c42187e801fb4412df1494" + integrity sha512-j38EvO5+LHX84jlo6h4UzmOwi0UgW61WRyPtJz4qaadK5eY3BTS5TY/S1Stc3Uk2lIM6TPevAlULiEJwie860g== cipher-base@^1.0.0, cipher-base@^1.0.1, cipher-base@^1.0.3: version "1.0.4" resolved "https://registry.yarnpkg.com/cipher-base/-/cipher-base-1.0.4.tgz#8760e4ecc272f4c363532f926d874aae2c1397de" + integrity sha512-Kkht5ye6ZGmwv40uUDZztayT2ThLQGfnj/T71N/XzeZeo3nf8foyW7zGTsPYkEya3m5f3cAypH+qe7YOrM1U2Q== dependencies: inherits "^2.0.1" safe-buffer "^5.0.1" @@ -1410,19 +1624,22 @@ cipher-base@^1.0.0, cipher-base@^1.0.1, cipher-base@^1.0.3: circular-json@^0.3.1: version "0.3.3" resolved "https://registry.yarnpkg.com/circular-json/-/circular-json-0.3.3.tgz#815c99ea84f6809529d2f45791bdf82711352d66" + integrity sha512-UZK3NBx2Mca+b5LsG7bY183pHWt5Y1xts4P3Pz7ENTwGVnJOUWbRb3ocjvX7hx9tq/yTAdclXm9sZ38gNuem4A== class-utils@^0.3.5: version "0.3.6" resolved "https://registry.yarnpkg.com/class-utils/-/class-utils-0.3.6.tgz#f93369ae8b9a7ce02fd41faad0ca83033190c463" + integrity sha512-qOhPa/Fj7s6TY8H8esGu5QNpMMQxz79h+urzrNYN6mn+9BnxlDGf5QZ+XeCDsxSjPqsSR56XOZOJmpeurnLMeg== dependencies: arr-union "^3.1.0" define-property "^0.2.5" isobject "^3.0.0" static-extend "^0.1.1" -cli-color@^1.2.0: - version "1.3.0" - resolved "https://registry.yarnpkg.com/cli-color/-/cli-color-1.3.0.tgz#cd2ec212efbd1a0eeb5b017f17d4e2d15e91420f" +cli-color@^1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/cli-color/-/cli-color-1.4.0.tgz#7d10738f48526824f8fe7da51857cb0f572fe01f" + integrity sha512-xu6RvQqqrWEo6MPR1eixqGPywhYBHRs653F9jfXB2Hx4jdM/3WxiNE1vppRmxtMIfl16SFYTpYlrnqH/HsK/2w== dependencies: ansi-regex "^2.1.1" d "1" @@ -1434,16 +1651,19 @@ cli-color@^1.2.0: cli-cursor@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/cli-cursor/-/cli-cursor-2.1.0.tgz#b35dac376479facc3e94747d41d0d0f5238ffcb5" + integrity sha1-s12sN2R5+sw+lHR9QdDQ9SOP/LU= dependencies: restore-cursor "^2.0.0" cli-width@^2.0.0: version "2.2.0" resolved "https://registry.yarnpkg.com/cli-width/-/cli-width-2.2.0.tgz#ff19ede8a9a5e579324147b0c11f0fbcbabed639" + integrity sha1-/xnt6Kml5XkyQUewwR8PvLq+1jk= cliui@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/cliui/-/cliui-2.1.0.tgz#4b475760ff80264c762c3a1719032e91c7fea0d1" + integrity sha1-S0dXYP+AJkx2LDoXGQMukcf+oNE= dependencies: center-align "^0.1.1" right-align "^0.1.1" @@ -1452,6 +1672,7 @@ cliui@^2.1.0: cliui@^3.2.0: version "3.2.0" resolved "https://registry.yarnpkg.com/cliui/-/cliui-3.2.0.tgz#120601537a916d29940f934da3b48d585a39213d" + integrity sha1-EgYBU3qRbSmUD5NNo7SNWFo5IT0= dependencies: string-width "^1.0.1" strip-ansi "^3.0.1" @@ -1460,6 +1681,7 @@ cliui@^3.2.0: cliui@^4.0.0: version "4.1.0" resolved "https://registry.yarnpkg.com/cliui/-/cliui-4.1.0.tgz#348422dbe82d800b3022eef4f6ac10bf2e4d1b49" + integrity sha512-4FG+RSG9DL7uEwRUZXZn3SS34DiDPfzP0VOiEwtUWlE+AR2EIg+hSyvrIgUUfhdgR/UkAeW2QHgeP+hWrXs7jQ== dependencies: string-width "^2.1.1" strip-ansi "^4.0.0" @@ -1468,18 +1690,22 @@ cliui@^4.0.0: clone@2.x, clone@^2.0.0: version "2.1.2" resolved "https://registry.yarnpkg.com/clone/-/clone-2.1.2.tgz#1b7f4b9f591f1e8f83670401600345a02887435f" + integrity sha1-G39Ln1kfHo+DZwQBYANFoCiHQ18= co@^4.6.0: version "4.6.0" resolved "https://registry.yarnpkg.com/co/-/co-4.6.0.tgz#6ea6bdf3d853ae54ccb8e47bfa0bf3f9031fb184" + integrity sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ= code-point-at@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/code-point-at/-/code-point-at-1.1.0.tgz#0d070b4d043a5bea33a2f1a40e2edb3d9a4ccf77" + integrity sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c= coinstring@^2.0.0: version "2.3.0" resolved "https://registry.yarnpkg.com/coinstring/-/coinstring-2.3.0.tgz#cdb63363a961502404a25afb82c2e26d5ff627a4" + integrity sha1-zbYzY6lhUCQEolr7gsLibV/2J6Q= dependencies: bs58 "^2.0.1" create-hash "^1.1.1" @@ -1487,6 +1713,7 @@ coinstring@^2.0.0: collection-visit@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/collection-visit/-/collection-visit-1.0.0.tgz#4bc0373c164bc3291b4d368c829cf1a80a59dca0" + integrity sha1-S8A3PBZLwykbTTaMgpzxqApZ3KA= dependencies: map-visit "^1.0.0" object-visit "^1.0.0" @@ -1494,126 +1721,146 @@ collection-visit@^1.0.0: color-convert@^1.9.0: version "1.9.3" resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.3.tgz#bb71850690e1f136567de629d2d5471deda4c1e8" + integrity sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg== dependencies: color-name "1.1.3" color-name@1.1.3: version "1.1.3" resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.3.tgz#a7d0558bd89c42f795dd42328f740831ca53bc25" + integrity sha1-p9BVi9icQveV3UIyj3QIMcpTvCU= colors@1.0.x: version "1.0.3" resolved "https://registry.yarnpkg.com/colors/-/colors-1.0.3.tgz#0433f44d809680fdeb60ed260f1b0c262e82a40b" + integrity sha1-BDP0TYCWgP3rYO0mDxsMJi6CpAs= colors@^1.1.2: version "1.3.2" resolved "https://registry.yarnpkg.com/colors/-/colors-1.3.2.tgz#2df8ff573dfbf255af562f8ce7181d6b971a359b" -combined-stream@1.0.6: - version "1.0.6" - resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.6.tgz#723e7df6e801ac5613113a7e445a9b69cb632818" - dependencies: - delayed-stream "~1.0.0" - -combined-stream@~1.0.6: +combined-stream@^1.0.6, combined-stream@~1.0.6: version "1.0.7" resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.7.tgz#2d1d24317afb8abe95d6d2c0b07b57813539d828" + integrity sha512-brWl9y6vOB1xYPZcpZde3N9zDByXTosAeMDo4p1wzo6UMOX4vumB+TP1RZ76sfE6Md68Q0NJSrE/gbezd4Ul+w== dependencies: delayed-stream "~1.0.0" commander@2.11.0: version "2.11.0" resolved "https://registry.yarnpkg.com/commander/-/commander-2.11.0.tgz#157152fd1e7a6c8d98a5b715cf376df928004563" + integrity sha512-b0553uYA5YAEGgyYIGYROzKQ7X5RAqedkfjiZxwi0kL1g3bOaBNNZfYkzt/CL0umgD5wc9Jec2FbB98CjkMRvQ== commander@2.15.1: version "2.15.1" resolved "https://registry.yarnpkg.com/commander/-/commander-2.15.1.tgz#df46e867d0fc2aec66a34662b406a9ccafff5b0f" + integrity sha512-VlfT9F3V0v+jr4yxPc5gg9s62/fIVWsd2Bk2iD435um1NlGMYdVCq+MjcXnhYq2icNOizHr1kK+5TI6H0Hy0ag== -commander@^2.11.0, commander@^2.14.1, commander@^2.15.0, commander@^2.8.1, commander@^2.9.0: +commander@^2.14.1, commander@^2.15.0, commander@^2.19.0, commander@^2.8.1, commander@^2.9.0: version "2.19.0" resolved "https://registry.yarnpkg.com/commander/-/commander-2.19.0.tgz#f6198aa84e5b83c46054b94ddedbfed5ee9ff12a" + integrity sha512-6tvAOO+D6OENvRAh524Dh9jcfKTYDQAqvqezbCW82xj5X0pSrcpxtvRKHLG0yBY6SD7PSDrJaj+0AiOcKVd1Xg== commander@~2.17.1: version "2.17.1" resolved "https://registry.yarnpkg.com/commander/-/commander-2.17.1.tgz#bd77ab7de6de94205ceacc72f1716d29f20a77bf" + integrity sha512-wPMUt6FnH2yzG95SA6mzjQOEKUU3aLaDEmzs1ti+1E9h+CsrZghRlqEM/EJ4KscsQVG8uNN4uVreUeT8+drlgg== commander@~2.8.1: version "2.8.1" resolved "https://registry.yarnpkg.com/commander/-/commander-2.8.1.tgz#06be367febfda0c330aa1e2a072d3dc9762425d4" + integrity sha1-Br42f+v9oMMwqh4qBy09yXYkJdQ= dependencies: graceful-readlink ">= 1.0.0" compare-versions@^3.0.1: version "3.4.0" resolved "https://registry.yarnpkg.com/compare-versions/-/compare-versions-3.4.0.tgz#e0747df5c9cb7f054d6d3dc3e1dbc444f9e92b26" + integrity sha512-tK69D7oNXXqUW3ZNo/z7NXTEz22TCF0pTE+YF9cxvaAM9XnkLo1fV621xCLrRR6aevJlKxExkss0vWqUCUpqdg== component-emitter@^1.2.1: version "1.2.1" resolved "https://registry.yarnpkg.com/component-emitter/-/component-emitter-1.2.1.tgz#137918d6d78283f7df7a6b7c5a63e140e69425e6" + integrity sha1-E3kY1teCg/ffemt8WmPhQOaUJeY= concat-map@0.0.1: version "0.0.1" resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" + integrity sha1-2Klr13/Wjfd5OnMDajug1UBdR3s= console-browserify@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/console-browserify/-/console-browserify-1.1.0.tgz#f0241c45730a9fc6323b206dbf38edc741d0bb10" + integrity sha1-8CQcRXMKn8YyOyBtvzjtx0HQuxA= dependencies: date-now "^0.1.4" console-control-strings@^1.0.0, console-control-strings@~1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/console-control-strings/-/console-control-strings-1.1.0.tgz#3d7cf4464db6446ea644bf4b39507f9851008e8e" + integrity sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4= constants-browserify@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/constants-browserify/-/constants-browserify-1.0.0.tgz#c20b96d8c617748aaf1c16021760cd27fcb8cb75" + integrity sha1-wguW2MYXdIqvHBYCF2DNJ/y4y3U= contains-path@^0.1.0: version "0.1.0" resolved "https://registry.yarnpkg.com/contains-path/-/contains-path-0.1.0.tgz#fe8cf184ff6670b6baef01a9d4861a5cbec4120a" + integrity sha1-/ozxhP9mcLa67wGp1IYaXL7EEgo= content-disposition@0.5.2: version "0.5.2" resolved "https://registry.yarnpkg.com/content-disposition/-/content-disposition-0.5.2.tgz#0cf68bb9ddf5f2be7961c3a85178cb85dba78cb4" + integrity sha1-DPaLud318r55YcOoUXjLhdunjLQ= content-type@~1.0.4: version "1.0.4" resolved "https://registry.yarnpkg.com/content-type/-/content-type-1.0.4.tgz#e138cc75e040c727b1966fe5e5f8c9aee256fe3b" + integrity sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA== convert-source-map@^1.5.1: version "1.6.0" resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-1.6.0.tgz#51b537a8c43e0f04dec1993bffcdd504e758ac20" + integrity sha512-eFu7XigvxdZ1ETfbgPBohgyQ/Z++C0eEhTor0qRwBw9unw+L0/6V8wkSuGgzdThkiS5lSpdptOQPD8Ak40a+7A== dependencies: safe-buffer "~5.1.1" cookie-signature@1.0.6: version "1.0.6" resolved "https://registry.yarnpkg.com/cookie-signature/-/cookie-signature-1.0.6.tgz#e303a882b342cc3ee8ca513a79999734dab3ae2c" + integrity sha1-4wOogrNCzD7oylE6eZmXNNqzriw= cookie@0.3.1: version "0.3.1" resolved "https://registry.yarnpkg.com/cookie/-/cookie-0.3.1.tgz#e7e0a1f9ef43b4c8ba925c5c5a96e806d16873bb" + integrity sha1-5+Ch+e9DtMi6klxcWpboBtFoc7s= cookiejar@^2.1.1: version "2.1.2" resolved "https://registry.yarnpkg.com/cookiejar/-/cookiejar-2.1.2.tgz#dd8a235530752f988f9a0844f3fc589e3111125c" + integrity sha512-Mw+adcfzPxcPeI+0WlvRrr/3lGVO0bD75SxX6811cxSh1Wbxx7xZBGK1eVtDf6si8rg2lhnUjsVLMFMfbRIuwA== copy-descriptor@^0.1.0: version "0.1.1" resolved "https://registry.yarnpkg.com/copy-descriptor/-/copy-descriptor-0.1.1.tgz#676f6eb3c39997c2ee1ac3a924fd6124748f578d" + integrity sha1-Z29us8OZl8LuGsOpJP1hJHSPV40= core-js@^2.4.0, core-js@^2.5.0: - version "2.5.7" - resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.5.7.tgz#f972608ff0cead68b841a16a932d0b183791814e" + version "2.6.0" + resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.6.0.tgz#1e30793e9ee5782b307e37ffa22da0eacddd84d4" + integrity sha512-kLRC6ncVpuEW/1kwrOXYX6KQASCVtrh1gQr/UiaVgFlf9WE5Vp+lNe5+h3LuMr5PAucWnnEXwH0nQHRH/gpGtw== core-util-is@1.0.2, core-util-is@~1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7" + integrity sha1-tf1UIgqivFq1eqtxQMlAdUUDwac= cors@^2.8.1: - version "2.8.4" - resolved "https://registry.yarnpkg.com/cors/-/cors-2.8.4.tgz#2bd381f2eb201020105cd50ea59da63090694686" + version "2.8.5" + resolved "https://registry.yarnpkg.com/cors/-/cors-2.8.5.tgz#eac11da51592dd86b9f06f6e7ac293b3df875d29" + integrity sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g== dependencies: object-assign "^4" vary "^1" @@ -1621,6 +1868,7 @@ cors@^2.8.1: coveralls@^3.0.1: version "3.0.2" resolved "https://registry.yarnpkg.com/coveralls/-/coveralls-3.0.2.tgz#f5a0bcd90ca4e64e088b710fa8dda640aea4884f" + integrity sha512-Tv0LKe/MkBOilH2v7WBiTBdudg2ChfGbdXafc/s330djpF3zKOmuehTeRwjXWc7pzfj9FrDUTA7tEx6Div8NFw== dependencies: growl "~> 1.10.0" js-yaml "^3.11.0" @@ -1632,6 +1880,7 @@ coveralls@^3.0.1: create-ecdh@^4.0.0: version "4.0.3" resolved "https://registry.yarnpkg.com/create-ecdh/-/create-ecdh-4.0.3.tgz#c9111b6f33045c4697f144787f9254cdc77c45ff" + integrity sha512-GbEHQPMOswGpKXM9kCWVrremUcBmjteUaQ01T9rkKCPDXfUHX0IoP9LpHYo2NPFampa4e+/pFDc3jQdxrxQLaw== dependencies: bn.js "^4.1.0" elliptic "^6.0.0" @@ -1639,6 +1888,7 @@ create-ecdh@^4.0.0: create-hash@^1.1.0, create-hash@^1.1.1, create-hash@^1.1.2: version "1.2.0" resolved "https://registry.yarnpkg.com/create-hash/-/create-hash-1.2.0.tgz#889078af11a63756bcfb59bd221996be3a9ef196" + integrity sha512-z00bCGNHDG8mHAkP7CtT1qVu+bFQUPjYq/4Iv3C3kWjTFV10zIjfSoeqXo9Asws8gwSHDGj/hl2u4OGIjapeCg== dependencies: cipher-base "^1.0.1" inherits "^2.0.1" @@ -1649,6 +1899,7 @@ create-hash@^1.1.0, create-hash@^1.1.1, create-hash@^1.1.2: create-hmac@^1.1.0, create-hmac@^1.1.2, create-hmac@^1.1.4: version "1.1.7" resolved "https://registry.yarnpkg.com/create-hmac/-/create-hmac-1.1.7.tgz#69170c78b3ab957147b2b8b04572e47ead2243ff" + integrity sha512-MJG9liiZ+ogc4TzUwuvbER1JRdgvUFSB5+VR/g5h82fGaIRWMWddtKBHi7/sVhfjQZ6SehlyhvQYrcYkaUIpLg== dependencies: cipher-base "^1.0.3" create-hash "^1.1.0" @@ -1657,16 +1908,18 @@ create-hmac@^1.1.0, create-hmac@^1.1.2, create-hmac@^1.1.4: safe-buffer "^5.0.1" sha.js "^2.4.8" -cron-parser@^2.4.0: - version "2.6.0" - resolved "https://registry.yarnpkg.com/cron-parser/-/cron-parser-2.6.0.tgz#ae2514ceda9ccb540256e201bdd23ae814e03674" +cron-parser@^2.7.3: + version "2.7.3" + resolved "https://registry.yarnpkg.com/cron-parser/-/cron-parser-2.7.3.tgz#12603f89f5375af353a9357be2543d3172eac651" + integrity sha512-t9Kc7HWBWPndBzvbdQ1YG9rpPRB37Tb/tTviziUOh1qs3TARGh3b1p+tnkOHNe1K5iI3oheBPgLqwotMM7+lpg== dependencies: is-nan "^1.2.1" - moment-timezone "^0.5.0" + moment-timezone "^0.5.23" cross-spawn@^5.0.1: version "5.1.0" resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-5.1.0.tgz#e8bd0efee58fcff6f8f94510a0a554bbfa235449" + integrity sha1-6L0O/uWPz/b4+UUQoKVUu/ojVEk= dependencies: lru-cache "^4.0.1" shebang-command "^1.2.0" @@ -1689,6 +1942,7 @@ crypt@~0.0.1: crypto-browserify@3.12.0, crypto-browserify@^3.11.0: version "3.12.0" resolved "https://registry.yarnpkg.com/crypto-browserify/-/crypto-browserify-3.12.0.tgz#396cf9f3137f03e4b8e532c58f698254e00f80ec" + integrity sha512-fz4spIh+znjO2VjL+IdhEpRJ3YN6sMzITSBijk6FK2UvTqruSQW+/cCZTSNsMiZNvUeq0CqurF+dAbyiGOY6Wg== dependencies: browserify-cipher "^1.0.0" browserify-sign "^4.0.0" @@ -1705,64 +1959,77 @@ crypto-browserify@3.12.0, crypto-browserify@^3.11.0: crypto-js@^3.1.4, crypto-js@^3.1.5: version "3.1.8" resolved "https://registry.yarnpkg.com/crypto-js/-/crypto-js-3.1.8.tgz#715f070bf6014f2ae992a98b3929258b713f08d5" + integrity sha1-cV8HC/YBTyrpkqmLOSkli3E/CNU= crypto-js@^3.1.9-1: version "3.1.9-1" resolved "https://registry.yarnpkg.com/crypto-js/-/crypto-js-3.1.9-1.tgz#fda19e761fc077e01ffbfdc6e9fdfc59e8806cd8" + integrity sha1-/aGedh/Ad+Af+/3G6f38WeiAbNg= crypto-random-string@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/crypto-random-string/-/crypto-random-string-1.0.0.tgz#a230f64f568310e1498009940790ec99545bca7e" + integrity sha1-ojD2T1aDEOFJgAmUB5DsmVRbyn4= csextends@^1.0.3: version "1.2.0" resolved "https://registry.yarnpkg.com/csextends/-/csextends-1.2.0.tgz#6374b210984b54d4495f29c99d3dd069b80543e5" + integrity sha512-S/8k1bDTJIwuGgQYmsRoE+8P+ohV32WhQ0l4zqrc0XDdxOhjQQD7/wTZwCzoZX53jSX3V/qwjT+OkPTxWQcmjg== cycle@1.0.x: version "1.0.3" resolved "https://registry.yarnpkg.com/cycle/-/cycle-1.0.3.tgz#21e80b2be8580f98b468f379430662b046c34ad2" + integrity sha1-IegLK+hYD5i0aPN5QwZisEbDStI= d@1: version "1.0.0" resolved "https://registry.yarnpkg.com/d/-/d-1.0.0.tgz#754bb5bfe55451da69a58b94d45f4c5b0462d58f" + integrity sha1-dUu1v+VUUdpppYuU1F9MWwRi1Y8= dependencies: es5-ext "^0.10.9" dashdash@^1.12.0: version "1.14.1" resolved "https://registry.yarnpkg.com/dashdash/-/dashdash-1.14.1.tgz#853cfa0f7cbe2fed5de20326b8dd581035f6e2f0" + integrity sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA= dependencies: assert-plus "^1.0.0" date-now@^0.1.4: version "0.1.4" resolved "https://registry.yarnpkg.com/date-now/-/date-now-0.1.4.tgz#eaf439fd4d4848ad74e5cc7dbef200672b9e345b" + integrity sha1-6vQ5/U1ISK105cx9vvIAZyueNFs= death@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/death/-/death-1.1.0.tgz#01aa9c401edd92750514470b8266390c66c67318" + integrity sha1-AaqcQB7dknUFFEcLgmY5DGbGcxg= debug@*, debug@^4.0.1: version "4.1.0" resolved "https://registry.yarnpkg.com/debug/-/debug-4.1.0.tgz#373687bffa678b38b1cd91f861b63850035ddc87" + integrity sha512-heNPJUJIqC+xB6ayLAMHaIrmN9HKa7aQO8MGqKpvCA+uJYVcvR6l5kgdrhRuwPFHU7P5/A1w0BjByPHwpfTDKg== dependencies: ms "^2.1.1" debug@2.6.9, debug@^2.1.2, debug@^2.2.0, debug@^2.3.3, debug@^2.6.8, debug@^2.6.9: version "2.6.9" resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f" + integrity sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA== dependencies: ms "2.0.0" debug@3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/debug/-/debug-3.1.0.tgz#5bb5a0672628b64149566ba16819e61518c67261" + integrity sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g== dependencies: ms "2.0.0" -debug@^3.0.1, debug@^3.1.0: +debug@^3.1.0, debug@^3.2.6: version "3.2.6" resolved "https://registry.yarnpkg.com/debug/-/debug-3.2.6.tgz#e83d17de16d8a7efb7717edbe5fb10135eee629b" + integrity sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ== dependencies: ms "^2.1.1" @@ -1773,16 +2040,19 @@ decamelize@^1.0.0, decamelize@^1.1.1: decode-uri-component@^0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/decode-uri-component/-/decode-uri-component-0.2.0.tgz#eb3913333458775cb84cd1a1fae062106bb87545" + integrity sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU= decompress-response@^3.2.0, decompress-response@^3.3.0: version "3.3.0" resolved "https://registry.yarnpkg.com/decompress-response/-/decompress-response-3.3.0.tgz#80a4dd323748384bfa248083622aedec982adff3" + integrity sha1-gKTdMjdIOEv6JICDYirt7Jgq3/M= dependencies: mimic-response "^1.0.0" decompress-tar@^4.0.0, decompress-tar@^4.1.0, decompress-tar@^4.1.1: version "4.1.1" resolved "https://registry.yarnpkg.com/decompress-tar/-/decompress-tar-4.1.1.tgz#718cbd3fcb16209716e70a26b84e7ba4592e5af1" + integrity sha512-JdJMaCrGpB5fESVyxwpCx4Jdj2AagLmv3y58Qy4GE6HMVjWz1FeVQk1Ct4Kye7PftcdOo/7U7UKzYBJgqnGeUQ== dependencies: file-type "^5.2.0" is-stream "^1.1.0" @@ -1791,6 +2061,7 @@ decompress-tar@^4.0.0, decompress-tar@^4.1.0, decompress-tar@^4.1.1: decompress-tarbz2@^4.0.0: version "4.1.1" resolved "https://registry.yarnpkg.com/decompress-tarbz2/-/decompress-tarbz2-4.1.1.tgz#3082a5b880ea4043816349f378b56c516be1a39b" + integrity sha512-s88xLzf1r81ICXLAVQVzaN6ZmX4A6U4z2nMbOwobxkLoIIfjVMBg7TeguTUXkKeXni795B6y5rnvDw7rxhAq9A== dependencies: decompress-tar "^4.1.0" file-type "^6.1.0" @@ -1801,6 +2072,7 @@ decompress-tarbz2@^4.0.0: decompress-targz@^4.0.0: version "4.1.1" resolved "https://registry.yarnpkg.com/decompress-targz/-/decompress-targz-4.1.1.tgz#c09bc35c4d11f3de09f2d2da53e9de23e7ce1eee" + integrity sha512-4z81Znfr6chWnRDNfFNqLwPvm4db3WuZkqV+UgXQzSngG3CEKdBkw5jrv3axjjL96glyiiKjsxJG3X6WBZwX3w== dependencies: decompress-tar "^4.1.1" file-type "^5.2.0" @@ -1809,6 +2081,7 @@ decompress-targz@^4.0.0: decompress-unzip@^4.0.1: version "4.0.1" resolved "https://registry.yarnpkg.com/decompress-unzip/-/decompress-unzip-4.0.1.tgz#deaaccdfd14aeaf85578f733ae8210f9b4848f69" + integrity sha1-3qrM39FK6vhVePczroIQ+bSEj2k= dependencies: file-type "^3.8.0" get-stream "^2.2.0" @@ -1818,6 +2091,7 @@ decompress-unzip@^4.0.1: decompress@^4.0.0: version "4.2.0" resolved "https://registry.yarnpkg.com/decompress/-/decompress-4.2.0.tgz#7aedd85427e5a92dacfe55674a7c505e96d01f9d" + integrity sha1-eu3YVCflqS2s/lVnSnxQXpbQH50= dependencies: decompress-tar "^4.0.0" decompress-tarbz2 "^4.0.0" @@ -1831,52 +2105,62 @@ decompress@^4.0.0: deep-assign@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/deep-assign/-/deep-assign-2.0.0.tgz#ebe06b1f07f08dae597620e3dd1622f371a1c572" + integrity sha1-6+BrHwfwja5ZdiDj3RYi83GhxXI= dependencies: is-obj "^1.0.0" deep-equal@~0.2.1: version "0.2.2" resolved "https://registry.yarnpkg.com/deep-equal/-/deep-equal-0.2.2.tgz#84b745896f34c684e98f2ce0e42abaf43bba017d" + integrity sha1-hLdFiW80xoTpjyzg5Cq69Du6AX0= deep-equal@~1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/deep-equal/-/deep-equal-1.0.1.tgz#f5d260292b660e084eff4cdbc9f08ad3247448b5" + integrity sha1-9dJgKStmDghO/0zbyfCK0yR0SLU= deep-extend@^0.6.0: version "0.6.0" resolved "https://registry.yarnpkg.com/deep-extend/-/deep-extend-0.6.0.tgz#c4fa7c95404a17a9c3e8ca7e1537312b736330ac" + integrity sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA== deep-is@~0.1.3: version "0.1.3" resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.3.tgz#b369d6fb5dbc13eecf524f91b070feedc357cf34" + integrity sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ= deferred-leveldown@~1.2.1: version "1.2.2" resolved "https://registry.yarnpkg.com/deferred-leveldown/-/deferred-leveldown-1.2.2.tgz#3acd2e0b75d1669924bc0a4b642851131173e1eb" + integrity sha512-uukrWD2bguRtXilKt6cAWKyoXrTSMo5m7crUdLfWQmu8kIm88w3QZoUL+6nhpfKVmhHANER6Re3sKoNoZ3IKMA== dependencies: abstract-leveldown "~2.6.0" define-properties@^1.1.1, define-properties@^1.1.2: version "1.1.3" resolved "https://registry.yarnpkg.com/define-properties/-/define-properties-1.1.3.tgz#cf88da6cbee26fe6db7094f61d870cbd84cee9f1" + integrity sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ== dependencies: object-keys "^1.0.12" define-property@^0.2.5: version "0.2.5" resolved "https://registry.yarnpkg.com/define-property/-/define-property-0.2.5.tgz#c35b1ef918ec3c990f9a5bc57be04aacec5c8116" + integrity sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY= dependencies: is-descriptor "^0.1.0" define-property@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/define-property/-/define-property-1.0.0.tgz#769ebaaf3f4a63aad3af9e8d304c9bbe79bfb0e6" + integrity sha1-dp66rz9KY6rTr56NMEybvnm/sOY= dependencies: is-descriptor "^1.0.0" define-property@^2.0.2: version "2.0.2" resolved "https://registry.yarnpkg.com/define-property/-/define-property-2.0.2.tgz#d459689e8d654ba77e02a817f8710d702cb16e9d" + integrity sha512-jwK2UV4cnPpbcG7+VRARKTZPUWowwXA8bzH5NP6ud0oeAxyYPuGZUAC7hMugpCdz4BeSZl2Dl9k66CHJ/46ZYQ== dependencies: is-descriptor "^1.0.2" isobject "^3.0.1" @@ -1884,38 +2168,32 @@ define-property@^2.0.2: defined@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/defined/-/defined-1.0.0.tgz#c98d9bcef75674188e110969151199e39b1fa693" - -del@^2.0.2: - version "2.2.2" - resolved "https://registry.yarnpkg.com/del/-/del-2.2.2.tgz#c12c981d067846c84bcaf862cff930d907ffd1a8" - dependencies: - globby "^5.0.0" - is-path-cwd "^1.0.0" - is-path-in-cwd "^1.0.0" - object-assign "^4.0.1" - pify "^2.0.0" - pinkie-promise "^2.0.0" - rimraf "^2.2.8" + integrity sha1-yY2bzvdWdBiOEQlpFRGZ45sfppM= delayed-stream@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619" + integrity sha1-3zrhmayt+31ECqrgsp4icrJOxhk= delegates@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/delegates/-/delegates-1.0.0.tgz#84c6e159b81904fdca59a0ef44cd870d31250f9a" + integrity sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o= delimit-stream@0.1.0: version "0.1.0" resolved "https://registry.yarnpkg.com/delimit-stream/-/delimit-stream-0.1.0.tgz#9b8319477c0e5f8aeb3ce357ae305fc25ea1cd2b" + integrity sha1-m4MZR3wOX4rrPONXrjBfwl6hzSs= depd@~1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/depd/-/depd-1.1.2.tgz#9bcd52e14c097763e749b274c4346ed2e560b5a9" + integrity sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak= des.js@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/des.js/-/des.js-1.0.0.tgz#c074d2e2aa6a8a9a07dbd61f9a15c2cd83ec8ecc" + integrity sha1-wHTS4qpqipoH29YfmhXCzYPsjsw= dependencies: inherits "^2.0.1" minimalistic-assert "^1.0.0" @@ -1923,28 +2201,34 @@ des.js@^1.0.0: destroy@~1.0.4: version "1.0.4" resolved "https://registry.yarnpkg.com/destroy/-/destroy-1.0.4.tgz#978857442c44749e4206613e37946205826abd80" + integrity sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA= detect-indent@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/detect-indent/-/detect-indent-4.0.0.tgz#f76d064352cdf43a1cb6ce619c4ee3a9475de208" + integrity sha1-920GQ1LN9Docts5hnE7jqUdd4gg= dependencies: repeating "^2.0.0" detect-libc@^1.0.2: version "1.0.3" resolved "https://registry.yarnpkg.com/detect-libc/-/detect-libc-1.0.3.tgz#fa137c4bd698edf55cd5cd02ac559f91a4c4ba9b" + integrity sha1-+hN8S9aY7fVc1c0CrFWfkaTEups= diff@3.3.1: version "3.3.1" resolved "https://registry.yarnpkg.com/diff/-/diff-3.3.1.tgz#aa8567a6eed03c531fc89d3f711cd0e5259dec75" + integrity sha512-MKPHZDMB0o6yHyDryUOScqZibp914ksXwAMYMTHj6KO8UeKsRYNJD3oNCKjTqZon+V488P7N/HzXF8t7ZR95ww== diff@3.5.0: version "3.5.0" resolved "https://registry.yarnpkg.com/diff/-/diff-3.5.0.tgz#800c0dd1e0a8bfbc95835c202ad220fe317e5a12" + integrity sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA== diffie-hellman@^5.0.0: version "5.0.3" resolved "https://registry.yarnpkg.com/diffie-hellman/-/diffie-hellman-5.0.3.tgz#40e8ee98f55a2149607146921c63e1ae5f3d2875" + integrity sha512-kqag/Nl+f3GwyK25fhUMYj81BUOrZ9IuJsjIcDE5icNM9FJHAVm3VcUDxdLPoQtTuUylWm6ZIknYJwwaPxsUzg== dependencies: bn.js "^4.1.0" miller-rabin "^4.0.0" @@ -1953,6 +2237,7 @@ diffie-hellman@^5.0.0: doctrine@1.5.0: version "1.5.0" resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-1.5.0.tgz#379dce730f6166f76cefa4e6707a159b02c5a6fa" + integrity sha1-N53Ocw9hZvds76TmcHoVmwLFpvo= dependencies: esutils "^2.0.2" isarray "^1.0.0" @@ -1960,20 +2245,24 @@ doctrine@1.5.0: doctrine@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-2.1.0.tgz#5cd01fc101621b42c4cd7f5d1a66243716d3f39d" + integrity sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw== dependencies: esutils "^2.0.2" dom-walk@^0.1.0: version "0.1.1" resolved "https://registry.yarnpkg.com/dom-walk/-/dom-walk-0.1.1.tgz#672226dc74c8f799ad35307df936aba11acd6018" + integrity sha1-ZyIm3HTI95mtNTB9+TaroRrNYBg= domain-browser@^1.1.1: version "1.2.0" resolved "https://registry.yarnpkg.com/domain-browser/-/domain-browser-1.2.0.tgz#3d31f50191a6749dd1375a7f522e823d42e54eda" + integrity sha512-jnjyiM6eRyZl2H+W8Q/zLMA481hzi0eszAaBUzIVnmYVDBbnLxVNnfu1HgEBvCbL+71FrxMl3E6lpKH7Ge3OXA== drbg.js@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/drbg.js/-/drbg.js-1.0.1.tgz#3e36b6c42b37043823cdbc332d58f31e2445480b" + integrity sha1-Pja2xCs3BDgjzbwzLVjzHiRFSAs= dependencies: browserify-aes "^1.0.6" create-hash "^1.1.2" @@ -1982,16 +2271,19 @@ drbg.js@^1.0.1: duplexer3@^0.1.4: version "0.1.4" resolved "https://registry.yarnpkg.com/duplexer3/-/duplexer3-0.1.4.tgz#ee01dd1cac0ed3cbc7fdbea37dc0a8f1ce002ce2" + integrity sha1-7gHdHKwO08vH/b6jfcCo8c4ALOI= eachr@^2.0.2: version "2.0.4" resolved "https://registry.yarnpkg.com/eachr/-/eachr-2.0.4.tgz#466f7caa10708f610509e32c807aafe57fc122bf" + integrity sha1-Rm98qhBwj2EFCeMsgHqv5X/BIr8= dependencies: typechecker "^2.0.8" ecc-jsbn@~0.1.1: version "0.1.2" resolved "https://registry.yarnpkg.com/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz#3a83a904e54353287874c564b7549386849a98c9" + integrity sha1-OoOpBOVDUyh4dMVkt1SThoSamMk= dependencies: jsbn "~0.1.0" safer-buffer "^2.1.0" @@ -1999,25 +2291,30 @@ ecc-jsbn@~0.1.1: editions@^1.1.1, editions@^1.3.3, editions@^1.3.4: version "1.3.4" resolved "https://registry.yarnpkg.com/editions/-/editions-1.3.4.tgz#3662cb592347c3168eb8e498a0ff73271d67f50b" + integrity sha512-gzao+mxnYDzIysXKMQi/+M1mjy/rjestjg6OPoYTtI+3Izp23oiGZitsl9lPDPiTGXbcSIk1iJWhliSaglxnUg== -editions@^2.0.2: - version "2.0.2" - resolved "https://registry.yarnpkg.com/editions/-/editions-2.0.2.tgz#54fdac6fb24b0a1a72ffc1ba0126c10602c3e0bd" +editions@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/editions/-/editions-2.1.0.tgz#5c6f6341ef19ee362a3bcbb907fe68e696dbc69e" + integrity sha512-yKrimWcvOXcYXtqsOeebbMLynm9qbYVd0005wveGU2biPxJaJoxA0jtaZrxiMe3mAanLr5lxoYFVz5zjv9JdnA== dependencies: - errlop "^1.0.2" - semver "^5.5.0" + errlop "^1.0.3" + semver "^5.6.0" ee-first@1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/ee-first/-/ee-first-1.1.1.tgz#590c61156b0ae2f4f0255732a158b266bc56b21d" + integrity sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0= electron-to-chromium@^1.3.47: - version "1.3.78" - resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.78.tgz#ecb72b5b166ba6598efb384461d63cad74678ebf" + version "1.3.92" + resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.92.tgz#9027b5abaea400045edd652c0e4838675c814399" + integrity sha512-En051LMzMl3/asMWGZEtU808HOoVWIpmmZx1Ep8N+TT9e7z/X8RcLeBU2kLSNLGQ+5SuKELzMx+MVuTBXk6Q9w== elliptic@6.3.3: version "6.3.3" resolved "https://registry.yarnpkg.com/elliptic/-/elliptic-6.3.3.tgz#5482d9646d54bcb89fd7d994fc9e2e9568876e3f" + integrity sha1-VILZZG1UvLif19mU/J4ulWiHbj8= dependencies: bn.js "^4.4.0" brorand "^1.0.1" @@ -2027,6 +2324,7 @@ elliptic@6.3.3: elliptic@=6.4.0: version "6.4.0" resolved "https://registry.yarnpkg.com/elliptic/-/elliptic-6.4.0.tgz#cac9af8762c85836187003c8dfe193e5e2eae5df" + integrity sha1-ysmvh2LIWDYYcAPI3+GT5eLq5d8= dependencies: bn.js "^4.4.0" brorand "^1.0.1" @@ -2039,6 +2337,7 @@ elliptic@=6.4.0: elliptic@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/elliptic/-/elliptic-3.1.0.tgz#c21682ef762769b56a74201609105da11d5f60cc" + integrity sha1-whaC73YnabVqdCAWCRBdoR1fYMw= dependencies: bn.js "^2.0.3" brorand "^1.0.1" @@ -2048,6 +2347,7 @@ elliptic@^3.1.0: elliptic@^6.0.0, elliptic@^6.2.3, elliptic@^6.4.0: version "6.4.1" resolved "https://registry.yarnpkg.com/elliptic/-/elliptic-6.4.1.tgz#c2d0b7776911b86722c632c3c06c60f2f819939a" + integrity sha512-BsXLz5sqX8OHcsh7CqBMztyXARmGQ3LWPtGjJi6DiJHq5C/qvi9P3OqgswKSDftbu8+IoI/QDTAm2fFnQ9SZSQ== dependencies: bn.js "^4.4.0" brorand "^1.0.1" @@ -2057,29 +2357,39 @@ elliptic@^6.0.0, elliptic@^6.2.3, elliptic@^6.4.0: minimalistic-assert "^1.0.0" minimalistic-crypto-utils "^1.0.0" +emoji-regex@^7.0.1: + version "7.0.1" + resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-7.0.1.tgz#5a132b28ebf84a289ba692862f7d4206ebcd32d0" + integrity sha512-cjx7oFbFIyZMpmWaEBnKeJXWAVzjXwK6yHiz/5X73A2Ww4pnabw+4ZaA/MxLroIQQrB3dL6XzEz8P3aZsSdj8Q== + emojis-list@^2.0.0: version "2.1.0" resolved "https://registry.yarnpkg.com/emojis-list/-/emojis-list-2.1.0.tgz#4daa4d9db00f9819880c79fa457ae5b09a1fd389" + integrity sha1-TapNnbAPmBmIDHn6RXrlsJof04k= encodeurl@~1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/encodeurl/-/encodeurl-1.0.2.tgz#ad3ff4c86ec2d029322f5a02c3a9a606c95b3f59" + integrity sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k= encoding@^0.1.11: version "0.1.12" resolved "https://registry.yarnpkg.com/encoding/-/encoding-0.1.12.tgz#538b66f3ee62cd1ab51ec323829d1f9480c74beb" + integrity sha1-U4tm8+5izRq1HsMjgp0flIDHS+s= dependencies: iconv-lite "~0.4.13" end-of-stream@^1.0.0: version "1.4.1" resolved "https://registry.yarnpkg.com/end-of-stream/-/end-of-stream-1.4.1.tgz#ed29634d19baba463b6ce6b80a37213eab71ec43" + integrity sha512-1MkrZNvWTKCaigbn+W15elq2BB/L22nqrSY5DKlo3X6+vclJm8Bb5djXJBmEX6fS3+zCh/F4VBK5Z2KxJt4s2Q== dependencies: once "^1.4.0" enhanced-resolve@^3.4.0: version "3.4.1" resolved "https://registry.yarnpkg.com/enhanced-resolve/-/enhanced-resolve-3.4.1.tgz#0421e339fd71419b3da13d129b3979040230476e" + integrity sha1-BCHjOf1xQZs9oT0Smzl5BAIwR24= dependencies: graceful-fs "^4.1.2" memory-fs "^0.4.0" @@ -2089,28 +2399,33 @@ enhanced-resolve@^3.4.0: eol@^0.9.1: version "0.9.1" resolved "https://registry.yarnpkg.com/eol/-/eol-0.9.1.tgz#f701912f504074be35c6117a5c4ade49cd547acd" + integrity sha512-Ds/TEoZjwggRoz/Q2O7SE3i4Jm66mqTDfmdHdq/7DKVk3bro9Q8h6WdXKdPqFLMoqxrDK5SVRzHVPOS6uuGtrg== -errlop@^1.0.2: +errlop@^1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/errlop/-/errlop-1.0.3.tgz#dba29c90cf832c3d2ce469fe515d7e5eef2c6676" + integrity sha512-5VTnt0yikY4LlQEfCXVSqfE6oLj1HVM4zVSvAKMnoYjL/zrb6nqiLowZS4XlG7xENfyj7lpYWvT+wfSCr6dtlA== dependencies: editions "^1.3.4" errno@^0.1.3, errno@~0.1.1: version "0.1.7" resolved "https://registry.yarnpkg.com/errno/-/errno-0.1.7.tgz#4684d71779ad39af177e3f007996f7c67c852618" + integrity sha512-MfrRBDWzIWifgq6tJj60gkAwtLNb6sQPlcFrSOflcP1aFmmruKQ2wRnze/8V6kgyz7H3FF8Npzv78mZ7XLLflg== dependencies: prr "~1.0.1" error-ex@^1.2.0: version "1.3.2" resolved "https://registry.yarnpkg.com/error-ex/-/error-ex-1.3.2.tgz#b4ac40648107fdcdcfae242f428bea8a14d4f1bf" + integrity sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g== dependencies: is-arrayish "^0.2.1" es-abstract@^1.5.0: version "1.12.0" resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.12.0.tgz#9dbbdd27c6856f0001421ca18782d786bf8a6165" + integrity sha512-C8Fx/0jFmV5IPoMOFPA9P9G5NtqW+4cOPit3MIuvR2t7Ag2K15EJTpxnHAYTzL+aYQJIESYeXZmDBfOBE1HcpA== dependencies: es-to-primitive "^1.1.1" function-bind "^1.1.1" @@ -2121,6 +2436,7 @@ es-abstract@^1.5.0: es-to-primitive@^1.1.1: version "1.2.0" resolved "https://registry.yarnpkg.com/es-to-primitive/-/es-to-primitive-1.2.0.tgz#edf72478033456e8dda8ef09e00ad9650707f377" + integrity sha512-qZryBOJjV//LaxLTV6UC//WewneB3LcXOL9NP++ozKVXsIIIpm/2c13UDiD9Jp2eThsecw9m3jPqDwTyobcdbg== dependencies: is-callable "^1.1.4" is-date-object "^1.0.1" @@ -2129,6 +2445,7 @@ es-to-primitive@^1.1.1: es5-ext@^0.10.14, es5-ext@^0.10.35, es5-ext@^0.10.45, es5-ext@^0.10.46, es5-ext@^0.10.9, es5-ext@~0.10.14, es5-ext@~0.10.2, es5-ext@~0.10.46: version "0.10.46" resolved "https://registry.yarnpkg.com/es5-ext/-/es5-ext-0.10.46.tgz#efd99f67c5a7ec789baa3daa7f79870388f7f572" + integrity sha512-24XxRvJXNFwEMpJb3nOkiRJKRoupmjYmOPVlI65Qy2SrtxwOTB+g6ODjBKOtwEHbYrhWRty9xxOWLNdClT2djw== dependencies: es6-iterator "~2.0.3" es6-symbol "~3.1.1" @@ -2137,6 +2454,7 @@ es5-ext@^0.10.14, es5-ext@^0.10.35, es5-ext@^0.10.45, es5-ext@^0.10.46, es5-ext@ es6-iterator@^2.0.1, es6-iterator@^2.0.3, es6-iterator@~2.0.1, es6-iterator@~2.0.3: version "2.0.3" resolved "https://registry.yarnpkg.com/es6-iterator/-/es6-iterator-2.0.3.tgz#a7de889141a05a94b0854403b2d0a0fbfa98f3b7" + integrity sha1-p96IkUGgWpSwhUQDstCg+/qY87c= dependencies: d "1" es5-ext "^0.10.35" @@ -2145,6 +2463,7 @@ es6-iterator@^2.0.1, es6-iterator@^2.0.3, es6-iterator@~2.0.1, es6-iterator@~2.0 es6-map@^0.1.3: version "0.1.5" resolved "https://registry.yarnpkg.com/es6-map/-/es6-map-0.1.5.tgz#9136e0503dcc06a301690f0bb14ff4e364e949f0" + integrity sha1-kTbgUD3MBqMBaQ8LsU/042TpSfA= dependencies: d "1" es5-ext "~0.10.14" @@ -2156,6 +2475,7 @@ es6-map@^0.1.3: es6-set@~0.1.5: version "0.1.5" resolved "https://registry.yarnpkg.com/es6-set/-/es6-set-0.1.5.tgz#d2b3ec5d4d800ced818db538d28974db0a73ccb1" + integrity sha1-0rPsXU2ADO2BjbU40ol02wpzzLE= dependencies: d "1" es5-ext "~0.10.14" @@ -2166,6 +2486,7 @@ es6-set@~0.1.5: es6-symbol@3.1.1, es6-symbol@^3.1.1, es6-symbol@~3.1.1: version "3.1.1" resolved "https://registry.yarnpkg.com/es6-symbol/-/es6-symbol-3.1.1.tgz#bf00ef4fdab6ba1b46ecb7b629b4c7ed5715cc77" + integrity sha1-vwDvT9q2uhtG7Le2KbTH7VcVzHc= dependencies: d "1" es5-ext "~0.10.14" @@ -2173,6 +2494,7 @@ es6-symbol@3.1.1, es6-symbol@^3.1.1, es6-symbol@~3.1.1: es6-weak-map@^2.0.1, es6-weak-map@^2.0.2: version "2.0.2" resolved "https://registry.yarnpkg.com/es6-weak-map/-/es6-weak-map-2.0.2.tgz#5e3ab32251ffd1538a1f8e5ffa1357772f92d96f" + integrity sha1-XjqzIlH/0VOKH45f+hNXdy+S2W8= dependencies: d "1" es5-ext "^0.10.14" @@ -2182,14 +2504,17 @@ es6-weak-map@^2.0.1, es6-weak-map@^2.0.2: escape-html@~1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/escape-html/-/escape-html-1.0.3.tgz#0258eae4d3d0c0974de1c169188ef0051d1d1988" + integrity sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg= escape-string-regexp@1.0.5, escape-string-regexp@^1.0.2, escape-string-regexp@^1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" + integrity sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ= escodegen@1.8.x: version "1.8.1" resolved "https://registry.yarnpkg.com/escodegen/-/escodegen-1.8.1.tgz#5a5b53af4693110bebb0867aa3430dd3b70a1018" + integrity sha1-WltTr0aTEQvrsIZ6o0MN07cKEBg= dependencies: esprima "^2.7.1" estraverse "^1.9.1" @@ -2201,6 +2526,7 @@ escodegen@1.8.x: escope@^3.6.0: version "3.6.0" resolved "https://registry.yarnpkg.com/escope/-/escope-3.6.0.tgz#e01975e812781a163a6dadfdd80398dc64c889c3" + integrity sha1-4Bl16BJ4GhY6ba392AOY3GTIicM= dependencies: es6-map "^0.1.3" es6-weak-map "^2.0.1" @@ -2214,6 +2540,7 @@ eslint-config-standard@^12.0.0: eslint-import-resolver-node@^0.3.1: version "0.3.2" resolved "https://registry.yarnpkg.com/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.2.tgz#58f15fb839b8d0576ca980413476aab2472db66a" + integrity sha512-sfmTqJfPSizWu4aymbPr4Iidp5yKm8yDkHp+Ir3YiTHiiDfxh69mOUsmiqW6RZ9zRXFaF64GtYmN7e+8GHBv6Q== dependencies: debug "^2.6.9" resolve "^1.5.0" @@ -2221,6 +2548,7 @@ eslint-import-resolver-node@^0.3.1: eslint-module-utils@^2.2.0: version "2.2.0" resolved "https://registry.yarnpkg.com/eslint-module-utils/-/eslint-module-utils-2.2.0.tgz#b270362cd88b1a48ad308976ce7fa54e98411746" + integrity sha1-snA2LNiLGkitMIl2zn+lTphBF0Y= dependencies: debug "^2.6.8" pkg-dir "^1.0.0" @@ -2235,6 +2563,7 @@ eslint-plugin-es@^1.3.1: eslint-plugin-import@^2.10.0: version "2.14.0" resolved "https://registry.yarnpkg.com/eslint-plugin-import/-/eslint-plugin-import-2.14.0.tgz#6b17626d2e3e6ad52cfce8807a845d15e22111a8" + integrity sha512-FpuRtniD/AY6sXByma2Wr0TXvXJ4nA/2/04VPlfpmUDPOpOY264x+ILiwnrk/k4RINgDAyFZByxqPUbSQ5YE7g== dependencies: contains-path "^0.1.0" debug "^2.6.8" @@ -2280,6 +2609,7 @@ eslint-utils@^1.3.0, eslint-utils@^1.3.1: eslint-visitor-keys@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-1.0.0.tgz#3f3180fb2e291017716acb4c9d6d5b5c34a6a81d" + integrity sha512-qzm/XxIbxm/FHyH341ZrbnMUpe+5Bocte9xkmFMzPMjRaZMcXww+MpBptFvtU+79L362nqiLhekCxCxDPaUMBQ== eslint@^5.8.0: version "5.8.0" @@ -2324,53 +2654,70 @@ eslint@^5.8.0: table "^5.0.2" text-table "^0.2.0" -espree@^4.0.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/espree/-/espree-4.1.0.tgz#728d5451e0fd156c04384a7ad89ed51ff54eb25f" +espree@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/espree/-/espree-5.0.0.tgz#fc7f984b62b36a0f543b13fb9cd7b9f4a7f5b65c" + integrity sha512-1MpUfwsdS9MMoN7ZXqAr9e9UKdVHDcvrJpyx7mm1WuQlx/ygErEQBzgi5Nh5qBHIoYweprhtMkTCb9GhcAIcsA== dependencies: acorn "^6.0.2" acorn-jsx "^5.0.0" eslint-visitor-keys "^1.0.0" +esprima-extract-comments@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/esprima-extract-comments/-/esprima-extract-comments-1.1.0.tgz#0dacab567a5900240de6d344cf18c33617becbc9" + integrity sha512-sBQUnvJwpeE9QnPrxh7dpI/dp67erYG4WXEAreAMoelPRpMR7NWb4YtwRPn9b+H1uLQKl/qS8WYmyaljTpjIsw== + dependencies: + esprima "^4.0.0" + esprima@2.7.x, esprima@^2.7.1: version "2.7.3" resolved "https://registry.yarnpkg.com/esprima/-/esprima-2.7.3.tgz#96e3b70d5779f6ad49cd032673d1c312767ba581" + integrity sha1-luO3DVd59q1JzQMmc9HDEnZ7pYE= esprima@^4.0.0: version "4.0.1" resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71" + integrity sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A== esquery@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/esquery/-/esquery-1.0.1.tgz#406c51658b1f5991a5f9b62b1dc25b00e3e5c708" + integrity sha512-SmiyZ5zIWH9VM+SRUReLS5Q8a7GxtRdxEBVZpm98rJM7Sb+A9DVCndXfkeFUd3byderg+EbDkfnevfCwynWaNA== dependencies: estraverse "^4.0.0" esrecurse@^4.1.0: version "4.2.1" resolved "https://registry.yarnpkg.com/esrecurse/-/esrecurse-4.2.1.tgz#007a3b9fdbc2b3bb87e4879ea19c92fdbd3942cf" + integrity sha512-64RBB++fIOAXPw3P9cy89qfMlvZEXZkqqJkjqqXIvzP5ezRZjW+lPWjw35UX/3EhUPFYbg5ER4JYgDw4007/DQ== dependencies: estraverse "^4.1.0" estraverse@^1.9.1: version "1.9.3" resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-1.9.3.tgz#af67f2dc922582415950926091a4005d29c9bb44" + integrity sha1-r2fy3JIlgkFZUJJgkaQAXSnJu0Q= estraverse@^4.0.0, estraverse@^4.1.0, estraverse@^4.1.1: version "4.2.0" resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-4.2.0.tgz#0dee3fed31fcd469618ce7342099fc1afa0bdb13" + integrity sha1-De4/7TH81GlhjOc0IJn8GvoL2xM= esutils@^2.0.2: version "2.0.2" resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.2.tgz#0abf4f1caa5bcb1f7a9d8acc6dea4faaa04bac9b" + integrity sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs= etag@~1.8.1: version "1.8.1" resolved "https://registry.yarnpkg.com/etag/-/etag-1.8.1.tgz#41ae2eeb65efa62268aebfea83ac7d79299b0887" + integrity sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc= eth-block-tracker@^2.2.2: version "2.3.1" resolved "https://registry.yarnpkg.com/eth-block-tracker/-/eth-block-tracker-2.3.1.tgz#ab6d177e5b50128fa06d7ae9e0489c7484bac95e" + integrity sha512-NamWuMBIl8kmkJFVj8WzGatySTzQPQag4Xr677yFxdVtIxACFbL/dQowk0MzEqIKk93U1TwY3MjVU6mOcwZnKA== dependencies: async-eventemitter ahultgren/async-eventemitter#fa06e39e56786ba541c180061dbf2c0a5bbf951c eth-query "^2.1.0" @@ -2384,6 +2731,7 @@ eth-block-tracker@^2.2.2: eth-lib@0.1.27, eth-lib@^0.1.26: version "0.1.27" resolved "https://registry.yarnpkg.com/eth-lib/-/eth-lib-0.1.27.tgz#f0b0fd144f865d2d6bf8257a40004f2e75ca1dd6" + integrity sha512-B8czsfkJYzn2UIEMwjc7Mbj+Cy72V+/OXH/tb44LV8jhrjizQJJ325xMOMyk3+ETa6r6oi0jsUY14+om8mQMWA== dependencies: bn.js "^4.11.6" elliptic "^6.4.0" @@ -2396,6 +2744,7 @@ eth-lib@0.1.27, eth-lib@^0.1.26: eth-lib@0.2.7: version "0.2.7" resolved "https://registry.yarnpkg.com/eth-lib/-/eth-lib-0.2.7.tgz#2f93f17b1e23aec3759cd4a3fe20c1286a3fc1ca" + integrity sha1-L5Pxex4jrsN1nNSj/iDBKGo/wco= dependencies: bn.js "^4.11.6" elliptic "^6.4.0" @@ -2404,6 +2753,7 @@ eth-lib@0.2.7: eth-lightwallet@^3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/eth-lightwallet/-/eth-lightwallet-3.0.1.tgz#297022932aa568f4e4eb0873bff257f5e5b78709" + integrity sha512-79vVCETy+4l1b6wuOWwjqPW3Bom5ZK46BgkUNwaXhiMG1rrMRHjpjYEWMqH0JHeCzOzB4HBIFz7eK1/4s6w5nA== dependencies: bitcore-lib "^0.15.0" bitcore-mnemonic "^1.5.0" @@ -2420,6 +2770,7 @@ eth-lightwallet@^3.0.1: eth-query@^2.1.0: version "2.1.2" resolved "https://registry.yarnpkg.com/eth-query/-/eth-query-2.1.2.tgz#d6741d9000106b51510c72db92d6365456a6da5e" + integrity sha1-1nQdkAAQa1FRDHLbktY2VFam2l4= dependencies: json-rpc-random-id "^1.0.0" xtend "^4.0.1" @@ -2427,6 +2778,7 @@ eth-query@^2.1.0: eth-sig-util@^1.4.2: version "1.4.2" resolved "https://registry.yarnpkg.com/eth-sig-util/-/eth-sig-util-1.4.2.tgz#8d958202c7edbaae839707fba6f09ff327606210" + integrity sha1-jZWCAsftuq6Dlwf7pvCf8ydgYhA= dependencies: ethereumjs-abi "git+https://github.com/ethereumjs/ethereumjs-abi.git" ethereumjs-util "^5.1.1" @@ -2434,6 +2786,7 @@ eth-sig-util@^1.4.2: ethereum-bridge@^0.6.1: version "0.6.1" resolved "https://registry.yarnpkg.com/ethereum-bridge/-/ethereum-bridge-0.6.1.tgz#53c93ed7c0e21752a91e5f089a5997e1d6fea228" + integrity sha512-yDTivI85618BoLI71yNRzW6iVcVN2rjnviCIzs0QOCOENj4XpYQhMDGhdqDi8XWDdzTd0Ja/Canuuh3vfE2IcA== dependencies: async "^2.4.1" borc "^2.0.2" @@ -2464,14 +2817,17 @@ ethereum-bridge@^0.6.1: ethereum-common@0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/ethereum-common/-/ethereum-common-0.2.0.tgz#13bf966131cce1eeade62a1b434249bb4cb120ca" + integrity sha512-XOnAR/3rntJgbCdGhqdaLIxDLWKLmsZOGhHdBKadEr6gEnJLH52k93Ou+TUdFaPN3hJc3isBZBal3U/XZ15abA== ethereum-common@^0.0.18: version "0.0.18" resolved "https://registry.yarnpkg.com/ethereum-common/-/ethereum-common-0.0.18.tgz#2fdc3576f232903358976eb39da783213ff9523f" + integrity sha1-L9w1dvIykDNYl26znaeDIT/5Uj8= ethereumjs-abi@0.6.4: version "0.6.4" resolved "https://registry.yarnpkg.com/ethereumjs-abi/-/ethereumjs-abi-0.6.4.tgz#9ba1bb056492d00c27279f6eccd4d58275912c1a" + integrity sha1-m6G7BWSS0AwnJ59uzNTVgnWRLBo= dependencies: bn.js "^4.10.0" ethereumjs-util "^4.3.0" @@ -2486,14 +2842,16 @@ ethereumjs-abi@^0.6.5, "ethereumjs-abi@git+https://github.com/ethereumjs/ethereu ethereumjs-account@^2.0.3: version "2.0.5" resolved "https://registry.yarnpkg.com/ethereumjs-account/-/ethereumjs-account-2.0.5.tgz#eeafc62de544cb07b0ee44b10f572c9c49e00a84" + integrity sha512-bgDojnXGjhMwo6eXQC0bY6UK2liSFUSMwwylOmQvZbSl/D7NXQ3+vrGO46ZeOgjGfxXmgIeVNDIiHw7fNZM4VA== dependencies: ethereumjs-util "^5.0.0" rlp "^2.0.0" safe-buffer "^5.1.1" -ethereumjs-block@^1.2.2, ethereumjs-block@~1.7.0: +ethereumjs-block@^1.2.2: version "1.7.1" resolved "https://registry.yarnpkg.com/ethereumjs-block/-/ethereumjs-block-1.7.1.tgz#78b88e6cc56de29a6b4884ee75379b6860333c3f" + integrity sha512-B+sSdtqm78fmKkBq78/QLKJbu/4Ts4P2KFISdgcuZUPDm9x+N7qgBPIIFUGbaakQh8bzuquiRVbdmvPKqbILRg== dependencies: async "^2.0.1" ethereum-common "0.2.0" @@ -2501,25 +2859,40 @@ ethereumjs-block@^1.2.2, ethereumjs-block@~1.7.0: ethereumjs-util "^5.0.0" merkle-patricia-tree "^2.1.2" -ethereumjs-common@~0.4.0: - version "0.4.1" - resolved "https://registry.yarnpkg.com/ethereumjs-common/-/ethereumjs-common-0.4.1.tgz#27690a24a817b058cc3a2aedef9392e8d7d63984" +ethereumjs-block@~2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/ethereumjs-block/-/ethereumjs-block-2.1.0.tgz#71d1b19e18061f14cf6371bf34ba31a359931360" + integrity sha512-ip+x4/7hUInX+TQfhEKsQh9MJK1Dbjp4AuPjf1UdX3udAV4beYD4EMCNIPzBLCsGS8WQZYXLpo83tVTISYNpow== + dependencies: + async "^2.0.1" + ethereumjs-common "^0.6.0" + ethereumjs-tx "^1.2.2" + ethereumjs-util "^5.0.0" + merkle-patricia-tree "^2.1.2" + +ethereumjs-common@^0.6.0: + version "0.6.1" + resolved "https://registry.yarnpkg.com/ethereumjs-common/-/ethereumjs-common-0.6.1.tgz#ec98edf315a7f107afb6acc48e937a8266979fae" + integrity sha512-4jOrfDu9qOBTTGGb3zrfT1tE1Hyc6a8LJpEk0Vk9AYlLkBY7crjVICyJpRvjNI+KLDMpMITMw3eWVZOLMtZdhw== ethereumjs-testrpc-sc@6.1.6: version "6.1.6" resolved "https://registry.yarnpkg.com/ethereumjs-testrpc-sc/-/ethereumjs-testrpc-sc-6.1.6.tgz#290595380b5182814564d4aa38f35b7788aab070" + integrity sha512-iv2qiGBFgk9mn5Nq2enX8dG5WQ7Lk+FCqpnxfPfH4Ns8KLPwttmNOy264nh3SXDJJvcQwz/XnlLteDQVILotbg== dependencies: source-map-support "^0.5.3" ethereumjs-testrpc@^6.0.3: version "6.0.3" resolved "https://registry.yarnpkg.com/ethereumjs-testrpc/-/ethereumjs-testrpc-6.0.3.tgz#7a0b87bf3670f92f607f98fa6a78801d9741b124" + integrity sha512-lAxxsxDKK69Wuwqym2K49VpXtBvLEsXr1sryNG4AkvL5DomMdeCBbu3D87UEevKenLHBiT8GTjARwN6Yj039gA== dependencies: webpack "^3.0.0" ethereumjs-tx@^1.2.0, ethereumjs-tx@^1.2.2, ethereumjs-tx@^1.3.1, ethereumjs-tx@^1.3.3, ethereumjs-tx@^1.3.4: version "1.3.7" resolved "https://registry.yarnpkg.com/ethereumjs-tx/-/ethereumjs-tx-1.3.7.tgz#88323a2d875b10549b8347e09f4862b546f3d89a" + integrity sha512-wvLMxzt1RPhAQ9Yi3/HKZTn0FZYpnsmQdbKYfUUpi4j1SEIcbkd9tndVjcPrufY3V7j2IebOpC00Zp2P/Ay2kA== dependencies: ethereum-common "^0.0.18" ethereumjs-util "^5.0.0" @@ -2527,6 +2900,7 @@ ethereumjs-tx@^1.2.0, ethereumjs-tx@^1.2.2, ethereumjs-tx@^1.3.1, ethereumjs-tx@ ethereumjs-util@^4.3.0: version "4.5.0" resolved "https://registry.yarnpkg.com/ethereumjs-util/-/ethereumjs-util-4.5.0.tgz#3e9428b317eebda3d7260d854fddda954b1f1bc6" + integrity sha1-PpQosxfuvaPXJg2FT93alUsfG8Y= dependencies: bn.js "^4.8.0" create-hash "^1.1.2" @@ -2537,6 +2911,7 @@ ethereumjs-util@^4.3.0: ethereumjs-util@^5.0.0, ethereumjs-util@^5.0.1, ethereumjs-util@^5.1.1, ethereumjs-util@^5.1.3, ethereumjs-util@^5.2.0: version "5.2.0" resolved "https://registry.yarnpkg.com/ethereumjs-util/-/ethereumjs-util-5.2.0.tgz#3e0c0d1741471acf1036052d048623dee54ad642" + integrity sha512-CJAKdI0wgMbQFLlLRtZKGcy/L6pzVRgelIZqRqNbuVFM3K9VEnyfbcvz0ncWMRNCe4kaHWjwRYQcYMucmwsnWA== dependencies: bn.js "^4.11.0" create-hash "^1.1.2" @@ -2546,16 +2921,30 @@ ethereumjs-util@^5.0.0, ethereumjs-util@^5.0.1, ethereumjs-util@^5.1.1, ethereum safe-buffer "^5.1.1" secp256k1 "^3.0.1" +ethereumjs-util@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/ethereumjs-util/-/ethereumjs-util-6.0.0.tgz#f14841c182b918615afefd744207c7932c8536c0" + integrity sha512-E3yKUyl0Fs95nvTFQZe/ZSNcofhDzUsDlA5y2uoRmf1+Ec7gpGhNCsgKkZBRh7Br5op8mJcYF/jFbmjj909+nQ== + dependencies: + bn.js "^4.11.0" + create-hash "^1.1.2" + ethjs-util "^0.1.6" + keccak "^1.0.2" + rlp "^2.0.0" + safe-buffer "^5.1.1" + secp256k1 "^3.0.1" + ethereumjs-vm@^2.0.2: - version "2.4.0" - resolved "https://registry.yarnpkg.com/ethereumjs-vm/-/ethereumjs-vm-2.4.0.tgz#244f1e35f2755e537a13546111d1a4c159d34b13" + version "2.5.0" + resolved "https://registry.yarnpkg.com/ethereumjs-vm/-/ethereumjs-vm-2.5.0.tgz#71dde54a093bd813c9defdc6d45ceb8fcca2f603" + integrity sha512-Cp1do4J2FIJFnbofqLsKb/aoZKG+Q8NBIbTa1qwZPQkQxzeR3DZVpFk/VbE1EUO6Ha0kSClJ1jzfj07z3cScSQ== dependencies: async "^2.1.2" async-eventemitter "^0.2.2" ethereumjs-account "^2.0.3" - ethereumjs-block "~1.7.0" - ethereumjs-common "~0.4.0" - ethereumjs-util "^5.2.0" + ethereumjs-block "~2.1.0" + ethereumjs-common "^0.6.0" + ethereumjs-util "^6.0.0" fake-merkle-patricia-tree "^1.0.1" functional-red-black-tree "^1.0.1" merkle-patricia-tree "^2.1.2" @@ -2565,6 +2954,7 @@ ethereumjs-vm@^2.0.2: ethereumjs-wallet@^0.6.0: version "0.6.2" resolved "https://registry.yarnpkg.com/ethereumjs-wallet/-/ethereumjs-wallet-0.6.2.tgz#67244b6af3e8113b53d709124b25477b64aeccda" + integrity sha512-DHEKPV9lYORM7dL8602dkb+AgdfzCYz2lxpdYQoD3OwG355LLDuivW9rGuLpDMCry/ORyBYV6n+QCo/71SwACg== dependencies: aes-js "^3.1.1" bs58check "^2.1.2" @@ -2593,6 +2983,7 @@ ethers@^4.0.7: ethjs-abi@0.1.8: version "0.1.8" resolved "https://registry.yarnpkg.com/ethjs-abi/-/ethjs-abi-0.1.8.tgz#cd288583ed628cdfadaf8adefa3ba1dbcbca6c18" + integrity sha1-zSiFg+1ijN+tr4re+juh28vKbBg= dependencies: bn.js "4.11.6" js-sha3 "0.5.5" @@ -2601,13 +2992,15 @@ ethjs-abi@0.1.8: ethjs-unit@0.1.6: version "0.1.6" resolved "https://registry.yarnpkg.com/ethjs-unit/-/ethjs-unit-0.1.6.tgz#c665921e476e87bce2a9d588a6fe0405b2c41699" + integrity sha1-xmWSHkduh7ziqdWIpv4EBbLEFpk= dependencies: bn.js "4.11.6" number-to-bn "1.7.0" -ethjs-util@^0.1.3: +ethjs-util@^0.1.3, ethjs-util@^0.1.6: version "0.1.6" resolved "https://registry.yarnpkg.com/ethjs-util/-/ethjs-util-0.1.6.tgz#f308b62f185f9fe6237132fb2a9818866a5cd536" + integrity sha512-CUnVOQq7gSpDHZVVrQW8ExxUETWrnrvXYvYz55wOU8Uj4VCgw56XC2B/fVqQN+f7gmrnRHSLVnFAwsCuNwji8w== dependencies: is-hex-prefixed "1.0.0" strip-hex-prefix "1.0.0" @@ -2615,6 +3008,7 @@ ethjs-util@^0.1.3: event-emitter@^0.3.5, event-emitter@~0.3.5: version "0.3.5" resolved "https://registry.yarnpkg.com/event-emitter/-/event-emitter-0.3.5.tgz#df8c69eef1647923c7157b9ce83840610b02cc39" + integrity sha1-34xp7vFkeSPHFXuc6DhAYQsCzDk= dependencies: d "1" es5-ext "~0.10.14" @@ -2622,18 +3016,22 @@ event-emitter@^0.3.5, event-emitter@~0.3.5: eventemitter3@1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/eventemitter3/-/eventemitter3-1.1.1.tgz#47786bdaa087caf7b1b75e73abc5c7d540158cd0" + integrity sha1-R3hr2qCHyvext15zq8XH1UAVjNA= events@^1.0.0: version "1.1.1" resolved "https://registry.yarnpkg.com/events/-/events-1.1.1.tgz#9ebdb7635ad099c70dcc4c2a1f5004288e8bd924" + integrity sha1-nr23Y1rQmccNzEwqH1AEKI6L2SQ= events@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/events/-/events-3.0.0.tgz#9a0a0dfaf62893d92b875b8f2698ca4114973e88" + integrity sha512-Dc381HFWJzEOhQ+d8pkNon++bk9h6cdAoAj4iE6Q4y6xgTzySWXlKn05/TVNpjnfRqi/X0EpJEJohPjNI3zpVA== evp_bytestokey@^1.0.0, evp_bytestokey@^1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/evp_bytestokey/-/evp_bytestokey-1.0.3.tgz#7fcbdb198dc71959432efe13842684e0525acb02" + integrity sha512-/f2Go4TognH/KvCISP7OUsHn85hT9nUkxxA9BEWxFn+Oj9o8ZNLm/40hdlgSLyuOimsrTKLUMEorQexp/aPQeA== dependencies: md5.js "^1.3.4" safe-buffer "^5.1.1" @@ -2641,6 +3039,7 @@ evp_bytestokey@^1.0.0, evp_bytestokey@^1.0.3: execa@^0.7.0: version "0.7.0" resolved "https://registry.yarnpkg.com/execa/-/execa-0.7.0.tgz#944becd34cc41ee32a63a9faf27ad5a65fc59777" + integrity sha1-lEvs00zEHuMqY6n68nrVpl/Fl3c= dependencies: cross-spawn "^5.0.1" get-stream "^3.0.0" @@ -2653,12 +3052,14 @@ execa@^0.7.0: expand-brackets@^0.1.4: version "0.1.5" resolved "https://registry.yarnpkg.com/expand-brackets/-/expand-brackets-0.1.5.tgz#df07284e342a807cd733ac5af72411e581d1177b" + integrity sha1-3wcoTjQqgHzXM6xa9yQR5YHRF3s= dependencies: is-posix-bracket "^0.1.0" expand-brackets@^2.1.4: version "2.1.4" resolved "https://registry.yarnpkg.com/expand-brackets/-/expand-brackets-2.1.4.tgz#b77735e315ce30f6b6eff0f83b04151a22449622" + integrity sha1-t3c14xXOMPa27/D4OwQVGiJEliI= dependencies: debug "^2.3.3" define-property "^0.2.5" @@ -2671,12 +3072,14 @@ expand-brackets@^2.1.4: expand-range@^1.8.1: version "1.8.2" resolved "https://registry.yarnpkg.com/expand-range/-/expand-range-1.8.2.tgz#a299effd335fe2721ebae8e257ec79644fc85337" + integrity sha1-opnv/TNf4nIeuujiV+x5ZE/IUzc= dependencies: fill-range "^2.1.0" express@^4.14.0: version "4.16.4" resolved "https://registry.yarnpkg.com/express/-/express-4.16.4.tgz#fddef61926109e24c515ea97fd2f1bdbf62df12e" + integrity sha512-j12Uuyb4FMrd/qQAm6uCHAkPtO8FDTRJZBDd5D2KOL2eLaz1yUNdUB/NOIyq0iU4q4cFarsUCrnFDPBcnksuOg== dependencies: accepts "~1.3.5" array-flatten "1.1.1" @@ -2712,12 +3115,14 @@ express@^4.14.0: extend-shallow@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/extend-shallow/-/extend-shallow-2.0.1.tgz#51af7d614ad9a9f610ea1bafbb989d6b1c56890f" + integrity sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8= dependencies: is-extendable "^0.1.0" extend-shallow@^3.0.0, extend-shallow@^3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/extend-shallow/-/extend-shallow-3.0.2.tgz#26a71aaf073b39fb2127172746131c2704028db8" + integrity sha1-Jqcarwc7OfshJxcnRhMcJwQCjbg= dependencies: assign-symbols "^1.0.0" is-extendable "^1.0.1" @@ -2729,6 +3134,7 @@ extend@~3.0.2: extendr@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/extendr/-/extendr-2.1.0.tgz#301aa0bbea565f4d2dc8f570f2a22611a8527b56" + integrity sha1-MBqgu+pWX00tyPVw8qImEahSe1Y= dependencies: typechecker "~2.0.1" @@ -2743,12 +3149,14 @@ external-editor@^3.0.0: extglob@^0.3.1: version "0.3.2" resolved "https://registry.yarnpkg.com/extglob/-/extglob-0.3.2.tgz#2e18ff3d2f49ab2765cec9023f011daa8d8349a1" + integrity sha1-Lhj/PS9JqydlzskCPwEdqo2DSaE= dependencies: is-extglob "^1.0.0" extglob@^2.0.4: version "2.0.4" resolved "https://registry.yarnpkg.com/extglob/-/extglob-2.0.4.tgz#ad00fe4dc612a9232e8718711dc5cb5ab0285543" + integrity sha512-Nmb6QXkELsuBr24CJSkilo6UHHgbekK5UiZgfE6UHD3Eb27YC6oD+bhcT+tJ6cl8dmsgdQxnWlcry8ksBIBLpw== dependencies: array-unique "^0.3.2" define-property "^1.0.0" @@ -2759,67 +3167,88 @@ extglob@^2.0.4: snapdragon "^0.8.1" to-regex "^3.0.1" +extract-comments@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/extract-comments/-/extract-comments-1.1.0.tgz#b90bca033a056bd69b8ba1c6b6b120fc2ee95c18" + integrity sha512-dzbZV2AdSSVW/4E7Ti5hZdHWbA+Z80RJsJhr5uiL10oyjl/gy7/o+HI1HwK4/WSZhlq4SNKU3oUzXlM13Qx02Q== + dependencies: + esprima-extract-comments "^1.1.0" + parse-code-context "^1.0.0" + extract-opts@^2.2.0: version "2.2.0" resolved "https://registry.yarnpkg.com/extract-opts/-/extract-opts-2.2.0.tgz#1fa28eba7352c6db480f885ceb71a46810be6d7d" + integrity sha1-H6KOunNSxttID4hc63GkaBC+bX0= dependencies: typechecker "~2.0.1" extsprintf@1.3.0: version "1.3.0" resolved "https://registry.yarnpkg.com/extsprintf/-/extsprintf-1.3.0.tgz#96918440e3041a7a414f8c52e3c574eb3c3e1e05" + integrity sha1-lpGEQOMEGnpBT4xS48V06zw+HgU= extsprintf@^1.2.0: version "1.4.0" resolved "https://registry.yarnpkg.com/extsprintf/-/extsprintf-1.4.0.tgz#e2689f8f356fad62cca65a3a91c5df5f9551692f" + integrity sha1-4mifjzVvrWLMplo6kcXfX5VRaS8= eyes@0.1.x: version "0.1.8" resolved "https://registry.yarnpkg.com/eyes/-/eyes-0.1.8.tgz#62cf120234c683785d902348a800ef3e0cc20bc0" + integrity sha1-Ys8SAjTGg3hdkCNIqADvPgzCC8A= fake-merkle-patricia-tree@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/fake-merkle-patricia-tree/-/fake-merkle-patricia-tree-1.0.1.tgz#4b8c3acfb520afadf9860b1f14cd8ce3402cddd3" + integrity sha1-S4w6z7Ugr635hgsfFM2M40As3dM= dependencies: checkpoint-store "^1.1.0" fast-deep-equal@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-1.1.0.tgz#c053477817c86b51daa853c81e059b733d023614" + integrity sha1-wFNHeBfIa1HaqFPIHgWbcz0CNhQ= fast-deep-equal@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz#7b05218ddf9667bf7f370bf7fdb2cb15fdd0aa49" + integrity sha1-ewUhjd+WZ79/Nwv3/bLLFf3Qqkk= fast-json-stable-stringify@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz#d5142c0caee6b1189f87d3a76111064f86c8bbf2" + integrity sha1-1RQsDK7msRifh9OnYREGT4bIu/I= fast-levenshtein@~2.0.4: version "2.0.6" resolved "https://registry.yarnpkg.com/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz#3d8a5c66883a16a30ca8643e851f19baa7797917" + integrity sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc= fd-slicer@~1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/fd-slicer/-/fd-slicer-1.1.0.tgz#25c7c89cb1f9077f8891bbe61d8f390eae256f1e" + integrity sha1-JcfInLH5B3+IkbvmHY85Dq4lbx4= dependencies: pend "~1.2.0" fetch-ponyfill@^4.0.0: version "4.1.0" resolved "https://registry.yarnpkg.com/fetch-ponyfill/-/fetch-ponyfill-4.1.0.tgz#ae3ce5f732c645eab87e4ae8793414709b239893" + integrity sha1-rjzl9zLGReq4fkroeTQUcJsjmJM= dependencies: node-fetch "~1.7.1" figures@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/figures/-/figures-2.0.0.tgz#3ab1a2d2a62c8bfb431a0c94cb797a2fce27c962" + integrity sha1-OrGi0qYsi/tDGgyUy3l6L84nyWI= dependencies: escape-string-regexp "^1.0.5" file-entry-cache@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/file-entry-cache/-/file-entry-cache-2.0.0.tgz#c392990c3e684783d838b8c84a45d8a048458361" + integrity sha1-w5KZDD5oR4PYOLjISkXYoEhFg2E= dependencies: flat-cache "^1.2.1" object-assign "^4.0.1" @@ -2827,22 +3256,27 @@ file-entry-cache@^2.0.0: file-type@^3.8.0: version "3.9.0" resolved "https://registry.yarnpkg.com/file-type/-/file-type-3.9.0.tgz#257a078384d1db8087bc449d107d52a52672b9e9" + integrity sha1-JXoHg4TR24CHvESdEH1SpSZyuek= file-type@^5.2.0: version "5.2.0" resolved "https://registry.yarnpkg.com/file-type/-/file-type-5.2.0.tgz#2ddbea7c73ffe36368dfae49dc338c058c2b8ad6" + integrity sha1-LdvqfHP/42No365J3DOMBYwritY= file-type@^6.1.0: version "6.2.0" resolved "https://registry.yarnpkg.com/file-type/-/file-type-6.2.0.tgz#e50cd75d356ffed4e306dc4f5bcf52a79903a919" + integrity sha512-YPcTBDV+2Tm0VqjybVd32MHdlEGAtuxS3VAYsumFokDSMG+ROT5wawGlnHDoz7bfMcMDt9hxuXvXwoKUx2fkOg== filename-regex@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/filename-regex/-/filename-regex-2.0.1.tgz#c1c4b9bee3e09725ddb106b75c1e301fe2f18b26" + integrity sha1-wcS5vuPglyXdsQa3XB4wH+LxiyY= fill-range@^2.1.0: version "2.2.4" resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-2.2.4.tgz#eb1e773abb056dcd8df2bfdf6af59b8b3a936565" + integrity sha512-cnrcCbj01+j2gTG921VZPnHbjmdAf8oQV/iGeV2kZxGSyfYjjTyY79ErsK1WJWMpw6DaApEX72binqJE+/d+5Q== dependencies: is-number "^2.1.0" isobject "^2.0.0" @@ -2853,6 +3287,7 @@ fill-range@^2.1.0: fill-range@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-4.0.0.tgz#d544811d428f98eb06a63dc402d2403c328c38f7" + integrity sha1-1USBHUKPmOsGpj3EAtJAPDKMOPc= dependencies: extend-shallow "^2.0.1" is-number "^3.0.0" @@ -2862,6 +3297,7 @@ fill-range@^4.0.0: finalhandler@1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/finalhandler/-/finalhandler-1.1.1.tgz#eebf4ed840079c83f4249038c9d703008301b105" + integrity sha512-Y1GUDo39ez4aHAw7MysnUD5JzYX+WaIj8I57kO3aEPT1fFRL4sr7mjei97FgnwhAyyzRYmQZaTHb2+9uZ1dPtg== dependencies: debug "2.6.9" encodeurl "~1.0.2" @@ -2874,6 +3310,7 @@ finalhandler@1.1.1: find-up@^1.0.0: version "1.1.2" resolved "https://registry.yarnpkg.com/find-up/-/find-up-1.1.2.tgz#6b2e9822b1a2ce0a60ab64d610eccad53cb24d0f" + integrity sha1-ay6YIrGizgpgq2TWEOzK1TyyTQ8= dependencies: path-exists "^2.0.0" pinkie-promise "^2.0.0" @@ -2881,67 +3318,79 @@ find-up@^1.0.0: find-up@^2.0.0, find-up@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/find-up/-/find-up-2.1.0.tgz#45d1b7e506c717ddd482775a2b77920a3c0c57a7" + integrity sha1-RdG35QbHF93UgndaK3eSCjwMV6c= dependencies: locate-path "^2.0.0" flat-cache@^1.2.1: - version "1.3.0" - resolved "https://registry.yarnpkg.com/flat-cache/-/flat-cache-1.3.0.tgz#d3030b32b38154f4e3b7e9c709f490f7ef97c481" + version "1.3.4" + resolved "https://registry.yarnpkg.com/flat-cache/-/flat-cache-1.3.4.tgz#2c2ef77525cc2929007dfffa1dd314aa9c9dee6f" + integrity sha512-VwyB3Lkgacfik2vhqR4uv2rvebqmDvFu4jlN/C1RzWoJEo8I7z4Q404oiqYCkq41mni8EzQnm95emU9seckwtg== dependencies: circular-json "^0.3.1" - del "^2.0.2" graceful-fs "^4.1.2" + rimraf "~2.6.2" write "^0.2.1" for-each@^0.3.2, for-each@~0.3.3: version "0.3.3" resolved "https://registry.yarnpkg.com/for-each/-/for-each-0.3.3.tgz#69b447e88a0a5d32c3e7084f3f1710034b21376e" + integrity sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw== dependencies: is-callable "^1.1.3" for-in@^1.0.1, for-in@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/for-in/-/for-in-1.0.2.tgz#81068d295a8142ec0ac726c6e2200c30fb6d5e80" + integrity sha1-gQaNKVqBQuwKxybG4iAMMPttXoA= for-own@^0.1.4: version "0.1.5" resolved "https://registry.yarnpkg.com/for-own/-/for-own-0.1.5.tgz#5265c681a4f294dabbf17c9509b6763aa84510ce" + integrity sha1-UmXGgaTylNq78XyVCbZ2OqhFEM4= dependencies: for-in "^1.0.1" forever-agent@~0.6.1: version "0.6.1" resolved "https://registry.yarnpkg.com/forever-agent/-/forever-agent-0.6.1.tgz#fbc71f0c41adeb37f96c577ad1ed42d8fdacca91" + integrity sha1-+8cfDEGt6zf5bFd60e1C2P2sypE= form-data@~2.3.2: - version "2.3.2" - resolved "https://registry.yarnpkg.com/form-data/-/form-data-2.3.2.tgz#4970498be604c20c005d4f5c23aecd21d6b49099" + version "2.3.3" + resolved "https://registry.yarnpkg.com/form-data/-/form-data-2.3.3.tgz#dcce52c05f644f298c6a7ab936bd724ceffbf3a6" + integrity sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ== dependencies: asynckit "^0.4.0" - combined-stream "1.0.6" + combined-stream "^1.0.6" mime-types "^2.1.12" forwarded@~0.1.2: version "0.1.2" resolved "https://registry.yarnpkg.com/forwarded/-/forwarded-0.1.2.tgz#98c23dab1175657b8c0573e8ceccd91b0ff18c84" + integrity sha1-mMI9qxF1ZXuMBXPozszZGw/xjIQ= fragment-cache@^0.2.1: version "0.2.1" resolved "https://registry.yarnpkg.com/fragment-cache/-/fragment-cache-0.2.1.tgz#4290fad27f13e89be7f33799c6bc5a0abfff0d19" + integrity sha1-QpD60n8T6Jvn8zeZxrxaCr//DRk= dependencies: map-cache "^0.2.2" fresh@0.5.2: version "0.5.2" resolved "https://registry.yarnpkg.com/fresh/-/fresh-0.5.2.tgz#3d8cadd90d976569fa835ab1f8e4b23a105605a7" + integrity sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac= fs-constants@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/fs-constants/-/fs-constants-1.0.0.tgz#6be0de9be998ce16af8afc24497b9ee9b7ccd9ad" + integrity sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow== fs-extra@^0.30.0: version "0.30.0" resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-0.30.0.tgz#f233ffcc08d4da7d432daa449776989db1df93f0" + integrity sha1-8jP/zAjU2n1DLapEl3aYnbHfk/A= dependencies: graceful-fs "^4.1.2" jsonfile "^2.1.0" @@ -2952,21 +3401,24 @@ fs-extra@^0.30.0: fs-extra@^2.0.0, fs-extra@^2.1.2: version "2.1.2" resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-2.1.2.tgz#046c70163cef9aad46b0e4a7fa467fb22d71de35" + integrity sha1-BGxwFjzvmq1GsOSn+kZ/si1x3jU= dependencies: graceful-fs "^4.1.2" jsonfile "^2.1.0" -fs-extra@^4.0.2: - version "4.0.3" - resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-4.0.3.tgz#0d852122e5bc5beb453fb028e9c0c9bf36340c94" +fs-extra@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-5.0.0.tgz#414d0110cdd06705734d055652c5411260c31abd" + integrity sha512-66Pm4RYbjzdyeuqudYqhFiNBbCIuI9kgRqLPSHIlXHidW8NIQtVdkM1yeZ4lXwuhbTETv3EUGMNHAAw6hiundQ== dependencies: graceful-fs "^4.1.2" jsonfile "^4.0.0" universalify "^0.1.0" -fs-extra@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-5.0.0.tgz#414d0110cdd06705734d055652c5411260c31abd" +fs-extra@^7.0.1: + version "7.0.1" + resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-7.0.1.tgz#4f189c44aa123b895f722804f55ea23eadc348e9" + integrity sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw== dependencies: graceful-fs "^4.1.2" jsonfile "^4.0.0" @@ -2975,12 +3427,14 @@ fs-extra@^5.0.0: fs-minipass@^1.2.5: version "1.2.5" resolved "https://registry.yarnpkg.com/fs-minipass/-/fs-minipass-1.2.5.tgz#06c277218454ec288df77ada54a03b8702aacb9d" + integrity sha512-JhBl0skXjUPCFH7x6x61gQxrKyXsxB5gcgePLZCwfyCGGsTISMoIeObbrvVeP6Xmyaudw4TT43qV2Gz+iyd2oQ== dependencies: minipass "^2.2.1" fs-promise@^2.0.0: version "2.0.3" resolved "https://registry.yarnpkg.com/fs-promise/-/fs-promise-2.0.3.tgz#f64e4f854bcf689aa8bddcba268916db3db46854" + integrity sha1-9k5PhUvPaJqovdy6JokW2z20aFQ= dependencies: any-promise "^1.3.0" fs-extra "^2.0.0" @@ -2990,6 +3444,7 @@ fs-promise@^2.0.0: fs.realpath@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" + integrity sha1-FQStJSMVjKpA20onh8sBQRmU6k8= fs@0.0.2: version "0.0.2" @@ -2998,6 +3453,7 @@ fs@0.0.2: fsevents@^1.0.0, fsevents@^1.2.2: version "1.2.4" resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-1.2.4.tgz#f41dcb1af2582af3692da36fc55cbd8e1041c426" + integrity sha512-z8H8/diyk76B7q5wg+Ud0+CqzcAF3mBBI/bA5ne5zrRUUIvNkJY//D3BqyH571KuAC4Nr7Rw7CjWX4r0y9DvNg== dependencies: nan "^2.9.2" node-pre-gyp "^0.10.0" @@ -3005,6 +3461,7 @@ fsevents@^1.0.0, fsevents@^1.2.2: fstream@^1.0.2, fstream@^1.0.8: version "1.0.11" resolved "https://registry.yarnpkg.com/fstream/-/fstream-1.0.11.tgz#5c1fb1f117477114f0632a0eb4b71b3cb0fd3171" + integrity sha1-XB+x8RdHcRTwYyoOtLcbPLD9MXE= dependencies: graceful-fs "^4.1.2" inherits "~2.0.0" @@ -3014,20 +3471,26 @@ fstream@^1.0.2, fstream@^1.0.8: function-bind@^1.0.2, function-bind@^1.1.1, function-bind@~1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.1.tgz#a56899d3ea3c9bab874bb9773b7c5ede92f4895d" + integrity sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A== functional-red-black-tree@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz#1b0ab3bd553b2a0d6399d29c0e3ea0b252078327" + integrity sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc= -ganache-cli@^6.1.8: - version "6.1.8" - resolved "https://registry.yarnpkg.com/ganache-cli/-/ganache-cli-6.1.8.tgz#49a8a331683a9652183f82ef1378d17e1814fcd3" +ganache-cli@^6.2.4: + version "6.2.4" + resolved "https://registry.yarnpkg.com/ganache-cli/-/ganache-cli-6.2.4.tgz#0ec3d5d993a85c9f252fb632105ab7ffe7668638" + integrity sha512-Yxi+G+Qktr8s1BML0BEC2oIseMP/svWXmojajrdHNG8k84cyihvemuW4DLM7XA/ZOqi88mKt3n/mWTi0RbYpOQ== dependencies: - source-map-support "^0.5.3" + bn.js "4.11.8" + source-map-support "0.5.9" + yargs "11.1.0" gauge@~2.7.3: version "2.7.4" resolved "https://registry.yarnpkg.com/gauge/-/gauge-2.7.4.tgz#2c03405c7538c39d7eb37b317022e325fb018bf7" + integrity sha1-LANAXHU4w51+s3sxcCLjJfsBi/c= dependencies: aproba "^1.0.3" console-control-strings "^1.0.0" @@ -3041,10 +3504,12 @@ gauge@~2.7.3: get-caller-file@^1.0.1: version "1.0.3" resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-1.0.3.tgz#f978fa4c90d1dfe7ff2d6beda2a515e713bdcf4a" + integrity sha512-3t6rVToeoZfYSGd8YoLFR2DJkiQrIiUrGcjvFX2mDw3bn6k2OtwHN0TNCLbBO+w8qTvimhDkv+LSscbJY1vE6w== get-stream@^2.2.0: version "2.3.1" resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-2.3.1.tgz#5f38f93f346009666ee0150a054167f91bdd95de" + integrity sha1-Xzj5PzRgCWZu4BUKBUFn+Rvdld4= dependencies: object-assign "^4.0.1" pinkie-promise "^2.0.0" @@ -3052,20 +3517,24 @@ get-stream@^2.2.0: get-stream@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-3.0.0.tgz#8e943d1358dc37555054ecbe2edb05aa174ede14" + integrity sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ= get-value@^2.0.3, get-value@^2.0.6: version "2.0.6" resolved "https://registry.yarnpkg.com/get-value/-/get-value-2.0.6.tgz#dc15ca1c672387ca76bd37ac0a395ba2042a2c28" + integrity sha1-3BXKHGcjh8p2vTesCjlbogQqLCg= getpass@^0.1.1: version "0.1.7" resolved "https://registry.yarnpkg.com/getpass/-/getpass-0.1.7.tgz#5eff8e3e684d569ae4cb2b1282604e8ba62149fa" + integrity sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo= dependencies: assert-plus "^1.0.0" glob-base@^0.3.0: version "0.3.0" resolved "https://registry.yarnpkg.com/glob-base/-/glob-base-0.3.0.tgz#dbb164f6221b1c0b1ccf82aea328b497df0ea3c4" + integrity sha1-27Fk9iIbHAscz4Kuoyi0l98Oo8Q= dependencies: glob-parent "^2.0.0" is-glob "^2.0.0" @@ -3073,12 +3542,14 @@ glob-base@^0.3.0: glob-parent@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-2.0.0.tgz#81383d72db054fcccf5336daa902f182f6edbb28" + integrity sha1-gTg9ctsFT8zPUzbaqQLxgvbtuyg= dependencies: is-glob "^2.0.0" glob-parent@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-3.1.0.tgz#9e6af6299d8d3bd2bd40430832bd113df906c5ae" + integrity sha1-nmr2KZ2NO9K9QEMIMr0RPfkGxa4= dependencies: is-glob "^3.1.0" path-dirname "^1.0.0" @@ -3086,6 +3557,7 @@ glob-parent@^3.1.0: glob@7.1.2: version "7.1.2" resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.2.tgz#c19c9df9a028702d678612384a6552404c636d15" + integrity sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ== dependencies: fs.realpath "^1.0.0" inflight "^1.0.4" @@ -3097,6 +3569,7 @@ glob@7.1.2: glob@^5.0.15: version "5.0.15" resolved "https://registry.yarnpkg.com/glob/-/glob-5.0.15.tgz#1bc936b9e02f4a603fcc222ecf7633d30b8b93b1" + integrity sha1-G8k2ueAvSmA/zCIuz3Yz0wuLk7E= dependencies: inflight "^1.0.4" inherits "2" @@ -3104,9 +3577,10 @@ glob@^5.0.15: once "^1.3.0" path-is-absolute "^1.0.0" -glob@^7.0.0, glob@^7.0.3, glob@^7.0.5, glob@^7.1.2, glob@~7.1.2: +glob@^7.0.0, glob@^7.0.5, glob@^7.1.2, glob@~7.1.2: version "7.1.3" resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.3.tgz#3960832d3f1574108342dafd3a67b332c0969df1" + integrity sha512-vcfuiIxogLV4DlGBHIUOwI0IbrJ8HWPc4MU7HzviGeNho/UJDfi6B5p3sHeWIQ0KGIU0Jpxi5ZHxemQfLkkAwQ== dependencies: fs.realpath "^1.0.0" inflight "^1.0.4" @@ -3118,6 +3592,7 @@ glob@^7.0.0, glob@^7.0.3, glob@^7.0.5, glob@^7.1.2, glob@~7.1.2: glob@~6.0.4: version "6.0.4" resolved "https://registry.yarnpkg.com/glob/-/glob-6.0.4.tgz#0f08860f6a155127b2fadd4f9ce24b1aab6e4d22" + integrity sha1-DwiGD2oVUSey+t1PnOJLGqtuTSI= dependencies: inflight "^1.0.4" inherits "2" @@ -3128,32 +3603,25 @@ glob@~6.0.4: global@~4.3.0: version "4.3.2" resolved "https://registry.yarnpkg.com/global/-/global-4.3.2.tgz#e76989268a6c74c38908b1305b10fc0e394e9d0f" + integrity sha1-52mJJopsdMOJCLEwWxD8DjlOnQ8= dependencies: min-document "^2.19.0" process "~0.5.1" globals@^11.7.0: - version "11.8.0" - resolved "https://registry.yarnpkg.com/globals/-/globals-11.8.0.tgz#c1ef45ee9bed6badf0663c5cb90e8d1adec1321d" + version "11.9.0" + resolved "https://registry.yarnpkg.com/globals/-/globals-11.9.0.tgz#bde236808e987f290768a93d065060d78e6ab249" + integrity sha512-5cJVtyXWH8PiJPVLZzzoIizXx944O4OmRro5MWKx5fT4MgcN7OfaMutPeaTdJCCURwbWdhhcCWcKIffPnmTzBg== globals@^9.18.0: version "9.18.0" resolved "https://registry.yarnpkg.com/globals/-/globals-9.18.0.tgz#aa3896b3e69b487f17e31ed2143d69a8e30c2d8a" - -globby@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/globby/-/globby-5.0.0.tgz#ebd84667ca0dbb330b99bcfc68eac2bc54370e0d" - dependencies: - array-union "^1.0.1" - arrify "^1.0.0" - glob "^7.0.3" - object-assign "^4.0.1" - pify "^2.0.0" - pinkie-promise "^2.0.0" + integrity sha512-S0nG3CLEQiY/ILxqtztTWH/3iRRdyBLw6KMDxnKMchrtbj2OFmehVh0WUCfW3DUrIgx/qFrJPICrq4Z4sTR9UQ== got@7.1.0, got@^7.1.0: version "7.1.0" resolved "https://registry.yarnpkg.com/got/-/got-7.1.0.tgz#05450fd84094e6bbea56f451a43a9c289166385a" + integrity sha512-Y5WMo7xKKq1muPsxD+KmrR8DH5auG7fBdDVueZwETwV6VytKyU9OX/ddpq2/1hp1vIPvVb4T81dKQz3BivkNLw== dependencies: decompress-response "^3.2.0" duplexer3 "^0.1.4" @@ -3171,24 +3639,29 @@ got@7.1.0, got@^7.1.0: url-to-options "^1.0.1" graceful-fs@*, graceful-fs@^4.1.10, graceful-fs@^4.1.11, graceful-fs@^4.1.2, graceful-fs@^4.1.6, graceful-fs@^4.1.9: - version "4.1.11" - resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.1.11.tgz#0e8bdfe4d1ddb8854d64e04ea7c00e2a026e5658" + version "4.1.15" + resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.1.15.tgz#ffb703e1066e8a0eeaa4c8b80ba9253eeefbfb00" + integrity sha512-6uHUhOPEBgQ24HM+r6b/QwWfZq+yiFcipKFrOFiBEnWdy5sdzYoi+pJeQaPI5qOLRFqWmAXUPQNsielzdLoecA== "graceful-readlink@>= 1.0.0": version "1.0.1" resolved "https://registry.yarnpkg.com/graceful-readlink/-/graceful-readlink-1.0.1.tgz#4cafad76bc62f02fa039b2f94e9a3dd3a391a725" + integrity sha1-TK+tdrxi8C+gObL5Tpo906ORpyU= growl@1.10.3: version "1.10.3" resolved "https://registry.yarnpkg.com/growl/-/growl-1.10.3.tgz#1926ba90cf3edfe2adb4927f5880bc22c66c790f" + integrity sha512-hKlsbA5Vu3xsh1Cg3J7jSmX/WaW6A5oBeqzM88oNbCRQFz+zUaXm6yxS4RVytp1scBoJzSYl4YAEOQIt6O8V1Q== growl@1.10.5, "growl@~> 1.10.0": version "1.10.5" resolved "https://registry.yarnpkg.com/growl/-/growl-1.10.5.tgz#f2735dc2283674fa67478b10181059355c369e5e" + integrity sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA== handlebars@^4.0.1: version "4.0.12" resolved "https://registry.yarnpkg.com/handlebars/-/handlebars-4.0.12.tgz#2c15c8a96d46da5e266700518ba8cb8d919d5bc5" + integrity sha512-RhmTekP+FZL+XNhwS1Wf+bTTZpdLougwt5pcgA1tuz6Jcx0fpH/7z0qd71RKnZHBCxIRBHfBOnio4gViPemNzA== dependencies: async "^2.5.0" optimist "^0.6.1" @@ -3199,53 +3672,64 @@ handlebars@^4.0.1: har-schema@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/har-schema/-/har-schema-2.0.0.tgz#a94c2224ebcac04782a0d9035521f24735b7ec92" + integrity sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI= har-validator@~5.1.0: - version "5.1.0" - resolved "https://registry.yarnpkg.com/har-validator/-/har-validator-5.1.0.tgz#44657f5688a22cfd4b72486e81b3a3fb11742c29" + version "5.1.3" + resolved "https://registry.yarnpkg.com/har-validator/-/har-validator-5.1.3.tgz#1ef89ebd3e4996557675eed9893110dc350fa080" + integrity sha512-sNvOCzEQNr/qrvJgc3UG/kD4QtlHycrzwS+6mfTrrSq97BvaYcPZZI1ZSqGSPR73Cxn4LKTD4PttRwfU7jWq5g== dependencies: - ajv "^5.3.0" + ajv "^6.5.5" har-schema "^2.0.0" has-ansi@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/has-ansi/-/has-ansi-2.0.0.tgz#34f5049ce1ecdf2b0649af3ef24e45ed35416d91" + integrity sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE= dependencies: ansi-regex "^2.0.0" has-flag@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-1.0.0.tgz#9d9e793165ce017a00f00418c43f942a7b1d11fa" + integrity sha1-nZ55MWXOAXoA8AQYxD+UKnsdEfo= has-flag@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-2.0.0.tgz#e8207af1cc7b30d446cc70b734b5e8be18f88d51" + integrity sha1-6CB68cx7MNRGzHC3NLXovhj4jVE= has-flag@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-3.0.0.tgz#b5d454dc2199ae225699f3467e5a07f3b955bafd" + integrity sha1-tdRU3CGZriJWmfNGfloH87lVuv0= has-symbol-support-x@^1.4.1: version "1.4.2" resolved "https://registry.yarnpkg.com/has-symbol-support-x/-/has-symbol-support-x-1.4.2.tgz#1409f98bc00247da45da67cee0a36f282ff26455" + integrity sha512-3ToOva++HaW+eCpgqZrCfN51IPB+7bJNVT6CUATzueB5Heb8o6Nam0V3HG5dlDvZU1Gn5QLcbahiKw/XVk5JJw== has-symbols@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/has-symbols/-/has-symbols-1.0.0.tgz#ba1a8f1af2a0fc39650f5c850367704122063b44" + integrity sha1-uhqPGvKg/DllD1yFA2dwQSIGO0Q= has-to-string-tag-x@^1.2.0: version "1.4.1" resolved "https://registry.yarnpkg.com/has-to-string-tag-x/-/has-to-string-tag-x-1.4.1.tgz#a045ab383d7b4b2012a00148ab0aa5f290044d4d" + integrity sha512-vdbKfmw+3LoOYVr+mtxHaX5a96+0f3DljYd8JOqvOLsf5mw2Otda2qCDT9qRqLAhrjyQ0h7ual5nOiASpsGNFw== dependencies: has-symbol-support-x "^1.4.1" has-unicode@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/has-unicode/-/has-unicode-2.0.1.tgz#e0e6fe6a28cf51138855e086d1691e771de2a8b9" + integrity sha1-4Ob+aijPUROIVeCG0Wkedx3iqLk= has-value@^0.3.1: version "0.3.1" resolved "https://registry.yarnpkg.com/has-value/-/has-value-0.3.1.tgz#7b1f58bada62ca827ec0a2078025654845995e1f" + integrity sha1-ex9YutpiyoJ+wKIHgCVlSEWZXh8= dependencies: get-value "^2.0.3" has-values "^0.1.4" @@ -3254,6 +3738,7 @@ has-value@^0.3.1: has-value@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/has-value/-/has-value-1.0.0.tgz#18b281da585b1c5c51def24c930ed29a0be6b177" + integrity sha1-GLKB2lhbHFxR3vJMkw7SmgvmsXc= dependencies: get-value "^2.0.6" has-values "^1.0.0" @@ -3262,10 +3747,12 @@ has-value@^1.0.0: has-values@^0.1.4: version "0.1.4" resolved "https://registry.yarnpkg.com/has-values/-/has-values-0.1.4.tgz#6d61de95d91dfca9b9a02089ad384bff8f62b771" + integrity sha1-bWHeldkd/Km5oCCJrThL/49it3E= has-values@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/has-values/-/has-values-1.0.0.tgz#95b0b63fec2146619a6fe57fe75628d5a39efe4f" + integrity sha1-lbC2P+whRmGab+V/51Yo1aOe/k8= dependencies: is-number "^3.0.0" kind-of "^4.0.0" @@ -3273,12 +3760,14 @@ has-values@^1.0.0: has@^1.0.1, has@~1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/has/-/has-1.0.3.tgz#722d7cbfc1f6aa8241f16dd814e011e1f41e8796" + integrity sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw== dependencies: function-bind "^1.1.1" hash-base@^3.0.0: version "3.0.4" resolved "https://registry.yarnpkg.com/hash-base/-/hash-base-3.0.4.tgz#5fc8686847ecd73499403319a6b0a3f3f6ae4918" + integrity sha1-X8hoaEfs1zSZQDMZprCj8/auSRg= dependencies: inherits "^2.0.1" safe-buffer "^5.0.1" @@ -3291,8 +3780,9 @@ hash.js@1.1.3: minimalistic-assert "^1.0.0" hash.js@^1.0.0, hash.js@^1.0.3: - version "1.1.5" - resolved "https://registry.yarnpkg.com/hash.js/-/hash.js-1.1.5.tgz#e38ab4b85dfb1e0c40fe9265c0e9b54854c23812" + version "1.1.7" + resolved "https://registry.yarnpkg.com/hash.js/-/hash.js-1.1.7.tgz#0babca538e8d4ee4a0f8988d68866537a003cf42" + integrity sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA== dependencies: inherits "^2.0.3" minimalistic-assert "^1.0.1" @@ -3300,6 +3790,7 @@ hash.js@^1.0.0, hash.js@^1.0.3: hdkey@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/hdkey/-/hdkey-1.1.0.tgz#e74e7b01d2c47f797fa65d1d839adb7a44639f29" + integrity sha512-E7aU8pNlWUJbXGjTz/+lKf1LkMcA3hUrC5ZleeizrmLSd++kvf8mSOe3q8CmBDA9j4hdfXO5iY6hGiTUCOV2jQ== dependencies: coinstring "^2.0.0" safe-buffer "^5.1.1" @@ -3308,10 +3799,12 @@ hdkey@^1.0.0: he@1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/he/-/he-1.1.1.tgz#93410fd21b009735151f8868c2f271f3427e23fd" + integrity sha1-k0EP0hsAlzUVH4howvJx80J+I/0= hmac-drbg@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/hmac-drbg/-/hmac-drbg-1.0.1.tgz#d2745701025a6c775a6c545793ed502fc0c649a1" + integrity sha1-0nRXAQJabHdabFRXk+1QL8DGSaE= dependencies: hash.js "^1.0.3" minimalistic-assert "^1.0.0" @@ -3320,6 +3813,7 @@ hmac-drbg@^1.0.0: home-or-tmp@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/home-or-tmp/-/home-or-tmp-2.0.0.tgz#e36c3f2d2cae7d746a857e38d18d5f32a7882db8" + integrity sha1-42w/LSyufXRqhX440Y1fMqeILbg= dependencies: os-homedir "^1.0.0" os-tmpdir "^1.0.1" @@ -3327,10 +3821,12 @@ home-or-tmp@^2.0.0: hosted-git-info@^2.1.4: version "2.7.1" resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-2.7.1.tgz#97f236977bd6e125408930ff6de3eec6281ec047" + integrity sha512-7T/BxH19zbcCTa8XkMlbK5lTo1WtgkFi3GvdWEyNuc4Vex7/9Dqbnpsf4JMydcfj9HCg4zUWFTL3Za6lapg5/w== http-errors@1.6.3, http-errors@~1.6.2, http-errors@~1.6.3: version "1.6.3" resolved "https://registry.yarnpkg.com/http-errors/-/http-errors-1.6.3.tgz#8b55680bb4be283a0b5bf4ea2e38580be1d9320d" + integrity sha1-i1VoC7S+KDoLW/TqLjhYC+HZMg0= dependencies: depd "~1.1.2" inherits "2.0.3" @@ -3340,10 +3836,12 @@ http-errors@1.6.3, http-errors@~1.6.2, http-errors@~1.6.3: http-https@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/http-https/-/http-https-1.0.0.tgz#2f908dd5f1db4068c058cd6e6d4ce392c913389b" + integrity sha1-L5CN1fHbQGjAWM1ubUzjkskTOJs= http-signature@~1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/http-signature/-/http-signature-1.2.0.tgz#9aecd925114772f3d95b65a60abb8f7c18fbace1" + integrity sha1-muzZJRFHcvPZW2WmCruPfBj7rOE= dependencies: assert-plus "^1.0.0" jsprim "^1.2.2" @@ -3352,10 +3850,12 @@ http-signature@~1.2.0: https-browserify@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/https-browserify/-/https-browserify-1.0.0.tgz#ec06c10e0a34c0f2faf199f7fd7fc78fffd03c73" + integrity sha1-7AbBDgo0wPL68Zn3/X/Hj//QPHM= i18n@^0.8.3: version "0.8.3" resolved "https://registry.yarnpkg.com/i18n/-/i18n-0.8.3.tgz#2d8cf1c24722602c2041d01ba6ae5eaa51388f0e" + integrity sha1-LYzxwkciYCwgQdAbpq5eqlE4jw4= dependencies: debug "*" make-plural "^3.0.3" @@ -3367,26 +3867,31 @@ i18n@^0.8.3: i@0.3.x: version "0.3.6" resolved "https://registry.yarnpkg.com/i/-/i-0.3.6.tgz#d96c92732076f072711b6b10fd7d4f65ad8ee23d" + integrity sha1-2WyScyB28HJxG2sQ/X1PZa2O4j0= iconv-lite@0.4.23: version "0.4.23" resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.23.tgz#297871f63be507adcfbfca715d0cd0eed84e9a63" + integrity sha512-neyTUVFtahjf0mB3dZT77u+8O0QB89jFdnBkd5P1JgYPbPaia3gXXOVL2fq8VyU2gMMD7SaN7QukTB/pmXYvDA== dependencies: safer-buffer ">= 2.1.2 < 3" iconv-lite@^0.4.24, iconv-lite@^0.4.4, iconv-lite@~0.4.13: version "0.4.24" resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.24.tgz#2022b4b25fbddc21d2f524974a474aafe733908b" + integrity sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA== dependencies: safer-buffer ">= 2.1.2 < 3" ieee754@^1.1.4, ieee754@^1.1.8: version "1.1.12" resolved "https://registry.yarnpkg.com/ieee754/-/ieee754-1.1.12.tgz#50bf24e5b9c8bb98af4964c941cdb0918da7b60b" + integrity sha512-GguP+DRY+pJ3soyIiGPTvdiVXjZ+DbXOxGpXn3eMvNW4x4irjqXm4wHKscC+TfxSJ0yw/S1F24tqdMNsMZTiLA== ignore-walk@^3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/ignore-walk/-/ignore-walk-3.0.1.tgz#a83e62e7d272ac0e3b551aaa82831a19b69f82f8" + integrity sha512-DTVlMx3IYPe0/JJcYP7Gxg7ttZZu3IInhuEhbchuqneY9wWe5Ojy2mXLBaQFUQmo0AW2r3qG7m1mg86js+gnlQ== dependencies: minimatch "^3.0.4" @@ -3401,6 +3906,7 @@ ignore@^5.0.2: ignorefs@^1.0.0: version "1.2.0" resolved "https://registry.yarnpkg.com/ignorefs/-/ignorefs-1.2.0.tgz#da59fb858976e4a5e43702ccd1f282fdbc9e5756" + integrity sha1-2ln7hYl25KXkNwLM0fKC/byeV1Y= dependencies: editions "^1.3.3" ignorepatterns "^1.1.0" @@ -3408,22 +3914,27 @@ ignorefs@^1.0.0: ignorepatterns@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/ignorepatterns/-/ignorepatterns-1.1.0.tgz#ac8f436f2239b5dfb66d5f0d3a904a87ac67cc5e" + integrity sha1-rI9DbyI5td+2bV8NOpBKh6xnzF4= immediate@^3.2.3: version "3.2.3" resolved "https://registry.yarnpkg.com/immediate/-/immediate-3.2.3.tgz#d140fa8f614659bd6541233097ddaac25cdd991c" + integrity sha1-0UD6j2FGWb1lQSMwl92qwlzdmRw= imurmurhash@^0.1.4: version "0.1.4" resolved "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea" + integrity sha1-khi5srkoojixPcT7a21XbyMUU+o= indexof@0.0.1: version "0.0.1" resolved "https://registry.yarnpkg.com/indexof/-/indexof-0.0.1.tgz#82dc336d232b9062179d05ab3293a66059fd435d" + integrity sha1-gtwzbSMrkGIXnQWrMpOmYFn9Q10= inflight@^1.0.4: version "1.0.6" resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9" + integrity sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk= dependencies: once "^1.3.0" wrappy "1" @@ -3431,14 +3942,17 @@ inflight@^1.0.4: inherits@2, inherits@2.0.3, inherits@^2.0.1, inherits@^2.0.3, inherits@~2.0.0, inherits@~2.0.1, inherits@~2.0.3: version "2.0.3" resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de" + integrity sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4= inherits@2.0.1, inherits@=2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.1.tgz#b17d08d326b4423e568eff719f91b0b1cbdf69f1" + integrity sha1-sX0I0ya0Qj5Wjv9xn5GwscvfafE= ini@~1.3.0: version "1.3.5" resolved "https://registry.yarnpkg.com/ini/-/ini-1.3.5.tgz#eee25f56db1c9ec6085e0c22778083f596abf927" + integrity sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw== inquirer@^6.1.0: version "6.2.0" @@ -3461,76 +3975,91 @@ inquirer@^6.1.0: interpret@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/interpret/-/interpret-1.1.0.tgz#7ed1b1410c6a0e0f78cf95d3b8440c63f78b8614" + integrity sha1-ftGxQQxqDg94z5XTuEQMY/eLhhQ= invariant@^2.2.2: version "2.2.4" resolved "https://registry.yarnpkg.com/invariant/-/invariant-2.2.4.tgz#610f3c92c9359ce1db616e538008d23ff35158e6" + integrity sha512-phJfQVBuaJM5raOpJjSfkiD6BpbCE4Ns//LaXl6wGYtUBY83nWS6Rf9tXm2e8VaK60JEjYldbPif/A2B1C2gNA== dependencies: loose-envify "^1.0.0" invert-kv@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/invert-kv/-/invert-kv-1.0.0.tgz#104a8e4aaca6d3d8cd157a8ef8bfab2d7a3ffdb6" + integrity sha1-EEqOSqym09jNFXqO+L+rLXo//bY= ipaddr.js@1.8.0: version "1.8.0" resolved "https://registry.yarnpkg.com/ipaddr.js/-/ipaddr.js-1.8.0.tgz#eaa33d6ddd7ace8f7f6fe0c9ca0440e706738b1e" + integrity sha1-6qM9bd16zo9/b+DJygRA5wZzix4= is-accessor-descriptor@^0.1.6: version "0.1.6" resolved "https://registry.yarnpkg.com/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz#a9e12cb3ae8d876727eeef3843f8a0897b5c98d6" + integrity sha1-qeEss66Nh2cn7u84Q/igiXtcmNY= dependencies: kind-of "^3.0.2" is-accessor-descriptor@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz#169c2f6d3df1f992618072365c9b0ea1f6878656" + integrity sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ== dependencies: kind-of "^6.0.0" is-arrayish@^0.2.1: version "0.2.1" resolved "https://registry.yarnpkg.com/is-arrayish/-/is-arrayish-0.2.1.tgz#77c99840527aa8ecb1a8ba697b80645a7a926a9d" + integrity sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0= is-binary-path@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/is-binary-path/-/is-binary-path-1.0.1.tgz#75f16642b480f187a711c814161fd3a4a7655898" + integrity sha1-dfFmQrSA8YenEcgUFh/TpKdlWJg= dependencies: binary-extensions "^1.0.0" is-buffer@^1.1.5, is-buffer@~1.1.1: version "1.1.6" resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-1.1.6.tgz#efaa2ea9daa0d7ab2ea13a97b2b8ad51fefbe8be" + integrity sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w== is-builtin-module@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-builtin-module/-/is-builtin-module-1.0.0.tgz#540572d34f7ac3119f8f76c30cbc1b1e037affbe" + integrity sha1-VAVy0096wxGfj3bDDLwbHgN6/74= dependencies: builtin-modules "^1.0.0" is-callable@^1.1.3, is-callable@^1.1.4: version "1.1.4" resolved "https://registry.yarnpkg.com/is-callable/-/is-callable-1.1.4.tgz#1e1adf219e1eeb684d691f9d6a05ff0d30a24d75" + integrity sha512-r5p9sxJjYnArLjObpjA4xu5EKI3CuKHkJXMhT7kwbpUyIFD1n5PMAsoPvWnvtZiNz7LjkYDRZhd7FlI0eMijEA== is-data-descriptor@^0.1.4: version "0.1.4" resolved "https://registry.yarnpkg.com/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz#0b5ee648388e2c860282e793f1856fec3f301b56" + integrity sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y= dependencies: kind-of "^3.0.2" is-data-descriptor@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz#d84876321d0e7add03990406abbbbd36ba9268c7" + integrity sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ== dependencies: kind-of "^6.0.0" is-date-object@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/is-date-object/-/is-date-object-1.0.1.tgz#9aa20eb6aeebbff77fbd33e74ca01b33581d3a16" + integrity sha1-mqIOtq7rv/d/vTPnTKAbM1gdOhY= is-descriptor@^0.1.0: version "0.1.6" resolved "https://registry.yarnpkg.com/is-descriptor/-/is-descriptor-0.1.6.tgz#366d8240dde487ca51823b1ab9f07a10a78251ca" + integrity sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg== dependencies: is-accessor-descriptor "^0.1.6" is-data-descriptor "^0.1.4" @@ -3539,6 +4068,7 @@ is-descriptor@^0.1.0: is-descriptor@^1.0.0, is-descriptor@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/is-descriptor/-/is-descriptor-1.0.2.tgz#3b159746a66604b04f8c81524ba365c5f14d86ec" + integrity sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg== dependencies: is-accessor-descriptor "^1.0.0" is-data-descriptor "^1.0.0" @@ -3547,210 +4077,230 @@ is-descriptor@^1.0.0, is-descriptor@^1.0.2: is-dotfile@^1.0.0: version "1.0.3" resolved "https://registry.yarnpkg.com/is-dotfile/-/is-dotfile-1.0.3.tgz#a6a2f32ffd2dfb04f5ca25ecd0f6b83cf798a1e1" + integrity sha1-pqLzL/0t+wT1yiXs0Pa4PPeYoeE= is-equal-shallow@^0.1.3: version "0.1.3" resolved "https://registry.yarnpkg.com/is-equal-shallow/-/is-equal-shallow-0.1.3.tgz#2238098fc221de0bcfa5d9eac4c45d638aa1c534" + integrity sha1-IjgJj8Ih3gvPpdnqxMRdY4qhxTQ= dependencies: is-primitive "^2.0.0" is-extendable@^0.1.0, is-extendable@^0.1.1: version "0.1.1" resolved "https://registry.yarnpkg.com/is-extendable/-/is-extendable-0.1.1.tgz#62b110e289a471418e3ec36a617d472e301dfc89" + integrity sha1-YrEQ4omkcUGOPsNqYX1HLjAd/Ik= is-extendable@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/is-extendable/-/is-extendable-1.0.1.tgz#a7470f9e426733d81bd81e1155264e3a3507cab4" + integrity sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA== dependencies: is-plain-object "^2.0.4" is-extglob@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-extglob/-/is-extglob-1.0.0.tgz#ac468177c4943405a092fc8f29760c6ffc6206c0" + integrity sha1-rEaBd8SUNAWgkvyPKXYMb/xiBsA= is-extglob@^2.1.0, is-extglob@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/is-extglob/-/is-extglob-2.1.1.tgz#a88c02535791f02ed37c76a1b9ea9773c833f8c2" + integrity sha1-qIwCU1eR8C7TfHahueqXc8gz+MI= is-finite@^1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/is-finite/-/is-finite-1.0.2.tgz#cc6677695602be550ef11e8b4aa6305342b6d0aa" + integrity sha1-zGZ3aVYCvlUO8R6LSqYwU0K20Ko= dependencies: number-is-nan "^1.0.0" is-fn@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-fn/-/is-fn-1.0.0.tgz#9543d5de7bcf5b08a22ec8a20bae6e286d510d8c" + integrity sha1-lUPV3nvPWwiiLsiiC65uKG1RDYw= is-fullwidth-code-point@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz#ef9e31386f031a7f0d643af82fde50c457ef00cb" + integrity sha1-754xOG8DGn8NZDr4L95QxFfvAMs= dependencies: number-is-nan "^1.0.0" is-fullwidth-code-point@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz#a3b30a5c4f199183167aaab93beefae3ddfb654f" + integrity sha1-o7MKXE8ZkYMWeqq5O+764937ZU8= is-function@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/is-function/-/is-function-1.0.1.tgz#12cfb98b65b57dd3d193a3121f5f6e2f437602b5" + integrity sha1-Es+5i2W1fdPRk6MSH19uL0N2ArU= is-glob@^2.0.0, is-glob@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-2.0.1.tgz#d096f926a3ded5600f3fdfd91198cb0888c2d863" + integrity sha1-0Jb5JqPe1WAPP9/ZEZjLCIjC2GM= dependencies: is-extglob "^1.0.0" is-glob@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-3.1.0.tgz#7ba5ae24217804ac70707b96922567486cc3e84a" + integrity sha1-e6WuJCF4BKxwcHuWkiVnSGzD6Eo= dependencies: is-extglob "^2.1.0" is-glob@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-4.0.0.tgz#9521c76845cc2610a85203ddf080a958c2ffabc0" + integrity sha1-lSHHaEXMJhCoUgPd8ICpWML/q8A= dependencies: is-extglob "^2.1.1" is-hex-prefixed@1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-hex-prefixed/-/is-hex-prefixed-1.0.0.tgz#7d8d37e6ad77e5d127148913c573e082d777f554" + integrity sha1-fY035q135dEnFIkTxXPggtd39VQ= is-nan@^1.2.1: version "1.2.1" resolved "https://registry.yarnpkg.com/is-nan/-/is-nan-1.2.1.tgz#9faf65b6fb6db24b7f5c0628475ea71f988401e2" + integrity sha1-n69ltvttskt/XAYoR16nH5iEAeI= dependencies: define-properties "^1.1.1" is-natural-number@^4.0.1: version "4.0.1" resolved "https://registry.yarnpkg.com/is-natural-number/-/is-natural-number-4.0.1.tgz#ab9d76e1db4ced51e35de0c72ebecf09f734cde8" + integrity sha1-q5124dtM7VHjXeDHLr7PCfc0zeg= is-number@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/is-number/-/is-number-2.1.0.tgz#01fcbbb393463a548f2f466cce16dece49db908f" + integrity sha1-Afy7s5NGOlSPL0ZszhbezknbkI8= dependencies: kind-of "^3.0.2" is-number@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/is-number/-/is-number-3.0.0.tgz#24fd6201a4782cf50561c810276afc7d12d71195" + integrity sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU= dependencies: kind-of "^3.0.2" is-number@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/is-number/-/is-number-4.0.0.tgz#0026e37f5454d73e356dfe6564699867c6a7f0ff" + integrity sha512-rSklcAIlf1OmFdyAqbnWTLVelsQ58uvZ66S/ZyawjWqIviTWCjg2PzVGw8WUA+nNuPTqb4wgA+NszrJ+08LlgQ== is-obj@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/is-obj/-/is-obj-1.0.1.tgz#3e4729ac1f5fde025cd7d83a896dab9f4f67db0f" + integrity sha1-PkcprB9f3gJc19g6iW2rn09n2w8= is-object@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/is-object/-/is-object-1.0.1.tgz#8952688c5ec2ffd6b03ecc85e769e02903083470" - -is-path-cwd@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/is-path-cwd/-/is-path-cwd-1.0.0.tgz#d225ec23132e89edd38fda767472e62e65f1106d" - -is-path-in-cwd@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/is-path-in-cwd/-/is-path-in-cwd-1.0.1.tgz#5ac48b345ef675339bd6c7a48a912110b241cf52" - dependencies: - is-path-inside "^1.0.0" - -is-path-inside@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/is-path-inside/-/is-path-inside-1.0.1.tgz#8ef5b7de50437a3fdca6b4e865ef7aa55cb48036" - dependencies: - path-is-inside "^1.0.1" + integrity sha1-iVJojF7C/9awPsyF52ngKQMINHA= is-plain-obj@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/is-plain-obj/-/is-plain-obj-1.1.0.tgz#71a50c8429dfca773c92a390a4a03b39fcd51d3e" + integrity sha1-caUMhCnfync8kqOQpKA7OfzVHT4= is-plain-object@^2.0.1, is-plain-object@^2.0.3, is-plain-object@^2.0.4: version "2.0.4" resolved "https://registry.yarnpkg.com/is-plain-object/-/is-plain-object-2.0.4.tgz#2c163b3fafb1b606d9d17928f05c2a1c38e07677" + integrity sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og== dependencies: isobject "^3.0.1" is-posix-bracket@^0.1.0: version "0.1.1" resolved "https://registry.yarnpkg.com/is-posix-bracket/-/is-posix-bracket-0.1.1.tgz#3334dc79774368e92f016e6fbc0a88f5cd6e6bc4" + integrity sha1-MzTceXdDaOkvAW5vvAqI9c1ua8Q= is-primitive@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/is-primitive/-/is-primitive-2.0.0.tgz#207bab91638499c07b2adf240a41a87210034575" + integrity sha1-IHurkWOEmcB7Kt8kCkGochADRXU= is-promise@^2.1, is-promise@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/is-promise/-/is-promise-2.1.0.tgz#79a2a9ece7f096e80f36d2b2f3bc16c1ff4bf3fa" + integrity sha1-eaKp7OfwlugPNtKy87wWwf9L8/o= is-regex@^1.0.4: version "1.0.4" resolved "https://registry.yarnpkg.com/is-regex/-/is-regex-1.0.4.tgz#5517489b547091b0930e095654ced25ee97e9491" + integrity sha1-VRdIm1RwkbCTDglWVM7SXul+lJE= dependencies: has "^1.0.1" -is-resolvable@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/is-resolvable/-/is-resolvable-1.1.0.tgz#fb18f87ce1feb925169c9a407c19318a3206ed88" - is-retry-allowed@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/is-retry-allowed/-/is-retry-allowed-1.1.0.tgz#11a060568b67339444033d0125a61a20d564fb34" + integrity sha1-EaBgVotnM5REAz0BJaYaINVk+zQ= is-stream@^1.0.0, is-stream@^1.0.1, is-stream@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-1.1.0.tgz#12d4a3dd4e68e0b79ceb8dbc84173ae80d91ca44" + integrity sha1-EtSj3U5o4Lec6428hBc66A2RykQ= is-symbol@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/is-symbol/-/is-symbol-1.0.2.tgz#a055f6ae57192caee329e7a860118b497a950f38" + integrity sha512-HS8bZ9ox60yCJLH9snBpIwv9pYUAkcuLhSA1oero1UB5y9aiQpRA8y2ex945AOtCZL1lJDeIk3G5LthswI46Lw== dependencies: has-symbols "^1.0.0" is-typedarray@^1.0.0, is-typedarray@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-typedarray/-/is-typedarray-1.0.0.tgz#e479c80858df0c1b11ddda6940f96011fcda4a9a" + integrity sha1-5HnICFjfDBsR3dppQPlgEfzaSpo= is-utf8@^0.2.0: version "0.2.1" resolved "https://registry.yarnpkg.com/is-utf8/-/is-utf8-0.2.1.tgz#4b0da1442104d1b336340e80797e865cf39f7d72" + integrity sha1-Sw2hRCEE0bM2NA6AeX6GXPOffXI= is-windows@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/is-windows/-/is-windows-1.0.2.tgz#d1850eb9791ecd18e6182ce12a30f396634bb19d" + integrity sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA== isarray@0.0.1: version "0.0.1" resolved "https://registry.yarnpkg.com/isarray/-/isarray-0.0.1.tgz#8a18acfca9a8f4177e09abfc6038939b05d1eedf" + integrity sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8= isarray@1.0.0, isarray@^1.0.0, isarray@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11" + integrity sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE= isexe@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10" + integrity sha1-6PvzdNxVb/iUehDcsFctYz8s+hA= isobject@^2.0.0: version "2.1.0" resolved "https://registry.yarnpkg.com/isobject/-/isobject-2.1.0.tgz#f065561096a3f1da2ef46272f815c840d87e0c89" + integrity sha1-8GVWEJaj8dou9GJy+BXIQNh+DIk= dependencies: isarray "1.0.0" isobject@^3.0.0, isobject@^3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/isobject/-/isobject-3.0.1.tgz#4e431e92b11a9731636aa1f9c8d1ccbcfdab78df" + integrity sha1-TkMekrEalzFjaqH5yNHMvP2reN8= isomorphic-fetch@^2.2.0: version "2.2.1" resolved "https://registry.yarnpkg.com/isomorphic-fetch/-/isomorphic-fetch-2.2.1.tgz#611ae1acf14f5e81f729507472819fe9733558a9" + integrity sha1-YRrhrPFPXoH3KVB0coGf6XM1WKk= dependencies: node-fetch "^1.0.1" whatwg-fetch ">=0.10.0" @@ -3758,10 +4308,12 @@ isomorphic-fetch@^2.2.0: isstream@0.1.x, isstream@~0.1.2: version "0.1.2" resolved "https://registry.yarnpkg.com/isstream/-/isstream-0.1.2.tgz#47e63f7af55afa6f92e1500e690eb8b8529c099a" + integrity sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo= istanbul@^0.4.5: version "0.4.5" resolved "https://registry.yarnpkg.com/istanbul/-/istanbul-0.4.5.tgz#65c7d73d4c4da84d4f3ac310b918fb0b8033733b" + integrity sha1-ZcfXPUxNqE1POsMQuRj7C4Azczs= dependencies: abbrev "1.0.x" async "1.x" @@ -3781,6 +4333,7 @@ istanbul@^0.4.5: isurl@^1.0.0-alpha5: version "1.0.0" resolved "https://registry.yarnpkg.com/isurl/-/isurl-1.0.0.tgz#b27f4f49f3cdaa3ea44a0a5b7f3462e6edc39d67" + integrity sha512-1P/yWsxPlDtn7QeRD+ULKQPaIaN6yF368GZ2vDfv0AL0NwpStafjWCDDdn0k8wgFMWpVAqG7oJhxHnlud42i9w== dependencies: has-to-string-tag-x "^1.2.0" is-object "^1.0.1" @@ -3788,30 +4341,37 @@ isurl@^1.0.0-alpha5: js-sha3@0.5.5: version "0.5.5" resolved "https://registry.yarnpkg.com/js-sha3/-/js-sha3-0.5.5.tgz#baf0c0e8c54ad5903447df96ade7a4a1bca79a4a" + integrity sha1-uvDA6MVK1ZA0R9+Wreekobynmko= js-sha3@0.5.7: version "0.5.7" resolved "https://registry.yarnpkg.com/js-sha3/-/js-sha3-0.5.7.tgz#0d4ffd8002d5333aabaf4a23eed2f6374c9f28e7" + integrity sha1-DU/9gALVMzqrr0oj7tL2N0yfKOc= js-sha3@^0.3.1: version "0.3.1" resolved "https://registry.yarnpkg.com/js-sha3/-/js-sha3-0.3.1.tgz#86122802142f0828502a0d1dee1d95e253bb0243" + integrity sha1-hhIoAhQvCChQKg0d7h2V4lO7AkM= js-string-escape@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/js-string-escape/-/js-string-escape-1.0.1.tgz#e2625badbc0d67c7533e9edc1068c587ae4137ef" + integrity sha1-4mJbrbwNZ8dTPp7cEGjFh65BN+8= "js-tokens@^3.0.0 || ^4.0.0", js-tokens@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499" + integrity sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ== js-tokens@^3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-3.0.2.tgz#9866df395102130e38f7f996bceb65443209c25b" + integrity sha1-mGbfOVECEw449/mWvOtlRDIJwls= js-yaml@3.x, js-yaml@^3.11.0, js-yaml@^3.12.0: version "3.12.0" resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.12.0.tgz#eaed656ec8344f10f527c6bfa1b6e2244de167d1" + integrity sha512-PIt2cnwmPfL4hKNwqeiuz4bKfnzHTBv6HyVgjahA6mPLwPDzjDWrplJBMjHUFxku/N3FlmrbyPclad+I+4mJ3A== dependencies: argparse "^1.0.7" esprima "^4.0.0" @@ -3819,22 +4379,27 @@ js-yaml@3.x, js-yaml@^3.11.0, js-yaml@^3.12.0: jsbn@~0.1.0: version "0.1.1" resolved "https://registry.yarnpkg.com/jsbn/-/jsbn-0.1.1.tgz#a5e654c2e5a2deb5f201d96cefbca80c0ef2f513" + integrity sha1-peZUwuWi3rXyAdls77yoDA7y9RM= jsesc@^1.3.0: version "1.3.0" resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-1.3.0.tgz#46c3fec8c1892b12b0833db9bc7622176dbab34b" + integrity sha1-RsP+yMGJKxKwgz25vHYiF226s0s= jsesc@~0.5.0: version "0.5.0" resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-0.5.0.tgz#e7dee66e35d6fc16f710fe91d5cf69f70f08911d" + integrity sha1-597mbjXW/Bb3EP6R1c9p9w8IkR0= json-loader@^0.5.4: version "0.5.7" resolved "https://registry.yarnpkg.com/json-loader/-/json-loader-0.5.7.tgz#dca14a70235ff82f0ac9a3abeb60d337a365185d" + integrity sha512-QLPs8Dj7lnf3e3QYS1zkCo+4ZwqOiF9d/nZnYozTISxXWCfNs9yuky5rJw4/W34s7POaNlbZmQGaB5NiXCbP4w== json-rpc-engine@^3.6.0: version "3.8.0" resolved "https://registry.yarnpkg.com/json-rpc-engine/-/json-rpc-engine-3.8.0.tgz#9d4ff447241792e1d0a232f6ef927302bb0c62a9" + integrity sha512-6QNcvm2gFuuK4TKU1uwfH0Qd/cOSb9c1lls0gbnIhciktIUQJwz6NQNAW4B1KiGPenv7IKu97V222Yo1bNhGuA== dependencies: async "^2.0.1" babel-preset-env "^1.7.0" @@ -3846,68 +4411,82 @@ json-rpc-engine@^3.6.0: json-rpc-error@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/json-rpc-error/-/json-rpc-error-2.0.0.tgz#a7af9c202838b5e905c7250e547f1aff77258a02" + integrity sha1-p6+cICg4tekFxyUOVH8a/3cligI= dependencies: inherits "^2.0.1" json-rpc-random-id@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/json-rpc-random-id/-/json-rpc-random-id-1.0.1.tgz#ba49d96aded1444dbb8da3d203748acbbcdec8c8" + integrity sha1-uknZat7RRE27jaPSA3SKy7zeyMg= json-schema-traverse@^0.3.0: version "0.3.1" resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-0.3.1.tgz#349a6d44c53a51de89b40805c5d5e59b417d3340" + integrity sha1-NJptRMU6Ud6JtAgFxdXlm0F9M0A= json-schema-traverse@^0.4.1: version "0.4.1" resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz#69f6a87d9513ab8bb8fe63bdb0979c448e684660" + integrity sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg== json-schema@0.2.3: version "0.2.3" resolved "https://registry.yarnpkg.com/json-schema/-/json-schema-0.2.3.tgz#b480c892e59a2f05954ce727bd3f2a4e882f9e13" + integrity sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM= json-stable-stringify-without-jsonify@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz#9db7b59496ad3f3cfef30a75142d2d930ad72651" + integrity sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE= json-stable-stringify@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/json-stable-stringify/-/json-stable-stringify-1.0.1.tgz#9a759d39c5f2ff503fd5300646ed445f88c4f9af" + integrity sha1-mnWdOcXy/1A/1TAGRu1EX4jE+a8= dependencies: jsonify "~0.0.0" json-stringify-safe@~5.0.1: version "5.0.1" resolved "https://registry.yarnpkg.com/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz#1296a2d58fd45f19a0f6ce01d65701e2c735b6eb" + integrity sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus= json-text-sequence@^0.1: version "0.1.1" resolved "https://registry.yarnpkg.com/json-text-sequence/-/json-text-sequence-0.1.1.tgz#a72f217dc4afc4629fff5feb304dc1bd51a2f3d2" + integrity sha1-py8hfcSvxGKf/1/rME3BvVGi89I= dependencies: delimit-stream "0.1.0" json5@^0.5.0, json5@^0.5.1: version "0.5.1" resolved "https://registry.yarnpkg.com/json5/-/json5-0.5.1.tgz#1eade7acc012034ad84e2396767ead9fa5495821" + integrity sha1-Hq3nrMASA0rYTiOWdn6tn6VJWCE= jsonfile@^2.1.0: version "2.4.0" resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-2.4.0.tgz#3736a2b428b87bbda0cc83b53fa3d633a35c2ae8" + integrity sha1-NzaitCi4e72gzIO1P6PWM6NcKug= optionalDependencies: graceful-fs "^4.1.6" jsonfile@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-4.0.0.tgz#8771aae0799b64076b76640fca058f9c10e33ecb" + integrity sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss= optionalDependencies: graceful-fs "^4.1.6" jsonify@~0.0.0: version "0.0.0" resolved "https://registry.yarnpkg.com/jsonify/-/jsonify-0.0.0.tgz#2c74b6ee41d93ca51b7b5aaee8f503631d252a73" + integrity sha1-LHS27kHZPKUbe1qu6PUDYx0lKnM= jsprim@^1.2.2: version "1.4.1" resolved "https://registry.yarnpkg.com/jsprim/-/jsprim-1.4.1.tgz#313e66bc1e5cc06e438bc1b7499c2e5c56acb6a2" + integrity sha1-MT5mvB5cwG5Di8G3SZwuXFastqI= dependencies: assert-plus "1.0.0" extsprintf "1.3.0" @@ -3917,6 +4496,7 @@ jsprim@^1.2.2: keccak@^1.0.2: version "1.4.0" resolved "https://registry.yarnpkg.com/keccak/-/keccak-1.4.0.tgz#572f8a6dbee8e7b3aa421550f9e6408ca2186f80" + integrity sha512-eZVaCpblK5formjPjeTBik7TAg+pqnDrMHIffSvi9Lh7PQgM1+hSzakUeZFCk9DVVG0dacZJuaz2ntwlzZUIBw== dependencies: bindings "^1.2.1" inherits "^2.0.3" @@ -3926,6 +4506,7 @@ keccak@^1.0.2: keccakjs@^0.2.0, keccakjs@^0.2.1: version "0.2.1" resolved "https://registry.yarnpkg.com/keccakjs/-/keccakjs-0.2.1.tgz#1d633af907ef305bbf9f2fa616d56c44561dfa4d" + integrity sha1-HWM6+QfvMFu/ny+mFtVsRFYd+k0= dependencies: browserify-sha3 "^0.0.1" sha3 "^1.1.0" @@ -3933,62 +4514,74 @@ keccakjs@^0.2.0, keccakjs@^0.2.1: kind-of@^3.0.2, kind-of@^3.0.3, kind-of@^3.2.0: version "3.2.2" resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-3.2.2.tgz#31ea21a734bab9bbb0f32466d893aea51e4a3c64" + integrity sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ= dependencies: is-buffer "^1.1.5" kind-of@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-4.0.0.tgz#20813df3d712928b207378691a45066fae72dd57" + integrity sha1-IIE989cSkosgc3hpGkUGb65y3Vc= dependencies: is-buffer "^1.1.5" kind-of@^5.0.0: version "5.1.0" resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-5.1.0.tgz#729c91e2d857b7a419a1f9aa65685c4c33f5845d" + integrity sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw== kind-of@^6.0.0, kind-of@^6.0.2: version "6.0.2" resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-6.0.2.tgz#01146b36a6218e64e58f3a8d66de5d7fc6f6d051" + integrity sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA== klaw@^1.0.0: version "1.3.1" resolved "https://registry.yarnpkg.com/klaw/-/klaw-1.3.1.tgz#4088433b46b3b1ba259d78785d8e96f73ba02439" + integrity sha1-QIhDO0azsbolnXh4XY6W9zugJDk= optionalDependencies: graceful-fs "^4.1.9" lazy-cache@^1.0.3: version "1.0.4" resolved "https://registry.yarnpkg.com/lazy-cache/-/lazy-cache-1.0.4.tgz#a1d78fc3a50474cb80845d3b3b6e1da49a446e8e" + integrity sha1-odePw6UEdMuAhF07O24dpJpEbo4= lcid@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/lcid/-/lcid-1.0.0.tgz#308accafa0bc483a3867b4b6f2b9506251d1b835" + integrity sha1-MIrMr6C8SDo4Z7S28rlQYlHRuDU= dependencies: invert-kv "^1.0.0" lcov-parse@^0.0.10: version "0.0.10" resolved "https://registry.yarnpkg.com/lcov-parse/-/lcov-parse-0.0.10.tgz#1b0b8ff9ac9c7889250582b70b71315d9da6d9a3" + integrity sha1-GwuP+ayceIklBYK3C3ExXZ2m2aM= level-codec@~7.0.0: version "7.0.1" resolved "https://registry.yarnpkg.com/level-codec/-/level-codec-7.0.1.tgz#341f22f907ce0f16763f24bddd681e395a0fb8a7" + integrity sha512-Ua/R9B9r3RasXdRmOtd+t9TCOEIIlts+TN/7XTT2unhDaL6sJn83S3rUyljbr6lVtw49N3/yA0HHjpV6Kzb2aQ== level-errors@^1.0.3: version "1.1.2" resolved "https://registry.yarnpkg.com/level-errors/-/level-errors-1.1.2.tgz#4399c2f3d3ab87d0625f7e3676e2d807deff404d" + integrity sha512-Sw/IJwWbPKF5Ai4Wz60B52yj0zYeqzObLh8k1Tk88jVmD51cJSKWSYpRyhVIvFzZdvsPqlH5wfhp/yxdsaQH4w== dependencies: errno "~0.1.1" level-errors@~1.0.3: version "1.0.5" resolved "https://registry.yarnpkg.com/level-errors/-/level-errors-1.0.5.tgz#83dbfb12f0b8a2516bdc9a31c4876038e227b859" + integrity sha512-/cLUpQduF6bNrWuAC4pwtUKA5t669pCsCi2XbmojG2tFeOr9j6ShtdDCtFFQO1DRt+EVZhx9gPzP9G2bUaG4ig== dependencies: errno "~0.1.1" level-iterator-stream@~1.3.0: version "1.3.1" resolved "https://registry.yarnpkg.com/level-iterator-stream/-/level-iterator-stream-1.3.1.tgz#e43b78b1a8143e6fa97a4f485eb8ea530352f2ed" + integrity sha1-5Dt4sagUPm+pek9IXrjqUwNS8u0= dependencies: inherits "^2.0.1" level-errors "^1.0.3" @@ -3998,6 +4591,7 @@ level-iterator-stream@~1.3.0: level-ws@0.0.0: version "0.0.0" resolved "https://registry.yarnpkg.com/level-ws/-/level-ws-0.0.0.tgz#372e512177924a00424b0b43aef2bb42496d228b" + integrity sha1-Ny5RIXeSSgBCSwtDrvK7QkltIos= dependencies: readable-stream "~1.0.15" xtend "~2.1.1" @@ -4005,6 +4599,7 @@ level-ws@0.0.0: levelup@^1.2.1: version "1.3.9" resolved "https://registry.yarnpkg.com/levelup/-/levelup-1.3.9.tgz#2dbcae845b2bb2b6bea84df334c475533bbd82ab" + integrity sha512-VVGHfKIlmw8w1XqpGOAGwq6sZm2WwWLmlDcULkKWQXEA5EopA8OBNJ2Ck2v6bdk8HeEZSbCSEgzXadyQFm76sQ== dependencies: deferred-leveldown "~1.2.1" level-codec "~7.0.0" @@ -4017,6 +4612,7 @@ levelup@^1.2.1: levn@^0.3.0, levn@~0.3.0: version "0.3.0" resolved "https://registry.yarnpkg.com/levn/-/levn-0.3.0.tgz#3b09924edf9f083c0490fdd4c0bc4421e04764ee" + integrity sha1-OwmSTt+fCDwEkP3UwLxEIeBHZO4= dependencies: prelude-ls "~1.1.2" type-check "~0.3.2" @@ -4024,6 +4620,7 @@ levn@^0.3.0, levn@~0.3.0: load-json-file@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/load-json-file/-/load-json-file-1.1.0.tgz#956905708d58b4bab4c2261b04f59f31c99374c0" + integrity sha1-lWkFcI1YtLq0wiYbBPWfMcmTdMA= dependencies: graceful-fs "^4.1.2" parse-json "^2.2.0" @@ -4034,6 +4631,7 @@ load-json-file@^1.0.0: load-json-file@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/load-json-file/-/load-json-file-2.0.0.tgz#7947e42149af80d696cbf797bcaabcfe1fe29ca8" + integrity sha1-eUfkIUmvgNaWy/eXvKq8/h/inKg= dependencies: graceful-fs "^4.1.2" parse-json "^2.2.0" @@ -4043,10 +4641,12 @@ load-json-file@^2.0.0: loader-runner@^2.3.0: version "2.3.1" resolved "https://registry.yarnpkg.com/loader-runner/-/loader-runner-2.3.1.tgz#026f12fe7c3115992896ac02ba022ba92971b979" + integrity sha512-By6ZFY7ETWOc9RFaAIb23IjJVcM4dvJC/N57nmdz9RSkMXvAXGI7SyVlAw3v8vjtDRlqThgVDVmTnr9fqMlxkw== loader-utils@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/loader-utils/-/loader-utils-1.1.0.tgz#c98aef488bcceda2ffb5e2de646d6a754429f5cd" + integrity sha1-yYrvSIvM7aL/teLeZG1qdUQp9c0= dependencies: big.js "^3.1.3" emojis-list "^2.0.0" @@ -4055,6 +4655,7 @@ loader-utils@^1.1.0: locate-path@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-2.0.0.tgz#2b568b265eec944c6d9c0de9c3dbbbca0354cd8e" + integrity sha1-K1aLJl7slExtnA3pw9u7ygNUzY4= dependencies: p-locate "^2.0.0" path-exists "^3.0.0" @@ -4062,44 +4663,54 @@ locate-path@^2.0.0: lodash.assign@^4.0.3, lodash.assign@^4.0.6: version "4.2.0" resolved "https://registry.yarnpkg.com/lodash.assign/-/lodash.assign-4.2.0.tgz#0d99f3ccd7a6d261d19bdaeb9245005d285808e7" + integrity sha1-DZnzzNem0mHRm9rrkkUAXShYCOc= lodash.debounce@^4.0.8: version "4.0.8" resolved "https://registry.yarnpkg.com/lodash.debounce/-/lodash.debounce-4.0.8.tgz#82d79bff30a67c4005ffd5e2515300ad9ca4d7af" + integrity sha1-gteb/zCmfEAF/9XiUVMArZyk168= -lodash@4.x, lodash@^4.13.1, lodash@^4.14.2, lodash@^4.17.10, lodash@^4.17.4, lodash@^4.17.5: +lodash@4.x, lodash@=4.17.11, lodash@^4.13.1, lodash@^4.14.2, lodash@^4.17.10, lodash@^4.17.11, lodash@^4.17.4, lodash@^4.17.5: version "4.17.11" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.11.tgz#b39ea6229ef607ecd89e2c8df12536891cac9b8d" + integrity sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg== lodash@=4.17.4: version "4.17.4" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.4.tgz#78203a4d1c328ae1d86dca6460e369b57f4055ae" + integrity sha1-eCA6TRwyiuHYbcpkYONptX9AVa4= log-driver@^1.2.7: version "1.2.7" resolved "https://registry.yarnpkg.com/log-driver/-/log-driver-1.2.7.tgz#63b95021f0702fedfa2c9bb0a24e7797d71871d8" + integrity sha512-U7KCmLdqsGHBLeWqYlFA0V0Sl6P08EE1ZrmA9cxjUE0WVqT9qnyVDPz1kzpFEP0jdJuFnasWIfSd7fsaNXkpbg== long-timeout@0.1.1: version "0.1.1" resolved "https://registry.yarnpkg.com/long-timeout/-/long-timeout-0.1.1.tgz#9721d788b47e0bcb5a24c2e2bee1a0da55dab514" + integrity sha1-lyHXiLR+C8taJMLivuGg2lXatRQ= longest@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/longest/-/longest-1.0.1.tgz#30a0b2da38f73770e8294a0d22e6625ed77d0097" + integrity sha1-MKCy2jj3N3DoKUoNIuZiXtd9AJc= loose-envify@^1.0.0, loose-envify@^1.1.0, loose-envify@^1.3.1: version "1.4.0" resolved "https://registry.yarnpkg.com/loose-envify/-/loose-envify-1.4.0.tgz#71ee51fa7be4caec1a63839f7e682d8132d30caf" + integrity sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q== dependencies: js-tokens "^3.0.0 || ^4.0.0" lowercase-keys@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/lowercase-keys/-/lowercase-keys-1.0.1.tgz#6f9e30b47084d971a7c820ff15a6c5167b74c26f" + integrity sha512-G2Lj61tXDnVFFOi8VZds+SoQjtQC3dgokKdDG2mTm1tx4m50NUHBOZSBwQQHyy0V12A0JTG4icfZQH+xPyh8VA== lru-cache@^4.0.1: - version "4.1.3" - resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-4.1.3.tgz#a1175cf3496dfc8436c156c334b4955992bce69c" + version "4.1.5" + resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-4.1.5.tgz#8bbe50ea85bed59bc9e33dcab8235ee9bcf443cd" + integrity sha512-sWZlbEP2OsHNkXrMl5GYk/jKk70MBng6UU4YI/qGDYbgf6YbP4EvmqISbXCoJiRKs+1bSpFHVgQxvJ17F2li5g== dependencies: pseudomap "^1.0.2" yallist "^2.1.2" @@ -4107,48 +4718,57 @@ lru-cache@^4.0.1: lru-queue@0.1: version "0.1.0" resolved "https://registry.yarnpkg.com/lru-queue/-/lru-queue-0.1.0.tgz#2738bd9f0d3cf4f84490c5736c48699ac632cda3" + integrity sha1-Jzi9nw089PhEkMVzbEhpmsYyzaM= dependencies: es5-ext "~0.10.2" ltgt@~2.2.0: version "2.2.1" resolved "https://registry.yarnpkg.com/ltgt/-/ltgt-2.2.1.tgz#f35ca91c493f7b73da0e07495304f17b31f87ee5" + integrity sha1-81ypHEk/e3PaDgdJUwTxezH4fuU= make-dir@^1.0.0: version "1.3.0" resolved "https://registry.yarnpkg.com/make-dir/-/make-dir-1.3.0.tgz#79c1033b80515bd6d24ec9933e860ca75ee27f0c" + integrity sha512-2w31R7SJtieJJnQtGc7RVL2StM2vGYVfqUOvUDxH6bC6aJTxPxTF0GnIgCyu7tjockiUWAYQRbxa7vKn34s5sQ== dependencies: pify "^3.0.0" make-plural@^3.0.3, make-plural@~3.0.3: version "3.0.6" resolved "https://registry.yarnpkg.com/make-plural/-/make-plural-3.0.6.tgz#2033a03bac290b8f3bb91258f65b9df7e8b01ca7" + integrity sha1-IDOgO6wpC487uRJY9lud9+iwHKc= optionalDependencies: minimist "^1.2.0" map-cache@^0.2.2: version "0.2.2" resolved "https://registry.yarnpkg.com/map-cache/-/map-cache-0.2.2.tgz#c32abd0bd6525d9b051645bb4f26ac5dc98a0dbf" + integrity sha1-wyq9C9ZSXZsFFkW7TyasXcmKDb8= map-visit@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/map-visit/-/map-visit-1.0.0.tgz#ecdca8f13144e660f1b5bd41f12f3479d98dfb8f" + integrity sha1-7Nyo8TFE5mDxtb1B8S80edmN+48= dependencies: object-visit "^1.0.0" math-interval-parser@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/math-interval-parser/-/math-interval-parser-1.1.0.tgz#dbeda5b06b3249973c6df6170fde2386f0afd893" + integrity sha1-2+2lsGsySZc8bfYXD94jhvCv2JM= dependencies: xregexp "^2.0.0" math-random@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/math-random/-/math-random-1.0.1.tgz#8b3aac588b8a66e4975e3cdea67f7bb329601fac" + integrity sha1-izqsWIuKZuSXXjzepn97sylgH6w= md5.js@^1.3.4: version "1.3.5" resolved "https://registry.yarnpkg.com/md5.js/-/md5.js-1.3.5.tgz#b5d07b8e3216e3e27cd728d72f70d1e6a342005f" + integrity sha512-xitP+WxNPcTTOgnTJcrhM0xvdPepipPSf3I8EIpGKeFLjt3PlJLIDG3u8EX53ZIubkb+5U2+3rELYpEhHhzdkg== dependencies: hash-base "^3.0.0" inherits "^2.0.1" @@ -4165,16 +4785,19 @@ md5@^2.1.0: media-typer@0.3.0: version "0.3.0" resolved "https://registry.yarnpkg.com/media-typer/-/media-typer-0.3.0.tgz#8710d7af0aa626f8fffa1ce00168545263255748" + integrity sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g= mem@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/mem/-/mem-1.1.0.tgz#5edd52b485ca1d900fe64895505399a0dfa45f76" + integrity sha1-Xt1StIXKHZAP5kiVUFOZoN+kX3Y= dependencies: mimic-fn "^1.0.0" memdown@^1.0.0: version "1.4.1" resolved "https://registry.yarnpkg.com/memdown/-/memdown-1.4.1.tgz#b4e4e192174664ffbae41361aa500f3119efe215" + integrity sha1-tOThkhdGZP+65BNhqlAPMRnv4hU= dependencies: abstract-leveldown "~2.7.1" functional-red-black-tree "^1.0.1" @@ -4186,6 +4809,7 @@ memdown@^1.0.0: memoizee@^0.4.14: version "0.4.14" resolved "https://registry.yarnpkg.com/memoizee/-/memoizee-0.4.14.tgz#07a00f204699f9a95c2d9e77218271c7cd610d57" + integrity sha512-/SWFvWegAIYAO4NQMpcX+gcra0yEZu4OntmUdrBaWrJncxOqAziGFlHxc7yjKVK2uu3lpPW27P27wkR82wA8mg== dependencies: d "1" es5-ext "^0.10.45" @@ -4199,6 +4823,7 @@ memoizee@^0.4.14: memory-fs@^0.4.0, memory-fs@~0.4.1: version "0.4.1" resolved "https://registry.yarnpkg.com/memory-fs/-/memory-fs-0.4.1.tgz#3a9a20b8462523e447cfbc7e8bb80ed667bfc552" + integrity sha1-OpoguEYlI+RHz7x+i7gO1me/xVI= dependencies: errno "^0.1.3" readable-stream "^2.0.1" @@ -4206,14 +4831,17 @@ memory-fs@^0.4.0, memory-fs@~0.4.1: memorystream@^0.3.1: version "0.3.1" resolved "https://registry.yarnpkg.com/memorystream/-/memorystream-0.3.1.tgz#86d7090b30ce455d63fbae12dda51a47ddcaf9b2" + integrity sha1-htcJCzDORV1j+64S3aUaR93K+bI= merge-descriptors@1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/merge-descriptors/-/merge-descriptors-1.0.1.tgz#b00aaa556dd8b44568150ec9d1b953f3f90cbb61" + integrity sha1-sAqqVW3YtEVoFQ7J0blT8/kMu2E= merkle-patricia-tree@^2.1.2: version "2.3.2" resolved "https://registry.yarnpkg.com/merkle-patricia-tree/-/merkle-patricia-tree-2.3.2.tgz#982ca1b5a0fde00eed2f6aeed1f9152860b8208a" + integrity sha512-81PW5m8oz/pz3GvsAwbauj7Y00rqm81Tzad77tHBwU7pIAtN+TJnMSOJhxBKflSVYhptMMb9RskhqHqrSm1V+g== dependencies: async "^1.4.2" ethereumjs-util "^5.0.0" @@ -4227,6 +4855,7 @@ merkle-patricia-tree@^2.1.2: messageformat@^0.3.1: version "0.3.1" resolved "https://registry.yarnpkg.com/messageformat/-/messageformat-0.3.1.tgz#e58fff8245e9b3971799e5b43db58b3e9417f5a2" + integrity sha1-5Y//gkXps5cXmeW0PbWLPpQX9aI= dependencies: async "~1.5.2" glob "~6.0.4" @@ -4237,10 +4866,12 @@ messageformat@^0.3.1: methods@~1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/methods/-/methods-1.1.2.tgz#5529a4d67654134edcc5266656835b0f851afcee" + integrity sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4= micromatch@^2.1.5: version "2.3.11" resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-2.3.11.tgz#86677c97d1720b363431d04d0d15293bd38c1565" + integrity sha1-hmd8l9FyCzY0MdBNDRUpO9OMFWU= dependencies: arr-diff "^2.0.0" array-unique "^0.2.1" @@ -4259,6 +4890,7 @@ micromatch@^2.1.5: micromatch@^3.1.10, micromatch@^3.1.4: version "3.1.10" resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-3.1.10.tgz#70859bc95c9840952f359a068a3fc49f9ecfac23" + integrity sha512-MWikgl9n9M3w+bpsY3He8L+w9eF9338xRl8IAO5viDizwSzziFEyUzo2xrrloB64ADbTf8uA8vRqqttDTOmccg== dependencies: arr-diff "^4.0.0" array-unique "^0.3.2" @@ -4277,80 +4909,96 @@ micromatch@^3.1.10, micromatch@^3.1.4: miller-rabin@^4.0.0: version "4.0.1" resolved "https://registry.yarnpkg.com/miller-rabin/-/miller-rabin-4.0.1.tgz#f080351c865b0dc562a8462966daa53543c78a4d" + integrity sha512-115fLhvZVqWwHPbClyntxEVfVDfl9DLLTuJvq3g2O/Oxi8AiNouAHvDSzHS0viUJc+V5vm3eq91Xwqn9dp4jRA== dependencies: bn.js "^4.0.0" brorand "^1.0.1" -mime-db@~1.36.0: - version "1.36.0" - resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.36.0.tgz#5020478db3c7fe93aad7bbcc4dcf869c43363397" +mime-db@~1.37.0: + version "1.37.0" + resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.37.0.tgz#0b6a0ce6fdbe9576e25f1f2d2fde8830dc0ad0d8" + integrity sha512-R3C4db6bgQhlIhPU48fUtdVmKnflq+hRdad7IyKhtFj06VPNVdk2RhiYL3UjQIlso8L+YxAtFkobT0VK+S/ybg== mime-types@^2.1.12, mime-types@^2.1.16, mime-types@~2.1.18, mime-types@~2.1.19: - version "2.1.20" - resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.20.tgz#930cb719d571e903738520f8470911548ca2cc19" + version "2.1.21" + resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.21.tgz#28995aa1ecb770742fe6ae7e58f9181c744b3f96" + integrity sha512-3iL6DbwpyLzjR3xHSFNFeb9Nz/M8WDkX33t1GFQnFOllWk8pOrh/LSrB5OXlnlW5P9LH73X6loW/eogc+F5lJg== dependencies: - mime-db "~1.36.0" + mime-db "~1.37.0" mime@1.4.1: version "1.4.1" resolved "https://registry.yarnpkg.com/mime/-/mime-1.4.1.tgz#121f9ebc49e3766f311a76e1fa1c8003c4b03aa6" + integrity sha512-KI1+qOZu5DcW6wayYHSzR/tXKCDC5Om4s1z2QJjDULzLcmf3DvzS7oluY4HCTrc+9FiKmWUgeNLg7W3uIQvxtQ== mimic-fn@^1.0.0: version "1.2.0" resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-1.2.0.tgz#820c86a39334640e99516928bd03fca88057d022" + integrity sha512-jf84uxzwiuiIVKiOLpfYk7N46TSy8ubTonmneY9vrpHNAnp0QBt2BxWV9dO3/j+BoVAb+a5G6YDPW3M5HOdMWQ== mimic-response@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/mimic-response/-/mimic-response-1.0.1.tgz#4923538878eef42063cb8a3e3b0798781487ab1b" + integrity sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ== min-document@^2.19.0: version "2.19.0" resolved "https://registry.yarnpkg.com/min-document/-/min-document-2.19.0.tgz#7bd282e3f5842ed295bb748cdd9f1ffa2c824685" + integrity sha1-e9KC4/WELtKVu3SM3Z8f+iyCRoU= dependencies: dom-walk "^0.1.0" minimalistic-assert@^1.0.0, minimalistic-assert@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz#2e194de044626d4a10e7f7fbc00ce73e83e4d5c7" + integrity sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A== minimalistic-crypto-utils@^1.0.0, minimalistic-crypto-utils@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz#f6c00c1c0b082246e5c4d99dfb8c7c083b2b582a" + integrity sha1-9sAMHAsIIkblxNmd+4x8CDsrWCo= "minimatch@2 || 3", minimatch@3.0.4, minimatch@^3.0.3, minimatch@^3.0.4: version "3.0.4" resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083" + integrity sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA== dependencies: brace-expansion "^1.1.7" minimist@0.0.8: version "0.0.8" resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.8.tgz#857fcabfc3397d2625b8228262e86aa7a011b05d" + integrity sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0= minimist@^1.2.0, minimist@~1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.0.tgz#a35008b20f41383eec1fb914f4cd5df79a264284" + integrity sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ= minimist@~0.0.1: version "0.0.10" resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.10.tgz#de3f98543dbf96082be48ad1a0c7cda836301dcf" + integrity sha1-3j+YVD2/lggr5IrRoMfNqDYwHc8= -minipass@^2.2.1, minipass@^2.3.3: - version "2.3.4" - resolved "https://registry.yarnpkg.com/minipass/-/minipass-2.3.4.tgz#4768d7605ed6194d6d576169b9e12ef71e9d9957" +minipass@^2.2.1, minipass@^2.3.4: + version "2.3.5" + resolved "https://registry.yarnpkg.com/minipass/-/minipass-2.3.5.tgz#cacebe492022497f656b0f0f51e2682a9ed2d848" + integrity sha512-Gi1W4k059gyRbyVUZQ4mEqLm0YIUiGYfvxhF6SIlk3ui1WVxMTGfGdQ2SInh3PDrRTVvPKgULkpJtT4RH10+VA== dependencies: safe-buffer "^5.1.2" yallist "^3.0.0" -minizlib@^1.1.0: - version "1.1.1" - resolved "https://registry.yarnpkg.com/minizlib/-/minizlib-1.1.1.tgz#6734acc045a46e61d596a43bb9d9cd326e19cc42" +minizlib@^1.1.1: + version "1.2.1" + resolved "https://registry.yarnpkg.com/minizlib/-/minizlib-1.2.1.tgz#dd27ea6136243c7c880684e8672bb3a45fd9b614" + integrity sha512-7+4oTUOWKg7AuL3vloEWekXY2/D20cevzsrNT2kGWm+39J9hGTCBv8VI5Pm5lXZ/o3/mdR4f8rflAPhnQb8mPA== dependencies: minipass "^2.2.1" mixin-deep@^1.2.0: version "1.3.1" resolved "https://registry.yarnpkg.com/mixin-deep/-/mixin-deep-1.3.1.tgz#a49e7268dce1a0d9698e45326c5626df3543d0fe" + integrity sha512-8ZItLHeEgaqEvd5lYBXfm4EZSFCX29Jb9K+lAHhDKzReKBQKj3R+7NOF6tjqYi9t4oI8VUfaWITJQm86wnXGNQ== dependencies: for-in "^1.0.2" is-extendable "^1.0.1" @@ -4358,12 +5006,14 @@ mixin-deep@^1.2.0: mkdirp-promise@^5.0.1: version "5.0.1" resolved "https://registry.yarnpkg.com/mkdirp-promise/-/mkdirp-promise-5.0.1.tgz#e9b8f68e552c68a9c1713b84883f7a1dd039b8a1" + integrity sha1-6bj2jlUsaKnBcTuEiD96HdA5uKE= dependencies: mkdirp "*" mkdirp@*, mkdirp@0.5.1, mkdirp@0.5.x, mkdirp@0.x.x, "mkdirp@>=0.5 0", mkdirp@^0.5.0, mkdirp@^0.5.1, mkdirp@~0.5.0, mkdirp@~0.5.1: version "0.5.1" resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.1.tgz#30057438eac6cf7f8c4767f38648d6697d75c903" + integrity sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM= dependencies: minimist "0.0.8" @@ -4380,6 +5030,7 @@ mocha-junit-reporter@^1.18.0: mocha@^4.0.1, mocha@^4.1.0: version "4.1.0" resolved "https://registry.yarnpkg.com/mocha/-/mocha-4.1.0.tgz#7d86cfbcf35cb829e2754c32e17355ec05338794" + integrity sha512-0RVnjg1HJsXY2YFDoTNzcc1NKhYuXKRrBAG2gDygmJJA136Cs2QlRliZG1mA0ap7cuaT30mw16luAeln+4RiNA== dependencies: browser-stdout "1.3.0" commander "2.11.0" @@ -4395,6 +5046,7 @@ mocha@^4.0.1, mocha@^4.1.0: mocha@^5.0.1: version "5.2.0" resolved "https://registry.yarnpkg.com/mocha/-/mocha-5.2.0.tgz#6d8ae508f59167f940f2b5b3c4a612ae50c90ae6" + integrity sha512-2IUgKDhc3J7Uug+FxMXuqIyYzH7gJjXECKe/w43IGgQHTSj3InJi+yAA7T24L9bQMRKiUEHxEX37G5JpVUGLcQ== dependencies: browser-stdout "1.3.1" commander "2.15.1" @@ -4411,51 +5063,62 @@ mocha@^5.0.1: mock-fs@^4.1.0: version "4.7.0" resolved "https://registry.yarnpkg.com/mock-fs/-/mock-fs-4.7.0.tgz#9f17e219cacb8094f4010e0a8c38589e2b33c299" + integrity sha512-WlQNtUlzMRpvLHf8dqeUmNqfdPjGY29KrJF50Ldb4AcL+vQeR8QH3wQcFMgrhTwb1gHjZn9xggho+84tBskLgA== -moment-timezone@^0.5.0: - version "0.5.21" - resolved "https://registry.yarnpkg.com/moment-timezone/-/moment-timezone-0.5.21.tgz#3cba247d84492174dbf71de2a9848fa13207b845" +moment-timezone@^0.5.23: + version "0.5.23" + resolved "https://registry.yarnpkg.com/moment-timezone/-/moment-timezone-0.5.23.tgz#7cbb00db2c14c71b19303cb47b0fb0a6d8651463" + integrity sha512-WHFH85DkCfiNMDX5D3X7hpNH3/PUhjTGcD0U1SgfBGZxJ3qUmJh5FdvaFjcClxOvB3rzdfj4oRffbI38jEnC1w== dependencies: moment ">= 2.9.0" "moment@>= 2.9.0", moment@^2.22.2: - version "2.22.2" - resolved "https://registry.yarnpkg.com/moment/-/moment-2.22.2.tgz#3c257f9839fc0e93ff53149632239eb90783ff66" + version "2.23.0" + resolved "https://registry.yarnpkg.com/moment/-/moment-2.23.0.tgz#759ea491ac97d54bac5ad776996e2a58cc1bc225" + integrity sha512-3IE39bHVqFbWWaPOMHZF98Q9c3LDKGTmypMiTM2QygGXXElkFWIH7GxfmlwmY2vwa+wmNsoYZmG2iusf1ZjJoA== mout@^0.11.0: version "0.11.1" resolved "https://registry.yarnpkg.com/mout/-/mout-0.11.1.tgz#ba3611df5f0e5b1ffbfd01166b8f02d1f5fa2b99" + integrity sha1-ujYR318OWx/7/QEWa48C0fX6K5k= ms@2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8" + integrity sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g= ms@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.1.tgz#30a5864eb3ebb0a66f2ebe6d727af06a09d86e0a" + integrity sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg== multihashes@^0.4.5: version "0.4.14" resolved "https://registry.yarnpkg.com/multihashes/-/multihashes-0.4.14.tgz#774db9a161f81a8a27dc60788f91248e020f5244" + integrity sha512-V/g/EIN6nALXfS/xHUAgtfPP3mn3sPIF/i9beuGKf25QXS2QZYCpeVJbDPEannkz32B2fihzCe2D/KMrbcmefg== dependencies: bs58 "^4.0.1" varint "^5.0.0" mustache@*: - version "3.0.0" - resolved "https://registry.yarnpkg.com/mustache/-/mustache-3.0.0.tgz#3de22dd9ba38152f7355399a953dd4528c403338" + version "3.0.1" + resolved "https://registry.yarnpkg.com/mustache/-/mustache-3.0.1.tgz#873855f23aa8a95b150fb96d9836edbc5a1d248a" + integrity sha512-jFI/4UVRsRYdUbuDTKT7KzfOp7FiD5WzYmmwNwXyUVypC0xjoTL78Fqc0jHUPIvvGD+6DQSPHIt1NE7D1ArsqA== mustache@^2.3.0: version "2.3.2" resolved "https://registry.yarnpkg.com/mustache/-/mustache-2.3.2.tgz#a6d4d9c3f91d13359ab889a812954f9230a3d0c5" + integrity sha512-KpMNwdQsYz3O/SBS1qJ/o3sqUJ5wSb8gb0pul8CO0S56b9Y2ALm8zCfsjPXsqGFfoNBkDwZuZIAjhsZI03gYVQ== mute-stream@0.0.7, mute-stream@~0.0.4: version "0.0.7" resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.7.tgz#3075ce93bc21b8fab43e1bc4da7e8115ed1e7bab" + integrity sha1-MHXOk7whuPq0PhvE2n6BFe0ee6s= mz@^2.6.0: version "2.7.0" resolved "https://registry.yarnpkg.com/mz/-/mz-2.7.0.tgz#95008057a56cafadc2bc63dde7f9ff6955948e32" + integrity sha512-z81GNO7nnYMEhrGh9LeymoE4+Yr0Wn5McHIZMK5cfQCl+NDX08sCZgUc9/6MHni9IWuFLm1Z3HTCXu2z9fN62Q== dependencies: any-promise "^1.0.0" object-assign "^4.0.1" @@ -4464,18 +5127,22 @@ mz@^2.6.0: nan@2.10.0: version "2.10.0" resolved "https://registry.yarnpkg.com/nan/-/nan-2.10.0.tgz#96d0cd610ebd58d4b4de9cc0c6828cda99c7548f" + integrity sha512-bAdJv7fBLhWC+/Bls0Oza+mvTaNQtP+1RyhhhvD95pgUJz6XM5IzgmxOkItJ9tkoCiplvAnXI1tNmmUD/eScyA== nan@^2.0.8, nan@^2.2.1, nan@^2.3.3, nan@^2.9.2: - version "2.11.1" - resolved "https://registry.yarnpkg.com/nan/-/nan-2.11.1.tgz#90e22bccb8ca57ea4cd37cc83d3819b52eea6766" + version "2.12.0" + resolved "https://registry.yarnpkg.com/nan/-/nan-2.12.0.tgz#9d443fdb5e13a20770cc5e602eee59760a685885" + integrity sha512-zT5nC0JhbljmyEf+Z456nvm7iO7XgRV2hYxoBtPpnyp+0Q4aCoP6uWNn76v/I6k2kCYNLWqWbwBWQcjsNI/bjw== nano-json-stream-parser@^0.1.2: version "0.1.2" resolved "https://registry.yarnpkg.com/nano-json-stream-parser/-/nano-json-stream-parser-0.1.2.tgz#0cc8f6d0e2b622b479c40d499c46d64b755c6f5f" + integrity sha1-DMj20OK2IrR5xA1JnEbWS3Vcb18= nanomatch@^1.2.9: version "1.2.13" resolved "https://registry.yarnpkg.com/nanomatch/-/nanomatch-1.2.13.tgz#b87a8aa4fc0de8fe6be88895b38983ff265bd119" + integrity sha512-fpoe2T0RbHwBTBUOftAfBPaDEi06ufaUai0mE6Yn1kacc3SnTErfb/h+X94VXzI64rKFHYImXSvdwGGCmwOqCA== dependencies: arr-diff "^4.0.0" array-unique "^0.3.2" @@ -4492,14 +5159,17 @@ nanomatch@^1.2.9: natural-compare@^1.4.0: version "1.4.0" resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" + integrity sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc= ncp@1.0.x: version "1.0.1" - resolved "http://registry.npmjs.org/ncp/-/ncp-1.0.1.tgz#d15367e5cb87432ba117d2bf80fdf45aecfb4246" + resolved "https://registry.yarnpkg.com/ncp/-/ncp-1.0.1.tgz#d15367e5cb87432ba117d2bf80fdf45aecfb4246" + integrity sha1-0VNn5cuHQyuhF9K/gP30Wuz7QkY= needle@^2.2.1: version "2.2.4" resolved "https://registry.yarnpkg.com/needle/-/needle-2.2.4.tgz#51931bff82533b1928b7d1d69e01f1b00ffd2a4e" + integrity sha512-HyoqEb4wr/rsoaIDfTH2aVL9nWtQqba2/HvMv+++m8u0dz808MaagKILxtfeSN7QU7nvbQ79zk3vYOJp9zsNEA== dependencies: debug "^2.1.2" iconv-lite "^0.4.4" @@ -4508,14 +5178,17 @@ needle@^2.2.1: negotiator@0.6.1: version "0.6.1" resolved "https://registry.yarnpkg.com/negotiator/-/negotiator-0.6.1.tgz#2b327184e8992101177b28563fb5e7102acd0ca9" + integrity sha1-KzJxhOiZIQEXeyhWP7XnECrNDKk= neo-async@^2.5.0: - version "2.5.2" - resolved "https://registry.yarnpkg.com/neo-async/-/neo-async-2.5.2.tgz#489105ce7bc54e709d736b195f82135048c50fcc" + version "2.6.0" + resolved "https://registry.yarnpkg.com/neo-async/-/neo-async-2.6.0.tgz#b9d15e4d71c6762908654b5183ed38b753340835" + integrity sha512-MFh0d/Wa7vkKO3Y3LlacqAEeHK0mckVqzDieUKTT+KGxi+zIpeVsFxymkIiRpbpDziHc290Xr9A1O4Om7otoRA== next-tick@1: version "1.0.0" resolved "https://registry.yarnpkg.com/next-tick/-/next-tick-1.0.0.tgz#ca86d1fe8828169b0120208e3dc8424b9db8342c" + integrity sha1-yobR/ogoFpsBICCOPchCS524NCw= nice-try@^1.0.4: version "1.0.5" @@ -4524,10 +5197,12 @@ nice-try@^1.0.4: node-async-loop@^1.2.2: version "1.2.2" resolved "https://registry.yarnpkg.com/node-async-loop/-/node-async-loop-1.2.2.tgz#c5870299bf6477b780c88b431aa5b37733f55a3d" + integrity sha1-xYcCmb9kd7eAyItDGqWzdzP1Wj0= node-cache@^4.1.1: version "4.2.0" resolved "https://registry.yarnpkg.com/node-cache/-/node-cache-4.2.0.tgz#48ac796a874e762582692004a376d26dfa875811" + integrity sha512-obRu6/f7S024ysheAjoYFEEBqqDWv4LOMNJEuO8vMeEw2AT4z+NCzO4hlc2lhI4vATzbCQv6kke9FVdx0RbCOw== dependencies: clone "2.x" lodash "4.x" @@ -4535,6 +5210,7 @@ node-cache@^4.1.1: node-fetch@^1.0.1, node-fetch@~1.7.1: version "1.7.3" resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-1.7.3.tgz#980f6f72d85211a5347c6b2bc18c5b84c3eb47ef" + integrity sha512-NhZ4CsKx7cYm2vSrBAr2PvFOe6sWDf0UYLRqA6svUYg7+/TSfVAu49jYC4BvQ4Sms9SZgdqGBgroqfDhJdTyKQ== dependencies: encoding "^0.1.11" is-stream "^1.0.1" @@ -4542,6 +5218,7 @@ node-fetch@^1.0.1, node-fetch@~1.7.1: node-libs-browser@^2.0.0: version "2.1.0" resolved "https://registry.yarnpkg.com/node-libs-browser/-/node-libs-browser-2.1.0.tgz#5f94263d404f6e44767d726901fff05478d600df" + integrity sha512-5AzFzdoIMb89hBGMZglEegffzgRg+ZFoUmisQ8HI4j1KDdpx13J0taNp2y9xPbur6W61gepGDDotGBVQ7mfUCg== dependencies: assert "^1.1.1" browserify-zlib "^0.2.0" @@ -4570,6 +5247,7 @@ node-libs-browser@^2.0.0: node-pre-gyp@^0.10.0: version "0.10.3" resolved "https://registry.yarnpkg.com/node-pre-gyp/-/node-pre-gyp-0.10.3.tgz#3070040716afdc778747b61b6887bf78880b80fc" + integrity sha512-d1xFs+C/IPS8Id0qPTZ4bUT8wWryfR/OzzAFxweG+uLN85oPzyo2Iw6bVlLQ/JOdgNonXLCoRyqDzDWq4iw72A== dependencies: detect-libc "^1.0.2" mkdirp "^0.5.1" @@ -4583,22 +5261,25 @@ node-pre-gyp@^0.10.0: tar "^4" node-schedule@^1.2.3: - version "1.3.0" - resolved "https://registry.yarnpkg.com/node-schedule/-/node-schedule-1.3.0.tgz#e7a7e816a7f2550d5b170bd106e765db28bdf030" + version "1.3.1" + resolved "https://registry.yarnpkg.com/node-schedule/-/node-schedule-1.3.1.tgz#6909dd644211bca153b15afc62e1dc0afa7d28be" + integrity sha512-cdNNePwKoisAi4DT00BB11H6IJ/WtA603YZ7+tLJcb/zCmCSxYKcvc+/GTyxC46jN/0ft7741vmMQrvxP8Sd+A== dependencies: - cron-parser "^2.4.0" + cron-parser "^2.7.3" long-timeout "0.1.1" sorted-array-functions "^1.0.0" nopt@3.x, nopt@~3.0.6: version "3.0.6" resolved "https://registry.yarnpkg.com/nopt/-/nopt-3.0.6.tgz#c6465dbf08abcd4db359317f79ac68a646b28ff9" + integrity sha1-xkZdvwirzU2zWTF/eaxopkayj/k= dependencies: abbrev "1" nopt@^4.0.1: version "4.0.1" resolved "https://registry.yarnpkg.com/nopt/-/nopt-4.0.1.tgz#d0d4685afd5415193c8c7505602d0d17cd64474d" + integrity sha1-0NRoWv1UFRk8jHUFYC0NF81kR00= dependencies: abbrev "1" osenv "^0.1.4" @@ -4606,6 +5287,7 @@ nopt@^4.0.1: normalize-package-data@^2.3.2: version "2.4.0" resolved "https://registry.yarnpkg.com/normalize-package-data/-/normalize-package-data-2.4.0.tgz#12f95a307d58352075a04907b84ac8be98ac012f" + integrity sha512-9jjUFbTPfEy3R/ad/2oNbKtW9Hgovl5O1FvFWKkKblNXoN/Oou6+9+KKohPK13Yc3/TyunyWhJp6gvRNR/PPAw== dependencies: hosted-git-info "^2.1.4" is-builtin-module "^1.0.0" @@ -4615,16 +5297,19 @@ normalize-package-data@^2.3.2: normalize-path@^2.0.0, normalize-path@^2.0.1, normalize-path@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-2.1.1.tgz#1ab28b556e198363a8c1a6f7e6fa20137fe6aed9" + integrity sha1-GrKLVW4Zg2Oowab35vogE3/mrtk= dependencies: remove-trailing-separator "^1.0.1" npm-bundled@^1.0.1: version "1.0.5" resolved "https://registry.yarnpkg.com/npm-bundled/-/npm-bundled-1.0.5.tgz#3c1732b7ba936b3a10325aef616467c0ccbcc979" + integrity sha512-m/e6jgWu8/v5niCUKQi9qQl8QdeEduFA96xHDDzFGqly0OOjI7c+60KM/2sppfnUU9JJagf+zs+yGhqSOFj71g== npm-packlist@^1.1.6: version "1.1.12" resolved "https://registry.yarnpkg.com/npm-packlist/-/npm-packlist-1.1.12.tgz#22bde2ebc12e72ca482abd67afc51eb49377243a" + integrity sha512-WJKFOVMeAlsU/pjXuqVdzU0WfgtIBCupkEVwn+1Y0ERAbUfWw8R4GjgVbaKnUjRoD2FoQbHOCbOyT5Mbs9Lw4g== dependencies: ignore-walk "^3.0.1" npm-bundled "^1.0.1" @@ -4632,12 +5317,14 @@ npm-packlist@^1.1.6: npm-run-path@^2.0.0: version "2.0.2" resolved "https://registry.yarnpkg.com/npm-run-path/-/npm-run-path-2.0.2.tgz#35a9232dfa35d7067b4cb2ddf2357b1871536c5f" + integrity sha1-NakjLfo11wZ7TLLd8jV7GHFTbF8= dependencies: path-key "^2.0.0" npmlog@^4.0.2: version "4.1.2" resolved "https://registry.yarnpkg.com/npmlog/-/npmlog-4.1.2.tgz#08a7f2a8bf734604779a9efa4ad5cc717abb954b" + integrity sha512-2uUqazuKlTaSI/dC8AzicUck7+IrEaOnN/e0jd3Xtt1KcGpwx30v50mL7oPyr/h9bL3E4aZccVwpwP+5W9Vjkg== dependencies: are-we-there-yet "~1.1.2" console-control-strings "~1.1.0" @@ -4647,10 +5334,12 @@ npmlog@^4.0.2: number-is-nan@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/number-is-nan/-/number-is-nan-1.0.1.tgz#097b602b53422a522c1afb8790318336941a011d" + integrity sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0= number-to-bn@1.7.0: version "1.7.0" resolved "https://registry.yarnpkg.com/number-to-bn/-/number-to-bn-1.7.0.tgz#bb3623592f7e5f9e0030b1977bd41a0c53fe1ea0" + integrity sha1-uzYjWS9+X54AMLGXe9QaDFP+HqA= dependencies: bn.js "4.11.6" strip-hex-prefix "1.0.0" @@ -4658,14 +5347,17 @@ number-to-bn@1.7.0: oauth-sign@~0.9.0: version "0.9.0" resolved "https://registry.yarnpkg.com/oauth-sign/-/oauth-sign-0.9.0.tgz#47a7b016baa68b5fa0ecf3dee08a85c679ac6455" + integrity sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ== object-assign@^4, object-assign@^4.0.0, object-assign@^4.0.1, object-assign@^4.1.0, object-assign@^4.1.1: version "4.1.1" resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863" + integrity sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM= object-copy@^0.1.0: version "0.1.0" resolved "https://registry.yarnpkg.com/object-copy/-/object-copy-0.1.0.tgz#7e7d858b781bd7c991a41ba975ed3812754e998c" + integrity sha1-fn2Fi3gb18mRpBupde04EnVOmYw= dependencies: copy-descriptor "^0.1.0" define-property "^0.2.5" @@ -4674,24 +5366,29 @@ object-copy@^0.1.0: object-inspect@~1.6.0: version "1.6.0" resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.6.0.tgz#c70b6cbf72f274aab4c34c0c82f5167bf82cf15b" + integrity sha512-GJzfBZ6DgDAmnuaM3104jR4s1Myxr3Y3zfIyN4z3UdqN69oSRacNK8UhnobDdC+7J2AHCjGwxQubNJfE70SXXQ== object-keys@^1.0.12: version "1.0.12" resolved "https://registry.yarnpkg.com/object-keys/-/object-keys-1.0.12.tgz#09c53855377575310cca62f55bb334abff7b3ed2" + integrity sha512-FTMyFUm2wBcGHnH2eXmz7tC6IwlqQZ6mVZ+6dm6vZ4IQIHjs6FdNsQBuKGPuUUUY6NfJw2PshC08Tn6LzLDOag== object-keys@~0.4.0: version "0.4.0" resolved "https://registry.yarnpkg.com/object-keys/-/object-keys-0.4.0.tgz#28a6aae7428dd2c3a92f3d95f21335dd204e0336" + integrity sha1-KKaq50KN0sOpLz2V8hM13SBOAzY= object-visit@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/object-visit/-/object-visit-1.0.1.tgz#f79c4493af0c5377b59fe39d395e41042dd045bb" + integrity sha1-95xEk68MU3e1n+OdOV5BBC3QRbs= dependencies: isobject "^3.0.0" object.omit@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/object.omit/-/object.omit-2.0.1.tgz#1a9c744829f39dbb858c76ca3579ae2a54ebd1fa" + integrity sha1-Gpx0SCnznbuFjHbKNXmuKlTr0fo= dependencies: for-own "^0.1.4" is-extendable "^0.1.1" @@ -4699,40 +5396,47 @@ object.omit@^2.0.0: object.pick@^1.3.0: version "1.3.0" resolved "https://registry.yarnpkg.com/object.pick/-/object.pick-1.3.0.tgz#87a10ac4c1694bd2e1cbf53591a66141fb5dd747" + integrity sha1-h6EKxMFpS9Lhy/U1kaZhQftd10c= dependencies: isobject "^3.0.1" oboe@2.1.3: version "2.1.3" resolved "https://registry.yarnpkg.com/oboe/-/oboe-2.1.3.tgz#2b4865dbd46be81225713f4e9bfe4bcf4f680a4f" + integrity sha1-K0hl29Rr6BIlcT9Om/5Lz09oCk8= dependencies: http-https "^1.0.0" on-finished@~2.3.0: version "2.3.0" resolved "https://registry.yarnpkg.com/on-finished/-/on-finished-2.3.0.tgz#20f1336481b083cd75337992a16971aa2d906947" + integrity sha1-IPEzZIGwg811M3mSoWlxqi2QaUc= dependencies: ee-first "1.1.1" once@1.x, once@^1.3.0, once@^1.3.1, once@^1.4.0: version "1.4.0" resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" + integrity sha1-WDsap3WWHUsROsF9nFC6753Xa9E= dependencies: wrappy "1" onetime@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/onetime/-/onetime-2.0.1.tgz#067428230fd67443b2794b22bba528b6867962d4" + integrity sha1-BnQoIw/WdEOyeUsiu6UotoZ5YtQ= dependencies: mimic-fn "^1.0.0" -openzeppelin-solidity@2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/openzeppelin-solidity/-/openzeppelin-solidity-2.0.0.tgz#b45dddbdae090f89577598c1a7e7518df61b7ba2" +openzeppelin-solidity@^2.1.0-rc.2: + version "2.1.0-rc.2" + resolved "https://registry.yarnpkg.com/openzeppelin-solidity/-/openzeppelin-solidity-2.1.0-rc.2.tgz#704b7c86cc45fc82bc23ab706d767d04cf3391dc" + integrity sha512-2Yf0c4k1v0L354ZXobBn6wL207fBw+906icm4F0DYix4U+4fUMA2xgjWzVFi6zdJKZnCgBRkg+eddF8ZZY6gNA== optimist@^0.6.1: version "0.6.1" resolved "https://registry.yarnpkg.com/optimist/-/optimist-0.6.1.tgz#da3ea74686fa21a19a111c326e90eb15a0196686" + integrity sha1-2j6nRob6IaGaERwybpDrFaAZZoY= dependencies: minimist "~0.0.1" wordwrap "~0.0.2" @@ -4740,6 +5444,7 @@ optimist@^0.6.1: optionator@^0.8.1, optionator@^0.8.2: version "0.8.2" resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.8.2.tgz#364c5e409d3f4d6301d6c0b4c05bba50180aeb64" + integrity sha1-NkxeQJ0/TWMB1sC0wFu6UBgK62Q= dependencies: deep-is "~0.1.3" fast-levenshtein "~2.0.4" @@ -4751,24 +5456,29 @@ optionator@^0.8.1, optionator@^0.8.2: original-require@1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/original-require/-/original-require-1.0.1.tgz#0f130471584cd33511c5ec38c8d59213f9ac5e20" + integrity sha1-DxMEcVhM0zURxew4yNWSE/msXiA= os-browserify@^0.3.0: version "0.3.0" resolved "https://registry.yarnpkg.com/os-browserify/-/os-browserify-0.3.0.tgz#854373c7f5c2315914fc9bfc6bd8238fdda1ec27" + integrity sha1-hUNzx/XCMVkU/Jv8a9gjj92h7Cc= os-homedir@^1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/os-homedir/-/os-homedir-1.0.2.tgz#ffbc4988336e0e833de0c168c7ef152121aa7fb3" + integrity sha1-/7xJiDNuDoM94MFox+8VISGqf7M= os-locale@^1.4.0: version "1.4.0" resolved "https://registry.yarnpkg.com/os-locale/-/os-locale-1.4.0.tgz#20f9f17ae29ed345e8bde583b13d2009803c14d9" + integrity sha1-IPnxeuKe00XoveWDsT0gCYA8FNk= dependencies: lcid "^1.0.0" os-locale@^2.0.0: version "2.1.0" resolved "https://registry.yarnpkg.com/os-locale/-/os-locale-2.1.0.tgz#42bc2900a6b5b8bd17376c8e882b65afccf24bf2" + integrity sha512-3sslG3zJbEYcaC4YVAvDorjGxc7tv6KVATnLPZONiljsUncvihe9BQoVCEs0RZ1kmf4Hk9OBqlZfJZWI4GanKA== dependencies: execa "^0.7.0" lcid "^1.0.0" @@ -4777,10 +5487,12 @@ os-locale@^2.0.0: os-tmpdir@^1.0.0, os-tmpdir@^1.0.1, os-tmpdir@~1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/os-tmpdir/-/os-tmpdir-1.0.2.tgz#bbe67406c79aa85c5cfec766fe5734555dfa1274" + integrity sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ= osenv@^0.1.4: version "0.1.5" resolved "https://registry.yarnpkg.com/osenv/-/osenv-0.1.5.tgz#85cdfafaeb28e8677f416e287592b5f3f49ea410" + integrity sha512-0CWcCECdMVc2Rw3U5w9ZjqX6ga6ubk1xDVKxtBQPK7wis/0F2r9T6k4ydGYhecl7YUBxBVxhL5oisPsNxAPe2g== dependencies: os-homedir "^1.0.0" os-tmpdir "^1.0.0" @@ -4788,40 +5500,48 @@ osenv@^0.1.4: p-cancelable@^0.3.0: version "0.3.0" resolved "https://registry.yarnpkg.com/p-cancelable/-/p-cancelable-0.3.0.tgz#b9e123800bcebb7ac13a479be195b507b98d30fa" + integrity sha512-RVbZPLso8+jFeq1MfNvgXtCRED2raz/dKpacfTNxsx6pLEpEomM7gah6VeHSYV3+vo0OAi4MkArtQcWWXuQoyw== p-finally@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/p-finally/-/p-finally-1.0.0.tgz#3fbcfb15b899a44123b34b6dcc18b724336a2cae" + integrity sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4= p-limit@^1.1.0: version "1.3.0" resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-1.3.0.tgz#b86bd5f0c25690911c7590fcbfc2010d54b3ccb8" + integrity sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q== dependencies: p-try "^1.0.0" p-locate@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-2.0.0.tgz#20a0103b222a70c8fd39cc2e580680f3dde5ec43" + integrity sha1-IKAQOyIqcMj9OcwuWAaA893l7EM= dependencies: p-limit "^1.1.0" p-timeout@^1.1.1: version "1.2.1" resolved "https://registry.yarnpkg.com/p-timeout/-/p-timeout-1.2.1.tgz#5eb3b353b7fce99f101a1038880bb054ebbea386" + integrity sha1-XrOzU7f86Z8QGhA4iAuwVOu+o4Y= dependencies: p-finally "^1.0.0" p-try@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/p-try/-/p-try-1.0.0.tgz#cbc79cdbaf8fd4228e13f621f2b1a237c1b207b3" + integrity sha1-y8ec26+P1CKOE/Yh8rGiN8GyB7M= pako@~1.0.5: - version "1.0.6" - resolved "https://registry.yarnpkg.com/pako/-/pako-1.0.6.tgz#0101211baa70c4bca4a0f63f2206e97b7dfaf258" + version "1.0.7" + resolved "https://registry.yarnpkg.com/pako/-/pako-1.0.7.tgz#2473439021b57f1516c82f58be7275ad8ef1bb27" + integrity sha512-3HNK5tW4x8o5mO8RuHZp3Ydw9icZXx0RANAOMzlMzx7LVXhMJ4mo3MOBpzyd7r/+RUu8BmndP47LXT+vzjtWcQ== parse-asn1@^5.0.0: version "5.1.1" resolved "https://registry.yarnpkg.com/parse-asn1/-/parse-asn1-5.1.1.tgz#f6bf293818332bd0dab54efb16087724745e6ca8" + integrity sha512-KPx7flKXg775zZpnp9SxJlz00gTd4BmJ2yJufSc44gMCRrRQ7NSzAcSJQfifuOLgW6bEi+ftrALtsgALeB2Adw== dependencies: asn1.js "^4.0.0" browserify-aes "^1.0.0" @@ -4829,9 +5549,15 @@ parse-asn1@^5.0.0: evp_bytestokey "^1.0.0" pbkdf2 "^3.0.3" +parse-code-context@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/parse-code-context/-/parse-code-context-1.0.0.tgz#718c295c593d0d19a37f898473268cc75e98de1e" + integrity sha512-OZQaqKaQnR21iqhlnPfVisFjBWjhnMl5J9MgbP8xC+EwoVqbXrq78lp+9Zb3ahmLzrIX5Us/qbvBnaS3hkH6OA== + parse-glob@^3.0.4: version "3.0.4" resolved "https://registry.yarnpkg.com/parse-glob/-/parse-glob-3.0.4.tgz#b2c376cfb11f35513badd173ef0bb6e3a388391c" + integrity sha1-ssN2z7EfNVE7rdFz7wu246OIORw= dependencies: glob-base "^0.3.0" is-dotfile "^1.0.0" @@ -4841,6 +5567,7 @@ parse-glob@^3.0.4: parse-headers@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/parse-headers/-/parse-headers-2.0.1.tgz#6ae83a7aa25a9d9b700acc28698cd1f1ed7e9536" + integrity sha1-aug6eqJanZtwCswoaYzR8e1+lTY= dependencies: for-each "^0.3.2" trim "0.0.1" @@ -4848,58 +5575,71 @@ parse-headers@^2.0.0: parse-json@^2.2.0: version "2.2.0" resolved "https://registry.yarnpkg.com/parse-json/-/parse-json-2.2.0.tgz#f480f40434ef80741f8469099f8dea18f55a4dc9" + integrity sha1-9ID0BDTvgHQfhGkJn43qGPVaTck= dependencies: error-ex "^1.2.0" parseurl@~1.3.2: version "1.3.2" resolved "https://registry.yarnpkg.com/parseurl/-/parseurl-1.3.2.tgz#fc289d4ed8993119460c156253262cdc8de65bf3" + integrity sha1-/CidTtiZMRlGDBViUyYs3I3mW/M= pascalcase@^0.1.1: version "0.1.1" resolved "https://registry.yarnpkg.com/pascalcase/-/pascalcase-0.1.1.tgz#b363e55e8006ca6fe21784d2db22bd15d7917f14" + integrity sha1-s2PlXoAGym/iF4TS2yK9FdeRfxQ= path-browserify@0.0.0: version "0.0.0" resolved "https://registry.yarnpkg.com/path-browserify/-/path-browserify-0.0.0.tgz#a0b870729aae214005b7d5032ec2cbbb0fb4451a" + integrity sha1-oLhwcpquIUAFt9UDLsLLuw+0RRo= path-dirname@^1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/path-dirname/-/path-dirname-1.0.2.tgz#cc33d24d525e099a5388c0336c6e32b9160609e0" + integrity sha1-zDPSTVJeCZpTiMAzbG4yuRYGCeA= path-exists@^2.0.0: version "2.1.0" resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-2.1.0.tgz#0feb6c64f0fc518d9a754dd5efb62c7022761f4b" + integrity sha1-D+tsZPD8UY2adU3V77YscCJ2H0s= dependencies: pinkie-promise "^2.0.0" path-exists@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-3.0.0.tgz#ce0ebeaa5f78cb18925ea7d810d7b59b010fd515" + integrity sha1-zg6+ql94yxiSXqfYENe1mwEP1RU= path-is-absolute@^1.0.0, path-is-absolute@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" + integrity sha1-F0uSaHNVNP+8es5r9TpanhtcX18= -path-is-inside@^1.0.1, path-is-inside@^1.0.2: +path-is-inside@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/path-is-inside/-/path-is-inside-1.0.2.tgz#365417dede44430d1c11af61027facf074bdfc53" + integrity sha1-NlQX3t5EQw0cEa9hAn+s8HS9/FM= path-key@^2.0.0, path-key@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/path-key/-/path-key-2.0.1.tgz#411cadb574c5a140d3a4b1910d40d80cc9f40b40" + integrity sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A= path-parse@^1.0.5: version "1.0.6" resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.6.tgz#d62dbb5679405d72c4737ec58600e9ddcf06d24c" + integrity sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw== path-to-regexp@0.1.7: version "0.1.7" resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-0.1.7.tgz#df604178005f522f15eb4490e7247a1bfaa67f8c" + integrity sha1-32BBeABfUi8V60SQ5yR6G/qmf4w= path-type@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/path-type/-/path-type-1.1.0.tgz#59c44f7ee491da704da415da5a4070ba4f8fe441" + integrity sha1-WcRPfuSR2nBNpBXaWkBwuk+P5EE= dependencies: graceful-fs "^4.1.2" pify "^2.0.0" @@ -4908,12 +5648,14 @@ path-type@^1.0.0: path-type@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/path-type/-/path-type-2.0.0.tgz#f012ccb8415b7096fc2daa1054c3d72389594c73" + integrity sha1-8BLMuEFbcJb8LaoQVMPXI4lZTHM= dependencies: pify "^2.0.0" pbkdf2@^3.0.3: version "3.0.17" resolved "https://registry.yarnpkg.com/pbkdf2/-/pbkdf2-3.0.17.tgz#976c206530617b14ebb32114239f7b09336e93a6" + integrity sha512-U/il5MsrZp7mGg3mSQfn742na2T+1/vHDCG5/iTI3X9MKUuYUZVLQhyRsg06mCgDBTd57TxzgZt7P+fYfjRLtA== dependencies: create-hash "^1.1.2" create-hmac "^1.1.4" @@ -4924,98 +5666,138 @@ pbkdf2@^3.0.3: pegjs@^0.10.0: version "0.10.0" resolved "https://registry.yarnpkg.com/pegjs/-/pegjs-0.10.0.tgz#cf8bafae6eddff4b5a7efb185269eaaf4610ddbd" + integrity sha1-z4uvrm7d/0tafvsYUmnqr0YQ3b0= pend@~1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/pend/-/pend-1.2.0.tgz#7a57eb550a6783f9115331fcf4663d5c8e007a50" + integrity sha1-elfrVQpng/kRUzH89GY9XI4AelA= performance-now@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/performance-now/-/performance-now-2.1.0.tgz#6309f4e0e5fa913ec1c69307ae364b4b377c9e7b" + integrity sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns= pify@^2.0.0, pify@^2.3.0: version "2.3.0" resolved "https://registry.yarnpkg.com/pify/-/pify-2.3.0.tgz#ed141a6ac043a849ea588498e7dca8b15330e90c" + integrity sha1-7RQaasBDqEnqWISY59yosVMw6Qw= pify@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/pify/-/pify-3.0.0.tgz#e5a4acd2c101fdf3d9a4d07f0dbc4db49dd28176" + integrity sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY= + +pify@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/pify/-/pify-4.0.1.tgz#4b2cd25c50d598735c50292224fd8c6df41e3231" + integrity sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g== pinkie-promise@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/pinkie-promise/-/pinkie-promise-2.0.1.tgz#2135d6dfa7a358c069ac9b178776288228450ffa" + integrity sha1-ITXW36ejWMBprJsXh3YogihFD/o= dependencies: pinkie "^2.0.0" pinkie@^2.0.0: version "2.0.4" resolved "https://registry.yarnpkg.com/pinkie/-/pinkie-2.0.4.tgz#72556b80cfa0d48a974e80e77248e80ed4f7f870" + integrity sha1-clVrgM+g1IqXToDnckjoDtT3+HA= pkg-dir@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/pkg-dir/-/pkg-dir-1.0.0.tgz#7a4b508a8d5bb2d629d447056ff4e9c9314cf3d4" + integrity sha1-ektQio1bstYp1EcFb/TpyTFM89Q= dependencies: find-up "^1.0.0" pkginfo@0.3.x: version "0.3.1" resolved "https://registry.yarnpkg.com/pkginfo/-/pkginfo-0.3.1.tgz#5b29f6a81f70717142e09e765bbeab97b4f81e21" + integrity sha1-Wyn2qB9wcXFC4J52W76rl7T4HiE= pkginfo@0.x.x: version "0.4.1" resolved "https://registry.yarnpkg.com/pkginfo/-/pkginfo-0.4.1.tgz#b5418ef0439de5425fc4995042dced14fb2a84ff" + integrity sha1-tUGO8EOd5UJfxJlQQtztFPsqhP8= pluralize@^7.0.0: version "7.0.0" resolved "https://registry.yarnpkg.com/pluralize/-/pluralize-7.0.0.tgz#298b89df8b93b0221dbf421ad2b1b1ea23fc6777" + integrity sha512-ARhBOdzS3e41FbkW/XWrTEtukqqLoK5+Z/4UeDaLuSW+39JPeFgs4gCGqsrJHVZX0fUrx//4OF0K1CUGwlIFow== posix-character-classes@^0.1.0: version "0.1.1" resolved "https://registry.yarnpkg.com/posix-character-classes/-/posix-character-classes-0.1.1.tgz#01eac0fe3b5af71a2a6c02feabb8c1fef7e00eab" + integrity sha1-AerA/jta9xoqbAL+q7jB/vfgDqs= pragma-singleton@1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/pragma-singleton/-/pragma-singleton-1.0.3.tgz#6894317bb8d47157e59de2a4a009db7e6f63e30e" + integrity sha1-aJQxe7jUcVflneKkoAnbfm9j4w4= prelude-ls@~1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.1.2.tgz#21932a549f5e52ffd9a827f570e04be62a97da54" + integrity sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ= prepend-http@^1.0.1: version "1.0.4" resolved "https://registry.yarnpkg.com/prepend-http/-/prepend-http-1.0.4.tgz#d4f4562b0ce3696e41ac52d0e002e57a635dc6dc" + integrity sha1-1PRWKwzjaW5BrFLQ4ALlemNdxtw= preserve@^0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/preserve/-/preserve-0.2.0.tgz#815ed1f6ebc65926f865b310c0713bcb3315ce4b" + integrity sha1-gV7R9uvGWSb4ZbMQwHE7yzMVzks= -prettier@^1.14.3: - version "1.14.3" - resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.14.3.tgz#90238dd4c0684b7edce5f83b0fb7328e48bd0895" +prettier-plugin-solidity-refactor@^1.0.0-alpha.10: + version "1.0.0-alpha.10" + resolved "https://registry.yarnpkg.com/prettier-plugin-solidity-refactor/-/prettier-plugin-solidity-refactor-1.0.0-alpha.10.tgz#39c783d9bae100792a71dbd9b60277fbc5cfa31b" + integrity sha512-xHZOIbYD1NYsacpGuPuCbwDbiU5nT07YPrRhkMsuulVocy15vL+XQLFyQmU+oMgeQuQLI8vW79QYw32SG08RbA== + dependencies: + emoji-regex "^7.0.1" + escape-string-regexp "^1.0.5" + extract-comments "^1.1.0" + prettier "^1.15.2" + solidity-parser-antlr "^0.3.1" + string-width "3.0.0" + +prettier@^1.15.2, prettier@^1.15.3: + version "1.15.3" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.15.3.tgz#1feaac5bdd181237b54dbe65d874e02a1472786a" + integrity sha512-gAU9AGAPMaKb3NNSUUuhhFAS7SCO4ALTN4nRIn6PJ075Qd28Yn2Ig2ahEJWdJwJmlEBTUfC7mMUSFy8MwsOCfg== private@^0.1.6, private@^0.1.8: version "0.1.8" resolved "https://registry.yarnpkg.com/private/-/private-0.1.8.tgz#2381edb3689f7a53d653190060fcf822d2f368ff" + integrity sha512-VvivMrbvd2nKkiG38qjULzlc+4Vx4wm/whI9pQD35YrARNnhxeiRktSOhSukRLFNlzg6Br/cJPet5J/u19r/mg== process-nextick-args@~2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-2.0.0.tgz#a37d732f4271b4ab1ad070d35508e8290788ffaa" + integrity sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw== process@^0.11.10: version "0.11.10" resolved "https://registry.yarnpkg.com/process/-/process-0.11.10.tgz#7332300e840161bda3e69a1d1d91a7d4bc16f182" + integrity sha1-czIwDoQBYb2j5podHZGn1LwW8YI= process@~0.5.1: version "0.5.2" resolved "https://registry.yarnpkg.com/process/-/process-0.5.2.tgz#1638d8a8e34c2f440a91db95ab9aeb677fc185cf" + integrity sha1-FjjYqONML0QKkduVq5rrZ3/Bhc8= progress@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/progress/-/progress-2.0.0.tgz#8a1be366bf8fc23db2bd23f10c6fe920b4389d1f" + version "2.0.3" + resolved "https://registry.yarnpkg.com/progress/-/progress-2.0.3.tgz#7e8cf8d8f5b8f239c1bc68beb4eb78567d572ef8" + integrity sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA== promise-to-callback@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/promise-to-callback/-/promise-to-callback-1.0.0.tgz#5d2a749010bfb67d963598fcd3960746a68feef7" + integrity sha1-XSp0kBC/tn2WNZj805YHRqaP7vc= dependencies: is-fn "^1.0.0" set-immediate-shim "^1.0.1" @@ -5023,6 +5805,7 @@ promise-to-callback@^1.0.0: prompt@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/prompt/-/prompt-1.0.0.tgz#8e57123c396ab988897fb327fd3aedc3e735e4fe" + integrity sha1-jlcSPDlquYiJf7Mn/Trtw+c15P4= dependencies: colors "^1.1.2" pkginfo "0.x.x" @@ -5034,6 +5817,7 @@ prompt@^1.0.0: prop-types@^15.6.2: version "15.6.2" resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.6.2.tgz#05d5ca77b4453e985d60fc7ff8c859094a497102" + integrity sha512-3pboPvLiWD7dkI3qf3KbUe6hKFKa52w+AE0VCqECtf+QHAKgOL37tTaNCnuX1nAAQ4ZhyP+kYVKf8rLmJ/feDQ== dependencies: loose-envify "^1.3.1" object-assign "^4.1.1" @@ -5041,6 +5825,7 @@ prop-types@^15.6.2: proxy-addr@~2.0.4: version "2.0.4" resolved "https://registry.yarnpkg.com/proxy-addr/-/proxy-addr-2.0.4.tgz#ecfc733bf22ff8c6f407fa275327b9ab67e48b93" + integrity sha512-5erio2h9jp5CHGwcybmxmVqHmnCBZeewlfJ0pex+UW7Qny7OOZXTtH56TGNyBizkgiOwhJtMKrVzDTeKcySZwA== dependencies: forwarded "~0.1.2" ipaddr.js "1.8.0" @@ -5048,18 +5833,22 @@ proxy-addr@~2.0.4: prr@~1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/prr/-/prr-1.0.1.tgz#d3fc114ba06995a45ec6893f484ceb1d78f5f476" + integrity sha1-0/wRS6BplaRexok/SEzrHXj19HY= pseudomap@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/pseudomap/-/pseudomap-1.0.2.tgz#f052a28da70e618917ef0a8ac34c1ae5a68286b3" + integrity sha1-8FKijacOYYkX7wqKw0wa5aaChrM= -psl@^1.1.24: - version "1.1.29" - resolved "https://registry.yarnpkg.com/psl/-/psl-1.1.29.tgz#60f580d360170bb722a797cc704411e6da850c67" +psl@^1.1.24, psl@^1.1.28: + version "1.1.31" + resolved "https://registry.yarnpkg.com/psl/-/psl-1.1.31.tgz#e9aa86d0101b5b105cbe93ac6b784cd547276184" + integrity sha512-/6pt4+C+T+wZUieKR620OpzN/LlnNKuWjy1iFLQ/UG35JqHlR/89MP1d96dUfkf6Dne3TuLQzOYEYshJ+Hx8mw== public-encrypt@^4.0.0: version "4.0.3" resolved "https://registry.yarnpkg.com/public-encrypt/-/public-encrypt-4.0.3.tgz#4fcc9d77a07e48ba7527e7cbe0de33d0701331e0" + integrity sha512-zVpa8oKZSz5bTMTFClc1fQOnyyEzpl5ozpi1B5YcvBrdohMjH2rfsBtyXcuNuwjsDIXmBYlF2N5FlJYhR29t8Q== dependencies: bn.js "^4.1.0" browserify-rsa "^4.0.0" @@ -5071,22 +5860,27 @@ public-encrypt@^4.0.0: punycode@1.3.2: version "1.3.2" resolved "https://registry.yarnpkg.com/punycode/-/punycode-1.3.2.tgz#9653a036fb7c1ee42342f2325cceefea3926c48d" + integrity sha1-llOgNvt8HuQjQvIyXM7v6jkmxI0= punycode@^1.2.4, punycode@^1.4.1: version "1.4.1" resolved "https://registry.yarnpkg.com/punycode/-/punycode-1.4.1.tgz#c0d5a63b2718800ad8e1eb0fa5269c84dd41845e" + integrity sha1-wNWmOycYgArY4esPpSachN1BhF4= -punycode@^2.1.0: +punycode@^2.1.0, punycode@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.1.1.tgz#b58b010ac40c22c5657616c8d2c2c02c7bf479ec" + integrity sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A== qs@6.5.2, qs@~6.5.2: version "6.5.2" resolved "https://registry.yarnpkg.com/qs/-/qs-6.5.2.tgz#cb3ae806e8740444584ef154ce8ee98d403f3e36" + integrity sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA== query-string@^5.0.1: version "5.1.1" resolved "https://registry.yarnpkg.com/query-string/-/query-string-5.1.1.tgz#a78c012b71c17e05f2e3fa2319dd330682efb3cb" + integrity sha512-gjWOsm2SoGlgLEdAGt7a6slVOk9mGiXmPFMqrEhLQ68rhQuBnpfs3+EmlvqKyxnCo9/PPlF+9MtY02S1aFg+Jw== dependencies: decode-uri-component "^0.2.0" object-assign "^4.1.0" @@ -5095,14 +5889,17 @@ query-string@^5.0.1: querystring-es3@^0.2.0: version "0.2.1" resolved "https://registry.yarnpkg.com/querystring-es3/-/querystring-es3-0.2.1.tgz#9ec61f79049875707d69414596fd907a4d711e73" + integrity sha1-nsYfeQSYdXB9aUFFlv2Qek1xHnM= querystring@0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/querystring/-/querystring-0.2.0.tgz#b209849203bb25df820da756e747005878521620" + integrity sha1-sgmEkgO7Jd+CDadW50cAWHhSFiA= randomatic@^3.0.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/randomatic/-/randomatic-3.1.0.tgz#36f2ca708e9e567f5ed2ec01949026d50aa10116" + version "3.1.1" + resolved "https://registry.yarnpkg.com/randomatic/-/randomatic-3.1.1.tgz#b776efc59375984e36c537b2f51a1f0aff0da1ed" + integrity sha512-TuDE5KxZ0J461RVjrJZCJc+J+zCkTb1MbH9AQUq68sMhOMcy9jLcb3BrZKgp9q9Ncltdg4QVqWrH02W2EFFVYw== dependencies: is-number "^4.0.0" kind-of "^6.0.0" @@ -5111,12 +5908,14 @@ randomatic@^3.0.0: randombytes@^2.0.0, randombytes@^2.0.1, randombytes@^2.0.5: version "2.0.6" resolved "https://registry.yarnpkg.com/randombytes/-/randombytes-2.0.6.tgz#d302c522948588848a8d300c932b44c24231da80" + integrity sha512-CIQ5OFxf4Jou6uOKe9t1AOgqpeU5fd70A8NPdHSGeYXqXsPe6peOwI0cUl88RWZ6sP1vPMV3avd/R6cZ5/sP1A== dependencies: safe-buffer "^5.1.0" randomfill@^1.0.3: version "1.0.4" resolved "https://registry.yarnpkg.com/randomfill/-/randomfill-1.0.4.tgz#c92196fc86ab42be983f1bf31778224931d61458" + integrity sha512-87lcbR8+MhcWcUiQ+9e+Rwx8MyR2P7qnt15ynUlbm3TU/fjbgz4GsvfSUDTemtCCtVCqb4ZcEFlyPNTh9bBTLw== dependencies: randombytes "^2.0.5" safe-buffer "^5.1.0" @@ -5124,14 +5923,17 @@ randomfill@^1.0.3: randomhex@0.1.5: version "0.1.5" resolved "https://registry.yarnpkg.com/randomhex/-/randomhex-0.1.5.tgz#baceef982329091400f2a2912c6cd02f1094f585" + integrity sha1-us7vmCMpCRQA8qKRLGzQLxCU9YU= range-parser@~1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/range-parser/-/range-parser-1.2.0.tgz#f49be6b487894ddc40dcc94a322f611092e00d5e" + integrity sha1-9JvmtIeJTdxA3MlKMi9hEJLgDV4= raw-body@2.3.3: version "2.3.3" resolved "https://registry.yarnpkg.com/raw-body/-/raw-body-2.3.3.tgz#1b324ece6b5706e153855bc1148c65bb7f6ea0c3" + integrity sha512-9esiElv1BrZoI3rCDuOuKCBRbuApGGaDPQfjSflGxdy4oyzqghxu6klEkkVIvBje+FF0BX9coEv8KqW6X/7njw== dependencies: bytes "3.0.0" http-errors "1.6.3" @@ -5141,6 +5943,7 @@ raw-body@2.3.3: rc@^1.2.7: version "1.2.8" resolved "https://registry.yarnpkg.com/rc/-/rc-1.2.8.tgz#cd924bf5200a075b83c188cd6b9e211b7fc0d3ed" + integrity sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw== dependencies: deep-extend "^0.6.0" ini "~1.3.0" @@ -5148,26 +5951,29 @@ rc@^1.2.7: strip-json-comments "~2.0.1" react-dom@^16.2.0: - version "16.5.2" - resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-16.5.2.tgz#b69ee47aa20bab5327b2b9d7c1fe2a30f2cfa9d7" + version "16.6.3" + resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-16.6.3.tgz#8fa7ba6883c85211b8da2d0efeffc9d3825cccc0" + integrity sha512-8ugJWRCWLGXy+7PmNh8WJz3g1TaTUt1XyoIcFN+x0Zbkoz+KKdUyx1AQLYJdbFXjuF41Nmjn5+j//rxvhFjgSQ== dependencies: loose-envify "^1.1.0" object-assign "^4.1.1" prop-types "^15.6.2" - schedule "^0.5.0" + scheduler "^0.11.2" react@^16.2.0: - version "16.5.2" - resolved "https://registry.yarnpkg.com/react/-/react-16.5.2.tgz#19f6b444ed139baa45609eee6dc3d318b3895d42" + version "16.6.3" + resolved "https://registry.yarnpkg.com/react/-/react-16.6.3.tgz#25d77c91911d6bbdd23db41e70fb094cc1e0871c" + integrity sha512-zCvmH2vbEolgKxtqXL2wmGCUxUyNheYn/C+PD1YAjfxHC54+MhdruyhO7QieQrYsYeTxrn93PM2y0jRH1zEExw== dependencies: loose-envify "^1.1.0" object-assign "^4.1.1" prop-types "^15.6.2" - schedule "^0.5.0" + scheduler "^0.11.2" read-pkg-up@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/read-pkg-up/-/read-pkg-up-1.0.1.tgz#9d63c13276c065918d57f002a57f40a1b643fb02" + integrity sha1-nWPBMnbAZZGNV/ACpX9AobZD+wI= dependencies: find-up "^1.0.0" read-pkg "^1.0.0" @@ -5175,6 +5981,7 @@ read-pkg-up@^1.0.1: read-pkg-up@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/read-pkg-up/-/read-pkg-up-2.0.0.tgz#6b72a8048984e0c41e79510fd5e9fa99b3b549be" + integrity sha1-a3KoBImE4MQeeVEP1en6mbO1Sb4= dependencies: find-up "^2.0.0" read-pkg "^2.0.0" @@ -5182,6 +5989,7 @@ read-pkg-up@^2.0.0: read-pkg@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/read-pkg/-/read-pkg-1.1.0.tgz#f5ffaa5ecd29cb31c0474bca7d756b6bb29e3f28" + integrity sha1-9f+qXs0pyzHAR0vKfXVra7KePyg= dependencies: load-json-file "^1.0.0" normalize-package-data "^2.3.2" @@ -5190,6 +5998,7 @@ read-pkg@^1.0.0: read-pkg@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/read-pkg/-/read-pkg-2.0.0.tgz#8ef1c0623c6a6db0dc6713c4bfac46332b2368f8" + integrity sha1-jvHAYjxqbbDcZxPEv6xGMysjaPg= dependencies: load-json-file "^2.0.0" normalize-package-data "^2.3.2" @@ -5198,12 +6007,14 @@ read-pkg@^2.0.0: read@1.0.x: version "1.0.7" resolved "https://registry.yarnpkg.com/read/-/read-1.0.7.tgz#b3da19bd052431a97671d44a42634adf710b40c4" + integrity sha1-s9oZvQUkMal2cdRKQmNK33ELQMQ= dependencies: mute-stream "~0.0.4" readable-stream@^1.0.33: version "1.1.14" resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-1.1.14.tgz#7cf4c54ef648e3813084c636dd2079e166c081d9" + integrity sha1-fPTFTvZI44EwhMY23SB54WbAgdk= dependencies: core-util-is "~1.0.0" inherits "~2.0.1" @@ -5213,6 +6024,7 @@ readable-stream@^1.0.33: readable-stream@^2.0.0, readable-stream@^2.0.1, readable-stream@^2.0.2, readable-stream@^2.0.6, readable-stream@^2.2.9, readable-stream@^2.3.0, readable-stream@^2.3.3, readable-stream@^2.3.5, readable-stream@^2.3.6: version "2.3.6" resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.6.tgz#b11c27d88b8ff1fbe070643cf94b0c79ae1b0aaf" + integrity sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw== dependencies: core-util-is "~1.0.0" inherits "~2.0.3" @@ -5225,6 +6037,7 @@ readable-stream@^2.0.0, readable-stream@^2.0.1, readable-stream@^2.0.2, readable readable-stream@~1.0.15: version "1.0.34" resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-1.0.34.tgz#125820e34bc842d2f2aaafafe4c2916ee32c157c" + integrity sha1-Elgg40vIQtLyqq+v5MKRbuMsFXw= dependencies: core-util-is "~1.0.0" inherits "~2.0.1" @@ -5234,6 +6047,7 @@ readable-stream@~1.0.15: readdirp@^2.0.0: version "2.2.1" resolved "https://registry.yarnpkg.com/readdirp/-/readdirp-2.2.1.tgz#0e87622a3325aa33e892285caf8b4e846529a525" + integrity sha512-1JU/8q+VgFZyxwrJ+SVIOsh+KywWGpds3NTqikiKpDMZWScmAYyKIgqkO+ARvNWJfXeXR1zxz7aHF4u4CyH6vQ== dependencies: graceful-fs "^4.1.11" micromatch "^3.1.10" @@ -5242,28 +6056,34 @@ readdirp@^2.0.0: readline-sync@^1.4.9: version "1.4.9" resolved "https://registry.yarnpkg.com/readline-sync/-/readline-sync-1.4.9.tgz#3eda8e65f23cd2a17e61301b1f0003396af5ecda" + integrity sha1-PtqOZfI80qF+YTAbHwADOWr17No= rechoir@^0.6.2: version "0.6.2" resolved "https://registry.yarnpkg.com/rechoir/-/rechoir-0.6.2.tgz#85204b54dba82d5742e28c96756ef43af50e3384" + integrity sha1-hSBLVNuoLVdC4oyWdW70OvUOM4Q= dependencies: resolve "^1.1.6" regenerate@^1.2.1: version "1.4.0" resolved "https://registry.yarnpkg.com/regenerate/-/regenerate-1.4.0.tgz#4a856ec4b56e4077c557589cae85e7a4c8869a11" + integrity sha512-1G6jJVDWrt0rK99kBjvEtziZNCICAuvIPkSiUFIQxVP06RCVpq3dmDo2oi6ABpYaDYaTRr67BEhL8r1wgEZZKg== regenerator-runtime@^0.10.5: version "0.10.5" resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.10.5.tgz#336c3efc1220adcedda2c9fab67b5a7955a33658" + integrity sha1-M2w+/BIgrc7dosn6tntaeVWjNlg= regenerator-runtime@^0.11.0: version "0.11.1" resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz#be05ad7f9bf7d22e056f9726cee5017fbf19e2e9" + integrity sha512-MguG95oij0fC3QV3URf4V2SDYGJhJnJGqvIIgdECeODCT98wSWDAJ94SSuVpYQUoTcGUIL6L4yNB7j1DFFHSBg== regenerator-transform@^0.10.0: version "0.10.1" resolved "https://registry.yarnpkg.com/regenerator-transform/-/regenerator-transform-0.10.1.tgz#1e4996837231da8b7f3cf4114d71b5691a0680dd" + integrity sha512-PJepbvDbuK1xgIgnau7Y90cwaAmO/LCLMI2mPvaXq2heGMR3aWW5/BQvYrhJ8jgmQjXewXvBjzfqKcVOmhjZ6Q== dependencies: babel-runtime "^6.18.0" babel-types "^6.19.0" @@ -5272,23 +6092,26 @@ regenerator-transform@^0.10.0: regex-cache@^0.4.2: version "0.4.4" resolved "https://registry.yarnpkg.com/regex-cache/-/regex-cache-0.4.4.tgz#75bdc58a2a1496cec48a12835bc54c8d562336dd" + integrity sha512-nVIZwtCjkC9YgvWkpM55B5rBhBYRZhAaJbgcFYXXsHnbZ9UZI9nnVWYZpBlCqv9ho2eZryPnWrZGsOdPwVWXWQ== dependencies: is-equal-shallow "^0.1.3" regex-not@^1.0.0, regex-not@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/regex-not/-/regex-not-1.0.2.tgz#1f4ece27e00b0b65e0247a6810e6a85d83a5752c" + integrity sha512-J6SDjUgDxQj5NusnOtdFxDwN/+HWykR8GELwctJ7mdqhcyy1xEc4SRFHUXvxTp661YaVKAjfRLZ9cCqS6tn32A== dependencies: extend-shallow "^3.0.2" safe-regex "^1.1.0" -regexpp@^2.0.0, regexpp@^2.0.1: +regexpp@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/regexpp/-/regexpp-2.0.1.tgz#8d19d31cf632482b589049f8281f93dbcba4d07f" regexpu-core@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/regexpu-core/-/regexpu-core-2.0.0.tgz#49d038837b8dcf8bfa5b9a42139938e6ea2ae240" + integrity sha1-SdA4g3uNz4v6W5pCE5k45uoq4kA= dependencies: regenerate "^1.2.1" regjsgen "^0.2.0" @@ -5297,52 +6120,62 @@ regexpu-core@^2.0.0: regjsgen@^0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/regjsgen/-/regjsgen-0.2.0.tgz#6c016adeac554f75823fe37ac05b92d5a4edb1f7" + integrity sha1-bAFq3qxVT3WCP+N6wFuS1aTtsfc= regjsparser@^0.1.4: version "0.1.5" resolved "https://registry.yarnpkg.com/regjsparser/-/regjsparser-0.1.5.tgz#7ee8f84dc6fa792d3fd0ae228d24bd949ead205c" + integrity sha1-fuj4Tcb6eS0/0K4ijSS9lJ6tIFw= dependencies: jsesc "~0.5.0" remove-trailing-separator@^1.0.1: version "1.1.0" resolved "https://registry.yarnpkg.com/remove-trailing-separator/-/remove-trailing-separator-1.1.0.tgz#c24bce2a283adad5bc3f58e0d48249b92379d8ef" + integrity sha1-wkvOKig62tW8P1jg1IJJuSN52O8= repeat-element@^1.1.2: version "1.1.3" resolved "https://registry.yarnpkg.com/repeat-element/-/repeat-element-1.1.3.tgz#782e0d825c0c5a3bb39731f84efee6b742e6b1ce" + integrity sha512-ahGq0ZnV5m5XtZLMb+vP76kcAM5nkLqk0lpqAuojSKGgQtn4eRi4ZZGm2olo2zKFH+sMsWaqOCW1dqAnOru72g== repeat-string@^1.5.2, repeat-string@^1.6.1: version "1.6.1" resolved "https://registry.yarnpkg.com/repeat-string/-/repeat-string-1.6.1.tgz#8dcae470e1c88abc2d600fff4a776286da75e637" + integrity sha1-jcrkcOHIirwtYA//Sndihtp15jc= repeating@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/repeating/-/repeating-2.0.1.tgz#5214c53a926d3552707527fbab415dbc08d06dda" + integrity sha1-UhTFOpJtNVJwdSf7q0FdvAjQbdo= dependencies: is-finite "^1.0.0" req-cwd@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/req-cwd/-/req-cwd-1.0.1.tgz#0d73aeae9266e697a78f7976019677e76acf0fff" + integrity sha1-DXOurpJm5penj3l2AZZ352rPD/8= dependencies: req-from "^1.0.1" req-from@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/req-from/-/req-from-1.0.1.tgz#bf81da5147947d32d13b947dc12a58ad4587350e" + integrity sha1-v4HaUUeUfTLRO5R9wSpYrUWHNQ4= dependencies: resolve-from "^2.0.0" request-promise-core@1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/request-promise-core/-/request-promise-core-1.1.1.tgz#3eee00b2c5aa83239cfb04c5700da36f81cd08b6" + integrity sha1-Pu4AssWqgyOc+wTFcA2jb4HNCLY= dependencies: lodash "^4.13.1" request-promise@^4.2.2: version "4.2.2" resolved "https://registry.yarnpkg.com/request-promise/-/request-promise-4.2.2.tgz#d1ea46d654a6ee4f8ee6a4fea1018c22911904b4" + integrity sha1-0epG1lSm7k+O5qT+oQGMIpEZBLQ= dependencies: bluebird "^3.5.0" request-promise-core "1.1.1" @@ -5352,6 +6185,7 @@ request-promise@^4.2.2: request@^2.67.0, request@^2.79.0, request@^2.81.0, request@^2.85.0, request@^2.88.0: version "2.88.0" resolved "https://registry.yarnpkg.com/request/-/request-2.88.0.tgz#9c2fca4f7d35b592efe57c7f0a55e81052124fef" + integrity sha512-NAqBSrijGLZdM0WZNsInLJpkJokL72XYjUpnB0iwsRgxh7dB6COrHnTBNwN0E+lHDAJzu7kLAkDeY08z2/A0hg== dependencies: aws-sign2 "~0.7.0" aws4 "^1.8.0" @@ -5377,18 +6211,27 @@ request@^2.67.0, request@^2.79.0, request@^2.81.0, request@^2.85.0, request@^2.8 require-directory@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/require-directory/-/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42" + integrity sha1-jGStX9MNqxyXbiNE/+f3kqam30I= require-from-string@^1.1.0: version "1.2.1" resolved "https://registry.yarnpkg.com/require-from-string/-/require-from-string-1.2.1.tgz#529c9ccef27380adfec9a2f965b649bbee636418" + integrity sha1-UpyczvJzgK3+yaL5ZbZJu+5jZBg= + +require-from-string@^2.0.0: + version "2.0.2" + resolved "https://registry.yarnpkg.com/require-from-string/-/require-from-string-2.0.2.tgz#89a7fdd938261267318eafe14f9c32e598c36909" + integrity sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw== require-main-filename@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/require-main-filename/-/require-main-filename-1.0.1.tgz#97f717b69d48784f5f526a6c5aa8ffdda055a4d1" + integrity sha1-l/cXtp1IeE9fUmpsWqj/3aBVpNE= require-uncached@^1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/require-uncached/-/require-uncached-1.0.3.tgz#4e0d56d6c9662fd31e43011c4b95aa49955421d3" + integrity sha1-Tg1W1slmL9MeQwEcS5WqSZVUIdM= dependencies: caller-path "^0.1.0" resolve-from "^1.0.0" @@ -5396,34 +6239,41 @@ require-uncached@^1.0.3: resolve-from@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-1.0.1.tgz#26cbfe935d1aeeeabb29bc3fe5aeb01e93d44226" + integrity sha1-Jsv+k10a7uq7Kbw/5a6wHpPUQiY= resolve-from@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-2.0.0.tgz#9480ab20e94ffa1d9e80a804c7ea147611966b57" + integrity sha1-lICrIOlP+h2egKgEx+oUdhGWa1c= resolve-url@^0.2.1: version "0.2.1" resolved "https://registry.yarnpkg.com/resolve-url/-/resolve-url-0.2.1.tgz#2c637fe77c893afd2a663fe21aa9080068e2052a" + integrity sha1-LGN/53yJOv0qZj/iGqkIAGjiBSo= resolve@1.1.x: version "1.1.7" resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.1.7.tgz#203114d82ad2c5ed9e8e0411b3932875e889e97b" + integrity sha1-IDEU2CrSxe2ejgQRs5ModeiJ6Xs= resolve@^1.1.6, resolve@^1.5.0, resolve@^1.6.0, resolve@^1.8.1: version "1.8.1" resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.8.1.tgz#82f1ec19a423ac1fbd080b0bab06ba36e84a7a26" + integrity sha512-AicPrAC7Qu1JxPCZ9ZgCZlY35QgFnNqc+0LtbRNxnVw4TXvjQ72wnuL9JQcEBgXkI9JM8MsT9kaQoHcpCRJOYA== dependencies: path-parse "^1.0.5" resolve@~1.7.1: version "1.7.1" resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.7.1.tgz#aadd656374fd298aee895bc026b8297418677fd3" + integrity sha512-c7rwLofp8g1U+h1KNyHL/jicrKg1Ek4q+Lr33AL65uZTinUZHe30D5HlyN5V9NW0JX1D5dXQ4jqW5l7Sy/kGfw== dependencies: path-parse "^1.0.5" restore-cursor@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/restore-cursor/-/restore-cursor-2.0.0.tgz#9f7ee287f82fd326d4fd162923d62129eee0dfaf" + integrity sha1-n37ih/gv0ybU/RYpI9YhKe7g368= dependencies: onetime "^2.0.0" signal-exit "^3.0.2" @@ -5431,32 +6281,38 @@ restore-cursor@^2.0.0: resumer@~0.0.0: version "0.0.0" resolved "https://registry.yarnpkg.com/resumer/-/resumer-0.0.0.tgz#f1e8f461e4064ba39e82af3cdc2a8c893d076759" + integrity sha1-8ej0YeQGS6Oegq883CqMiT0HZ1k= dependencies: through "~2.3.4" ret@~0.1.10: version "0.1.15" resolved "https://registry.yarnpkg.com/ret/-/ret-0.1.15.tgz#b8a4825d5bdb1fc3f6f53c2bc33f81388681c7bc" + integrity sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg== revalidator@0.1.x: version "0.1.8" resolved "https://registry.yarnpkg.com/revalidator/-/revalidator-0.1.8.tgz#fece61bfa0c1b52a206bd6b18198184bdd523a3b" + integrity sha1-/s5hv6DBtSoga9axgZgYS91SOjs= right-align@^0.1.1: version "0.1.3" resolved "https://registry.yarnpkg.com/right-align/-/right-align-0.1.3.tgz#61339b722fe6a3515689210d24e14c96148613ef" + integrity sha1-YTObci/mo1FWiSENJOFMlhSGE+8= dependencies: align-text "^0.1.1" -rimraf@2, rimraf@2.x.x, rimraf@^2.2.8, rimraf@^2.6.1: +rimraf@2, rimraf@2.x.x, rimraf@^2.2.8, rimraf@^2.6.1, rimraf@~2.6.2: version "2.6.2" resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.6.2.tgz#2ed8150d24a16ea8651e6d6ef0f47c4158ce7a36" + integrity sha512-lreewLK/BlghmxtfH36YYVg1i8IAce4TI7oao75I1g245+6BctqTVQiBP3YUJ9C6DQOXJmkYR9X9fCLtCOJc5w== dependencies: glob "^7.0.5" ripemd160@^2.0.0, ripemd160@^2.0.1: version "2.0.2" resolved "https://registry.yarnpkg.com/ripemd160/-/ripemd160-2.0.2.tgz#a1c1a6f624751577ba5d07914cbc92850585890c" + integrity sha512-ii4iagi25WusVoiC4B4lq7pbXfAp3D9v5CwfkY33vffw2+pkDjY1D8GaN7spsxvCSx8dkPqOZCEZyfxcmJG2IA== dependencies: hash-base "^3.0.0" inherits "^2.0.1" @@ -5464,18 +6320,21 @@ ripemd160@^2.0.0, ripemd160@^2.0.1: rlp@^2.0.0: version "2.1.0" resolved "https://registry.yarnpkg.com/rlp/-/rlp-2.1.0.tgz#e4f9886d5a982174f314543831e36e1a658460f9" + integrity sha512-93U7IKH5j7nmXFVg19MeNBGzQW5uXW1pmCuKY8veeKIhYTE32C2d0mOegfiIAfXcHOKJjjPlJisn8iHDF5AezA== dependencies: safe-buffer "^5.1.1" run-async@^2.2.0: version "2.3.0" resolved "https://registry.yarnpkg.com/run-async/-/run-async-2.3.0.tgz#0371ab4ae0bdd720d4166d7dfda64ff7a445a6c0" + integrity sha1-A3GrSuC91yDUFm19/aZP96RFpsA= dependencies: is-promise "^2.1.0" rustbn.js@~0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/rustbn.js/-/rustbn.js-0.2.0.tgz#8082cb886e707155fd1cb6f23bd591ab8d55d0ca" + integrity sha512-4VlvkRUuCJvr2J6Y0ImW7NvTCriMi7ErOAqWk1y69vAdoNIzCF3yPmgeNzx+RQTLEDFq5sHfscn1MwHxP9hNfA== rxjs@^6.1.0: version "6.3.3" @@ -5486,54 +6345,65 @@ rxjs@^6.1.0: safe-buffer@5.1.2, safe-buffer@^5.0.1, safe-buffer@^5.1.0, safe-buffer@^5.1.1, safe-buffer@^5.1.2, safe-buffer@~5.1.0, safe-buffer@~5.1.1: version "5.1.2" resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d" + integrity sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g== safe-event-emitter@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/safe-event-emitter/-/safe-event-emitter-1.0.1.tgz#5b692ef22329ed8f69fdce607e50ca734f6f20af" + integrity sha512-e1wFe99A91XYYxoQbcq2ZJUWurxEyP8vfz7A7vuUe1s95q8r5ebraVaA1BukYJcpM6V16ugWoD9vngi8Ccu5fg== dependencies: events "^3.0.0" safe-regex@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/safe-regex/-/safe-regex-1.1.0.tgz#40a3669f3b077d1e943d44629e157dd48023bf2e" + integrity sha1-QKNmnzsHfR6UPURinhV91IAjvy4= dependencies: ret "~0.1.10" safe@^0.4.5: version "0.4.6" resolved "https://registry.yarnpkg.com/safe/-/safe-0.4.6.tgz#1d5580cf2635c5cb940ea48fb5081ae3c25b1be1" + integrity sha1-HVWAzyY1xcuUDqSPtQga48JbG+E= safefs@^3.1.2: version "3.2.2" resolved "https://registry.yarnpkg.com/safefs/-/safefs-3.2.2.tgz#8170c1444d7038e08caea05a374fae2fa349e15c" + integrity sha1-gXDBRE1wOOCMrqBaN0+uL6NJ4Vw= dependencies: graceful-fs "*" "safer-buffer@>= 2.1.2 < 3", safer-buffer@^2.0.2, safer-buffer@^2.1.0, safer-buffer@~2.1.0: version "2.1.2" resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" + integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg== sax@^1.2.4: version "1.2.4" resolved "https://registry.yarnpkg.com/sax/-/sax-1.2.4.tgz#2816234e2378bddc4e5354fab5caa895df7100d9" + integrity sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw== scandirectory@^2.5.0: version "2.5.0" resolved "https://registry.yarnpkg.com/scandirectory/-/scandirectory-2.5.0.tgz#6ce03f54a090b668e3cbedbf20edf9e310593e72" + integrity sha1-bOA/VKCQtmjjy+2/IO354xBZPnI= dependencies: ignorefs "^1.0.0" safefs "^3.1.2" taskgroup "^4.0.5" -schedule@^0.5.0: - version "0.5.0" - resolved "https://registry.yarnpkg.com/schedule/-/schedule-0.5.0.tgz#c128fffa0b402488b08b55ae74bb9df55cc29cc8" +scheduler@^0.11.2: + version "0.11.3" + resolved "https://registry.yarnpkg.com/scheduler/-/scheduler-0.11.3.tgz#b5769b90cf8b1464f3f3cfcafe8e3cd7555a2d6b" + integrity sha512-i9X9VRRVZDd3xZw10NY5Z2cVMbdYg6gqFecfj79USv1CFN+YrJ3gIPRKf1qlY+Sxly4djoKdfx1T+m9dnRB8kQ== dependencies: + loose-envify "^1.1.0" object-assign "^4.1.1" scrypt-async@^1.2.0: version "1.3.1" resolved "https://registry.yarnpkg.com/scrypt-async/-/scrypt-async-1.3.1.tgz#a11fd6fac981b4b823ee01dee0221169500ddae9" + integrity sha1-oR/W+smBtLgj7gHe4CIRaVAN2uk= scrypt-js@2.0.4: version "2.0.4" @@ -5542,6 +6412,7 @@ scrypt-js@2.0.4: scrypt.js@0.2.0, scrypt.js@^0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/scrypt.js/-/scrypt.js-0.2.0.tgz#af8d1465b71e9990110bedfc593b9479e03a8ada" + integrity sha1-r40UZbcemZARC+38WTuUeeA6ito= dependencies: scrypt "^6.0.2" scryptsy "^1.2.1" @@ -5549,18 +6420,21 @@ scrypt.js@0.2.0, scrypt.js@^0.2.0: scrypt@^6.0.2: version "6.0.3" resolved "https://registry.yarnpkg.com/scrypt/-/scrypt-6.0.3.tgz#04e014a5682b53fa50c2d5cce167d719c06d870d" + integrity sha1-BOAUpWgrU/pQwtXM4WfXGcBthw0= dependencies: nan "^2.0.8" scryptsy@^1.2.1: version "1.2.1" resolved "https://registry.yarnpkg.com/scryptsy/-/scryptsy-1.2.1.tgz#a3225fa4b2524f802700761e2855bdf3b2d92163" + integrity sha1-oyJfpLJST4AnAHYeKFW987LZIWM= dependencies: pbkdf2 "^3.0.3" secp256k1@^3.0.1: version "3.5.2" resolved "https://registry.yarnpkg.com/secp256k1/-/secp256k1-3.5.2.tgz#f95f952057310722184fe9c914e6b71281f2f2ae" + integrity sha512-iin3kojdybY6NArd+UFsoTuapOF7bnJNf2UbcWXaY3z+E1sJDipl60vtzB5hbO/uquBu7z0fd4VC4Irp+xoFVQ== dependencies: bindings "^1.2.1" bip66 "^1.1.3" @@ -5574,24 +6448,29 @@ secp256k1@^3.0.1: seek-bzip@^1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/seek-bzip/-/seek-bzip-1.0.5.tgz#cfe917cb3d274bcffac792758af53173eb1fabdc" + integrity sha1-z+kXyz0nS8/6x5J1ivUxc+sfq9w= dependencies: commander "~2.8.1" semaphore@>=1.0.1, semaphore@^1.0.3: version "1.1.0" resolved "https://registry.yarnpkg.com/semaphore/-/semaphore-1.1.0.tgz#aaad8b86b20fe8e9b32b16dc2ee682a8cd26a8aa" + integrity sha512-O4OZEaNtkMd/K0i6js9SL+gqy0ZCBMgUvlSqHKi4IBdjhe7wB8pwztUk1BbZ1fmrvpwFrPbHzqd2w5pTcJH6LA== -"semver@2 || 3 || 4 || 5", semver@^5.3.0, semver@^5.5.0, semver@^5.5.1: +"semver@2 || 3 || 4 || 5", semver@^5.3.0, semver@^5.5.0, semver@^5.5.1, semver@^5.6.0: version "5.6.0" resolved "https://registry.yarnpkg.com/semver/-/semver-5.6.0.tgz#7e74256fbaa49c75aa7c7a205cc22799cac80004" + integrity sha512-RS9R6R35NYgQn++fkDWaOmqGoj4Ek9gGs+DPxNUZKuwE183xjJroKvyo1IzVFeXvUrvmALy6FWD5xrdJT25gMg== semver@~5.4.1: version "5.4.1" resolved "https://registry.yarnpkg.com/semver/-/semver-5.4.1.tgz#e059c09d8571f0540823733433505d3a2f00b18e" + integrity sha512-WfG/X9+oATh81XtllIo/I8gOiY9EXRdv1cQdyykeXK17YcUW3EXUAi2To4pcH6nZtJPr7ZOpM5OMyWJZm+8Rsg== send@0.16.2: version "0.16.2" resolved "https://registry.yarnpkg.com/send/-/send-0.16.2.tgz#6ecca1e0f8c156d141597559848df64730a6bbc1" + integrity sha512-E64YFPUssFHEFBvpbbjr44NCLtI1AohxQ8ZSiJjQLskAdKuriYEP6VyGEsRDH8ScozGpkaX1BGvhanqCwkcEZw== dependencies: debug "2.6.9" depd "~1.1.2" @@ -5610,6 +6489,7 @@ send@0.16.2: serve-static@1.13.2: version "1.13.2" resolved "https://registry.yarnpkg.com/serve-static/-/serve-static-1.13.2.tgz#095e8472fd5b46237db50ce486a43f4b86c6cec1" + integrity sha512-p/tdJrO4U387R9oMjb1oj7qSMaMfmOyd4j9hOFoxZe2baQszgHcSWjuya/CiT5kgZZKRudHNOA0pYXOl8rQ5nw== dependencies: encodeurl "~1.0.2" escape-html "~1.0.3" @@ -5619,6 +6499,7 @@ serve-static@1.13.2: servify@^0.1.12: version "0.1.12" resolved "https://registry.yarnpkg.com/servify/-/servify-0.1.12.tgz#142ab7bee1f1d033b66d0707086085b17c06db95" + integrity sha512-/xE6GvsKKqyo1BAY+KxOWXcLpPsUUyji7Qg3bVD7hh1eRze5bR1uYiuDA/k3Gof1s9BTzQZEJK8sNcNGFIzeWw== dependencies: body-parser "^1.16.0" cors "^2.8.1" @@ -5629,14 +6510,17 @@ servify@^0.1.12: set-blocking@^2.0.0, set-blocking@~2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/set-blocking/-/set-blocking-2.0.0.tgz#045f9782d011ae9a6803ddd382b24392b3d890f7" + integrity sha1-BF+XgtARrppoA93TgrJDkrPYkPc= set-immediate-shim@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/set-immediate-shim/-/set-immediate-shim-1.0.1.tgz#4b2b1b27eb808a9f8dcc481a58e5e56f599f3f61" + integrity sha1-SysbJ+uAip+NzEgaWOXlb1mfP2E= set-value@^0.4.3: version "0.4.3" resolved "https://registry.yarnpkg.com/set-value/-/set-value-0.4.3.tgz#7db08f9d3d22dc7f78e53af3c3bf4666ecdfccf1" + integrity sha1-fbCPnT0i3H945Trzw79GZuzfzPE= dependencies: extend-shallow "^2.0.1" is-extendable "^0.1.1" @@ -5646,6 +6530,7 @@ set-value@^0.4.3: set-value@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/set-value/-/set-value-2.0.0.tgz#71ae4a88f0feefbbf52d1ea604f3fb315ebb6274" + integrity sha512-hw0yxk9GT/Hr5yJEYnHNKYXkIA8mVJgd9ditYZCe16ZczcaELYYcfvaXesNACk2O8O0nTiPQcQhGUQj8JLzeeg== dependencies: extend-shallow "^2.0.1" is-extendable "^0.1.1" @@ -5655,18 +6540,22 @@ set-value@^2.0.0: setimmediate@1.0.4: version "1.0.4" resolved "https://registry.yarnpkg.com/setimmediate/-/setimmediate-1.0.4.tgz#20e81de622d4a02588ce0c8da8973cbcf1d3138f" + integrity sha1-IOgd5iLUoCWIzgyNqJc8vPHTE48= setimmediate@^1.0.4, setimmediate@^1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/setimmediate/-/setimmediate-1.0.5.tgz#290cbb232e306942d7d7ea9b83732ab7856f8285" + integrity sha1-KQy7Iy4waULX1+qbg3Mqt4VvgoU= setprototypeof@1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/setprototypeof/-/setprototypeof-1.1.0.tgz#d0bd85536887b6fe7c0d818cb962d9d91c54e656" + integrity sha512-BvE/TwpZX4FXExxOxZyRGQQv651MSwmWKZGqvmPcRIjDqWub67kTKuIMx43cZZrS/cBBzwBcNDWoFxt2XEFIpQ== sha.js@^2.4.0, sha.js@^2.4.8: version "2.4.11" resolved "https://registry.yarnpkg.com/sha.js/-/sha.js-2.4.11.tgz#37a5cf0b81ecbc6943de109ba2960d1b26584ae7" + integrity sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ== dependencies: inherits "^2.0.1" safe-buffer "^5.0.1" @@ -5674,30 +6563,35 @@ sha.js@^2.4.0, sha.js@^2.4.8: sha3@^1.1.0: version "1.2.2" resolved "https://registry.yarnpkg.com/sha3/-/sha3-1.2.2.tgz#a66c5098de4c25bc88336ec8b4817d005bca7ba9" + integrity sha1-pmxQmN5MJbyIM27ItIF9AFvKe6k= dependencies: nan "2.10.0" shebang-command@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-1.2.0.tgz#44aac65b695b03398968c39f363fee5deafdf1ea" + integrity sha1-RKrGW2lbAzmJaMOfNj/uXer98eo= dependencies: shebang-regex "^1.0.0" shebang-regex@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-1.0.0.tgz#da42f49740c0b42db2ca9728571cb190c98efea3" + integrity sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM= shelljs@^0.7.4: version "0.7.8" resolved "https://registry.yarnpkg.com/shelljs/-/shelljs-0.7.8.tgz#decbcf874b0d1e5fb72e14b164a9683048e9acb3" + integrity sha1-3svPh0sNHl+3LhSxZKloMEjprLM= dependencies: glob "^7.0.0" interpret "^1.0.0" rechoir "^0.6.2" shelljs@^0.8.1: - version "0.8.2" - resolved "https://registry.yarnpkg.com/shelljs/-/shelljs-0.8.2.tgz#345b7df7763f4c2340d584abb532c5f752ca9e35" + version "0.8.3" + resolved "https://registry.yarnpkg.com/shelljs/-/shelljs-0.8.3.tgz#a7f3319520ebf09ee81275b2368adb286659b097" + integrity sha512-fc0BKlAWiLpwZljmOvAOTE/gXawtCoNrP5oaY7KIaQbbyHeQVg01pSEuEGvGh3HEdBU4baCD7wQBwADmM/7f7A== dependencies: glob "^7.0.0" interpret "^1.0.0" @@ -5706,14 +6600,17 @@ shelljs@^0.8.1: signal-exit@^3.0.0, signal-exit@^3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.2.tgz#b5fdc08f1287ea1178628e415e25132b73646c6d" + integrity sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0= simple-concat@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/simple-concat/-/simple-concat-1.0.0.tgz#7344cbb8b6e26fb27d66b2fc86f9f6d5997521c6" + integrity sha1-c0TLuLbib7J9ZrL8hvn21Zl1IcY= simple-get@^2.7.0: version "2.8.1" resolved "https://registry.yarnpkg.com/simple-get/-/simple-get-2.8.1.tgz#0e22e91d4575d87620620bc91308d57a77f44b5d" + integrity sha512-lSSHRSw3mQNUGPAYRqo7xy9dhKmxFXIjLjp4KHpf99GEH2VH7C3AM+Qfx6du6jhfUi6Vm7XnbEVEf7Wb6N8jRw== dependencies: decompress-response "^3.3.0" once "^1.3.1" @@ -5722,16 +6619,21 @@ simple-get@^2.7.0: slash@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/slash/-/slash-1.0.0.tgz#c41f2f6c39fc16d1cd17ad4b5d896114ae470d55" + integrity sha1-xB8vbDn8FtHNF61LXYlhFK5HDVU= -slice-ansi@1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/slice-ansi/-/slice-ansi-1.0.0.tgz#044f1a49d8842ff307aad6b505ed178bd950134d" +slice-ansi@2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/slice-ansi/-/slice-ansi-2.0.0.tgz#5373bdb8559b45676e8541c66916cdd6251612e7" + integrity sha512-4j2WTWjp3GsZ+AOagyzVbzp4vWGtZ0hEZ/gDY/uTvm6MTxUfTUIsnMIFb1bn8o0RuXiqUw15H1bue8f22Vw2oQ== dependencies: + ansi-styles "^3.2.0" + astral-regex "^1.0.0" is-fullwidth-code-point "^2.0.0" snapdragon-node@^2.0.1: version "2.1.1" resolved "https://registry.yarnpkg.com/snapdragon-node/-/snapdragon-node-2.1.1.tgz#6c175f86ff14bdb0724563e8f3c1b021a286853b" + integrity sha512-O27l4xaMYt/RSQ5TR3vpWCAB5Kb/czIcqUFOM/C4fYcLnbZUc1PkjTAMjof2pBWaSTwOUd6qUHcFGVGj7aIwnw== dependencies: define-property "^1.0.0" isobject "^3.0.0" @@ -5740,12 +6642,14 @@ snapdragon-node@^2.0.1: snapdragon-util@^3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/snapdragon-util/-/snapdragon-util-3.0.1.tgz#f956479486f2acd79700693f6f7b805e45ab56e2" + integrity sha512-mbKkMdQKsjX4BAL4bRYTj21edOf8cN7XHdYUJEe+Zn99hVEYcMvKPct1IqNe7+AZPirn8BCDOQBHQZknqmKlZQ== dependencies: kind-of "^3.2.0" snapdragon@^0.8.1: version "0.8.2" resolved "https://registry.yarnpkg.com/snapdragon/-/snapdragon-0.8.2.tgz#64922e7c565b0e14204ba1aa7d6964278d25182d" + integrity sha512-FtyOnWN/wCHTVXOMwvSv26d+ko5vWlIDD6zoUJ7LW8vh+ZBC8QdljveRP+crNrtBwioEUWy/4dMtbBjA4ioNlg== dependencies: base "^0.11.1" debug "^2.2.0" @@ -5759,39 +6663,46 @@ snapdragon@^0.8.1: sol-digger@0.0.2: version "0.0.2" resolved "https://registry.yarnpkg.com/sol-digger/-/sol-digger-0.0.2.tgz#406c4a9d31e269e7f88eb1c2ea101318e5e09025" + integrity sha1-QGxKnTHiaef4jrHC6hATGOXgkCU= sol-explore@1.6.1: version "1.6.1" resolved "https://registry.yarnpkg.com/sol-explore/-/sol-explore-1.6.1.tgz#b59f073c69fe332560d5a10c32ba8ca7f2986cfb" + integrity sha1-tZ8HPGn+MyVg1aEMMrqMp/KYbPs= sol-explore@^1.6.2: version "1.6.2" resolved "https://registry.yarnpkg.com/sol-explore/-/sol-explore-1.6.2.tgz#43ae8c419fd3ac056a05f8a9d1fb1022cd41ecc2" + integrity sha1-Q66MQZ/TrAVqBfip0fsQIs1B7MI= sol-merger@^0.1.2: - version "0.1.2" - resolved "https://registry.yarnpkg.com/sol-merger/-/sol-merger-0.1.2.tgz#1f12500f42d427dc0ec8e4c113392acd8a6f62d9" - dependencies: - bluebird "^3.5.0" - cli-color "^1.2.0" - commander "^2.11.0" - debug "^3.0.1" - fs-extra "^4.0.2" + version "0.1.3" + resolved "https://registry.yarnpkg.com/sol-merger/-/sol-merger-0.1.3.tgz#184284ba4811aebe8950f510df4e8218f568b35f" + integrity sha512-mEirUbl1mZJt2iNBqptsBpxb8n7ZD0trNlnV/+CBAQH8TIFhHIKXdBE8ykD1v+8My18sq7GqHYPmpHE9ckB2Jw== + dependencies: + bluebird "^3.5.3" + cli-color "^1.4.0" + commander "^2.19.0" + debug "^3.2.6" + fs-extra "^7.0.1" glob "^7.1.2" -solc@0.4.24: - version "0.4.24" - resolved "https://registry.yarnpkg.com/solc/-/solc-0.4.24.tgz#354f14b269b38cbaa82a47d1ff151723502b954e" +solc@0.5.0: + version "0.5.0" + resolved "https://registry.yarnpkg.com/solc/-/solc-0.5.0.tgz#2deb2ae992acac3afb909f85c38d00f01dcb335e" + integrity sha512-mdLHDl9WeYrN+FIKcMc9PlPfnA9DG9ur5QpCDKcv6VC4RINAsTF4EMuXMZMKoQTvZhtLyJIVH/BZ+KU830Z8Xg== dependencies: fs-extra "^0.30.0" + keccak "^1.0.2" memorystream "^0.3.1" - require-from-string "^1.1.0" - semver "^5.3.0" - yargs "^4.7.1" + require-from-string "^2.0.0" + semver "^5.5.0" + yargs "^11.0.0" -solc@^0.4.19, solc@^0.4.2, solc@^0.4.24: +solc@^0.4.19, solc@^0.4.2: version "0.4.25" resolved "https://registry.yarnpkg.com/solc/-/solc-0.4.25.tgz#06b8321f7112d95b4b903639b1138a4d292f5faa" + integrity sha512-jU1YygRVy6zatgXrLY2rRm7HW1d7a8CkkEgNJwvH2VLpWhMFsMdWcJn6kUqZwcSz/Vm+w89dy7Z/aB5p6AFTrg== dependencies: fs-extra "^0.30.0" memorystream "^0.3.1" @@ -5802,6 +6713,7 @@ solc@^0.4.19, solc@^0.4.2, solc@^0.4.24: solidity-coverage@^0.5.11: version "0.5.11" resolved "https://registry.yarnpkg.com/solidity-coverage/-/solidity-coverage-0.5.11.tgz#1ee45f6d98b75a615aadb8f9aa7db4a2b32258e7" + integrity sha512-qikdsSi6+9XbfvwA0aI7HUVpF9fIFNqRWTw23M89GMDY+b6Gj0wWU9IngJS0fimoZIAdEp3bfChxvpfVcrUesg== dependencies: death "^1.1.0" ethereumjs-testrpc-sc "6.1.6" @@ -5817,6 +6729,7 @@ solidity-coverage@^0.5.11: solidity-docgen@^0.1.0: version "0.1.0" resolved "https://registry.yarnpkg.com/solidity-docgen/-/solidity-docgen-0.1.0.tgz#f3a56ff074e8c7d832af3a3d462c3b5abf0f64cb" + integrity sha512-F7ufNWmlP5c5hIi66Ijv9tc+HNosyO7ijWq6pRtyBR1WqyJBH/0DJkD6QZI8HkE8p6LEXiPKxGBWbAeVT9Nu9g== dependencies: commander "^2.14.1" lodash "^4.17.5" @@ -5826,9 +6739,15 @@ solidity-docgen@^0.1.0: react-dom "^16.2.0" shelljs "^0.8.1" +solidity-parser-antlr@^0.3.1: + version "0.3.2" + resolved "https://registry.yarnpkg.com/solidity-parser-antlr/-/solidity-parser-antlr-0.3.2.tgz#1cf9d019280550a31299dc380e87a310dc4ca154" + integrity sha512-aO/lbnc14A81cQigN5sKNuwbxohPyJOq7kpLirYT/6emCw5Gjb0TJoZ3TzL1tYdIX6gjTAMlQ1UZwOcrzOAp4w== + solidity-parser-sc@0.4.11: version "0.4.11" resolved "https://registry.yarnpkg.com/solidity-parser-sc/-/solidity-parser-sc-0.4.11.tgz#86734c9205537007f4d6201b57176e41696ee607" + integrity sha512-1kV5iC7m3CtMDfmHaVNwz2saSGQVIuF16rIxU417Al38MVCWHMQQ5vT6cmLsNwDe60S74auobWij9vNawSeOyw== dependencies: mocha "^4.1.0" pegjs "^0.10.0" @@ -5837,10 +6756,12 @@ solidity-parser-sc@0.4.11: solium-plugin-security@0.1.1: version "0.1.1" resolved "https://registry.yarnpkg.com/solium-plugin-security/-/solium-plugin-security-0.1.1.tgz#2a87bcf8f8c3abf7d198e292e4ac080284e3f3f6" + integrity sha512-kpLirBwIq4mhxk0Y/nn5cQ6qdJTI+U1LO3gpoNIcqNaW+sI058moXBe2UiHs+9wvF9IzYD49jcKhFTxcR9u9SQ== solium@^1.1.6: version "1.1.8" resolved "https://registry.yarnpkg.com/solium/-/solium-1.1.8.tgz#35d30a15c572a233ce8a90226d6cfccb762fadb7" + integrity sha512-fn0lusM6of14CytIDDHK73SGjn6NsVTaCVJjaKCKJyqKhT00rH/hDtvnIeZ2ZTD9z/xaXd4Js2brW3az6AV9RA== dependencies: ajv "^5.2.2" chokidar "^1.6.0" @@ -5858,6 +6779,7 @@ solium@^1.1.6: solparse@2.2.5: version "2.2.5" resolved "https://registry.yarnpkg.com/solparse/-/solparse-2.2.5.tgz#72709c867cd6bfc50ec2325f4b81d2b3ea365d99" + integrity sha512-t7tvtR6KU6QfPYLMv1nlCh9DA8HYIu5tbjHpKu0fhGFZ1NuSp0KKDHfFHv07g6v1xgcuUY3rVqNFjZt5b9+5qA== dependencies: mocha "^4.0.1" pegjs "^0.10.0" @@ -5866,14 +6788,17 @@ solparse@2.2.5: sorted-array-functions@^1.0.0: version "1.2.0" resolved "https://registry.yarnpkg.com/sorted-array-functions/-/sorted-array-functions-1.2.0.tgz#43265b21d6e985b7df31621b1c11cc68d8efc7c3" + integrity sha512-sWpjPhIZJtqO77GN+LD8dDsDKcWZ9GCOJNqKzi1tvtjGIzwfoyuRH8S0psunmc6Z5P+qfDqztSbwYR5X/e1UTg== source-list-map@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/source-list-map/-/source-list-map-2.0.1.tgz#3993bd873bfc48479cca9ea3a547835c7c154b34" + integrity sha512-qnQ7gVMxGNxsiL4lEuJwe/To8UnK7fAnmbGEEH8RpLouuKbeEm0lhbQVFIrNSuB+G7tVrAlVsZgETT5nljf+Iw== source-map-resolve@^0.5.0: version "0.5.2" resolved "https://registry.yarnpkg.com/source-map-resolve/-/source-map-resolve-0.5.2.tgz#72e2cc34095543e43b2c62b2c4c10d4a9054f259" + integrity sha512-MjqsvNwyz1s0k81Goz/9vRBe9SZdB09Bdw+/zYyO+3CuPk6fouTaxscHkgtE8jKvf01kVfl8riHzERQ/kefaSA== dependencies: atob "^2.1.1" decode-uri-component "^0.2.0" @@ -5881,40 +6806,47 @@ source-map-resolve@^0.5.0: source-map-url "^0.4.0" urix "^0.1.0" -source-map-support@^0.4.15: - version "0.4.18" - resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.4.18.tgz#0286a6de8be42641338594e97ccea75f0a2c585f" - dependencies: - source-map "^0.5.6" - -source-map-support@^0.5.3: +source-map-support@0.5.9, source-map-support@^0.5.3: version "0.5.9" resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.9.tgz#41bc953b2534267ea2d605bccfa7bfa3111ced5f" + integrity sha512-gR6Rw4MvUlYy83vP0vxoVNzM6t8MUXqNuRsuBmBHQDu1Fh6X015FrLdgoDKcNdkwGubozq0P4N0Q37UyFVr1EA== dependencies: buffer-from "^1.0.0" source-map "^0.6.0" +source-map-support@^0.4.15: + version "0.4.18" + resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.4.18.tgz#0286a6de8be42641338594e97ccea75f0a2c585f" + integrity sha512-try0/JqxPLF9nOjvSta7tVondkP5dwgyLDjVoyMDlmjugT2lRZ1OfsrYTkCd2hkDnJTKRbO/Rl3orm8vlsUzbA== + dependencies: + source-map "^0.5.6" + source-map-url@^0.4.0: version "0.4.0" resolved "https://registry.yarnpkg.com/source-map-url/-/source-map-url-0.4.0.tgz#3e935d7ddd73631b97659956d55128e87b5084a3" + integrity sha1-PpNdfd1zYxuXZZlW1VEo6HtQhKM= source-map@^0.5.3, source-map@^0.5.6, source-map@^0.5.7, source-map@~0.5.1: version "0.5.7" resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.7.tgz#8a039d2d1021d22d1ea14c80d8ea468ba2ef3fcc" + integrity sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w= source-map@^0.6.0, source-map@^0.6.1, source-map@~0.6.1: version "0.6.1" resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263" + integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g== source-map@~0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.2.0.tgz#dab73fbcfc2ba819b4de03bd6f6eaa48164b3f9d" + integrity sha1-2rc/vPwrqBm03gO9b26qSBZLP50= dependencies: amdefine ">=0.0.4" spdx-correct@^3.0.0: - version "3.0.2" - resolved "https://registry.yarnpkg.com/spdx-correct/-/spdx-correct-3.0.2.tgz#19bb409e91b47b1ad54159243f7312a858db3c2e" + version "3.1.0" + resolved "https://registry.yarnpkg.com/spdx-correct/-/spdx-correct-3.1.0.tgz#fb83e504445268f154b074e218c87c003cd31df4" + integrity sha512-lr2EZCctC2BNR7j7WzJ2FpDznxky1sjfxvvYEyzxNyb6lZXHODmEoJeFu4JupYlkfha1KZpJyoqiJ7pgA1qq8Q== dependencies: spdx-expression-parse "^3.0.0" spdx-license-ids "^3.0.0" @@ -5922,35 +6854,42 @@ spdx-correct@^3.0.0: spdx-exceptions@^2.1.0: version "2.2.0" resolved "https://registry.yarnpkg.com/spdx-exceptions/-/spdx-exceptions-2.2.0.tgz#2ea450aee74f2a89bfb94519c07fcd6f41322977" + integrity sha512-2XQACfElKi9SlVb1CYadKDXvoajPgBVPn/gOQLrTvHdElaVhr7ZEbqJaRnJLVNeaI4cMEAgVCeBMKF6MWRDCRA== spdx-expression-parse@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/spdx-expression-parse/-/spdx-expression-parse-3.0.0.tgz#99e119b7a5da00e05491c9fa338b7904823b41d0" + integrity sha512-Yg6D3XpRD4kkOmTpdgbUiEJFKghJH03fiC1OPll5h/0sO6neh2jqRDVHOQ4o/LMea0tgCkbMgea5ip/e+MkWyg== dependencies: spdx-exceptions "^2.1.0" spdx-license-ids "^3.0.0" spdx-license-ids@^3.0.0: - version "3.0.1" - resolved "https://registry.yarnpkg.com/spdx-license-ids/-/spdx-license-ids-3.0.1.tgz#e2a303236cac54b04031fa7a5a79c7e701df852f" + version "3.0.2" + resolved "https://registry.yarnpkg.com/spdx-license-ids/-/spdx-license-ids-3.0.2.tgz#a59efc09784c2a5bada13cfeaf5c75dd214044d2" + integrity sha512-qky9CVt0lVIECkEsYbNILVnPvycuEBkXoMFLRWsREkomQLevYhtRKC+R91a5TOAQ3bCMjikRwhyaRqj1VYatYg== split-string@^3.0.1, split-string@^3.0.2: version "3.1.0" resolved "https://registry.yarnpkg.com/split-string/-/split-string-3.1.0.tgz#7cb09dda3a86585705c64b39a6466038682e8fe2" + integrity sha512-NzNVhJDYpwceVVii8/Hu6DKfD2G+NrQHlS/V/qgv763EYudVwEcMQNxd2lh+0VrUByXN/oJkl5grOhYWvQUYiw== dependencies: extend-shallow "^3.0.0" sprintf-js@>=1.0.3: - version "1.1.1" - resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.1.1.tgz#36be78320afe5801f6cea3ee78b6e5aab940ea0c" + version "1.1.2" + resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.1.2.tgz#da1765262bf8c0f571749f2ad6c26300207ae673" + integrity sha512-VE0SOVEHCk7Qc8ulkWw3ntAzXuqf7S2lvwQaDLRnUeIEaKNQJzV6BwmLKhOqT61aGhfUMrXeaBk+oDGCzvhcug== sprintf-js@~1.0.2: version "1.0.3" resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c" + integrity sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw= sshpk@^1.7.0: - version "1.15.1" - resolved "https://registry.yarnpkg.com/sshpk/-/sshpk-1.15.1.tgz#b79a089a732e346c6e0714830f36285cd38191a2" + version "1.15.2" + resolved "https://registry.yarnpkg.com/sshpk/-/sshpk-1.15.2.tgz#c946d6bd9b1a39d0e8635763f5242d6ed6dcb629" + integrity sha512-Ra/OXQtuh0/enyl4ETZAfTaeksa6BXks5ZcjpSUNrjBr0DvrJKX+1fsKDPpT9TBXgHAFsa4510aNVgI8g/+SzA== dependencies: asn1 "~0.2.3" assert-plus "^1.0.0" @@ -5965,10 +6904,12 @@ sshpk@^1.7.0: stack-trace@0.0.x: version "0.0.10" resolved "https://registry.yarnpkg.com/stack-trace/-/stack-trace-0.0.10.tgz#547c70b347e8d32b4e108ea1a2a159e5fdde19c0" + integrity sha1-VHxws0fo0ytOEI6hoqFZ5f3eGcA= static-extend@^0.1.1: version "0.1.2" resolved "https://registry.yarnpkg.com/static-extend/-/static-extend-0.1.2.tgz#60809c39cbff55337226fd5e0b520f341f1fb5c6" + integrity sha1-YICcOcv/VTNyJv1eC1IPNB8ftcY= dependencies: define-property "^0.2.5" object-copy "^0.1.0" @@ -5976,22 +6917,27 @@ static-extend@^0.1.1: "statuses@>= 1.4.0 < 2": version "1.5.0" resolved "https://registry.yarnpkg.com/statuses/-/statuses-1.5.0.tgz#161c7dac177659fd9811f43771fa99381478628c" + integrity sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow= statuses@~1.4.0: version "1.4.0" resolved "https://registry.yarnpkg.com/statuses/-/statuses-1.4.0.tgz#bb73d446da2796106efcc1b601a253d6c46bd087" + integrity sha512-zhSCtt8v2NDrRlPQpCNtw/heZLtfUDqxBM1udqikb/Hbk52LK4nQSwr10u77iopCW5LsyHpuXS0GnEc48mLeew== stdio@^0.2.7: version "0.2.7" resolved "https://registry.yarnpkg.com/stdio/-/stdio-0.2.7.tgz#a1c57da10fe1cfaa0c3bf683c9d0743d1b660839" + integrity sha1-ocV9oQ/hz6oMO/aDydB0PRtmCDk= stealthy-require@^1.1.0: version "1.1.1" resolved "https://registry.yarnpkg.com/stealthy-require/-/stealthy-require-1.1.1.tgz#35b09875b4ff49f26a777e509b3090a3226bf24b" + integrity sha1-NbCYdbT/SfJqd35QmzCQoyJr8ks= stream-browserify@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/stream-browserify/-/stream-browserify-2.0.1.tgz#66266ee5f9bdb9940a4e4514cafb43bb71e5c9db" + integrity sha1-ZiZu5fm9uZQKTkUUyvtDu3Hlyds= dependencies: inherits "~2.0.1" readable-stream "^2.0.2" @@ -5999,6 +6945,7 @@ stream-browserify@^2.0.1: stream-http@^2.7.2: version "2.8.3" resolved "https://registry.yarnpkg.com/stream-http/-/stream-http-2.8.3.tgz#b2d242469288a5a27ec4fe8933acf623de6514fc" + integrity sha512-+TSkfINHDo4J+ZobQLWiMouQYB+UVYFttRA94FpEzzJ7ZdqcL4uUUQ7WkdkI4DSozGmgBUE/a47L+38PenXhUw== dependencies: builtin-status-codes "^3.0.0" inherits "^2.0.1" @@ -6009,10 +6956,21 @@ stream-http@^2.7.2: strict-uri-encode@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/strict-uri-encode/-/strict-uri-encode-1.1.0.tgz#279b225df1d582b1f54e65addd4352e18faa0713" + integrity sha1-J5siXfHVgrH1TmWt3UNS4Y+qBxM= + +string-width@3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-3.0.0.tgz#5a1690a57cc78211fffd9bf24bbe24d090604eb1" + integrity sha512-rr8CUxBbvOZDUvc5lNIJ+OC1nPVpz+Siw9VBtUjB9b6jZehZLFt0JMCZzShFHIsI8cbhm0EsNIfWJMFV3cu3Ew== + dependencies: + emoji-regex "^7.0.1" + is-fullwidth-code-point "^2.0.0" + strip-ansi "^5.0.0" string-width@^1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/string-width/-/string-width-1.0.2.tgz#118bdf5b8cdc51a2a7e70d211e07e2b0b9b107d3" + integrity sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M= dependencies: code-point-at "^1.0.0" is-fullwidth-code-point "^1.0.0" @@ -6021,6 +6979,7 @@ string-width@^1.0.1: "string-width@^1.0.2 || 2", string-width@^2.0.0, string-width@^2.1.0, string-width@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/string-width/-/string-width-2.1.1.tgz#ab93f27a8dc13d28cac815c462143a6d9012ae9e" + integrity sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw== dependencies: is-fullwidth-code-point "^2.0.0" strip-ansi "^4.0.0" @@ -6028,100 +6987,132 @@ string-width@^1.0.1: string.prototype.trim@~1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/string.prototype.trim/-/string.prototype.trim-1.1.2.tgz#d04de2c89e137f4d7d206f086b5ed2fae6be8cea" + integrity sha1-0E3iyJ4Tf019IG8Ia17S+ua+jOo= dependencies: define-properties "^1.1.2" es-abstract "^1.5.0" function-bind "^1.0.2" -string_decoder@^1.0.0, string_decoder@~1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.1.1.tgz#9cf1611ba62685d7030ae9e4ba34149c3af03fc8" +string_decoder@^1.0.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.2.0.tgz#fe86e738b19544afe70469243b2a1ee9240eae8d" + integrity sha512-6YqyX6ZWEYguAxgZzHGL7SsCeGx3V2TtOTqZz1xSTSWnqsbWwbptafNyvf/ACquZUXV3DANr5BDIwNYe1mN42w== dependencies: safe-buffer "~5.1.0" string_decoder@~0.10.x: version "0.10.31" resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-0.10.31.tgz#62e203bc41766c6c28c9fc84301dab1c5310fa94" + integrity sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ= + +string_decoder@~1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.1.1.tgz#9cf1611ba62685d7030ae9e4ba34149c3af03fc8" + integrity sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg== + dependencies: + safe-buffer "~5.1.0" strip-ansi@^3.0.0, strip-ansi@^3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-3.0.1.tgz#6a385fb8853d952d5ff05d0e8aaf94278dc63dcf" + integrity sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8= dependencies: ansi-regex "^2.0.0" strip-ansi@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-4.0.0.tgz#a8479022eb1ac368a871389b635262c505ee368f" + integrity sha1-qEeQIusaw2iocTibY1JixQXuNo8= dependencies: ansi-regex "^3.0.0" +strip-ansi@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-5.0.0.tgz#f78f68b5d0866c20b2c9b8c61b5298508dc8756f" + integrity sha512-Uu7gQyZI7J7gn5qLn1Np3G9vcYGTVqB+lFTytnDJv83dd8T22aGH451P3jueT2/QemInJDfxHB5Tde5OzgG1Ow== + dependencies: + ansi-regex "^4.0.0" + strip-bom@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-2.0.0.tgz#6219a85616520491f35788bdbf1447a99c7e6b0e" + integrity sha1-YhmoVhZSBJHzV4i9vxRHqZx+aw4= dependencies: is-utf8 "^0.2.0" strip-bom@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-3.0.0.tgz#2334c18e9c759f7bdd56fdef7e9ae3d588e68ed3" + integrity sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM= strip-dirs@^2.0.0: version "2.1.0" resolved "https://registry.yarnpkg.com/strip-dirs/-/strip-dirs-2.1.0.tgz#4987736264fc344cf20f6c34aca9d13d1d4ed6c5" + integrity sha512-JOCxOeKLm2CAS73y/U4ZeZPTkE+gNVCzKt7Eox84Iej1LT/2pTWYpZKJuxwQpvX1LiZb1xokNR7RLfuBAa7T3g== dependencies: is-natural-number "^4.0.1" strip-eof@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/strip-eof/-/strip-eof-1.0.0.tgz#bb43ff5598a6eb05d89b59fcd129c983313606bf" + integrity sha1-u0P/VZim6wXYm1n80SnJgzE2Br8= strip-hex-prefix@1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/strip-hex-prefix/-/strip-hex-prefix-1.0.0.tgz#0c5f155fef1151373377de9dbb588da05500e36f" + integrity sha1-DF8VX+8RUTczd96du1iNoFUA428= dependencies: is-hex-prefixed "1.0.0" strip-json-comments@^2.0.1, strip-json-comments@~2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-2.0.1.tgz#3c531942e908c2697c0ec344858c286c7ca0a60a" + integrity sha1-PFMZQukIwml8DsNEhYwobHygpgo= supports-color@4.4.0: version "4.4.0" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-4.4.0.tgz#883f7ddabc165142b2a61427f3352ded195d1a3e" + integrity sha512-rKC3+DyXWgK0ZLKwmRsrkyHVZAjNkfzeehuFWdGGcqGDTZFH73+RH6S/RDAAxl9GusSjZSUWYLmT9N5pzXFOXQ== dependencies: has-flag "^2.0.0" supports-color@5.4.0: version "5.4.0" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.4.0.tgz#1c6b337402c2137605efe19f10fec390f6faab54" + integrity sha512-zjaXglF5nnWpsq470jSv6P9DwPvgLkuapYmfDm3JWOm0vkNTVF2tI4UrN2r6jH1qM/uc/WtxYY1hYoA2dOKj5w== dependencies: has-flag "^3.0.0" supports-color@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-2.0.0.tgz#535d045ce6b6363fa40117084629995e9df324c7" + integrity sha1-U10EXOa2Nj+kARcIRimZXp3zJMc= supports-color@^3.1.0: version "3.2.3" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-3.2.3.tgz#65ac0504b3954171d8a64946b2ae3cbb8a5f54f6" + integrity sha1-ZawFBLOVQXHYpklGsq48u4pfVPY= dependencies: has-flag "^1.0.0" supports-color@^4.2.1: version "4.5.0" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-4.5.0.tgz#be7a0de484dec5c5cddf8b3d59125044912f635b" + integrity sha1-vnoN5ITexcXN34s9WRJQRJEvY1s= dependencies: has-flag "^2.0.0" supports-color@^5.3.0: version "5.5.0" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.5.0.tgz#e2e69a44ac8772f78a1ec0b35b689df6530efc8f" + integrity sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow== dependencies: has-flag "^3.0.0" swarm-js@0.1.37: version "0.1.37" resolved "https://registry.yarnpkg.com/swarm-js/-/swarm-js-0.1.37.tgz#27d485317a340bbeec40292af783cc10acfa4663" + integrity sha512-G8gi5fcXP/2upwiuOShJ258sIufBVztekgobr3cVgYXObZwJ5AXLqZn52AI+/ffft29pJexF9WNdUxjlkVehoQ== dependencies: bluebird "^3.5.0" buffer "^5.0.5" @@ -6147,12 +7138,14 @@ table@^5.0.2: string-width "^2.1.1" tapable@^0.2.7: - version "0.2.8" - resolved "https://registry.yarnpkg.com/tapable/-/tapable-0.2.8.tgz#99372a5c999bf2df160afc0d74bed4f47948cd22" + version "0.2.9" + resolved "https://registry.yarnpkg.com/tapable/-/tapable-0.2.9.tgz#af2d8bbc9b04f74ee17af2b4d9048f807acd18a8" + integrity sha512-2wsvQ+4GwBvLPLWsNfLCDYGsW6xb7aeC6utq2Qh0PFwgEy7K7dsma9Jsmb2zSQj7GvYAyUGSntLtsv++GmgL1A== tape@^4.4.0, tape@^4.6.3: version "4.9.1" resolved "https://registry.yarnpkg.com/tape/-/tape-4.9.1.tgz#1173d7337e040c76fbf42ec86fcabedc9b3805c9" + integrity sha512-6fKIXknLpoe/Jp4rzHKFPpJUHDHDqn8jus99IfPnHIjyz78HYlefTGD3b5EkbQzuLfaEvmfPK3IolLgq2xT3kw== dependencies: deep-equal "~1.0.1" defined "~1.0.0" @@ -6171,6 +7164,7 @@ tape@^4.4.0, tape@^4.6.3: tar-stream@^1.5.2: version "1.6.2" resolved "https://registry.yarnpkg.com/tar-stream/-/tar-stream-1.6.2.tgz#8ea55dab37972253d9a9af90fdcd559ae435c555" + integrity sha512-rzS0heiNf8Xn7/mpdSVVSMAWAoy9bfb1WOTYC78Z0UQKeKa/CWS8FOq0lKGNa8DWKAn9gxjCvMLYc5PGXYlK2A== dependencies: bl "^1.0.0" buffer-alloc "^1.2.0" @@ -6183,6 +7177,7 @@ tar-stream@^1.5.2: tar.gz@^1.0.5: version "1.0.7" resolved "https://registry.yarnpkg.com/tar.gz/-/tar.gz-1.0.7.tgz#577ef2c595faaa73452ef0415fed41113212257b" + integrity sha512-uhGatJvds/3diZrETqMj4RxBR779LKlIE74SsMcn5JProZsfs9j0QBwWO1RW+IWNJxS2x8Zzra1+AW6OQHWphg== dependencies: bluebird "^2.9.34" commander "^2.8.1" @@ -6193,19 +7188,21 @@ tar.gz@^1.0.5: tar@^2.1.1: version "2.2.1" resolved "https://registry.yarnpkg.com/tar/-/tar-2.2.1.tgz#8e4d2a256c0e2185c6b18ad694aec968b83cb1d1" + integrity sha1-jk0qJWwOIYXGsYrWlK7JaLg8sdE= dependencies: block-stream "*" fstream "^1.0.2" inherits "2" tar@^4: - version "4.4.6" - resolved "https://registry.yarnpkg.com/tar/-/tar-4.4.6.tgz#63110f09c00b4e60ac8bcfe1bf3c8660235fbc9b" + version "4.4.8" + resolved "https://registry.yarnpkg.com/tar/-/tar-4.4.8.tgz#b19eec3fde2a96e64666df9fdb40c5ca1bc3747d" + integrity sha512-LzHF64s5chPQQS0IYBn9IN5h3i98c12bo4NCO7e0sGM2llXQ3p2FGC5sdENN4cTW48O915Sh+x+EXx7XW96xYQ== dependencies: - chownr "^1.0.1" + chownr "^1.1.1" fs-minipass "^1.2.5" - minipass "^2.3.3" - minizlib "^1.1.0" + minipass "^2.3.4" + minizlib "^1.1.1" mkdirp "^0.5.0" safe-buffer "^5.1.2" yallist "^3.0.2" @@ -6213,6 +7210,7 @@ tar@^4: taskgroup@^4.0.5, taskgroup@^4.2.0: version "4.3.1" resolved "https://registry.yarnpkg.com/taskgroup/-/taskgroup-4.3.1.tgz#7de193febd768273c457730497024d512c27915a" + integrity sha1-feGT/r12gnPEV3MElwJNUSwnkVo= dependencies: ambi "^2.2.0" csextends "^1.0.3" @@ -6220,36 +7218,43 @@ taskgroup@^4.0.5, taskgroup@^4.2.0: text-table@^0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4" + integrity sha1-f17oI66AUgfACvLfSoTsP8+lcLQ= thenify-all@^1.0.0, thenify-all@^1.6.0: version "1.6.0" resolved "https://registry.yarnpkg.com/thenify-all/-/thenify-all-1.6.0.tgz#1a1918d402d8fc3f98fbf234db0bcc8cc10e9726" + integrity sha1-GhkY1ALY/D+Y+/I02wvMjMEOlyY= dependencies: thenify ">= 3.1.0 < 4" "thenify@>= 3.1.0 < 4": version "3.3.0" resolved "https://registry.yarnpkg.com/thenify/-/thenify-3.3.0.tgz#e69e38a1babe969b0108207978b9f62b88604839" + integrity sha1-5p44obq+lpsBCCB5eLn2K4hgSDk= dependencies: any-promise "^1.0.0" through@^2.3.6, through@~2.3.4, through@~2.3.8: version "2.3.8" resolved "https://registry.yarnpkg.com/through/-/through-2.3.8.tgz#0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5" + integrity sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU= timed-out@^4.0.0, timed-out@^4.0.1: version "4.0.1" resolved "https://registry.yarnpkg.com/timed-out/-/timed-out-4.0.1.tgz#f32eacac5a175bea25d7fab565ab3ed8741ef56f" + integrity sha1-8y6srFoXW+ol1/q1Zas+2HQe9W8= timers-browserify@^2.0.4: version "2.0.10" resolved "https://registry.yarnpkg.com/timers-browserify/-/timers-browserify-2.0.10.tgz#1d28e3d2aadf1d5a5996c4e9f95601cd053480ae" + integrity sha512-YvC1SV1XdOUaL6gx5CoGroT3Gu49pK9+TZ38ErPldOWW4j49GI1HKs9DV+KGq/w6y+LZ72W1c8cKz2vzY+qpzg== dependencies: setimmediate "^1.0.4" timers-ext@^0.1.5: version "0.1.7" resolved "https://registry.yarnpkg.com/timers-ext/-/timers-ext-0.1.7.tgz#6f57ad8578e07a3fb9f91d9387d65647555e25c6" + integrity sha512-b85NUNzTSdodShTIbky6ZF02e8STtVVfD+fu4aXXShEELpozH+bCpJLYMPZbsABN2wDH7fJpqIoXxJpzbf0NqQ== dependencies: es5-ext "~0.10.46" next-tick "1" @@ -6257,6 +7262,7 @@ timers-ext@^0.1.5: tingodb@^0.6.1: version "0.6.1" resolved "https://registry.yarnpkg.com/tingodb/-/tingodb-0.6.1.tgz#f63336259af7dfa6c90dfe2556a0dfb0d4eede59" + integrity sha1-9jM2JZr336bJDf4lVqDfsNTu3lk= dependencies: lodash "^4.17.5" safe "^0.4.5" @@ -6267,30 +7273,36 @@ tingodb@^0.6.1: tmp@^0.0.33: version "0.0.33" resolved "https://registry.yarnpkg.com/tmp/-/tmp-0.0.33.tgz#6d34335889768d21b2bcda0aa277ced3b1bfadf9" + integrity sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw== dependencies: os-tmpdir "~1.0.2" to-arraybuffer@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/to-arraybuffer/-/to-arraybuffer-1.0.1.tgz#7d229b1fcc637e466ca081180836a7aabff83f43" + integrity sha1-fSKbH8xjfkZsoIEYCDanqr/4P0M= to-buffer@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/to-buffer/-/to-buffer-1.1.1.tgz#493bd48f62d7c43fcded313a03dcadb2e1213a80" + integrity sha512-lx9B5iv7msuFYE3dytT+KE5tap+rNYw+K4jVkb9R/asAb+pbBSM17jtunHplhBe6RRJdZx3Pn2Jph24O32mOVg== to-fast-properties@^1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/to-fast-properties/-/to-fast-properties-1.0.3.tgz#b83571fa4d8c25b82e231b06e3a3055de4ca1a47" + integrity sha1-uDVx+k2MJbguIxsG46MFXeTKGkc= to-object-path@^0.3.0: version "0.3.0" resolved "https://registry.yarnpkg.com/to-object-path/-/to-object-path-0.3.0.tgz#297588b7b0e7e0ac08e04e672f85c1f4999e17af" + integrity sha1-KXWIt7Dn4KwI4E5nL4XB9JmeF68= dependencies: kind-of "^3.0.2" to-regex-range@^2.1.0: version "2.1.1" resolved "https://registry.yarnpkg.com/to-regex-range/-/to-regex-range-2.1.1.tgz#7c80c17b9dfebe599e27367e0d4dd5590141db38" + integrity sha1-fIDBe53+vlmeJzZ+DU3VWQFB2zg= dependencies: is-number "^3.0.0" repeat-string "^1.6.1" @@ -6298,38 +7310,53 @@ to-regex-range@^2.1.0: to-regex@^3.0.1, to-regex@^3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/to-regex/-/to-regex-3.0.2.tgz#13cfdd9b336552f30b51f33a8ae1b42a7a7599ce" + integrity sha512-FWtleNAtZ/Ki2qtqej2CXTOayOH9bHDQF+Q48VpWyDXjbYxA4Yz8iDB31zXOBUlOHHKidDbqGVrTUvQMPmBGBw== dependencies: define-property "^2.0.2" extend-shallow "^3.0.2" regex-not "^1.0.2" safe-regex "^1.1.0" -tough-cookie@>=2.3.3, tough-cookie@~2.4.3: +tough-cookie@>=2.3.3: + version "2.5.0" + resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-2.5.0.tgz#cd9fb2a0aa1d5a12b473bd9fb96fa3dcff65ade2" + integrity sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g== + dependencies: + psl "^1.1.28" + punycode "^2.1.1" + +tough-cookie@~2.4.3: version "2.4.3" resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-2.4.3.tgz#53f36da3f47783b0925afa06ff9f3b165280f781" + integrity sha512-Q5srk/4vDM54WJsJio3XNn6K2sCG+CQ8G5Wz6bZhRZoAe/+TxjWB/GlFAnYEbkYVlON9FMk/fE3h2RLpPXo4lQ== dependencies: psl "^1.1.24" punycode "^1.4.1" tree-kill@^1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/tree-kill/-/tree-kill-1.2.0.tgz#5846786237b4239014f05db156b643212d4c6f36" + version "1.2.1" + resolved "https://registry.yarnpkg.com/tree-kill/-/tree-kill-1.2.1.tgz#5398f374e2f292b9dcc7b2e71e30a5c3bb6c743a" + integrity sha512-4hjqbObwlh2dLyW4tcz0Ymw0ggoaVDMveUB9w8kFSQScdRLo0gxO9J7WFcUBo+W3C1TLdFIEwNOWebgZZ0RH9Q== trim-right@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/trim-right/-/trim-right-1.0.1.tgz#cb2e1203067e0c8de1f614094b9fe45704ea6003" + integrity sha1-yy4SAwZ+DI3h9hQJS5/kVwTqYAM= trim@0.0.1: version "0.0.1" resolved "https://registry.yarnpkg.com/trim/-/trim-0.0.1.tgz#5858547f6b290757ee95cccc666fb50084c460dd" + integrity sha1-WFhUf2spB1fulczMZm+1AITEYN0= truffle-blockchain-utils@^0.0.5: version "0.0.5" resolved "https://registry.yarnpkg.com/truffle-blockchain-utils/-/truffle-blockchain-utils-0.0.5.tgz#a4e5c064dadd69f782a137f3d276d21095da7a47" + integrity sha1-pOXAZNrdafeCoTfz0nbSEJXaekc= truffle-contract-schema@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/truffle-contract-schema/-/truffle-contract-schema-2.0.1.tgz#9bf821d32e26e674ba15eb5d40f96b10b1c9d568" + integrity sha1-m/gh0y4m5nS6FetdQPlrELHJ1Wg= dependencies: ajv "^5.1.1" crypto-js "^3.1.9-1" @@ -6338,6 +7365,7 @@ truffle-contract-schema@^2.0.1: truffle-contract@^3.0.4: version "3.0.6" resolved "https://registry.yarnpkg.com/truffle-contract/-/truffle-contract-3.0.6.tgz#2ef6fc32d7faafa9f4aed8e50001a9fdea342192" + integrity sha1-Lvb8Mtf6r6n0rtjlAAGp/eo0IZI= dependencies: ethjs-abi "0.1.8" truffle-blockchain-utils "^0.0.5" @@ -6348,6 +7376,7 @@ truffle-contract@^3.0.4: truffle-error@^0.0.3: version "0.0.3" resolved "https://registry.yarnpkg.com/truffle-error/-/truffle-error-0.0.3.tgz#4bf55242e14deee1c7194932709182deff2c97ca" + integrity sha1-S/VSQuFN7uHHGUkycJGC3v8sl8o= truffle-hdwallet-provider-privkey@0.2.0: version "0.2.0" @@ -6361,18 +7390,21 @@ truffle-hdwallet-provider-privkey@0.2.0: truffle-wallet-provider@0.0.5: version "0.0.5" resolved "https://registry.yarnpkg.com/truffle-wallet-provider/-/truffle-wallet-provider-0.0.5.tgz#db59ce6fa1c558766011137509a94dfca8d1408e" + integrity sha1-21nOb6HFWHZgERN1CalN/KjRQI4= dependencies: ethereumjs-wallet "^0.6.0" web3 "^0.18.2" web3-provider-engine "^8.4.0" -truffle@4.1.14: - version "4.1.14" - resolved "https://registry.yarnpkg.com/truffle/-/truffle-4.1.14.tgz#8d2c298e29abf9b1e486e44ff9faca6d34bb9030" +truffle@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/truffle/-/truffle-5.0.0.tgz#2e4e2eedc5583ae38c7227585e5177d6360fbc6d" + integrity sha512-la0TJu+E59Ut62i6cGY0sugeubglDqH5w49a7IrpxZ1nnsDqv6qWB3ibiyYiCp/jr+iI0bLtcr3DKkfQjVDd+g== dependencies: + app-module-path "^2.2.0" mocha "^4.1.0" original-require "1.0.1" - solc "0.4.24" + solc "0.5.0" tslib@^1.9.0: version "1.9.3" @@ -6381,30 +7413,36 @@ tslib@^1.9.0: tty-browserify@0.0.0: version "0.0.0" resolved "https://registry.yarnpkg.com/tty-browserify/-/tty-browserify-0.0.0.tgz#a157ba402da24e9bf957f9aa69d524eed42901a6" + integrity sha1-oVe6QC2iTpv5V/mqadUk7tQpAaY= tunnel-agent@^0.6.0: version "0.6.0" resolved "https://registry.yarnpkg.com/tunnel-agent/-/tunnel-agent-0.6.0.tgz#27a5dea06b36b04a0a9966774b290868f0fc40fd" + integrity sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0= dependencies: safe-buffer "^5.0.1" tweetnacl@0.13.2: version "0.13.2" resolved "https://registry.yarnpkg.com/tweetnacl/-/tweetnacl-0.13.2.tgz#453161770469d45cd266c36404e2bc99a8fa9944" + integrity sha1-RTFhdwRp1FzSZsNkBOK8maj6mUQ= tweetnacl@^0.14.3, tweetnacl@~0.14.0: version "0.14.5" resolved "https://registry.yarnpkg.com/tweetnacl/-/tweetnacl-0.14.5.tgz#5ae68177f192d4456269d108afa93ff8743f4f64" + integrity sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q= type-check@~0.3.2: version "0.3.2" resolved "https://registry.yarnpkg.com/type-check/-/type-check-0.3.2.tgz#5884cab512cf1d355e3fb784f30804b2b520db72" + integrity sha1-WITKtRLPHTVeP7eE8wgEsrUg23I= dependencies: prelude-ls "~1.1.2" type-is@~1.6.16: version "1.6.16" resolved "https://registry.yarnpkg.com/type-is/-/type-is-1.6.16.tgz#f89ce341541c672b25ee7ae3c73dee3b2be50194" + integrity sha512-HRkVv/5qY2G6I8iab9cI7v1bOIdhm94dVjQCPFElW9W+3GeDOSHmy2EBYe4VTApuzolPcmgFTN3ftVJRKR2J9Q== dependencies: media-typer "0.3.0" mime-types "~2.1.18" @@ -6412,26 +7450,31 @@ type-is@~1.6.16: typechecker@^2.0.8: version "2.1.0" resolved "https://registry.yarnpkg.com/typechecker/-/typechecker-2.1.0.tgz#d1c2093a54ff8a19f58cff877eeaa54f2242d383" + integrity sha1-0cIJOlT/ihn1jP+HfuqlTyJC04M= typechecker@^4.3.0: - version "4.6.0" - resolved "https://registry.yarnpkg.com/typechecker/-/typechecker-4.6.0.tgz#d245d9c2df21147d5e2a942fff170b68ece73c87" + version "4.7.0" + resolved "https://registry.yarnpkg.com/typechecker/-/typechecker-4.7.0.tgz#5249f427358f45b7250c4924fd4d01ed9ba435e9" + integrity sha512-4LHc1KMNJ6NDGO+dSM/yNfZQRtp8NN7psYrPHUblD62Dvkwsp3VShsbM78kOgpcmMkRTgvwdKOTjctS+uMllgQ== dependencies: - editions "^2.0.2" + editions "^2.1.0" typechecker@~2.0.1: version "2.0.8" resolved "https://registry.yarnpkg.com/typechecker/-/typechecker-2.0.8.tgz#e83da84bb64c584ccb345838576c40b0337db82e" + integrity sha1-6D2oS7ZMWEzLNFg4V2xAsDN9uC4= typedarray-to-buffer@^3.1.2: version "3.1.5" resolved "https://registry.yarnpkg.com/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz#a97ee7a9ff42691b9f783ff1bc5112fe3fca9080" + integrity sha512-zdu8XMNEDepKKR+XYOXAVPtWui0ly0NtohUscw+UmaHiAWT8hrV1rr//H6V+0DvJ3OQ19S979M0laLfX8rm82Q== dependencies: is-typedarray "^1.0.0" uglify-js@^2.8.29: version "2.8.29" resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-2.8.29.tgz#29c5733148057bb4e1f75df35b7a9cb72e6a59dd" + integrity sha1-KcVzMUgFe7Th913zW3qcty5qWd0= dependencies: source-map "~0.5.1" yargs "~3.10.0" @@ -6441,6 +7484,7 @@ uglify-js@^2.8.29: uglify-js@^3.1.4: version "3.4.9" resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.4.9.tgz#af02f180c1207d76432e473ed24a28f4a782bae3" + integrity sha512-8CJsbKOtEbnJsTyv6LE6m6ZKniqMiFWmm9sRbopbkGs3gMPPfd3Fh8iIA4Ykv5MgaTbqHr4BaoGLJLZNhsrW1Q== dependencies: commander "~2.17.1" source-map "~0.6.1" @@ -6448,10 +7492,12 @@ uglify-js@^3.1.4: uglify-to-browserify@~1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/uglify-to-browserify/-/uglify-to-browserify-1.0.2.tgz#6e0924d6bda6b5afe349e39a6d632850a0f882b7" + integrity sha1-bgkk1r2mta/jSeOabWMoUKD4grc= uglifyjs-webpack-plugin@^0.4.6: version "0.4.6" resolved "https://registry.yarnpkg.com/uglifyjs-webpack-plugin/-/uglifyjs-webpack-plugin-0.4.6.tgz#b951f4abb6bd617e66f63eb891498e391763e309" + integrity sha1-uVH0q7a9YX5m9j64kUmOORdj4wk= dependencies: source-map "^0.5.6" uglify-js "^2.8.29" @@ -6460,10 +7506,12 @@ uglifyjs-webpack-plugin@^0.4.6: ultron@~1.1.0: version "1.1.1" resolved "https://registry.yarnpkg.com/ultron/-/ultron-1.1.1.tgz#9fe1536a10a664a65266a1e3ccf85fd36302bc9c" + integrity sha512-UIEXBNeYmKptWH6z8ZnqTeS8fV74zG0/eRU9VGkpzz+LIJNs8W/zM/L+7ctCkRrgbNnnR0xxw4bKOr0cW0N0Og== unbzip2-stream@^1.0.9: version "1.3.1" resolved "https://registry.yarnpkg.com/unbzip2-stream/-/unbzip2-stream-1.3.1.tgz#7854da51622a7e63624221196357803b552966a1" + integrity sha512-fIZnvdjblYs7Cru/xC6tCPVhz7JkYcVQQkePwMLyQELzYTds2Xn8QefPVnvdVhhZqubxNA1cASXEH5wcK0Bucw== dependencies: buffer "^3.0.1" through "^2.3.6" @@ -6471,14 +7519,17 @@ unbzip2-stream@^1.0.9: underscore@1.8.3: version "1.8.3" resolved "https://registry.yarnpkg.com/underscore/-/underscore-1.8.3.tgz#4f3fb53b106e6097fcf9cb4109f2a5e9bdfa5022" + integrity sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI= underscore@^1.8.3: version "1.9.1" resolved "https://registry.yarnpkg.com/underscore/-/underscore-1.9.1.tgz#06dce34a0e68a7babc29b365b8e74b8925203961" + integrity sha512-5/4etnCkd9c8gwgowi5/om/mYO5ajCaOgdzj/oW+0eQV9WxKBDZw5+ycmKmeaTXjInS/W0BzpGLo2xR2aBwZdg== union-value@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/union-value/-/union-value-1.0.0.tgz#5c71c34cb5bad5dcebe3ea0cd08207ba5aa1aea4" + integrity sha1-XHHDTLW61dzr4+oM0IIHulqhrqQ= dependencies: arr-union "^3.1.0" get-value "^2.0.6" @@ -6488,18 +7539,22 @@ union-value@^1.0.0: universalify@^0.1.0: version "0.1.2" resolved "https://registry.yarnpkg.com/universalify/-/universalify-0.1.2.tgz#b646f69be3942dabcecc9d6639c80dc105efaa66" + integrity sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg== -unorm@^1.3.3: +unorm@^1.4.1: version "1.4.1" resolved "https://registry.yarnpkg.com/unorm/-/unorm-1.4.1.tgz#364200d5f13646ca8bcd44490271335614792300" + integrity sha1-NkIA1fE2RsqLzURJAnEzVhR5IwA= unpipe@1.0.0, unpipe@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/unpipe/-/unpipe-1.0.0.tgz#b2bf4ee8514aae6165b4817829d21b2ef49904ec" + integrity sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw= unset-value@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/unset-value/-/unset-value-1.0.0.tgz#8376873f7d2335179ffb1e6fc3a8ed0dfc8ab559" + integrity sha1-g3aHP30jNRef+x5vw6jtDfyKtVk= dependencies: has-value "^0.3.1" isobject "^3.0.0" @@ -6507,34 +7562,41 @@ unset-value@^1.0.0: upath@^1.0.5: version "1.1.0" resolved "https://registry.yarnpkg.com/upath/-/upath-1.1.0.tgz#35256597e46a581db4793d0ce47fa9aebfc9fabd" + integrity sha512-bzpH/oBhoS/QI/YtbkqCg6VEiPYjSZtrHQM6/QnJS6OL9pKUFLqb3aFh4Scvwm45+7iAgiMkLhSbaZxUqmrprw== uri-js@^4.2.2: version "4.2.2" resolved "https://registry.yarnpkg.com/uri-js/-/uri-js-4.2.2.tgz#94c540e1ff772956e2299507c010aea6c8838eb0" + integrity sha512-KY9Frmirql91X2Qgjry0Wd4Y+YTdrdZheS8TFwvkbLWf/G5KNJDCh6pKL5OZctEW4+0Baa5idK2ZQuELRwPznQ== dependencies: punycode "^2.1.0" urix@^0.1.0: version "0.1.0" resolved "https://registry.yarnpkg.com/urix/-/urix-0.1.0.tgz#da937f7a62e21fec1fd18d49b35c2935067a6c72" + integrity sha1-2pN/emLiH+wf0Y1Js1wpNQZ6bHI= url-parse-lax@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/url-parse-lax/-/url-parse-lax-1.0.0.tgz#7af8f303645e9bd79a272e7a14ac68bc0609da73" + integrity sha1-evjzA2Rem9eaJy56FKxovAYJ2nM= dependencies: prepend-http "^1.0.1" url-set-query@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/url-set-query/-/url-set-query-1.0.0.tgz#016e8cfd7c20ee05cafe7795e892bd0702faa339" + integrity sha1-AW6M/Xwg7gXK/neV6JK9BwL6ozk= url-to-options@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/url-to-options/-/url-to-options-1.0.1.tgz#1505a03a289a48cbd7a434efbaeec5055f5633a9" + integrity sha1-FQWgOiiaSMvXpDTvuu7FBV9WM6k= url@^0.11.0: version "0.11.0" resolved "https://registry.yarnpkg.com/url/-/url-0.11.0.tgz#3838e97cfc60521eb73c525a8e55bfdd9e2e28f1" + integrity sha1-ODjpfPxgUh63PFJajlW/3Z4uKPE= dependencies: punycode "1.3.2" querystring "0.2.0" @@ -6542,38 +7604,46 @@ url@^0.11.0: use@^3.1.0: version "3.1.1" resolved "https://registry.yarnpkg.com/use/-/use-3.1.1.tgz#d50c8cac79a19fbc20f2911f56eb973f4e10070f" + integrity sha512-cwESVXlO3url9YWlFW/TA9cshCEhtu7IKJ/p5soJ/gGpj7vbvFrAY/eIioQ6Dw23KjZhYgiIo8HOs1nQ2vr/oQ== utf8@2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/utf8/-/utf8-2.1.1.tgz#2e01db02f7d8d0944f77104f1609eb0c304cf768" + integrity sha1-LgHbAvfY0JRPdxBPFgnrDDBM92g= utf8@^2.1.1, utf8@^2.1.2: version "2.1.2" resolved "https://registry.yarnpkg.com/utf8/-/utf8-2.1.2.tgz#1fa0d9270e9be850d9b05027f63519bf46457d96" + integrity sha1-H6DZJw6b6FDZsFAn9jUZv0ZFfZY= utf8@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/utf8/-/utf8-3.0.0.tgz#f052eed1364d696e769ef058b183df88c87f69d1" + integrity sha512-E8VjFIQ/TyQgp+TZfS6l8yp/xWppSAHzidGiRrqe4bK4XP9pTRyKFgGJpO3SN7zdX4DeomTrwaseCHovfpFcqQ== util-deprecate@~1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" + integrity sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8= util@0.10.3: version "0.10.3" resolved "https://registry.yarnpkg.com/util/-/util-0.10.3.tgz#7afb1afe50805246489e3db7fe0ed379336ac0f9" + integrity sha1-evsa/lCAUkZInj23/g7TeTNqwPk= dependencies: inherits "2.0.1" util@^0.10.3: version "0.10.4" resolved "https://registry.yarnpkg.com/util/-/util-0.10.4.tgz#3aa0125bfe668a4672de58857d3ace27ecb76901" + integrity sha512-0Pm9hTQ3se5ll1XihRic3FDIku70C+iHUdT/W926rSgHV5QgXsYbKZN8MSC3tJtSkhuROzvsQjAaFENRXr+19A== dependencies: inherits "2.0.3" utile@0.3.x: version "0.3.0" resolved "https://registry.yarnpkg.com/utile/-/utile-0.3.0.tgz#1352c340eb820e4d8ddba039a4fbfaa32ed4ef3a" + integrity sha1-E1LDQOuCDk2N26A5pPv6oy7U7zo= dependencies: async "~0.9.0" deep-equal "~0.2.1" @@ -6585,22 +7655,27 @@ utile@0.3.x: utils-merge@1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/utils-merge/-/utils-merge-1.0.1.tgz#9f95710f50a267947b2ccc124741c1028427e713" + integrity sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM= uuid@2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/uuid/-/uuid-2.0.1.tgz#c2a30dedb3e535d72ccf82e343941a50ba8533ac" + integrity sha1-wqMN7bPlNdcsz4LjQ5QaULqFM6w= uuid@^3.0.1, uuid@^3.3.2: version "3.3.2" resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.3.2.tgz#1b4af4955eb3077c501c23872fc6513811587131" + integrity sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA== valid-url@^1.0.9: version "1.0.9" resolved "https://registry.yarnpkg.com/valid-url/-/valid-url-1.0.9.tgz#1c14479b40f1397a75782f115e4086447433a200" + integrity sha1-HBRHm0DxOXp1eC8RXkCGRHQzogA= validate-npm-package-license@^3.0.1: version "3.0.4" resolved "https://registry.yarnpkg.com/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz#fc91f6b9c7ba15c857f4cb2c5defeec39d4f410a" + integrity sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew== dependencies: spdx-correct "^3.0.0" spdx-expression-parse "^3.0.0" @@ -6608,14 +7683,17 @@ validate-npm-package-license@^3.0.1: varint@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/varint/-/varint-5.0.0.tgz#d826b89f7490732fabc0c0ed693ed475dcb29ebf" + integrity sha1-2Ca4n3SQcy+rwMDtaT7Uddyynr8= vary@^1, vary@~1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/vary/-/vary-1.1.2.tgz#2299f02c6ded30d4a5961b0b9f74524a18f634fc" + integrity sha1-IpnwLG3tMNSllhsLn3RSShj2NPw= verror@1.10.0: version "1.10.0" resolved "https://registry.yarnpkg.com/verror/-/verror-1.10.0.tgz#3a105ca17053af55d6e270c1f8288682e18da400" + integrity sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA= dependencies: assert-plus "^1.0.0" core-util-is "1.0.2" @@ -6624,12 +7702,14 @@ verror@1.10.0: vm-browserify@0.0.4: version "0.0.4" resolved "https://registry.yarnpkg.com/vm-browserify/-/vm-browserify-0.0.4.tgz#5d7ea45bbef9e4a6ff65f95438e0a87c357d5a73" + integrity sha1-XX6kW7755Kb/ZflUOOCofDV9WnM= dependencies: indexof "0.0.1" watchpack@^1.4.0: version "1.6.0" resolved "https://registry.yarnpkg.com/watchpack/-/watchpack-1.6.0.tgz#4bc12c2ebe8aa277a71f1d3f14d685c7b446cd00" + integrity sha512-i6dHe3EyLjMmDlU1/bGQpEw25XSjkJULPuAVKCbNRefQVq48yXKUpwg538F7AZTf9kyr57zj++pQFltUa5H7yA== dependencies: chokidar "^2.0.2" graceful-fs "^4.1.2" @@ -6638,6 +7718,7 @@ watchpack@^1.4.0: watchr@~2.4.13: version "2.4.13" resolved "https://registry.yarnpkg.com/watchr/-/watchr-2.4.13.tgz#d74847bb4d6f90f61fe2c74f9f68662aa0e07601" + integrity sha1-10hHu01vkPYf4sdPn2hmKqDgdgE= dependencies: eachr "^2.0.2" extendr "^2.1.0" @@ -6651,6 +7732,7 @@ watchr@~2.4.13: web3-bzz@1.0.0-beta.34: version "1.0.0-beta.34" resolved "https://registry.yarnpkg.com/web3-bzz/-/web3-bzz-1.0.0-beta.34.tgz#068d37777ab65e5c60f8ec8b9a50cfe45277929c" + integrity sha1-Bo03d3q2Xlxg+OyLmlDP5FJ3kpw= dependencies: got "7.1.0" swarm-js "0.1.37" @@ -6659,6 +7741,7 @@ web3-bzz@1.0.0-beta.34: web3-core-helpers@1.0.0-beta.34: version "1.0.0-beta.34" resolved "https://registry.yarnpkg.com/web3-core-helpers/-/web3-core-helpers-1.0.0-beta.34.tgz#b168da00d3e19e156bc15ae203203dd4dfee2d03" + integrity sha1-sWjaANPhnhVrwVriAyA91N/uLQM= dependencies: underscore "1.8.3" web3-eth-iban "1.0.0-beta.34" @@ -6667,6 +7750,7 @@ web3-core-helpers@1.0.0-beta.34: web3-core-method@1.0.0-beta.34: version "1.0.0-beta.34" resolved "https://registry.yarnpkg.com/web3-core-method/-/web3-core-method-1.0.0-beta.34.tgz#ec163c8a2c490fa02a7ec15559fa7307fc7cc6dd" + integrity sha1-7BY8iixJD6AqfsFVWfpzB/x8xt0= dependencies: underscore "1.8.3" web3-core-helpers "1.0.0-beta.34" @@ -6677,6 +7761,7 @@ web3-core-method@1.0.0-beta.34: web3-core-promievent@1.0.0-beta.34: version "1.0.0-beta.34" resolved "https://registry.yarnpkg.com/web3-core-promievent/-/web3-core-promievent-1.0.0-beta.34.tgz#a4f4fa6784bb293e82c60960ae5b56a94cd03edc" + integrity sha1-pPT6Z4S7KT6CxglgrltWqUzQPtw= dependencies: any-promise "1.3.0" eventemitter3 "1.1.1" @@ -6684,6 +7769,7 @@ web3-core-promievent@1.0.0-beta.34: web3-core-requestmanager@1.0.0-beta.34: version "1.0.0-beta.34" resolved "https://registry.yarnpkg.com/web3-core-requestmanager/-/web3-core-requestmanager-1.0.0-beta.34.tgz#01f8f6cf2ae6b6f0b70c38bae1ef741b5bab215c" + integrity sha1-Afj2zyrmtvC3DDi64e90G1urIVw= dependencies: underscore "1.8.3" web3-core-helpers "1.0.0-beta.34" @@ -6694,6 +7780,7 @@ web3-core-requestmanager@1.0.0-beta.34: web3-core-subscriptions@1.0.0-beta.34: version "1.0.0-beta.34" resolved "https://registry.yarnpkg.com/web3-core-subscriptions/-/web3-core-subscriptions-1.0.0-beta.34.tgz#9fed144033f221c3cf21060302ffdaf5ef2de2de" + integrity sha1-n+0UQDPyIcPPIQYDAv/a9e8t4t4= dependencies: eventemitter3 "1.1.1" underscore "1.8.3" @@ -6702,6 +7789,7 @@ web3-core-subscriptions@1.0.0-beta.34: web3-core@1.0.0-beta.34: version "1.0.0-beta.34" resolved "https://registry.yarnpkg.com/web3-core/-/web3-core-1.0.0-beta.34.tgz#121be8555e9fb00d2c5d05ddd3381d0c9e46987e" + integrity sha1-EhvoVV6fsA0sXQXd0zgdDJ5GmH4= dependencies: web3-core-helpers "1.0.0-beta.34" web3-core-method "1.0.0-beta.34" @@ -6711,6 +7799,7 @@ web3-core@1.0.0-beta.34: web3-eth-abi@1.0.0-beta.34: version "1.0.0-beta.34" resolved "https://registry.yarnpkg.com/web3-eth-abi/-/web3-eth-abi-1.0.0-beta.34.tgz#034533e3aa2f7e59ff31793eaea685c0ed5af67a" + integrity sha1-A0Uz46ovfln/MXk+rqaFwO1a9no= dependencies: bn.js "4.11.6" underscore "1.8.3" @@ -6720,6 +7809,7 @@ web3-eth-abi@1.0.0-beta.34: web3-eth-accounts@1.0.0-beta.34: version "1.0.0-beta.34" resolved "https://registry.yarnpkg.com/web3-eth-accounts/-/web3-eth-accounts-1.0.0-beta.34.tgz#e09142eeecc797ac3459b75e9b23946d3695f333" + integrity sha1-4JFC7uzHl6w0WbdemyOUbTaV8zM= dependencies: any-promise "1.3.0" crypto-browserify "3.12.0" @@ -6735,6 +7825,7 @@ web3-eth-accounts@1.0.0-beta.34: web3-eth-contract@1.0.0-beta.34: version "1.0.0-beta.34" resolved "https://registry.yarnpkg.com/web3-eth-contract/-/web3-eth-contract-1.0.0-beta.34.tgz#9dbb38fae7643a808427a20180470ec7415c91e6" + integrity sha1-nbs4+udkOoCEJ6IBgEcOx0FckeY= dependencies: underscore "1.8.3" web3-core "1.0.0-beta.34" @@ -6748,6 +7839,7 @@ web3-eth-contract@1.0.0-beta.34: web3-eth-iban@1.0.0-beta.34: version "1.0.0-beta.34" resolved "https://registry.yarnpkg.com/web3-eth-iban/-/web3-eth-iban-1.0.0-beta.34.tgz#9af458605867ccf74ea979aaf326b38ba6a5ba0c" + integrity sha1-mvRYYFhnzPdOqXmq8yazi6alugw= dependencies: bn.js "4.11.6" web3-utils "1.0.0-beta.34" @@ -6755,6 +7847,7 @@ web3-eth-iban@1.0.0-beta.34: web3-eth-personal@1.0.0-beta.34: version "1.0.0-beta.34" resolved "https://registry.yarnpkg.com/web3-eth-personal/-/web3-eth-personal-1.0.0-beta.34.tgz#9afba167342ebde5420bcd5895c3f6c34388f205" + integrity sha1-mvuhZzQuveVCC81YlcP2w0OI8gU= dependencies: web3-core "1.0.0-beta.34" web3-core-helpers "1.0.0-beta.34" @@ -6765,6 +7858,7 @@ web3-eth-personal@1.0.0-beta.34: web3-eth@1.0.0-beta.34: version "1.0.0-beta.34" resolved "https://registry.yarnpkg.com/web3-eth/-/web3-eth-1.0.0-beta.34.tgz#74086000850c6fe6f535ef49837d6d4bb6113268" + integrity sha1-dAhgAIUMb+b1Ne9Jg31tS7YRMmg= dependencies: underscore "1.8.3" web3-core "1.0.0-beta.34" @@ -6782,6 +7876,7 @@ web3-eth@1.0.0-beta.34: web3-net@1.0.0-beta.34: version "1.0.0-beta.34" resolved "https://registry.yarnpkg.com/web3-net/-/web3-net-1.0.0-beta.34.tgz#427cea2f431881449c8e38d523290f173f9ff63d" + integrity sha1-QnzqL0MYgUScjjjVIykPFz+f9j0= dependencies: web3-core "1.0.0-beta.34" web3-core-method "1.0.0-beta.34" @@ -6790,6 +7885,7 @@ web3-net@1.0.0-beta.34: web3-provider-engine@^13.8.0: version "13.8.0" resolved "https://registry.yarnpkg.com/web3-provider-engine/-/web3-provider-engine-13.8.0.tgz#4c7c1ad2af5f1fe10343b8a65495879a2f9c00df" + integrity sha512-fZXhX5VWwWpoFfrfocslyg6P7cN3YWPG/ASaevNfeO80R+nzgoPUBXcWQekSGSsNDkeRTis4aMmpmofYf1TNtQ== dependencies: async "^2.5.0" clone "^2.0.0" @@ -6814,6 +7910,7 @@ web3-provider-engine@^13.8.0: web3-provider-engine@^8.4.0: version "8.6.1" resolved "https://registry.yarnpkg.com/web3-provider-engine/-/web3-provider-engine-8.6.1.tgz#4d86e19e30caaf97df351511ec0f60136e5b30eb" + integrity sha1-TYbhnjDKr5ffNRUR7A9gE25bMOs= dependencies: async "^2.1.2" clone "^2.0.0" @@ -6833,6 +7930,7 @@ web3-provider-engine@^8.4.0: web3-providers-http@1.0.0-beta.34: version "1.0.0-beta.34" resolved "https://registry.yarnpkg.com/web3-providers-http/-/web3-providers-http-1.0.0-beta.34.tgz#e561b52bbb43766282007d40285bfe3550c27e7a" + integrity sha1-5WG1K7tDdmKCAH1AKFv+NVDCfno= dependencies: web3-core-helpers "1.0.0-beta.34" xhr2 "0.1.4" @@ -6840,6 +7938,7 @@ web3-providers-http@1.0.0-beta.34: web3-providers-ipc@1.0.0-beta.34: version "1.0.0-beta.34" resolved "https://registry.yarnpkg.com/web3-providers-ipc/-/web3-providers-ipc-1.0.0-beta.34.tgz#a1b77f1a306d73649a9c039052e40cb71328d00a" + integrity sha1-obd/GjBtc2SanAOQUuQMtxMo0Ao= dependencies: oboe "2.1.3" underscore "1.8.3" @@ -6848,6 +7947,7 @@ web3-providers-ipc@1.0.0-beta.34: web3-providers-ws@1.0.0-beta.34: version "1.0.0-beta.34" resolved "https://registry.yarnpkg.com/web3-providers-ws/-/web3-providers-ws-1.0.0-beta.34.tgz#7de70f1b83f2de36476772156becfef6e3516eb3" + integrity sha1-fecPG4Py3jZHZ3IVa+z+9uNRbrM= dependencies: underscore "1.8.3" web3-core-helpers "1.0.0-beta.34" @@ -6856,6 +7956,7 @@ web3-providers-ws@1.0.0-beta.34: web3-shh@1.0.0-beta.34: version "1.0.0-beta.34" resolved "https://registry.yarnpkg.com/web3-shh/-/web3-shh-1.0.0-beta.34.tgz#975061d71eaec42ccee576f7bd8f70f03844afe0" + integrity sha1-l1Bh1x6uxCzO5Xb3vY9w8DhEr+A= dependencies: web3-core "1.0.0-beta.34" web3-core-method "1.0.0-beta.34" @@ -6865,6 +7966,7 @@ web3-shh@1.0.0-beta.34: web3-utils@1.0.0-beta.34: version "1.0.0-beta.34" resolved "https://registry.yarnpkg.com/web3-utils/-/web3-utils-1.0.0-beta.34.tgz#9411fc39aaef39ca4e06169f762297d9ff020970" + integrity sha1-lBH8OarvOcpOBhafdiKX2f8CCXA= dependencies: bn.js "4.11.6" eth-lib "0.1.27" @@ -6877,6 +7979,7 @@ web3-utils@1.0.0-beta.34: web3@0.19.1: version "0.19.1" resolved "https://registry.yarnpkg.com/web3/-/web3-0.19.1.tgz#e763d5b1107c4bc24abd4f8cbee1ba3659e6eb31" + integrity sha1-52PVsRB8S8JKvU+MvuG6Nlnm6zE= dependencies: bignumber.js "^4.0.2" crypto-js "^3.1.4" @@ -6887,6 +7990,7 @@ web3@0.19.1: web3@0.20.2: version "0.20.2" resolved "https://registry.yarnpkg.com/web3/-/web3-0.20.2.tgz#c54dac5fc0e377399c04c1a6ecbb12e4513278d6" + integrity sha1-xU2sX8DjdzmcBMGm7LsS5FEyeNY= dependencies: bignumber.js "git+https://github.com/frozeman/bignumber.js-nolookahead.git" crypto-js "^3.1.4" @@ -6897,6 +8001,7 @@ web3@0.20.2: web3@0.20.6: version "0.20.6" resolved "https://registry.yarnpkg.com/web3/-/web3-0.20.6.tgz#3e97306ae024fb24e10a3d75c884302562215120" + integrity sha1-PpcwauAk+yThCj11yIQwJWIhUSA= dependencies: bignumber.js "git+https://github.com/frozeman/bignumber.js-nolookahead.git" crypto-js "^3.1.4" @@ -6907,6 +8012,7 @@ web3@0.20.6: web3@1.0.0-beta.34: version "1.0.0-beta.34" resolved "https://registry.yarnpkg.com/web3/-/web3-1.0.0-beta.34.tgz#347e561b784098cb5563315f490479a1d91f2ab1" + integrity sha1-NH5WG3hAmMtVYzFfSQR5odkfKrE= dependencies: web3-bzz "1.0.0-beta.34" web3-core "1.0.0-beta.34" @@ -6919,6 +8025,7 @@ web3@1.0.0-beta.34: web3@^0.16.0: version "0.16.0" resolved "https://registry.yarnpkg.com/web3/-/web3-0.16.0.tgz#a4554175cd462943035b1f1d39432f741c6b6019" + integrity sha1-pFVBdc1GKUMDWx8dOUMvdBxrYBk= dependencies: bignumber.js "git+https://github.com/debris/bignumber.js#master" crypto-js "^3.1.4" @@ -6928,6 +8035,7 @@ web3@^0.16.0: web3@^0.18.2, web3@^0.18.4: version "0.18.4" resolved "https://registry.yarnpkg.com/web3/-/web3-0.18.4.tgz#81ec1784145491f2eaa8955b31c06049e07c5e7d" + integrity sha1-gewXhBRUkfLqqJVbMcBgSeB8Xn0= dependencies: bignumber.js "git+https://github.com/debris/bignumber.js.git#94d7146671b9719e00a09c29b01a691bc85048c2" crypto-js "^3.1.4" @@ -6938,6 +8046,7 @@ web3@^0.18.2, web3@^0.18.4: web3@^0.20.6: version "0.20.7" resolved "https://registry.yarnpkg.com/web3/-/web3-0.20.7.tgz#1605e6d81399ed6f85a471a4f3da0c8be57df2f7" + integrity sha512-VU6/DSUX93d1fCzBz7WP/SGCQizO1rKZi4Px9j/3yRyfssHyFcZamMw2/sj4E8TlfMXONvZLoforR8B4bRoyTQ== dependencies: bignumber.js "git+https://github.com/frozeman/bignumber.js-nolookahead.git" crypto-js "^3.1.4" @@ -6948,6 +8057,7 @@ web3@^0.20.6: webpack-sources@^1.0.1: version "1.3.0" resolved "https://registry.yarnpkg.com/webpack-sources/-/webpack-sources-1.3.0.tgz#2a28dcb9f1f45fe960d8f1493252b5ee6530fa85" + integrity sha512-OiVgSrbGu7NEnEvQJJgdSFPl2qWKkWq5lHMhgiToIiN9w34EBnjYzSYs+VbL5KoYiLNtFFa7BZIKxRED3I32pA== dependencies: source-list-map "^2.0.0" source-map "~0.6.1" @@ -6955,6 +8065,7 @@ webpack-sources@^1.0.1: webpack@^3.0.0: version "3.12.0" resolved "https://registry.yarnpkg.com/webpack/-/webpack-3.12.0.tgz#3f9e34360370602fcf639e97939db486f4ec0d74" + integrity sha512-Sw7MdIIOv/nkzPzee4o0EdvCuPmxT98+vVpIvwtcwcF1Q4SDSNp92vwcKc4REe7NItH9f1S4ra9FuQ7yuYZ8bQ== dependencies: acorn "^5.0.0" acorn-dynamic-import "^2.0.0" @@ -6991,38 +8102,46 @@ webpack@^3.0.0: whatwg-fetch@>=0.10.0: version "3.0.0" resolved "https://registry.yarnpkg.com/whatwg-fetch/-/whatwg-fetch-3.0.0.tgz#fc804e458cc460009b1a2b966bc8817d2578aefb" + integrity sha512-9GSJUgz1D4MfyKU7KRqwOjXCXTqWdFNvEr7eUBYchQiVc744mqK/MzXPNR2WsPkmkOa4ywfg8C2n8h+13Bey1Q== which-module@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/which-module/-/which-module-1.0.0.tgz#bba63ca861948994ff307736089e3b96026c2a4f" + integrity sha1-u6Y8qGGUiZT/MHc2CJ47lgJsKk8= which-module@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/which-module/-/which-module-2.0.0.tgz#d9ef07dce77b9902b8a3a8fa4b31c3e3f7e6e87a" + integrity sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho= which@^1.1.1, which@^1.2.9: version "1.3.1" resolved "https://registry.yarnpkg.com/which/-/which-1.3.1.tgz#a45043d54f5805316da8d62f9f50918d3da70b0a" + integrity sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ== dependencies: isexe "^2.0.0" wide-align@^1.1.0: version "1.1.3" resolved "https://registry.yarnpkg.com/wide-align/-/wide-align-1.1.3.tgz#ae074e6bdc0c14a431e804e624549c633b000457" + integrity sha512-QGkOQc8XL6Bt5PwnsExKBPuMKBxnGxWWW3fU55Xt4feHozMUhdUMaBCk290qpm/wG5u/RSKzwdAC4i51YigihA== dependencies: string-width "^1.0.2 || 2" window-size@0.1.0: version "0.1.0" resolved "https://registry.yarnpkg.com/window-size/-/window-size-0.1.0.tgz#5438cd2ea93b202efa3a19fe8887aee7c94f9c9d" + integrity sha1-VDjNLqk7IC76Ohn+iIeu58lPnJ0= window-size@^0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/window-size/-/window-size-0.2.0.tgz#b4315bb4214a3d7058ebeee892e13fa24d98b075" + integrity sha1-tDFbtCFKPXBY6+7okuE/ok2YsHU= winston@2.1.x: version "2.1.1" - resolved "http://registry.npmjs.org/winston/-/winston-2.1.1.tgz#3c9349d196207fd1bdff9d4bc43ef72510e3a12e" + resolved "https://registry.yarnpkg.com/winston/-/winston-2.1.1.tgz#3c9349d196207fd1bdff9d4bc43ef72510e3a12e" + integrity sha1-PJNJ0ZYgf9G9/51LxD73JRDjoS4= dependencies: async "~1.0.0" colors "1.0.x" @@ -7035,6 +8154,7 @@ winston@2.1.x: winston@^2.3.1: version "2.4.4" resolved "https://registry.yarnpkg.com/winston/-/winston-2.4.4.tgz#a01e4d1d0a103cf4eada6fc1f886b3110d71c34b" + integrity sha512-NBo2Pepn4hK4V01UfcWcDlmiVTs7VTB1h7bgnB0rgP146bYhMxX0ypCz3lBOfNxCO4Zuek7yeT+y/zM1OfMw4Q== dependencies: async "~1.0.0" colors "1.0.x" @@ -7046,18 +8166,22 @@ winston@^2.3.1: wordwrap@0.0.2: version "0.0.2" resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-0.0.2.tgz#b79669bb42ecb409f83d583cad52ca17eaa1643f" + integrity sha1-t5Zpu0LstAn4PVg8rVLKF+qhZD8= wordwrap@^1.0.0, wordwrap@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-1.0.0.tgz#27584810891456a4171c8d0226441ade90cbcaeb" + integrity sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus= wordwrap@~0.0.2: version "0.0.3" resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-0.0.3.tgz#a3d5da6cd5c0bc0008d37234bbaf1bed63059107" + integrity sha1-o9XabNXAvAAI03I0u68b7WMFkQc= wrap-ansi@^2.0.0: version "2.1.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-2.1.0.tgz#d8fc3d284dd05794fe84973caecdd1cf824fdd85" + integrity sha1-2Pw9KE3QV5T+hJc8rs3Rz4JP3YU= dependencies: string-width "^1.0.1" strip-ansi "^3.0.1" @@ -7065,16 +8189,19 @@ wrap-ansi@^2.0.0: wrappy@1: version "1.0.2" resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" + integrity sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8= write@^0.2.1: version "0.2.1" resolved "https://registry.yarnpkg.com/write/-/write-0.2.1.tgz#5fc03828e264cea3fe91455476f7a3c566cb0757" + integrity sha1-X8A4KOJkzqP+kUVUdvejxWbLB1c= dependencies: mkdirp "^0.5.1" ws@^3.0.0: version "3.3.3" resolved "https://registry.yarnpkg.com/ws/-/ws-3.3.3.tgz#f1cf84fe2d5e901ebce94efaece785f187a228f2" + integrity sha512-nnWLa/NwZSt4KQJu51MYlCcSQ5g7INpOrOMt4XV8j4dqTXdmlUmSHQ8/oLC069ckre0fRsgfvsKwbTdtKLCDkA== dependencies: async-limiter "~1.0.0" safe-buffer "~5.1.0" @@ -7083,12 +8210,14 @@ ws@^3.0.0: xhr-request-promise@^0.1.2: version "0.1.2" resolved "https://registry.yarnpkg.com/xhr-request-promise/-/xhr-request-promise-0.1.2.tgz#343c44d1ee7726b8648069682d0f840c83b4261d" + integrity sha1-NDxE0e53JrhkgGloLQ+EDIO0Jh0= dependencies: xhr-request "^1.0.1" xhr-request@^1.0.1: version "1.1.0" resolved "https://registry.yarnpkg.com/xhr-request/-/xhr-request-1.1.0.tgz#f4a7c1868b9f198723444d82dcae317643f2e2ed" + integrity sha512-Y7qzEaR3FDtL3fP30k9wO/e+FBnBByZeybKOhASsGP30NIkRAAkKD/sCnLvgEfAIEC1rcmK7YG8f4oEnIrrWzA== dependencies: buffer-to-arraybuffer "^0.0.5" object-assign "^4.1.1" @@ -7101,16 +8230,19 @@ xhr-request@^1.0.1: xhr2-cookies@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/xhr2-cookies/-/xhr2-cookies-1.1.0.tgz#7d77449d0999197f155cb73b23df72505ed89d48" + integrity sha1-fXdEnQmZGX8VXLc7I99yUF7YnUg= dependencies: cookiejar "^2.1.1" xhr2@*, xhr2@0.1.4: version "0.1.4" resolved "https://registry.yarnpkg.com/xhr2/-/xhr2-0.1.4.tgz#7f87658847716db5026323812f818cadab387a5f" + integrity sha1-f4dliEdxbbUCYyOBL4GMras4el8= xhr@^2.0.4, xhr@^2.2.0, xhr@^2.3.3: version "2.5.0" resolved "https://registry.yarnpkg.com/xhr/-/xhr-2.5.0.tgz#bed8d1676d5ca36108667692b74b316c496e49dd" + integrity sha512-4nlO/14t3BNUZRXIXfXe+3N6w3s1KoxcJUUURctd64BLRe67E4gRwp4PjywtDY72fXpZ1y6Ch0VZQRY/gMPzzQ== dependencies: global "~4.3.0" is-function "^1.0.1" @@ -7124,40 +8256,49 @@ xml@^1.0.0: xmlhttprequest@*, xmlhttprequest@1.8.0: version "1.8.0" resolved "https://registry.yarnpkg.com/xmlhttprequest/-/xmlhttprequest-1.8.0.tgz#67fe075c5c24fef39f9d65f5f7b7fe75171968fc" + integrity sha1-Z/4HXFwk/vOfnWX197f+dRcZaPw= xregexp@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/xregexp/-/xregexp-2.0.0.tgz#52a63e56ca0b84a7f3a5f3d61872f126ad7a5943" + integrity sha1-UqY+VsoLhKfzpfPWGHLxJq16WUM= xtend@^4.0.0, xtend@^4.0.1, xtend@~4.0.0: version "4.0.1" resolved "https://registry.yarnpkg.com/xtend/-/xtend-4.0.1.tgz#a5c6d532be656e23db820efb943a1f04998d63af" + integrity sha1-pcbVMr5lbiPbgg77lDofBJmNY68= xtend@~2.1.1: version "2.1.2" resolved "https://registry.yarnpkg.com/xtend/-/xtend-2.1.2.tgz#6efecc2a4dad8e6962c4901b337ce7ba87b5d28b" + integrity sha1-bv7MKk2tjmlixJAbM3znuoe10os= dependencies: object-keys "~0.4.0" y18n@^3.2.1: version "3.2.1" resolved "https://registry.yarnpkg.com/y18n/-/y18n-3.2.1.tgz#6d15fba884c08679c0d77e88e7759e811e07fa41" + integrity sha1-bRX7qITAhnnA136I53WegR4H+kE= yaeti@^0.0.6: version "0.0.6" resolved "https://registry.yarnpkg.com/yaeti/-/yaeti-0.0.6.tgz#f26f484d72684cf42bedfb76970aa1608fbf9577" + integrity sha1-8m9ITXJoTPQr7ft2lwqhYI+/lXc= yallist@^2.1.2: version "2.1.2" resolved "https://registry.yarnpkg.com/yallist/-/yallist-2.1.2.tgz#1c11f9218f076089a47dd512f93c6699a6a81d52" + integrity sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI= yallist@^3.0.0, yallist@^3.0.2: - version "3.0.2" - resolved "https://registry.yarnpkg.com/yallist/-/yallist-3.0.2.tgz#8452b4bb7e83c7c188d8041c1a837c773d6d8bb9" + version "3.0.3" + resolved "https://registry.yarnpkg.com/yallist/-/yallist-3.0.3.tgz#b4b049e314be545e3ce802236d6cd22cd91c3de9" + integrity sha512-S+Zk8DEWE6oKpV+vI3qWkaK+jSbIK86pCwe2IF/xwIpQ8jEuxpw9NyaGjmp9+BoJv5FV2piqCDcoCtStppiq2A== yargs-parser@^2.4.1: version "2.4.1" resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-2.4.1.tgz#85568de3cf150ff49fa51825f03a8c880ddcc5c4" + integrity sha1-hVaN488VD/SfpRgl8DqMiA3cxcQ= dependencies: camelcase "^3.0.0" lodash.assign "^4.0.6" @@ -7165,24 +8306,28 @@ yargs-parser@^2.4.1: yargs-parser@^7.0.0: version "7.0.0" resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-7.0.0.tgz#8d0ac42f16ea55debd332caf4c4038b3e3f5dfd9" + integrity sha1-jQrELxbqVd69MyyvTEA4s+P139k= dependencies: camelcase "^4.1.0" yargs-parser@^8.1.0: version "8.1.0" resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-8.1.0.tgz#f1376a33b6629a5d063782944da732631e966950" + integrity sha512-yP+6QqN8BmrgW2ggLtTbdrOyBNSI7zBa4IykmiV5R1wl1JWNxQvWhMfMdmzIYtKU7oP3OOInY/tl2ov3BDjnJQ== dependencies: camelcase "^4.1.0" yargs-parser@^9.0.2: version "9.0.2" resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-9.0.2.tgz#9ccf6a43460fe4ed40a9bb68f48d43b8a68cc077" + integrity sha1-nM9qQ0YP5O1Aqbto9I1DuKaMwHc= dependencies: camelcase "^4.1.0" -yargs@^10.0.3: - version "10.1.2" - resolved "https://registry.yarnpkg.com/yargs/-/yargs-10.1.2.tgz#454d074c2b16a51a43e2fb7807e4f9de69ccb5c5" +yargs@11.1.0, yargs@^11.0.0: + version "11.1.0" + resolved "https://registry.yarnpkg.com/yargs/-/yargs-11.1.0.tgz#90b869934ed6e871115ea2ff58b03f4724ed2d77" + integrity sha512-NwW69J42EsCSanF8kyn5upxvjp5ds+t3+udGBeTbFnERA+lF541DDpMawzo4z6W/QrzNM18D+BPMiOBibnFV5A== dependencies: cliui "^4.0.0" decamelize "^1.1.1" @@ -7195,11 +8340,12 @@ yargs@^10.0.3: string-width "^2.0.0" which-module "^2.0.0" y18n "^3.2.1" - yargs-parser "^8.1.0" + yargs-parser "^9.0.2" -yargs@^11.0.0: - version "11.1.0" - resolved "https://registry.yarnpkg.com/yargs/-/yargs-11.1.0.tgz#90b869934ed6e871115ea2ff58b03f4724ed2d77" +yargs@^10.0.3: + version "10.1.2" + resolved "https://registry.yarnpkg.com/yargs/-/yargs-10.1.2.tgz#454d074c2b16a51a43e2fb7807e4f9de69ccb5c5" + integrity sha512-ivSoxqBGYOqQVruxD35+EyCFDYNEFL/Uo6FcOnz+9xZdZzK0Zzw4r4KhbrME1Oo2gOggwJod2MnsdamSG7H9ig== dependencies: cliui "^4.0.0" decamelize "^1.1.1" @@ -7212,11 +8358,12 @@ yargs@^11.0.0: string-width "^2.0.0" which-module "^2.0.0" y18n "^3.2.1" - yargs-parser "^9.0.2" + yargs-parser "^8.1.0" yargs@^4.6.0, yargs@^4.7.1: version "4.8.1" resolved "https://registry.yarnpkg.com/yargs/-/yargs-4.8.1.tgz#c0c42924ca4aaa6b0e6da1739dfb216439f9ddc0" + integrity sha1-wMQpJMpKqmsObaFznfshZDn53cA= dependencies: cliui "^3.2.0" decamelize "^1.1.1" @@ -7236,6 +8383,7 @@ yargs@^4.6.0, yargs@^4.7.1: yargs@^8.0.2: version "8.0.2" resolved "https://registry.yarnpkg.com/yargs/-/yargs-8.0.2.tgz#6299a9055b1cefc969ff7e79c1d918dceb22c360" + integrity sha1-YpmpBVsc78lp/355wdkY3Osiw2A= dependencies: camelcase "^4.1.0" cliui "^3.2.0" @@ -7254,6 +8402,7 @@ yargs@^8.0.2: yargs@~3.10.0: version "3.10.0" resolved "https://registry.yarnpkg.com/yargs/-/yargs-3.10.0.tgz#f7ee7bd857dd7c1d2d38c0e74efbd681d1431fd1" + integrity sha1-9+572FfdfB0tOMDnTvvWgdFDH9E= dependencies: camelcase "^1.0.2" cliui "^2.1.0" @@ -7263,6 +8412,7 @@ yargs@~3.10.0: yauzl@^2.4.2: version "2.10.0" resolved "https://registry.yarnpkg.com/yauzl/-/yauzl-2.10.0.tgz#c7eb17c93e112cb1086fa6d8e51fb0667b79a5f9" + integrity sha1-x+sXyT4RLLEIb6bY5R+wZnt5pfk= dependencies: buffer-crc32 "~0.2.3" fd-slicer "~1.1.0"