diff --git a/0 b/0 deleted file mode 100644 index e69de29bb..000000000 diff --git a/CHANGELOG.md b/CHANGELOG.md index 58ad6a93a..c5e428e11 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,31 +1,29 @@ # Changelog All notable changes to this project will be documented in this file. -# v3.0.0 - -[__3.0.0__] - -## Changed -* Changed the first three params in Security Token `event ModuleAdded()` to be indexed for search. Params are `unit8[] types`, `bytes32 _name` and `address _moduleFactory` - # v3.0.0 - Release Candidate [__3.0.0__](https://www.npmjs.com/package/polymath-core?activeTab=readme) __10-11-18__ -## Added +## SecurityToken * Added new function `addModuleWithLabel()` which takes an extra param `_label` that used for giving the customize label to the module for display purpose. #428 -* Introduce new contract `STRGetter.sol`. It only contains the getter functions of the STR. - -## Fixed +* Changed the first three params in Security Token `event ModuleAdded()` to be indexed for search. Params are `unit8[] types`, `bytes32 _name` and `address _moduleFactory` * Fixed `addModule` function to be backwards compatible and call the new `addModuleWithLabel` function with an empty label. * Fixed event `ModuleAdded` to also emit `_label`. * Fixed function `getModule` to also return the respective module label. + +## STR +* Introduce new contract `STRGetter.sol`. It only contains the getter functions of the STR. * Replaced `updatePolyTokenAddress()` function with `updateFromRegistry()` in `SecurityTokenRegistry`. * Migrate all the getters of `SecurityTokenRegsitry.sol` to `STRGetter.sol` contract. +* Removed `_polyToken` parameter from `initialize` function in `SecurityTokenRegistry`. -## Removed +## GeneralTransferManager +* Add `_isAccredited` variable in the `modifyWhitelist()` function of the GeneralTransferManager. + +## Generalize * Removed `_polyAddress` parameter from constructors of all modules and module factories. -* Removed `_polyToken` parameter from `initialize` function in `SecurityTokenRegistry`. + # v2.1.0 - Release Candidate diff --git a/contracts/interfaces/IBoot.sol b/contracts/interfaces/IBoot.sol index 9e295fb2f..34d3c3fc1 100644 --- a/contracts/interfaces/IBoot.sol +++ b/contracts/interfaces/IBoot.sol @@ -6,4 +6,5 @@ interface IBoot { * @return bytes4 Configure function signature */ function getInitFunction() external pure returns(bytes4); + } \ No newline at end of file diff --git a/contracts/libraries/VersionUtils.sol b/contracts/libraries/VersionUtils.sol index 645e183b4..8375cde68 100644 --- a/contracts/libraries/VersionUtils.sol +++ b/contracts/libraries/VersionUtils.sol @@ -106,4 +106,25 @@ library VersionUtils { return _unpackVersion; } + + /** + * @notice Used to packed the KYC data + */ + function packKYC(uint64 _a, uint64 _b, uint64 _c, uint8 _d, uint8 _e, uint8 _f) internal pure returns(uint256) { + return (uint256(_a) << 152) | (uint256(_b) << 88) | (uint256(_c) << 24) | (uint256(_d) << 16) | (uint256(_e) << 8) | uint256(_f); + } + + /** + * @notice Used to convert packed data into KYC data + * @param _packedVersion Packed data + */ + function unpackKYC(uint256 _packedVersion) internal pure returns(uint64 fromTime, uint64 toTime, uint64 expiryTime, uint8 canBuy, uint8 added, uint8 accredited) { + fromTime = uint64(_packedVersion >> 152); + toTime = uint64(_packedVersion >> 88); + expiryTime = uint64(_packedVersion >> 24); + canBuy = uint8(_packedVersion >> 16); + added = uint8(_packedVersion >> 8); + accredited = uint8(_packedVersion); + } + } diff --git a/contracts/modules/Checkpoint/DividendCheckpoint.sol b/contracts/modules/Checkpoint/DividendCheckpoint.sol index 92a89dc01..3bfc358d8 100644 --- a/contracts/modules/Checkpoint/DividendCheckpoint.sol +++ b/contracts/modules/Checkpoint/DividendCheckpoint.sol @@ -10,7 +10,6 @@ pragma solidity ^0.5.0; import "./ICheckpoint.sol"; import "./DividendCheckpointStorage.sol"; import "../Module.sol"; -import "../../interfaces/ISecurityToken.sol"; import "openzeppelin-solidity/contracts/math/SafeMath.sol"; import "openzeppelin-solidity/contracts/math/Math.sol"; diff --git a/contracts/modules/Experimental/Burn/TrackedRedemption.sol b/contracts/modules/Experimental/Burn/TrackedRedemption.sol index 9b86ef82f..eda7ca14c 100644 --- a/contracts/modules/Experimental/Burn/TrackedRedemption.sol +++ b/contracts/modules/Experimental/Burn/TrackedRedemption.sol @@ -2,7 +2,6 @@ pragma solidity ^0.5.0; import "../../Burn/IBurn.sol"; import "../../Module.sol"; -import "../../../interfaces/ISecurityToken.sol"; import "openzeppelin-solidity/contracts/math/SafeMath.sol"; /** diff --git a/contracts/modules/Experimental/Mixed/ScheduledCheckpoint.sol b/contracts/modules/Experimental/Mixed/ScheduledCheckpoint.sol index e2aed863f..9cc14c730 100644 --- a/contracts/modules/Experimental/Mixed/ScheduledCheckpoint.sol +++ b/contracts/modules/Experimental/Mixed/ScheduledCheckpoint.sol @@ -2,7 +2,6 @@ pragma solidity ^0.5.0; import "./../../Checkpoint/ICheckpoint.sol"; import "../../TransferManager/TransferManager.sol"; -import "../../../interfaces/ISecurityToken.sol"; import "openzeppelin-solidity/contracts/math/SafeMath.sol"; /** diff --git a/contracts/modules/Experimental/TransferManager/KYCTransferManager.sol b/contracts/modules/Experimental/TransferManager/KYCTransferManager.sol index 7a314220e..a4bd779e0 100644 --- a/contracts/modules/Experimental/TransferManager/KYCTransferManager.sol +++ b/contracts/modules/Experimental/TransferManager/KYCTransferManager.sol @@ -1,7 +1,6 @@ pragma solidity ^0.5.0; import "../../TransferManager/TransferManager.sol"; -import "../../../interfaces/IDataStore.sol"; import "../../../interfaces/ISecurityToken.sol"; import "openzeppelin-solidity/contracts/math/SafeMath.sol"; diff --git a/contracts/modules/Experimental/TransferManager/SignedTransferManager.sol b/contracts/modules/Experimental/TransferManager/SignedTransferManager.sol index 7b0fb4ec2..69fed8036 100644 --- a/contracts/modules/Experimental/TransferManager/SignedTransferManager.sol +++ b/contracts/modules/Experimental/TransferManager/SignedTransferManager.sol @@ -1,8 +1,6 @@ pragma solidity ^0.5.0; import "../../TransferManager/TransferManager.sol"; -import "../../../interfaces/IDataStore.sol"; -import "../../../interfaces/ISecurityToken.sol"; import "openzeppelin-solidity/contracts/math/SafeMath.sol"; import "openzeppelin-solidity/contracts/cryptography/ECDSA.sol"; diff --git a/contracts/modules/Experimental/Wallet/VestingEscrowWallet.sol b/contracts/modules/Experimental/Wallet/VestingEscrowWallet.sol index 5b483cdf5..e0231aacd 100644 --- a/contracts/modules/Experimental/Wallet/VestingEscrowWallet.sol +++ b/contracts/modules/Experimental/Wallet/VestingEscrowWallet.sol @@ -3,7 +3,6 @@ pragma solidity ^0.5.0; import "openzeppelin-solidity/contracts/math/SafeMath.sol"; import "../../../storage/VestingEscrowWalletStorage.sol"; import "./IWallet.sol"; -import "../../../interfaces/ISecurityToken.sol"; /** * @title Wallet for core vesting escrow functionality diff --git a/contracts/modules/Module.sol b/contracts/modules/Module.sol index f6c967f77..4ed977d54 100644 --- a/contracts/modules/Module.sol +++ b/contracts/modules/Module.sol @@ -1,9 +1,11 @@ pragma solidity ^0.5.0; +import "./ModuleStorage.sol"; import "../interfaces/IModule.sol"; +import "../interfaces/IDataStore.sol"; +import "../interfaces/ISecurityToken.sol"; import "../interfaces/ICheckPermission.sol"; import "openzeppelin-solidity/contracts/token/ERC20/IERC20.sol"; -import "./ModuleStorage.sol"; import "openzeppelin-solidity/contracts/ownership/Ownable.sol"; /** @@ -58,4 +60,8 @@ contract Module is IModule, ModuleStorage { require(polyToken.transferFrom(securityToken, Ownable(factory).owner(), _amount), "Unable to take fee"); return true; } + + function getDataStore() public view returns(address) { + return ISecurityToken(securityToken).dataStore(); + } } diff --git a/contracts/modules/PermissionManager/GeneralPermissionManager.sol b/contracts/modules/PermissionManager/GeneralPermissionManager.sol index 6469ac3bb..6ce855897 100644 --- a/contracts/modules/PermissionManager/GeneralPermissionManager.sol +++ b/contracts/modules/PermissionManager/GeneralPermissionManager.sol @@ -3,7 +3,6 @@ pragma solidity ^0.5.0; import "./IPermissionManager.sol"; import "../Module.sol"; import "./GeneralPermissionManagerStorage.sol"; -import "../../interfaces/ISecurityToken.sol"; /** * @title Permission Manager module for core permissioning functionality diff --git a/contracts/modules/STO/CappedSTO.sol b/contracts/modules/STO/CappedSTO.sol index 596936e37..8286da28f 100644 --- a/contracts/modules/STO/CappedSTO.sol +++ b/contracts/modules/STO/CappedSTO.sol @@ -1,7 +1,6 @@ pragma solidity ^0.5.0; import "./STO.sol"; -import "../../interfaces/ISecurityToken.sol"; import "openzeppelin-solidity/contracts/utils/ReentrancyGuard.sol"; import "openzeppelin-solidity/contracts/math/SafeMath.sol"; import "./CappedSTOStorage.sol"; diff --git a/contracts/modules/STO/DummySTO.sol b/contracts/modules/STO/DummySTO.sol index 5a4e5e560..8b1a9101d 100644 --- a/contracts/modules/STO/DummySTO.sol +++ b/contracts/modules/STO/DummySTO.sol @@ -1,7 +1,6 @@ pragma solidity ^0.5.0; import "./STO.sol"; -import "../../interfaces/ISecurityToken.sol"; import "./DummySTOStorage.sol"; /** @@ -37,7 +36,7 @@ contract DummySTO is DummySTOStorage, STO { * @notice This function returns the signature of configure function */ function getInitFunction() public pure returns(bytes4) { - return bytes4(keccak256("configure(uint256,uint256,uint256,string)")); + return this.configure.selector; } /** diff --git a/contracts/modules/STO/PreSaleSTO.sol b/contracts/modules/STO/PreSaleSTO.sol index 09f4a1ce9..824b808fc 100644 --- a/contracts/modules/STO/PreSaleSTO.sol +++ b/contracts/modules/STO/PreSaleSTO.sol @@ -1,7 +1,6 @@ pragma solidity ^0.5.0; import "./STO.sol"; -import "../../interfaces/ISecurityToken.sol"; import "openzeppelin-solidity/contracts/math/SafeMath.sol"; import "./PreSaleSTOStorage.sol"; diff --git a/contracts/modules/STO/USDTieredSTO.sol b/contracts/modules/STO/USDTieredSTO.sol index 20cce3e87..bd64aaca6 100644 --- a/contracts/modules/STO/USDTieredSTO.sol +++ b/contracts/modules/STO/USDTieredSTO.sol @@ -1,7 +1,6 @@ pragma solidity ^0.5.0; import "./STO.sol"; -import "../../interfaces/ISecurityToken.sol"; import "../../interfaces/IOracle.sol"; import "../../RegistryUpdater.sol"; import "../../libraries/DecimalMath.sol"; diff --git a/contracts/modules/TransferManager/CountTransferManager.sol b/contracts/modules/TransferManager/CountTransferManager.sol index 9901ba714..b598505f0 100644 --- a/contracts/modules/TransferManager/CountTransferManager.sol +++ b/contracts/modules/TransferManager/CountTransferManager.sol @@ -2,7 +2,6 @@ pragma solidity ^0.5.0; import "./TransferManager.sol"; import "./CountTransferManagerStorage.sol"; -import "../../interfaces/ISecurityToken.sol"; /** * @title Transfer Manager for limiting maximum number of token holders diff --git a/contracts/modules/TransferManager/GeneralTransferManager.sol b/contracts/modules/TransferManager/GeneralTransferManager.sol index 746b994c2..0139291ef 100644 --- a/contracts/modules/TransferManager/GeneralTransferManager.sol +++ b/contracts/modules/TransferManager/GeneralTransferManager.sol @@ -1,9 +1,10 @@ pragma solidity ^0.5.0; import "./TransferManager.sol"; +import "../../libraries/Encoder.sol"; +import "../../libraries/VersionUtils.sol"; import "../../storage/GeneralTransferManagerStorage.sol"; import "openzeppelin-solidity/contracts/math/SafeMath.sol"; -import "../../interfaces/ISecurityToken.sol"; import "openzeppelin-solidity/contracts/cryptography/ECDSA.sol"; /** @@ -40,14 +41,18 @@ contract GeneralTransferManager is GeneralTransferManagerStorage, TransferManage uint256 _fromTime, uint256 _toTime, uint256 _expiryTime, - bool _canBuyFromSTO + bool _canBuyFromSTO, + bool _isAccredited ); /** * @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) + { } @@ -149,6 +154,11 @@ contract GeneralTransferManager is GeneralTransferManagerStorage, TransferManage bool /* _isTransfer */ ) external returns(Result) { if (!paused) { + uint64 fromTime; + uint64 fromExpiry; + uint64 toExpiry; + uint64 toTime; + uint8 canBuyFromSTO; if (allowAllTransfers) { //All transfers allowed, regardless of whitelist return Result.VALID; @@ -156,29 +166,32 @@ contract GeneralTransferManager is GeneralTransferManagerStorage, TransferManage if (allowAllBurnTransfers && (_to == address(0))) { return Result.VALID; } + + (fromTime, fromExpiry, canBuyFromSTO, toTime, toExpiry) = _getValuesForTransfer(_from, _to); + if (allowAllWhitelistTransfers) { //Anyone on the whitelist can transfer, regardless of time - return (_onWhitelist(_to) && _onWhitelist(_from)) ? Result.VALID : Result.NA; + return (_validExpiry(toExpiry) && _validExpiry(fromExpiry)) ? Result.VALID : Result.NA; } - - (uint64 adjustedFromTime, uint64 adjustedToTime) = _adjustTimes(whitelist[_from].fromTime, whitelist[_to].toTime); + // Using the local variables to avoid the stack too deep error + (fromTime, toTime) = _adjustTimes(fromTime, toTime); if (_from == issuanceAddress) { // Possible STO transaction, but investor not allowed to purchased from STO - if ((whitelist[_to].canBuyFromSTO == 0) && _isSTOAttached()) { + if ((canBuyFromSTO == uint8(0)) && _isSTOAttached()) { return Result.NA; } // if allowAllWhitelistIssuances is true, so time stamp ignored if (allowAllWhitelistIssuances) { - return _onWhitelist(_to) ? Result.VALID : Result.NA; + return _validExpiry(toExpiry) ? Result.VALID : Result.NA; } else { - return (_onWhitelist(_to) && (adjustedToTime <= uint64(now))) ? Result.VALID : Result.NA; + return (_validExpiry(toExpiry) && _validLockTime(toTime)) ? Result.VALID : Result.NA; } } //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 (_validExpiry(fromExpiry) && _validLockTime(fromTime) && _validExpiry(toExpiry) && + _validLockTime(toTime)) ? Result.VALID : Result.NA; /*solium-disable-line security/no-block-members*/ } return Result.NA; } @@ -190,18 +203,20 @@ contract GeneralTransferManager is GeneralTransferManagerStorage, TransferManage * @param _toTime is the moment when the purchase lockup period ends and the investor can freely purchase tokens from others * @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. + * @param _isAccredited is used to differentiate whether the investor is Accredited or not. */ function modifyWhitelist( address _investor, uint256 _fromTime, uint256 _toTime, uint256 _expiryTime, - bool _canBuyFromSTO + bool _canBuyFromSTO, + bool _isAccredited ) public withPerm(WHITELIST) { - _modifyWhitelist(_investor, _fromTime, _toTime, _expiryTime, _canBuyFromSTO); + _modifyWhitelist(_investor, _fromTime, _toTime, _expiryTime, _canBuyFromSTO, _isAccredited); } /** @@ -211,18 +226,23 @@ contract GeneralTransferManager is GeneralTransferManagerStorage, TransferManage * @param _toTime is the moment when the purchase lockup period ends and the investor can freely purchase tokens from others * @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. + * @param _isAccredited is used to differentiate whether the investor is Accredited 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, bool _isAccredited) internal { require(_investor != address(0), "Invalid investor"); - uint8 canBuyFromSTO = 0; - if (_canBuyFromSTO) { - canBuyFromSTO = 1; - } - if (whitelist[_investor].added == uint8(0)) { - investors.push(_investor); + uint8 added; + uint8 canBuyFromSTO; + uint8 isAccredited; + IDataStore dataStore = IDataStore(getDataStore()); + added = _getAddedValue(_investor, dataStore); + if (added == uint8(0)) { + investors.push(_investor); } - whitelist[_investor] = TimeRestriction(uint64(_fromTime), uint64(_toTime), uint64(_expiryTime), canBuyFromSTO, uint8(1)); - emit ModifyWhitelist(_investor, now, msg.sender, _fromTime, _toTime, _expiryTime, _canBuyFromSTO); + canBuyFromSTO = _canBuyFromSTO ? 1 : 0; + isAccredited = _isAccredited ? 1 : 0; + uint256 _data = VersionUtils.packKYC(uint64(_fromTime), uint64(_toTime), uint64(_expiryTime), canBuyFromSTO, uint8(1), isAccredited); + dataStore.setUint256(_getKey(WHITELIST, _investor), _data); + emit ModifyWhitelist(_investor, now, msg.sender, _fromTime, _toTime, _expiryTime, _canBuyFromSTO, _isAccredited); } /** @@ -231,21 +251,30 @@ contract GeneralTransferManager is GeneralTransferManagerStorage, TransferManage * @param _fromTimes An array of the moment when the sale lockup period ends and the investor can freely sell his tokens * @param _toTimes An array of the moment when the purchase lockup period ends and the investor can freely purchase tokens from others * @param _expiryTimes An array of the moment till investors KYC will be validated. After that investor need to do re-KYC - * @param _canBuyFromSTO An array of boolean values + * @param _canBuyFromSTO An array of boolean values. + * @param _isAccredited An array of boolean values to differentiate whether the investor is Accredited or not. */ function modifyWhitelistMulti( 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"); - require(_toTimes.length == _expiryTimes.length, "Mismatched input lengths"); - require(_canBuyFromSTO.length == _toTimes.length, "Mismatched input length"); + bool[] memory _canBuyFromSTO, + bool[] memory _isAccredited + ) + public + withPerm(WHITELIST) + { + require( + _investors.length == _fromTimes.length && + _fromTimes.length == _toTimes.length && + _toTimes.length == _expiryTimes.length && + _canBuyFromSTO.length == _toTimes.length && + _canBuyFromSTO.length == _isAccredited.length, + "Mismatched input lengths" + ); for (uint256 i = 0; i < _investors.length; i++) { - _modifyWhitelist(_investors[i], _fromTimes[i], _toTimes[i], _expiryTimes[i], _canBuyFromSTO[i]); + _modifyWhitelist(_investors[i], _fromTimes[i], _toTimes[i], _expiryTimes[i], _canBuyFromSTO[i], _isAccredited[i]); } } @@ -256,6 +285,7 @@ contract GeneralTransferManager is GeneralTransferManagerStorage, TransferManage * @param _toTime is the moment when the purchase lockup period ends and the investor can freely purchase tokens from others * @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. + * @param _isAccredited is used to differentiate whether the investor is Accredited or not. * @param _validFrom is the time that this signature is valid from * @param _validTo is the time that this signature is valid until * @param _nonce nonce of signature (avoid replay attack) @@ -267,6 +297,7 @@ contract GeneralTransferManager is GeneralTransferManagerStorage, TransferManage uint256 _toTime, uint256 _expiryTime, bool _canBuyFromSTO, + bool _isAccredited, uint256 _validFrom, uint256 _validTo, uint256 _nonce, @@ -281,10 +312,10 @@ contract GeneralTransferManager is GeneralTransferManagerStorage, TransferManage require(!nonceMap[_investor][_nonce], "Already used signature"); nonceMap[_investor][_nonce] = true; bytes32 hash = keccak256( - abi.encodePacked(this, _investor, _fromTime, _toTime, _expiryTime, _canBuyFromSTO, _validFrom, _validTo, _nonce) + abi.encodePacked(this, _investor, _fromTime, _toTime, _expiryTime, _canBuyFromSTO, _isAccredited, _validFrom, _validTo, _nonce) ); _checkSig(hash, _signature); - _modifyWhitelist(_investor, _fromTime, _toTime, _expiryTime, _canBuyFromSTO); + _modifyWhitelist(_investor, _fromTime, _toTime, _expiryTime, _canBuyFromSTO, _isAccredited); } /** @@ -298,12 +329,19 @@ contract GeneralTransferManager is GeneralTransferManagerStorage, TransferManage } /** - * @notice Internal function used to check whether the investor is in the whitelist or not - & also checks whether the KYC of investor get expired or not - * @param _investor Address of the investor + * @notice Internal function used to check whether the KYC of investor is valid + * @param _expiryTime Expiry time of the investor */ - function _onWhitelist(address _investor) internal view returns(bool) { - return (whitelist[_investor].expiryTime >= uint64(now)); /*solium-disable-line security/no-block-members*/ + function _validExpiry(uint64 _expiryTime) internal view returns(bool) { + return (_expiryTime >= uint64(now)); /*solium-disable-line security/no-block-members*/ + } + + /** + * @notice Internal function used to check whether the lock time of investor is valid + * @param _lockTime Lock time of the investor + */ + function _validLockTime(uint64 _lockTime) internal view returns(bool) { + return (_lockTime <= uint64(now)); /*solium-disable-line security/no-block-members*/ } /** @@ -329,10 +367,39 @@ contract GeneralTransferManager is GeneralTransferManagerStorage, TransferManage return (adjustedFromTime, adjustedToTime); } + function _getKey(bytes32 _key1, address _key2) internal pure returns(bytes32) { + return bytes32(keccak256(abi.encodePacked(_key1, _key2))); + } + + function _getValues(address _investor, IDataStore dataStore) internal view returns( + uint64 fromTime, + uint64 toTime, + uint64 expiryTime, + uint8 canBuyFromSTO, + uint8 added, + uint8 isAccredited + ) + { + uint256 _whitelistData = dataStore.getUint256(_getKey(WHITELIST, _investor)); + (fromTime, toTime, expiryTime, canBuyFromSTO, added, isAccredited) = VersionUtils.unpackKYC(_whitelistData); + } + + function _getAddedValue(address _investor, IDataStore dataStore) internal view returns(uint8) { + uint256 _whitelistData = dataStore.getUint256(_getKey(WHITELIST, _investor)); + //extracts `added` from packed `_whitelistData` + return uint8(_whitelistData >> 8); + } + + function _getValuesForTransfer(address _from, address _to) internal view returns(uint64 fromTime, uint64 fromExpiry, uint8 canBuyFromSTO, uint64 toTime, uint64 toExpiry) { + IDataStore dataStore = IDataStore(getDataStore()); + (fromTime,, fromExpiry,,,) = _getValues(_from, dataStore); + (, toTime, toExpiry, canBuyFromSTO,,) = _getValues(_to, dataStore); + } + /** * @dev Returns list of all investors */ - function getInvestors() external view returns(address[] memory) { + function getInvestors() public view returns(address[] memory) { return investors; } @@ -344,10 +411,11 @@ contract GeneralTransferManager is GeneralTransferManagerStorage, TransferManage uint256[] memory fromTimes, uint256[] memory toTimes, uint256[] memory expiryTimes, - bool[] memory canBuyFromSTOs + bool[] memory canBuyFromSTOs, + bool[] memory isAccrediteds ) { - (fromTimes, toTimes, expiryTimes, canBuyFromSTOs) = _investorsData(investors); - return (investors, fromTimes, toTimes, expiryTimes, canBuyFromSTOs); + (fromTimes, toTimes, expiryTimes, canBuyFromSTOs, isAccrediteds) = _investorsData(getInvestors()); + return (getInvestors(), fromTimes, toTimes, expiryTimes, canBuyFromSTOs, isAccrediteds); } @@ -358,6 +426,7 @@ contract GeneralTransferManager is GeneralTransferManagerStorage, TransferManage uint256[] memory, uint256[] memory, uint256[] memory, + bool[] memory, bool[] memory ) { return _investorsData(_investors); @@ -367,23 +436,22 @@ contract GeneralTransferManager is GeneralTransferManagerStorage, TransferManage uint256[] memory, uint256[] memory, uint256[] memory, + bool[] memory, bool[] memory ) { uint256[] memory fromTimes = new uint256[](_investors.length); uint256[] memory toTimes = new uint256[](_investors.length); uint256[] memory expiryTimes = new uint256[](_investors.length); bool[] memory canBuyFromSTOs = new bool[](_investors.length); + bool[] memory isAccrediteds = new bool[](_investors.length); for (uint256 i = 0; i < _investors.length; i++) { - fromTimes[i] = whitelist[_investors[i]].fromTime; - toTimes[i] = whitelist[_investors[i]].toTime; - expiryTimes[i] = whitelist[_investors[i]].expiryTime; - if (whitelist[_investors[i]].canBuyFromSTO == 0) { - canBuyFromSTOs[i] = false; - } else { - canBuyFromSTOs[i] = true; - } + uint8 canBuyFromSTO; + uint8 isAccredited; + (fromTimes[i], toTimes[i], expiryTimes[i], canBuyFromSTO,,isAccredited) = _getValues(_investors[i], IDataStore(getDataStore())); + canBuyFromSTOs[i] = canBuyFromSTO == 0 ? false : true; + isAccrediteds[i] = isAccredited == 0 ? false : true; } - return (fromTimes, toTimes, expiryTimes, canBuyFromSTOs); + return (fromTimes, toTimes, expiryTimes, canBuyFromSTOs, isAccrediteds); } /** diff --git a/contracts/modules/TransferManager/GeneralTransferManagerFactory.sol b/contracts/modules/TransferManager/GeneralTransferManagerFactory.sol index 5718ffbbc..78de01e46 100644 --- a/contracts/modules/TransferManager/GeneralTransferManagerFactory.sol +++ b/contracts/modules/TransferManager/GeneralTransferManagerFactory.sol @@ -56,8 +56,9 @@ contract GeneralTransferManagerFactory is ModuleFactory { * @notice Type of the Module factory */ function getTypes() external view returns(uint8[] memory) { - uint8[] memory res = new uint8[](1); + uint8[] memory res = new uint8[](2); res[0] = 2; + res[1] = 6; return res; } diff --git a/contracts/storage/GeneralTransferManagerStorage.sol b/contracts/storage/GeneralTransferManagerStorage.sol index 83418fc2a..b481e31d5 100644 --- a/contracts/storage/GeneralTransferManagerStorage.sol +++ b/contracts/storage/GeneralTransferManagerStorage.sol @@ -4,15 +4,17 @@ pragma solidity ^0.5.0; * @title Transfer Manager module for core transfer validation functionality */ contract GeneralTransferManagerStorage { + + bytes32 public constant WHITELIST = "WHITELIST"; + bytes32 public constant FLAGS = "FLAGS"; + //Address from which issuances come address public issuanceAddress = address(0); //Address which can sign whitelist changes address public signingAddress = address(0); - bytes32 public constant WHITELIST = "WHITELIST"; - bytes32 public constant FLAGS = "FLAGS"; - +/* //from and to timestamps that an investor can send / receive tokens respectively struct TimeRestriction { uint64 fromTime; @@ -22,6 +24,10 @@ contract GeneralTransferManagerStorage { uint8 added; } + // An address can only send / receive tokens once their corresponding uint256 > block.number + // (unless allowAllTransfers == true or allowAllWhitelistTransfers == true) + mapping (address => TimeRestriction) public whitelist; +*/ // Allows all TimeRestrictions to be offset struct Defaults { uint64 fromTime; @@ -34,9 +40,6 @@ contract GeneralTransferManagerStorage { // List of all addresses that have been added to the GTM at some point address[] public investors; - // An address can only send / receive tokens once their corresponding uint256 > block.number - // (unless allowAllTransfers == true or allowAllWhitelistTransfers == true) - mapping (address => TimeRestriction) public whitelist; // Map of used nonces by customer mapping(address => mapping(uint256 => bool)) public nonceMap; @@ -48,5 +51,5 @@ contract GeneralTransferManagerStorage { bool public allowAllWhitelistIssuances = true; //If true, time lock is ignored for burn transactions bool public allowAllBurnTransfers = false; - + } diff --git a/contracts/tokens/STFactory.sol b/contracts/tokens/STFactory.sol index 8c78c04ff..ba97256a2 100644 --- a/contracts/tokens/STFactory.sol +++ b/contracts/tokens/STFactory.sol @@ -40,9 +40,9 @@ contract STFactory is ISTFactory { _tokenDetails, _polymathRegistry ); - newSecurityToken.addModule(transferManagerFactory, "", 0, 0); //NB When dataStore is generated, the security token address is automatically set via the constructor in DataStoreProxy. newSecurityToken.changeDataStore(dataStoreFactory.generateDataStore(address(newSecurityToken))); + newSecurityToken.addModule(transferManagerFactory, "", 0, 0); newSecurityToken.transferOwnership(_issuer); return address(newSecurityToken); } diff --git a/test/b_capped_sto.js b/test/b_capped_sto.js index f0b7cb24d..8e637736e 100644 --- a/test/b_capped_sto.js +++ b/test/b_capped_sto.js @@ -316,7 +316,7 @@ contract("CappedSTO", async (accounts) => { P_expiryTime = toTime + duration.days(100); // Add the Investor in to the whitelist - let tx = await I_GeneralTransferManager.modifyWhitelist(account_investor1, fromTime, toTime, expiryTime, true, { + let tx = await I_GeneralTransferManager.modifyWhitelist(account_investor1, fromTime, toTime, expiryTime, true, false, { from: account_issuer }); @@ -392,6 +392,7 @@ contract("CappedSTO", async (accounts) => { toTime + duration.days(20), expiryTime, true, + false, { from: account_issuer } @@ -530,7 +531,7 @@ contract("CappedSTO", async (accounts) => { it("Should successfully whitelist investor 3", async () => { balanceOfReceiver = new BN(await web3.eth.getBalance(account_fundsReceiver)); - let tx = await I_GeneralTransferManager.modifyWhitelist(account_investor3, fromTime, toTime, expiryTime, true, { + let tx = await I_GeneralTransferManager.modifyWhitelist(account_investor3, fromTime, toTime, expiryTime, true, false, { from: account_issuer, gas: 500000 }); @@ -696,7 +697,7 @@ contract("CappedSTO", async (accounts) => { 10500, "Tokens are not transfered properly" ); - let tx = await I_GeneralTransferManager.modifyWhitelist(account_investor1, P_fromTime, P_toTime, P_expiryTime, true, { + let tx = await I_GeneralTransferManager.modifyWhitelist(account_investor1, P_fromTime, P_toTime, P_expiryTime, true, false, { from: account_issuer, gas: 500000 }); @@ -761,6 +762,7 @@ contract("CappedSTO", async (accounts) => { P_toTime + duration.days(20), P_expiryTime, true, + false, { from: account_issuer, gas: 500000 @@ -971,7 +973,7 @@ contract("CappedSTO", async (accounts) => { 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, { + let tx = await I_GeneralTransferManager.modifyWhitelist(account_investor3, P_fromTime, P_toTime, P_expiryTime, true, false, { from: account_issuer, gas: 500000 }); diff --git a/test/c_checkpoints.js b/test/c_checkpoints.js index f115d9c1c..707310678 100644 --- a/test/c_checkpoints.js +++ b/test/c_checkpoints.js @@ -154,6 +154,7 @@ contract("Checkpoints", async function(accounts) { ltime, ltime.add(new BN(duration.days(10))), false, + false, { from: account_issuer, gas: 6000000 @@ -180,6 +181,7 @@ contract("Checkpoints", async function(accounts) { ltime, ltime.add(new BN(duration.days(10))), false, + false, { from: account_issuer, gas: 6000000 @@ -206,6 +208,7 @@ contract("Checkpoints", async function(accounts) { ltime, ltime.add(new BN(duration.days(10))), false, + false, { from: account_issuer, gas: 6000000 diff --git a/test/d_count_transfer_manager.js b/test/d_count_transfer_manager.js index a742f8990..1dd9a544e 100644 --- a/test/d_count_transfer_manager.js +++ b/test/d_count_transfer_manager.js @@ -206,6 +206,7 @@ contract("CountTransferManager", async (accounts) => { currentTime, currentTime.add(new BN(duration.days(10))), true, + false, { from: account_issuer, gas: 500000 @@ -236,6 +237,7 @@ contract("CountTransferManager", async (accounts) => { currentTime, currentTime.add(new BN(duration.days(10))), true, + false, { from: account_issuer, gas: 500000 @@ -263,6 +265,7 @@ contract("CountTransferManager", async (accounts) => { currentTime, currentTime.add(new BN(duration.days(10))), true, + false, { from: account_issuer, gas: 500000 @@ -288,6 +291,7 @@ contract("CountTransferManager", async (accounts) => { currentTime, currentTime.add(new BN(duration.days(10))), true, + false, { from: account_issuer, gas: 500000 @@ -376,6 +380,7 @@ contract("CountTransferManager", async (accounts) => { currentTime, currentTime.add(new BN(duration.days(10))), true, + false, { from: account_issuer, gas: 500000 @@ -388,6 +393,7 @@ contract("CountTransferManager", async (accounts) => { currentTime, currentTime.add(new BN(duration.days(10))), true, + false, { from: account_issuer, gas: 500000 @@ -400,6 +406,7 @@ contract("CountTransferManager", async (accounts) => { currentTime, currentTime.add(new BN(duration.days(10))), true, + false, { from: account_issuer, gas: 500000 @@ -412,6 +419,7 @@ contract("CountTransferManager", async (accounts) => { currentTime, currentTime.add(new BN(duration.days(10))), true, + false, { from: account_issuer, gas: 500000 diff --git a/test/e_erc20_dividends.js b/test/e_erc20_dividends.js index cc1f8f891..577c8dfc0 100644 --- a/test/e_erc20_dividends.js +++ b/test/e_erc20_dividends.js @@ -215,6 +215,7 @@ contract("ERC20DividendCheckpoint", async (accounts) => { currentTime, currentTime.add(new BN(duration.days(30))), true, + false, { from: account_issuer, gas: 500000 @@ -245,6 +246,7 @@ contract("ERC20DividendCheckpoint", async (accounts) => { currentTime, currentTime.add(new BN(duration.days(30))), true, + false, { from: account_issuer, gas: 500000 @@ -391,6 +393,7 @@ contract("ERC20DividendCheckpoint", async (accounts) => { currentTime, currentTime.add(new BN(duration.days(20))), true, + false, { from: account_issuer, gas: 500000 @@ -454,6 +457,7 @@ contract("ERC20DividendCheckpoint", async (accounts) => { currentTime, currentTime.add(new BN(duration.days(100000))), true, + false, { from: account_issuer, gas: 500000 diff --git a/test/f_ether_dividends.js b/test/f_ether_dividends.js index a6ace6440..ca539b6eb 100644 --- a/test/f_ether_dividends.js +++ b/test/f_ether_dividends.js @@ -209,6 +209,7 @@ contract("EtherDividendCheckpoint", async (accounts) => { currentTime, currentTime.add(new BN(duration.days(300000))), true, + false, { from: account_issuer, gas: 500000 @@ -239,6 +240,7 @@ contract("EtherDividendCheckpoint", async (accounts) => { currentTime, currentTime.add(new BN(duration.days(3000000))), true, + false, { from: account_issuer, gas: 500000 @@ -373,6 +375,7 @@ contract("EtherDividendCheckpoint", async (accounts) => { currentTime, currentTime.add(new BN(duration.days(200000))), true, + false, { from: account_issuer, gas: 500000 @@ -424,6 +427,7 @@ contract("EtherDividendCheckpoint", async (accounts) => { currentTime, currentTime.add(new BN(duration.days(10000))), true, + false, { from: account_issuer, gas: 500000 @@ -730,6 +734,7 @@ contract("EtherDividendCheckpoint", async (accounts) => { currentTime, currentTime.add(new BN(duration.days(1000000))), true, + false, { from: account_issuer, gas: 500000 diff --git a/test/h_general_transfer_manager.js b/test/h_general_transfer_manager.js index 3feae6422..33fb1edca 100644 --- a/test/h_general_transfer_manager.js +++ b/test/h_general_transfer_manager.js @@ -1,7 +1,7 @@ import latestTime from "./helpers/latestTime"; import { duration, promisifyLogWatch, latestBlock } from "./helpers/utils"; import takeSnapshot, { increaseTime, revertToSnapshot } from "./helpers/time"; -import { getSignGTMData, signData } from "./helpers/signData"; +import { getSignGTMData } from "./helpers/signData"; import { pk } from "./helpers/testprivateKey"; import { encodeProxyCall, encodeModuleCall } from "./helpers/encodeCall"; import { catchRevert } from "./helpers/exceptions"; @@ -169,7 +169,6 @@ contract("GeneralTransferManager", async (accounts) => { await I_PolyToken.approve(I_STRProxied.address, initRegFee, { from: token_owner }); 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"); @@ -203,11 +202,32 @@ contract("GeneralTransferManager", async (accounts) => { }); it("Should whitelist the affiliates before the STO attached", async () => { + console.log(`Estimate gas of one Whitelist: + ${await I_GeneralTransferManager.modifyWhitelist.estimateGas( + account_affiliates1, + currentTime + currentTime.add(new BN(duration.days(30))), + currentTime + currentTime.add(new BN(duration.days(90))), + currentTime + currentTime.add(new BN(duration.days(965))), + false, + false, + { + from: account_issuer + } + )}` + ); + let fromTime1 = currentTime + currentTime.add(new BN(duration.days(30))); + let fromTime2 = currentTime.add(new BN(duration.days(30))); + let toTime1 = currentTime + currentTime.add(new BN(duration.days(90))); + let toTime2 = currentTime.add(new BN(duration.days(90))); + let expiryTime1 = currentTime + currentTime.add(new BN(duration.days(965))); + let expiryTime2 = currentTime.add(new BN(duration.days(365))); + let tx = await I_GeneralTransferManager.modifyWhitelistMulti( [account_affiliates1, account_affiliates2], - [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)))], + [fromTime1, fromTime2], + [toTime1, toTime2], + [expiryTime1, expiryTime2], + [false, false], [false, false], { from: account_issuer, @@ -218,7 +238,15 @@ contract("GeneralTransferManager", async (accounts) => { assert.equal(tx.logs[1].args._investor, account_affiliates2); assert.deepEqual(await I_GeneralTransferManager.getInvestors.call(), [account_affiliates1, account_affiliates2]); console.log(await I_GeneralTransferManager.getAllInvestorsData.call()); - console.log(await I_GeneralTransferManager.getInvestorsData.call([account_affiliates1, account_affiliates2])); + let data = await I_GeneralTransferManager.getInvestorsData.call([account_affiliates1, account_affiliates2]); + assert.equal(data[0][0].toString(), fromTime1); + assert.equal(data[0][1].toString(), fromTime2); + assert.equal(data[1][0].toString(), toTime1); + assert.equal(data[1][1].toString(), toTime2); + assert.equal(data[2][0].toString(), expiryTime1); + assert.equal(data[2][1].toString(), expiryTime2); + assert.isFalse(data[3][0]); + assert.isFalse(data[3][1]); }); it("Should whitelist lots of addresses and check gas", async () => { @@ -229,7 +257,7 @@ contract("GeneralTransferManager", async (accounts) => { let times = range1(50); let bools = rangeB(50); - let tx = await I_GeneralTransferManager.modifyWhitelistMulti(mockInvestors, times, times, times, bools, { + let tx = await I_GeneralTransferManager.modifyWhitelistMulti(mockInvestors, times, times, times, bools, bools, { from: account_issuer, gas: 7900000 }); @@ -241,6 +269,11 @@ contract("GeneralTransferManager", async (accounts) => { }); it("Should mint the tokens to the affiliates", async () => { + console.log(` + Estimate gas cost for minting the tokens: ${await I_SecurityToken.mintMulti.estimateGas([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 + })} + `) 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 @@ -331,6 +364,7 @@ contract("GeneralTransferManager", async (accounts) => { currentTime, currentTime.add(new BN(duration.days(10))), true, + false, { from: account_issuer, gas: 6000000 @@ -347,6 +381,9 @@ contract("GeneralTransferManager", async (accounts) => { await increaseTime(5000); // Mint some tokens + console.log( + `Gas usage of minting of tokens: ${await I_DummySTO.generateTokens.estimateGas(account_investor1, new BN(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)).toString(), new BN(web3.utils.toWei("1", "ether")).toString()); @@ -385,7 +422,7 @@ contract("GeneralTransferManager", async (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, new BN(0), new BN(0), currentTime.add(new BN(duration.days(20))), true, { + let tx = await I_GeneralTransferManager.modifyWhitelist(account_investor1, new BN(0), new BN(0), currentTime.add(new BN(duration.days(20))), true, false, { from: account_issuer, gas: 6000000 }); @@ -402,6 +439,7 @@ contract("GeneralTransferManager", async (accounts) => { currentTime, currentTime.add(new BN(duration.days(20))), true, + true, { from: account_issuer, gas: 6000000 @@ -438,7 +476,7 @@ contract("GeneralTransferManager", async (accounts) => { 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, new BN(0), new BN(0), new BN(0), false, { + await I_GeneralTransferManager.modifyWhitelist(account_investor2, new BN(0), new BN(0), new BN(0), false, false, { from: account_issuer, gas: 6000000 }); @@ -480,6 +518,7 @@ contract("GeneralTransferManager", async (accounts) => { toTime, expiryTime, true, + false, validFrom, validTo, nonce, @@ -493,6 +532,7 @@ contract("GeneralTransferManager", async (accounts) => { toTime, expiryTime, true, + false, validFrom, validTo, nonce, @@ -518,6 +558,7 @@ contract("GeneralTransferManager", async (accounts) => { toTime, expiryTime, true, + false, validFrom, validTo, nonce, @@ -531,6 +572,7 @@ contract("GeneralTransferManager", async (accounts) => { toTime, expiryTime, true, + false, validFrom, validTo, nonce, @@ -556,6 +598,7 @@ contract("GeneralTransferManager", async (accounts) => { toTime, expiryTime, true, + false, validFrom, validTo, nonce, @@ -569,6 +612,7 @@ contract("GeneralTransferManager", async (accounts) => { toTime, expiryTime, true, + false, validFrom, validTo, nonce, @@ -594,6 +638,7 @@ contract("GeneralTransferManager", async (accounts) => { currentTime.add(new BN(duration.days(100))).toNumber(), expiryTime + duration.days(200), true, + false, validFrom, validTo, nonce, @@ -606,6 +651,7 @@ contract("GeneralTransferManager", async (accounts) => { currentTime.add(new BN(duration.days(100))).toNumber(), expiryTime + duration.days(200), true, + false, validFrom, validTo, nonce, @@ -644,6 +690,7 @@ contract("GeneralTransferManager", async (accounts) => { currentTime.add(new BN(duration.days(100))).toNumber(), expiryTime + duration.days(200), true, + false, validFrom, validTo, nonce, @@ -657,6 +704,7 @@ contract("GeneralTransferManager", async (accounts) => { currentTime.add(new BN(duration.days(100))).toNumber(), expiryTime + duration.days(200), true, + false, validFrom, validTo, nonce, @@ -682,6 +730,7 @@ contract("GeneralTransferManager", async (accounts) => { currentTime.add(new BN(duration.days(100))).toNumber(), expiryTime + duration.days(200), true, + false, validFrom, validTo, nonce, @@ -694,6 +743,7 @@ contract("GeneralTransferManager", async (accounts) => { currentTime.add(new BN(duration.days(100))).toNumber(), expiryTime + duration.days(200), true, + false, validFrom, validTo, nonce, @@ -783,6 +833,7 @@ contract("GeneralTransferManager", async (accounts) => { [toTime, toTime], [expiryTime, expiryTime], [true, true], + [true, true], { from: account_delegate, gas: 6000000 @@ -803,6 +854,7 @@ contract("GeneralTransferManager", async (accounts) => { [toTime, toTime], [expiryTime, expiryTime], [1, 1], + [true, true], { from: account_delegate, gas: 6000000 @@ -823,6 +875,7 @@ contract("GeneralTransferManager", async (accounts) => { [toTime], [expiryTime, expiryTime], [true, true], + [true, true], { from: account_delegate, gas: 6000000 @@ -843,6 +896,7 @@ contract("GeneralTransferManager", async (accounts) => { [toTime, toTime], [expiryTime], [true, true], + [true, true], { from: account_delegate, gas: 6000000 @@ -862,6 +916,7 @@ contract("GeneralTransferManager", async (accounts) => { [toTime, toTime], [expiryTime, expiryTime], [true, true], + [true, true], { from: token_owner, gas: 6000000 diff --git a/test/helpers/signData.js b/test/helpers/signData.js index 3acbc6d4c..73a2ff761 100644 --- a/test/helpers/signData.js +++ b/test/helpers/signData.js @@ -27,8 +27,8 @@ function getSignSTMData(tmAddress, nonce, expiry, fromAddress, toAddress, amount return data; } -function getSignGTMData(tmAddress, investorAddress, fromTime, toTime, expiryTime, restricted, validFrom, validTo, nonce, pk) { - let hash = web3.utils.soliditySha3({t: 'address', v: tmAddress}, {t: 'address', v: investorAddress}, {t: 'uint256', v: new BN(fromTime)}, {t: 'uint256', v: new BN(toTime)}, {t: 'uint256', v: new BN(expiryTime)}, {t: 'bool', v: restricted}, {t: 'uint256', v: new BN(validFrom)}, {t: 'uint256', v: new BN(validTo)}, {t: 'uint256', v: new BN(nonce)}); +function getSignGTMData(tmAddress, investorAddress, fromTime, toTime, expiryTime, restricted, accredited, validFrom, validTo, nonce, pk) { + let hash = web3.utils.soliditySha3({t: 'address', v: tmAddress}, {t: 'address', v: investorAddress}, {t: 'uint256', v: new BN(fromTime)}, {t: 'uint256', v: new BN(toTime)}, {t: 'uint256', v: new BN(expiryTime)}, {t: 'bool', v: restricted}, {t: 'bool', v: accredited}, {t: 'uint256', v: new BN(validFrom)}, {t: 'uint256', v: new BN(validTo)}, {t: 'uint256', v: new BN(nonce)}); let signature = (web3.eth.accounts.sign(hash, pk)); return signature.signature; } diff --git a/test/i_Issuance.js b/test/i_Issuance.js index 15f68fc2a..321f6c8d5 100644 --- a/test/i_Issuance.js +++ b/test/i_Issuance.js @@ -211,6 +211,7 @@ contract("Issuance", async (accounts) => { toTime + duration.days(90), expiryTime + duration.days(50), true, + false, { from: account_polymath } @@ -270,7 +271,7 @@ contract("Issuance", async (accounts) => { }); it("should add the investor into the whitelist by the delegate", async () => { - let tx = await I_GeneralTransferManager.modifyWhitelist(account_investor2, fromTime, toTime, expiryTime, true, { + let tx = await I_GeneralTransferManager.modifyWhitelist(account_investor2, fromTime, toTime, expiryTime, true, false, { from: account_delegate, gas: 7000000 }); diff --git a/test/j_manual_approval_transfer_manager.js b/test/j_manual_approval_transfer_manager.js index b46239995..bb4b10403 100644 --- a/test/j_manual_approval_transfer_manager.js +++ b/test/j_manual_approval_transfer_manager.js @@ -176,6 +176,7 @@ contract("ManualApprovalTransferManager", accounts => { currentTime, currentTime.add(new BN(duration.days(30))), true, + false, { from: account_issuer, gas: 6000000 @@ -206,6 +207,7 @@ contract("ManualApprovalTransferManager", accounts => { currentTime, currentTime.add(new BN(duration.days(30))), true, + false, { from: account_issuer, gas: 6000000 @@ -295,6 +297,7 @@ contract("ManualApprovalTransferManager", accounts => { currentTime, currentTime.add(new BN(duration.days(10))), true, + false, { from: account_issuer, gas: 6000000 diff --git a/test/l_percentage_transfer_manager.js b/test/l_percentage_transfer_manager.js index 428f35b41..880f87606 100644 --- a/test/l_percentage_transfer_manager.js +++ b/test/l_percentage_transfer_manager.js @@ -203,6 +203,7 @@ contract("PercentageTransferManager", async (accounts) => { currentTime, currentTime.add(new BN(duration.days(10))), true, + false, { from: account_issuer, gas: 6000000 @@ -233,6 +234,7 @@ contract("PercentageTransferManager", async (accounts) => { currentTime, currentTime.add(new BN(duration.days(10))), true, + false, { from: account_issuer, gas: 6000000 @@ -298,6 +300,7 @@ contract("PercentageTransferManager", async (accounts) => { currentTime, currentTime.add(new BN(duration.days(10))), true, + false, { from: account_issuer, gas: 6000000 diff --git a/test/m_presale_sto.js b/test/m_presale_sto.js index 86259560c..b5056bf0a 100644 --- a/test/m_presale_sto.js +++ b/test/m_presale_sto.js @@ -241,7 +241,7 @@ contract("PreSaleSTO", async (accounts) => { expiryTime = toTime + duration.days(100); // Add the Investor in to the whitelist - let tx = await I_GeneralTransferManager.modifyWhitelist(account_investor1, fromTime, toTime, expiryTime, true, { + let tx = await I_GeneralTransferManager.modifyWhitelist(account_investor1, fromTime, toTime, expiryTime, true, false, { from: account_issuer, gas: 6000000 }); @@ -282,7 +282,7 @@ contract("PreSaleSTO", async (accounts) => { expiryTime = toTime + duration.days(100); // Add the Investor in to the whitelist - let tx1 = await I_GeneralTransferManager.modifyWhitelist(account_investor2, fromTime, toTime, expiryTime, true, { + let tx1 = await I_GeneralTransferManager.modifyWhitelist(account_investor2, fromTime, toTime, expiryTime, true, false, { from: account_issuer, gas: 6000000 }); @@ -290,7 +290,7 @@ contract("PreSaleSTO", async (accounts) => { assert.equal(tx1.logs[0].args._investor, account_investor2, "Failed in adding the investor in whitelist"); // Add the Investor in to the whitelist - let tx2 = await I_GeneralTransferManager.modifyWhitelist(account_investor3, fromTime, toTime, expiryTime, true, { + let tx2 = await I_GeneralTransferManager.modifyWhitelist(account_investor3, fromTime, toTime, expiryTime, true, false, { from: account_issuer, gas: 6000000 }); diff --git a/test/o_security_token.js b/test/o_security_token.js index 680950ccd..e5a2a1d40 100644 --- a/test/o_security_token.js +++ b/test/o_security_token.js @@ -199,7 +199,7 @@ contract("SecurityToken", async (accounts) => { 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, currentTime, toTime, expiryTime, true, { + let tx = await I_GeneralTransferManager.modifyWhitelist(account_affiliate1, currentTime, toTime, expiryTime, true, false, { from: token_owner, gas: 6000000 }); @@ -218,7 +218,7 @@ contract("SecurityToken", async (accounts) => { 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, currentTime, toTime, expiryTime, true, { + let tx = await I_GeneralTransferManager.modifyWhitelist(account_affiliate2, currentTime, toTime, expiryTime, true, false, { from: token_owner, gas: 6000000 }); @@ -536,7 +536,7 @@ contract("SecurityToken", async (accounts) => { toTime = fromTime + duration.days(100); expiryTime = toTime + duration.days(100); - let tx = await I_GeneralTransferManager.modifyWhitelist(account_investor1, fromTime, toTime, expiryTime, true, { + let tx = await I_GeneralTransferManager.modifyWhitelist(account_investor1, fromTime, toTime, expiryTime, true, false, { from: token_owner, gas: 6000000 }); @@ -648,7 +648,7 @@ contract("SecurityToken", async (accounts) => { }); it("Should transfer from whitelist investor1 to whitelist investor 2", async () => { - let tx = await I_GeneralTransferManager.modifyWhitelist(account_investor2, fromTime, toTime, expiryTime, true, { + let tx = await I_GeneralTransferManager.modifyWhitelist(account_investor2, fromTime, toTime, expiryTime, true, false, { from: token_owner, gas: 500000 }); @@ -670,7 +670,7 @@ contract("SecurityToken", async (accounts) => { it("Should transferFrom from one investor to other", async () => { 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, { + let tx = await I_GeneralTransferManager.modifyWhitelist(account_investor3, fromTime, toTime, expiryTime, true, false, { from: token_owner, gas: 500000 }); @@ -715,7 +715,7 @@ contract("SecurityToken", async (accounts) => { }); it("Should add the investor in the whitelist by the delegate", async () => { - let tx = await I_GeneralTransferManager.modifyWhitelist(account_temp, fromTime, toTime, expiryTime, true, { + let tx = await I_GeneralTransferManager.modifyWhitelist(account_temp, fromTime, toTime, expiryTime, true, false, { from: account_delegate, gas: 6000000 }); @@ -755,7 +755,7 @@ contract("SecurityToken", async (accounts) => { }); it("Should remove investor from the whitelist by the delegate", async () => { - let tx = await I_GeneralTransferManager.modifyWhitelist(account_temp, new BN(0), new BN(0), new BN(0), true, { + let tx = await I_GeneralTransferManager.modifyWhitelist(account_temp, new BN(0), new BN(0), new BN(0), true, false, { from: account_delegate, gas: 6000000 }); @@ -784,7 +784,7 @@ contract("SecurityToken", async (accounts) => { }); it("Should fail in buying to tokens", async () => { - let tx = await I_GeneralTransferManager.modifyWhitelist(account_temp, fromTime, toTime, expiryTime, true, { + let tx = await I_GeneralTransferManager.modifyWhitelist(account_temp, fromTime, toTime, expiryTime, true, false, { from: account_delegate, gas: 6000000 }); @@ -970,7 +970,8 @@ contract("SecurityToken", async (accounts) => { currentTime, currentTime.add(new BN(duration.seconds(2))), currentTime.add(new BN(duration.days(50))), - true, + true, + false, { from: account_delegate, gas: 6000000 @@ -1013,6 +1014,7 @@ contract("SecurityToken", async (accounts) => { currentTime.add(new BN(duration.seconds(2))), currentTime.add(new BN(duration.days(50))), true, + false, { from: account_delegate, gas: 6000000 diff --git a/test/p_usd_tiered_sto.js b/test/p_usd_tiered_sto.js index f70d222ed..7946512a8 100644 --- a/test/p_usd_tiered_sto.js +++ b/test/p_usd_tiered_sto.js @@ -1010,8 +1010,8 @@ contract("USDTieredSTO", async (accounts) => { let expiryTime = toTime + duration.days(100); let whitelisted = true; - await I_GeneralTransferManager.modifyWhitelist(ACCREDITED1, fromTime, toTime, expiryTime, whitelisted, { from: ISSUER }); - await I_GeneralTransferManager.modifyWhitelist(NONACCREDITED1, fromTime, toTime, expiryTime, whitelisted, { from: ISSUER }); + await I_GeneralTransferManager.modifyWhitelist(ACCREDITED1, fromTime, toTime, expiryTime, whitelisted, true, { from: ISSUER }); + await I_GeneralTransferManager.modifyWhitelist(NONACCREDITED1, fromTime, toTime, expiryTime, whitelisted, false, { from: ISSUER }); // // Advance time to after STO start // await increaseTime(duration.days(3)); @@ -1110,8 +1110,8 @@ contract("USDTieredSTO", async (accounts) => { let expiryTime = toTime + duration.days(100); let whitelisted = true; - await I_GeneralTransferManager.modifyWhitelist(ACCREDITED1, fromTime, toTime, expiryTime, whitelisted, { from: ISSUER }); - await I_GeneralTransferManager.modifyWhitelist(NONACCREDITED1, fromTime, toTime, expiryTime, whitelisted, { from: ISSUER }); + await I_GeneralTransferManager.modifyWhitelist(ACCREDITED1, fromTime, toTime, expiryTime, whitelisted, true, { from: ISSUER }); + await I_GeneralTransferManager.modifyWhitelist(NONACCREDITED1, fromTime, toTime, expiryTime, whitelisted, false, { from: ISSUER }); // Advance time to after STO start await increaseTime(duration.days(3)); @@ -1165,8 +1165,8 @@ contract("USDTieredSTO", async (accounts) => { let expiryTime = toTime + duration.days(100); let whitelisted = true; - await I_GeneralTransferManager.modifyWhitelist(ACCREDITED1, fromTime, toTime, expiryTime, whitelisted, { from: ISSUER }); - await I_GeneralTransferManager.modifyWhitelist(NONACCREDITED1, fromTime, toTime, expiryTime, whitelisted, { from: ISSUER }); + await I_GeneralTransferManager.modifyWhitelist(ACCREDITED1, fromTime, toTime, expiryTime, whitelisted, true, { from: ISSUER }); + await I_GeneralTransferManager.modifyWhitelist(NONACCREDITED1, fromTime, toTime, expiryTime, whitelisted,false, { from: ISSUER }); // Advance time to after STO start await increaseTime(duration.days(3)); @@ -1235,8 +1235,8 @@ contract("USDTieredSTO", async (accounts) => { let expiryTime = toTime.add(new BN(duration.days(100))); let whitelisted = true; - await I_GeneralTransferManager.modifyWhitelist(ACCREDITED1, fromTime, toTime, expiryTime, whitelisted, { from: ISSUER }); - await I_GeneralTransferManager.modifyWhitelist(NONACCREDITED1, fromTime, toTime, expiryTime, whitelisted, { from: ISSUER }); + await I_GeneralTransferManager.modifyWhitelist(ACCREDITED1, fromTime, toTime, expiryTime, whitelisted, true, { from: ISSUER }); + await I_GeneralTransferManager.modifyWhitelist(NONACCREDITED1, fromTime, toTime, expiryTime, whitelisted, false, { from: ISSUER }); // Advance time to after STO start await increaseTime(duration.days(3)); @@ -1282,8 +1282,8 @@ contract("USDTieredSTO", async (accounts) => { let expiryTime = toTime + duration.days(100); let whitelisted = true; - await I_GeneralTransferManager.modifyWhitelist(ACCREDITED1, fromTime, toTime, expiryTime, whitelisted, { from: ISSUER }); - await I_GeneralTransferManager.modifyWhitelist(NONACCREDITED1, fromTime, toTime, expiryTime, whitelisted, { from: ISSUER }); + await I_GeneralTransferManager.modifyWhitelist(ACCREDITED1, fromTime, toTime, expiryTime, whitelisted, true, { from: ISSUER }); + await I_GeneralTransferManager.modifyWhitelist(NONACCREDITED1, fromTime, toTime, expiryTime, whitelisted, false, { from: ISSUER }); // Advance time to after STO end await increaseTime(duration.days(3)); @@ -1337,9 +1337,9 @@ contract("USDTieredSTO", async (accounts) => { let expiryTime = toTime + duration.days(100); let whitelisted = true; - await I_GeneralTransferManager.modifyWhitelist(ACCREDITED1, fromTime, toTime, expiryTime, whitelisted, { from: ISSUER }); - await I_GeneralTransferManager.modifyWhitelist(NONACCREDITED1, fromTime, toTime, expiryTime, whitelisted, { from: ISSUER }); - await I_GeneralTransferManager.modifyWhitelist(RESERVEWALLET, fromTime, toTime, expiryTime, whitelisted, { from: ISSUER }); + await I_GeneralTransferManager.modifyWhitelist(ACCREDITED1, fromTime, toTime, expiryTime, whitelisted, true, { from: ISSUER }); + await I_GeneralTransferManager.modifyWhitelist(NONACCREDITED1, fromTime, toTime, expiryTime, whitelisted, false, { from: ISSUER }); + await I_GeneralTransferManager.modifyWhitelist(RESERVEWALLET, fromTime, toTime, expiryTime, whitelisted, false, { from: ISSUER }); // Advance time to after STO start await increaseTime(duration.days(3)); @@ -1405,11 +1405,11 @@ contract("USDTieredSTO", async (accounts) => { let expiryTime = toTime + duration.days(100); let whitelisted = true; - const tx1 = await I_GeneralTransferManager.modifyWhitelist(NONACCREDITED1, fromTime, toTime, expiryTime, whitelisted, { + const tx1 = await I_GeneralTransferManager.modifyWhitelist(NONACCREDITED1, fromTime, toTime, expiryTime, whitelisted, false, { from: ISSUER }); assert.equal(tx1.logs[0].args._investor, NONACCREDITED1, "Failed in adding the investor in whitelist"); - const tx2 = await I_GeneralTransferManager.modifyWhitelist(ACCREDITED1, fromTime, toTime, expiryTime, whitelisted, { + const tx2 = await I_GeneralTransferManager.modifyWhitelist(ACCREDITED1, fromTime, toTime, expiryTime, whitelisted, true, { from: ISSUER }); assert.equal(tx2.logs[0].args._investor, ACCREDITED1, "Failed in adding the investor in whitelist"); diff --git a/test/q_usd_tiered_sto_sim.js b/test/q_usd_tiered_sto_sim.js index c0f62f589..8862bab3d 100644 --- a/test/q_usd_tiered_sto_sim.js +++ b/test/q_usd_tiered_sto_sim.js @@ -372,11 +372,11 @@ contract("USDTieredSTO Sim", async (accounts) => { let expiryTime = toTime + duration.days(100); let canBuyFromSTO = true; - await I_GeneralTransferManager.modifyWhitelist(ACCREDITED1, fromTime, toTime, expiryTime, canBuyFromSTO, { from: ISSUER }); - await I_GeneralTransferManager.modifyWhitelist(ACCREDITED2, fromTime, toTime, expiryTime, canBuyFromSTO, { from: ISSUER }); - await I_GeneralTransferManager.modifyWhitelist(NONACCREDITED1, fromTime, toTime, expiryTime, canBuyFromSTO, { from: ISSUER }); - await I_GeneralTransferManager.modifyWhitelist(NONACCREDITED2, fromTime, toTime, expiryTime, canBuyFromSTO, { from: ISSUER }); - await I_GeneralTransferManager.modifyWhitelist(NOTAPPROVED, fromTime, toTime, expiryTime, false, { from: ISSUER }); + await I_GeneralTransferManager.modifyWhitelist(ACCREDITED1, fromTime, toTime, expiryTime, canBuyFromSTO, true, { from: ISSUER }); + await I_GeneralTransferManager.modifyWhitelist(ACCREDITED2, fromTime, toTime, expiryTime, canBuyFromSTO, true, { from: ISSUER }); + await I_GeneralTransferManager.modifyWhitelist(NONACCREDITED1, fromTime, toTime, expiryTime, canBuyFromSTO, false, { from: ISSUER }); + await I_GeneralTransferManager.modifyWhitelist(NONACCREDITED2, fromTime, toTime, expiryTime, canBuyFromSTO, false, { from: ISSUER }); + await I_GeneralTransferManager.modifyWhitelist(NOTAPPROVED, fromTime, toTime, expiryTime, false, false, { from: ISSUER }); await increaseTime(duration.days(3)); diff --git a/test/r_concurrent_STO.js b/test/r_concurrent_STO.js index 513f8c8a7..e25647af3 100644 --- a/test/r_concurrent_STO.js +++ b/test/r_concurrent_STO.js @@ -167,7 +167,7 @@ contract("Concurrent STO", async (accounts) => { let expiryTime = toTime + duration.days(100); let canBuyFromSTO = true; - let tx = await I_GeneralTransferManager.modifyWhitelist(account_investor1, fromTime, toTime, expiryTime, canBuyFromSTO, { + let tx = await I_GeneralTransferManager.modifyWhitelist(account_investor1, fromTime, toTime, expiryTime, canBuyFromSTO, false, { from: account_issuer, gas: 500000 }); diff --git a/test/v_tracked_redemptions.js b/test/v_tracked_redemptions.js index a0b3ba36f..ad9f588b1 100644 --- a/test/v_tracked_redemptions.js +++ b/test/v_tracked_redemptions.js @@ -193,6 +193,7 @@ contract("TrackedRedemption", async (accounts) => { currentTime, currentTime.add(new BN(duration.days(30))), true, + false, { from: account_issuer, gas: 500000 @@ -223,6 +224,7 @@ contract("TrackedRedemption", async (accounts) => { currentTime, currentTime.add(new BN(duration.days(30))), true, + false, { from: account_issuer, gas: 500000 diff --git a/test/w_lockup_transfer_manager.js b/test/w_lockup_transfer_manager.js index 254ae384f..ac54788a1 100644 --- a/test/w_lockup_transfer_manager.js +++ b/test/w_lockup_transfer_manager.js @@ -203,6 +203,7 @@ contract('LockUpTransferManager', accounts => { currentTime, currentTime.add(new BN(duration.days(10))), true, + false, { from: account_issuer }); @@ -230,6 +231,7 @@ contract('LockUpTransferManager', accounts => { currentTime, currentTime.add(new BN(duration.days(10))), true, + false, { from: account_issuer }); @@ -300,6 +302,7 @@ contract('LockUpTransferManager', accounts => { currentTime, currentTime.add(new BN(duration.days(10))), true, + false, { from: account_issuer }); diff --git a/test/x_scheduled_checkpoints.js b/test/x_scheduled_checkpoints.js index dd23a8f9e..745aa0ab0 100644 --- a/test/x_scheduled_checkpoints.js +++ b/test/x_scheduled_checkpoints.js @@ -183,6 +183,7 @@ contract("ScheduledCheckpoint", async (accounts) => { currentTime, currentTime.add(new BN(duration.days(10))), true, + false, { from: account_issuer, gas: 6000000 @@ -228,6 +229,7 @@ contract("ScheduledCheckpoint", async (accounts) => { currentTime, currentTime.add(new BN(duration.days(10))), true, + false, { from: account_issuer, gas: 6000000 @@ -264,6 +266,7 @@ contract("ScheduledCheckpoint", async (accounts) => { currentTime, currentTime.add(new BN(duration.days(10))), true, + false, { from: account_issuer, gas: 6000000 diff --git a/test/y_volume_restriction_tm.js b/test/y_volume_restriction_tm.js index e855673dd..c46fe3a9c 100644 --- a/test/y_volume_restriction_tm.js +++ b/test/y_volume_restriction_tm.js @@ -230,6 +230,7 @@ contract('VolumeRestrictionTransferManager', accounts => { [newLatestTime, newLatestTime, newLatestTime], [newLatestTime.add(new BN(duration.days(60))), newLatestTime.add(new BN(duration.days(60))), newLatestTime.add(new BN(duration.days(60)))], [true, true, true], + [false,false,false], { from: token_owner } @@ -1304,6 +1305,7 @@ contract('VolumeRestrictionTransferManager', accounts => { newLatestTime, newLatestTime.add(new BN(duration.days(30))), true, + false, { from: token_owner } diff --git a/test/z_blacklist_transfer_manager.js b/test/z_blacklist_transfer_manager.js index 2c4a5cef3..0038052b6 100644 --- a/test/z_blacklist_transfer_manager.js +++ b/test/z_blacklist_transfer_manager.js @@ -220,6 +220,7 @@ contract('BlacklistTransferManager', accounts => { currentTime, currentTime.add(new BN(duration.days(50))), true, + false, { from: account_issuer }); @@ -247,6 +248,7 @@ contract('BlacklistTransferManager', accounts => { currentTime, currentTime.add(new BN(duration.days(50))), true, + false, { from: account_issuer }); @@ -271,6 +273,7 @@ contract('BlacklistTransferManager', accounts => { currentTime, currentTime.add(new BN(duration.days(50))), true, + false, { from: account_issuer }); @@ -295,6 +298,7 @@ contract('BlacklistTransferManager', accounts => { currentTime, currentTime.add(new BN(duration.days(50))), true, + false, { from: account_issuer }); @@ -319,6 +323,7 @@ contract('BlacklistTransferManager', accounts => { currentTime, currentTime.add(new BN(duration.days(50))), true, + false, { from: account_issuer }); diff --git a/test/z_fuzzer_volumn_restriction_transfer_manager.js b/test/z_fuzzer_volumn_restriction_transfer_manager.js index 5aac12df8..c9e5f56d8 100644 --- a/test/z_fuzzer_volumn_restriction_transfer_manager.js +++ b/test/z_fuzzer_volumn_restriction_transfer_manager.js @@ -218,6 +218,7 @@ contract('VolumeRestrictionTransferManager', accounts => { [currentTime, currentTime, currentTime], [currentTime.add(new BN(duration.days(60))), currentTime.add(new BN(duration.days(60))), currentTime.add(new BN(duration.days(60)))], [true, true, true], + [false, false, false], { from: token_owner } diff --git a/test/z_general_permission_manager_fuzzer.js b/test/z_general_permission_manager_fuzzer.js index 98f2ecbe3..b78b07b43 100644 --- a/test/z_general_permission_manager_fuzzer.js +++ b/test/z_general_permission_manager_fuzzer.js @@ -353,7 +353,7 @@ contract("GeneralPermissionManager Fuzz", async (accounts) => { console.log("3"); if (randomPerms === "WHITELIST") { - let tx = await I_GeneralTransferManager.modifyWhitelist(accounts[j], fromTime, toTime, expiryTime, 1, { + let tx = await I_GeneralTransferManager.modifyWhitelist(accounts[j], fromTime, toTime, expiryTime, 1, false, { from: accounts[j] }); assert.equal(tx.logs[0].args._investor, accounts[j]); @@ -364,6 +364,7 @@ contract("GeneralPermissionManager Fuzz", async (accounts) => { [toTime, toTime], [expiryTime, expiryTime], [1, 1], + [false, false], { from: accounts[j] } ); console.log(tx2.logs[1].args); @@ -372,7 +373,7 @@ contract("GeneralPermissionManager Fuzz", async (accounts) => { } else { console.log("3.3"); await catchRevert( - I_GeneralTransferManager.modifyWhitelist(accounts[j], fromTime, toTime, expiryTime, 1, { from: accounts[j] }) + I_GeneralTransferManager.modifyWhitelist(accounts[j], fromTime, toTime, expiryTime, 1, false, { from: accounts[j] }) ); console.log("3.4"); await catchRevert( @@ -382,6 +383,7 @@ contract("GeneralPermissionManager Fuzz", async (accounts) => { [toTime, toTime], [expiryTime, expiryTime], [1, 1], + [false, false], { from: accounts[j] } ) ); diff --git a/test/z_vesting_escrow_wallet.js b/test/z_vesting_escrow_wallet.js index 52252a62c..57f102052 100644 --- a/test/z_vesting_escrow_wallet.js +++ b/test/z_vesting_escrow_wallet.js @@ -199,6 +199,7 @@ contract('VestingEscrowWallet', accounts => { currentTime, currentTime.add(new BN(durationUtil.days(10))), true, + false, { from: token_owner, gas: 6000000 @@ -225,6 +226,7 @@ contract('VestingEscrowWallet', accounts => { [currentTime, currentTime, currentTime, currentTime], [currentTime.add(new BN(durationUtil.days(10))), currentTime.add(new BN(durationUtil.days(10))), currentTime.add(new BN(durationUtil.days(10))), currentTime.add(new BN(durationUtil.days(10)))], [true, true, true, true], + [false, false, false, false], { from: token_owner, gas: 6000000 diff --git a/test/zb_signed_transfer_manager.js b/test/zb_signed_transfer_manager.js index 88b8a7428..105729b14 100644 --- a/test/zb_signed_transfer_manager.js +++ b/test/zb_signed_transfer_manager.js @@ -166,6 +166,7 @@ contract("SignedTransferManager", accounts => { currentTime, currentTime.add(new BN(duration.days(10))), true, + false, { from: account_issuer }