From c68e33af714e5e13927265737379c1745aab4789 Mon Sep 17 00:00:00 2001 From: satyam Date: Mon, 7 Jan 2019 13:12:20 +0530 Subject: [PATCH 1/5] move storage contracts to storage folder and migrate vesting to experimental --- contracts/modules/{ => Experimental}/Wallet/IWallet.sol | 4 ++-- .../{ => Experimental}/Wallet/VestingEscrowWallet.sol | 2 +- .../Wallet/VestingEscrowWalletFactory.sol | 8 ++++---- contracts/modules/STO/USDTieredSTO.sol | 2 +- .../modules/TransferManager/GeneralTransferManager.sol | 2 +- contracts/modules/TransferManager/VolumeRestrictionTM.sol | 2 +- contracts/proxy/GeneralTransferManagerProxy.sol | 2 +- contracts/proxy/USDTieredSTOProxy.sol | 2 +- contracts/proxy/VestingEscrowWalletProxy.sol | 2 +- contracts/proxy/VolumeRestrictionTMProxy.sol | 2 +- .../GeneralTransferManagerStorage.sol | 0 .../{modules/STO => storage}/USDTieredSTOStorage.sol | 2 +- .../Wallet => storage}/VestingEscrowWalletStorage.sol | 0 .../VolumeRestrictionTMStorage.sol | 0 14 files changed, 15 insertions(+), 15 deletions(-) rename contracts/modules/{ => Experimental}/Wallet/IWallet.sol (83%) rename contracts/modules/{ => Experimental}/Wallet/VestingEscrowWallet.sol (99%) rename contracts/modules/{ => Experimental}/Wallet/VestingEscrowWalletFactory.sol (94%) rename contracts/{modules/TransferManager => storage}/GeneralTransferManagerStorage.sol (100%) rename contracts/{modules/STO => storage}/USDTieredSTOStorage.sol (98%) rename contracts/{modules/Wallet => storage}/VestingEscrowWalletStorage.sol (100%) rename contracts/{modules/TransferManager => storage}/VolumeRestrictionTMStorage.sol (100%) diff --git a/contracts/modules/Wallet/IWallet.sol b/contracts/modules/Experimental/Wallet/IWallet.sol similarity index 83% rename from contracts/modules/Wallet/IWallet.sol rename to contracts/modules/Experimental/Wallet/IWallet.sol index ea5c918d8..96affd472 100644 --- a/contracts/modules/Wallet/IWallet.sol +++ b/contracts/modules/Experimental/Wallet/IWallet.sol @@ -1,7 +1,7 @@ pragma solidity ^0.4.24; -import "../../Pausable.sol"; -import "../Module.sol"; +import "../../../Pausable.sol"; +import "../../Module.sol"; /** * @title Interface to be implemented by all Wallet modules diff --git a/contracts/modules/Wallet/VestingEscrowWallet.sol b/contracts/modules/Experimental/Wallet/VestingEscrowWallet.sol similarity index 99% rename from contracts/modules/Wallet/VestingEscrowWallet.sol rename to contracts/modules/Experimental/Wallet/VestingEscrowWallet.sol index 17f6dbb08..c53e1143f 100644 --- a/contracts/modules/Wallet/VestingEscrowWallet.sol +++ b/contracts/modules/Experimental/Wallet/VestingEscrowWallet.sol @@ -1,7 +1,7 @@ pragma solidity ^0.4.24; import "openzeppelin-solidity/contracts/math/SafeMath.sol"; -import "./VestingEscrowWalletStorage.sol"; +import "../../../storage/VestingEscrowWalletStorage.sol"; import "./IWallet.sol"; /** diff --git a/contracts/modules/Wallet/VestingEscrowWalletFactory.sol b/contracts/modules/Experimental/Wallet/VestingEscrowWalletFactory.sol similarity index 94% rename from contracts/modules/Wallet/VestingEscrowWalletFactory.sol rename to contracts/modules/Experimental/Wallet/VestingEscrowWalletFactory.sol index 238d571ea..2e35453f0 100644 --- a/contracts/modules/Wallet/VestingEscrowWalletFactory.sol +++ b/contracts/modules/Experimental/Wallet/VestingEscrowWalletFactory.sol @@ -1,9 +1,9 @@ pragma solidity ^0.4.24; -import "../../proxy/VestingEscrowWalletProxy.sol"; -import "../../interfaces/IBoot.sol"; -import "../ModuleFactory.sol"; -import "../../libraries/Util.sol"; +import "../../../proxy/VestingEscrowWalletProxy.sol"; +import "../../../interfaces/IBoot.sol"; +import "../../ModuleFactory.sol"; +import "../../../libraries/Util.sol"; /** * @title Factory for deploying VestingEscrowWallet module diff --git a/contracts/modules/STO/USDTieredSTO.sol b/contracts/modules/STO/USDTieredSTO.sol index 47e659299..ceb3b7b30 100644 --- a/contracts/modules/STO/USDTieredSTO.sol +++ b/contracts/modules/STO/USDTieredSTO.sol @@ -7,7 +7,7 @@ import "../../RegistryUpdater.sol"; import "../../libraries/DecimalMath.sol"; import "openzeppelin-solidity/contracts/math/SafeMath.sol"; import "openzeppelin-solidity/contracts/ReentrancyGuard.sol"; -import "./USDTieredSTOStorage.sol"; +import "../../storage/USDTieredSTOStorage.sol"; /** * @title STO module for standard capped crowdsale diff --git a/contracts/modules/TransferManager/GeneralTransferManager.sol b/contracts/modules/TransferManager/GeneralTransferManager.sol index ef7d15e98..dc7eabd4b 100644 --- a/contracts/modules/TransferManager/GeneralTransferManager.sol +++ b/contracts/modules/TransferManager/GeneralTransferManager.sol @@ -1,7 +1,7 @@ pragma solidity ^0.4.24; import "./ITransferManager.sol"; -import "./GeneralTransferManagerStorage.sol"; +import "../../storage/GeneralTransferManagerStorage.sol"; import "openzeppelin-solidity/contracts/math/SafeMath.sol"; /** diff --git a/contracts/modules/TransferManager/VolumeRestrictionTM.sol b/contracts/modules/TransferManager/VolumeRestrictionTM.sol index c452b4663..d5cb487f2 100644 --- a/contracts/modules/TransferManager/VolumeRestrictionTM.sol +++ b/contracts/modules/TransferManager/VolumeRestrictionTM.sol @@ -1,7 +1,7 @@ pragma solidity ^0.4.24; import "./ITransferManager.sol"; -import "./VolumeRestrictionTMStorage.sol"; +import "../../storage/VolumeRestrictionTMStorage.sol"; import "openzeppelin-solidity/contracts/math/SafeMath.sol"; import "../../libraries/BokkyPooBahsDateTimeLibrary.sol"; diff --git a/contracts/proxy/GeneralTransferManagerProxy.sol b/contracts/proxy/GeneralTransferManagerProxy.sol index cb9b69070..0fbaa7880 100644 --- a/contracts/proxy/GeneralTransferManagerProxy.sol +++ b/contracts/proxy/GeneralTransferManagerProxy.sol @@ -1,6 +1,6 @@ pragma solidity ^0.4.24; -import "../modules/TransferManager/GeneralTransferManagerStorage.sol"; +import "../storage/GeneralTransferManagerStorage.sol"; import "./OwnedProxy.sol"; import "../Pausable.sol"; import "../modules/ModuleStorage.sol"; diff --git a/contracts/proxy/USDTieredSTOProxy.sol b/contracts/proxy/USDTieredSTOProxy.sol index 12cf8fdb1..a412a8278 100644 --- a/contracts/proxy/USDTieredSTOProxy.sol +++ b/contracts/proxy/USDTieredSTOProxy.sol @@ -1,6 +1,6 @@ pragma solidity ^0.4.24; -import "../modules/STO/USDTieredSTOStorage.sol"; +import "../storage/USDTieredSTOStorage.sol"; import "./OwnedProxy.sol"; import "../Pausable.sol"; import "openzeppelin-solidity/contracts/ReentrancyGuard.sol"; diff --git a/contracts/proxy/VestingEscrowWalletProxy.sol b/contracts/proxy/VestingEscrowWalletProxy.sol index 0138e0402..8f7be97ce 100644 --- a/contracts/proxy/VestingEscrowWalletProxy.sol +++ b/contracts/proxy/VestingEscrowWalletProxy.sol @@ -1,6 +1,6 @@ pragma solidity ^0.4.24; -import "../modules/Wallet/VestingEscrowWalletStorage.sol"; +import "../storage/VestingEscrowWalletStorage.sol"; import "./OwnedProxy.sol"; import "../Pausable.sol"; import "../modules/ModuleStorage.sol"; diff --git a/contracts/proxy/VolumeRestrictionTMProxy.sol b/contracts/proxy/VolumeRestrictionTMProxy.sol index e8c24e6be..0f5cc7f5a 100644 --- a/contracts/proxy/VolumeRestrictionTMProxy.sol +++ b/contracts/proxy/VolumeRestrictionTMProxy.sol @@ -1,6 +1,6 @@ pragma solidity ^0.4.24; -import "../modules/TransferManager/VolumeRestrictionTMStorage.sol"; +import "../storage/VolumeRestrictionTMStorage.sol"; import "./OwnedProxy.sol"; import "../Pausable.sol"; import "../modules/ModuleStorage.sol"; diff --git a/contracts/modules/TransferManager/GeneralTransferManagerStorage.sol b/contracts/storage/GeneralTransferManagerStorage.sol similarity index 100% rename from contracts/modules/TransferManager/GeneralTransferManagerStorage.sol rename to contracts/storage/GeneralTransferManagerStorage.sol diff --git a/contracts/modules/STO/USDTieredSTOStorage.sol b/contracts/storage/USDTieredSTOStorage.sol similarity index 98% rename from contracts/modules/STO/USDTieredSTOStorage.sol rename to contracts/storage/USDTieredSTOStorage.sol index 5d9581408..1671d003c 100644 --- a/contracts/modules/STO/USDTieredSTOStorage.sol +++ b/contracts/storage/USDTieredSTOStorage.sol @@ -1,6 +1,6 @@ pragma solidity ^0.4.24; -import "../../interfaces/IERC20.sol"; +import "../interfaces/IERC20.sol"; /** * @title Contract used to store layout for the USDTieredSTO storage diff --git a/contracts/modules/Wallet/VestingEscrowWalletStorage.sol b/contracts/storage/VestingEscrowWalletStorage.sol similarity index 100% rename from contracts/modules/Wallet/VestingEscrowWalletStorage.sol rename to contracts/storage/VestingEscrowWalletStorage.sol diff --git a/contracts/modules/TransferManager/VolumeRestrictionTMStorage.sol b/contracts/storage/VolumeRestrictionTMStorage.sol similarity index 100% rename from contracts/modules/TransferManager/VolumeRestrictionTMStorage.sol rename to contracts/storage/VolumeRestrictionTMStorage.sol From b7d5aaccc2e94bd78985f8b4035cfe97948d5873 Mon Sep 17 00:00:00 2001 From: satyam Date: Tue, 8 Jan 2019 16:17:54 +0530 Subject: [PATCH 2/5] BTM migrate to experimental --- .../TransferManager/BlacklistTransferManager.sol | 2 +- .../TransferManager/BlacklistTransferManagerFactory.sol | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) rename contracts/modules/{ => Experimental}/TransferManager/BlacklistTransferManager.sol (99%) rename contracts/modules/{ => Experimental}/TransferManager/BlacklistTransferManagerFactory.sol (97%) diff --git a/contracts/modules/TransferManager/BlacklistTransferManager.sol b/contracts/modules/Experimental/TransferManager/BlacklistTransferManager.sol similarity index 99% rename from contracts/modules/TransferManager/BlacklistTransferManager.sol rename to contracts/modules/Experimental/TransferManager/BlacklistTransferManager.sol index d88fea770..d1e653803 100644 --- a/contracts/modules/TransferManager/BlacklistTransferManager.sol +++ b/contracts/modules/Experimental/TransferManager/BlacklistTransferManager.sol @@ -1,6 +1,6 @@ pragma solidity ^0.4.24; -import "./ITransferManager.sol"; +import "../../TransferManager/ITransferManager.sol"; import "openzeppelin-solidity/contracts/math/SafeMath.sol"; /** diff --git a/contracts/modules/TransferManager/BlacklistTransferManagerFactory.sol b/contracts/modules/Experimental/TransferManager/BlacklistTransferManagerFactory.sol similarity index 97% rename from contracts/modules/TransferManager/BlacklistTransferManagerFactory.sol rename to contracts/modules/Experimental/TransferManager/BlacklistTransferManagerFactory.sol index cdb7c90eb..36dd4304f 100644 --- a/contracts/modules/TransferManager/BlacklistTransferManagerFactory.sol +++ b/contracts/modules/Experimental/TransferManager/BlacklistTransferManagerFactory.sol @@ -1,8 +1,8 @@ pragma solidity ^0.4.24; import "./BlacklistTransferManager.sol"; -import "../ModuleFactory.sol"; -import "../../libraries/Util.sol"; +import "../../ModuleFactory.sol"; +import "../../../libraries/Util.sol"; /** * @title Factory for deploying BlacklistManager module From 6f90041a079cc9a4eecebd5c453c27186b5cc32f Mon Sep 17 00:00:00 2001 From: satyam Date: Thu, 10 Jan 2019 13:15:03 +0530 Subject: [PATCH 3/5] move Lockup to experimental --- 0 | 0 .../TransferManager/LockUpTransferManager.sol | 2 +- .../TransferManager/LockUpTransferManagerFactory.sol | 2 +- 3 files changed, 2 insertions(+), 2 deletions(-) delete mode 100644 0 rename contracts/modules/{ => Experimental}/TransferManager/LockUpTransferManager.sol (99%) rename contracts/modules/{ => Experimental}/TransferManager/LockUpTransferManagerFactory.sol (98%) diff --git a/0 b/0 deleted file mode 100644 index e69de29bb..000000000 diff --git a/contracts/modules/TransferManager/LockUpTransferManager.sol b/contracts/modules/Experimental/TransferManager/LockUpTransferManager.sol similarity index 99% rename from contracts/modules/TransferManager/LockUpTransferManager.sol rename to contracts/modules/Experimental/TransferManager/LockUpTransferManager.sol index 993bbd5bb..85ae126fa 100644 --- a/contracts/modules/TransferManager/LockUpTransferManager.sol +++ b/contracts/modules/Experimental/TransferManager/LockUpTransferManager.sol @@ -1,6 +1,6 @@ pragma solidity ^0.4.24; -import "./ITransferManager.sol"; +import "../../TransferManager/ITransferManager.sol"; import "openzeppelin-solidity/contracts/math/SafeMath.sol"; contract LockUpTransferManager is ITransferManager { diff --git a/contracts/modules/TransferManager/LockUpTransferManagerFactory.sol b/contracts/modules/Experimental/TransferManager/LockUpTransferManagerFactory.sol similarity index 98% rename from contracts/modules/TransferManager/LockUpTransferManagerFactory.sol rename to contracts/modules/Experimental/TransferManager/LockUpTransferManagerFactory.sol index 3f5e7b31a..22581eba4 100644 --- a/contracts/modules/TransferManager/LockUpTransferManagerFactory.sol +++ b/contracts/modules/Experimental/TransferManager/LockUpTransferManagerFactory.sol @@ -1,6 +1,6 @@ pragma solidity ^0.4.24; -import "../ModuleFactory.sol"; +import "../../ModuleFactory.sol"; import "./LockUpTransferManager.sol"; /** From 3aedc88dac4b9096a2ea0b6042002eaae1e015c4 Mon Sep 17 00:00:00 2001 From: Adam Dossa Date: Fri, 11 Jan 2019 11:58:24 -0400 Subject: [PATCH 4/5] Small re-shuffling --- contracts/libraries/VolumeRestrictionLib.sol | 31 +++++-------------- .../TransferManager/VolumeRestrictionTM.sol | 2 +- .../storage/VolumeRestrictionTMStorage.sol | 22 +++++++++---- 3 files changed, 25 insertions(+), 30 deletions(-) diff --git a/contracts/libraries/VolumeRestrictionLib.sol b/contracts/libraries/VolumeRestrictionLib.sol index e1e94a50b..bc89a5177 100644 --- a/contracts/libraries/VolumeRestrictionLib.sol +++ b/contracts/libraries/VolumeRestrictionLib.sol @@ -3,27 +3,12 @@ pragma solidity ^0.4.24; import "./BokkyPooBahsDateTimeLibrary.sol"; import "openzeppelin-solidity/contracts/math/SafeMath.sol"; import "../interfaces/ISecurityToken.sol"; +import "../storage/VolumeRestrictionTMStorage.sol"; library VolumeRestrictionLib { using SafeMath for uint256; - enum TypeOfPeriod { MultipleDays, OneDay, Both } - - struct RestrictedHolder { - // 1 represent true & 0 for false - uint8 seen; - // Type of period will be enum index of TypeOfPeriod enum - uint8 typeOfPeriod; - // Index of the array where the holder address lives - uint128 index; - } - - struct RestrictedData { - mapping(address => RestrictedHolder) restrictedHolders; - address[] restrictedAddresses; - } - function _checkLengthOfArray( address[] _holders, uint256[] _allowedTokens, @@ -45,14 +30,14 @@ library VolumeRestrictionLib { ); } - function _deleteHolderFromList(RestrictedData storage data, address _holder, uint8 _typeOfPeriod) public { + function _deleteHolderFromList(VolumeRestrictionTMStorage.RestrictedData storage data, address _holder, uint8 _typeOfPeriod) public { // Deleting the holder if holder's type of Period is `Both` type otherwise // it will assign the given type `_typeOfPeriod` to the _holder typeOfPeriod // `_typeOfPeriod` it always be contrary to the removing restriction // if removing restriction is individual then typeOfPeriod is TypeOfPeriod.OneDay // in uint8 its value is 1. if removing restriction is daily individual then typeOfPeriod // is TypeOfPeriod.MultipleDays in uint8 its value is 0. - if (data.restrictedHolders[_holder].typeOfPeriod != uint8(TypeOfPeriod.Both)) { + if (data.restrictedHolders[_holder].typeOfPeriod != uint8(VolumeRestrictionTMStorage.TypeOfPeriod.Both)) { uint128 index = data.restrictedHolders[_holder].index; uint256 _len = data.restrictedAddresses.length; if (index != _len) { @@ -66,22 +51,22 @@ library VolumeRestrictionLib { } } - function _addRestrictionData(RestrictedData storage data, address _holder, uint8 _callFrom, uint256 _endTime) public { + function _addRestrictionData(VolumeRestrictionTMStorage.RestrictedData storage data, address _holder, uint8 _callFrom, uint256 _endTime) public { uint128 index = data.restrictedHolders[_holder].index; if (data.restrictedHolders[_holder].seen == 0) { data.restrictedAddresses.push(_holder); index = uint128(data.restrictedAddresses.length); } uint8 _type = _getTypeOfPeriod(data.restrictedHolders[_holder].typeOfPeriod, _callFrom, _endTime); - data.restrictedHolders[_holder] = RestrictedHolder(uint8(1), _type, index); + data.restrictedHolders[_holder] = VolumeRestrictionTMStorage.RestrictedHolder(uint8(1), _type, index); } function _getTypeOfPeriod(uint8 _currentTypeOfPeriod, uint8 _callFrom, uint256 _endTime) internal pure returns(uint8) { if (_currentTypeOfPeriod != _callFrom && _endTime != uint256(0)) - return uint8(TypeOfPeriod.Both); + return uint8(VolumeRestrictionTMStorage.TypeOfPeriod.Both); else return _callFrom; } - -} \ No newline at end of file + +} diff --git a/contracts/modules/TransferManager/VolumeRestrictionTM.sol b/contracts/modules/TransferManager/VolumeRestrictionTM.sol index 7f39f1095..9051e66e5 100644 --- a/contracts/modules/TransferManager/VolumeRestrictionTM.sol +++ b/contracts/modules/TransferManager/VolumeRestrictionTM.sol @@ -1,9 +1,9 @@ pragma solidity ^0.4.24; import "./ITransferManager.sol"; -import "../../storage/VolumeRestrictionTMStorage.sol"; import "openzeppelin-solidity/contracts/math/SafeMath.sol"; import "../../libraries/BokkyPooBahsDateTimeLibrary.sol"; +import "../../libraries/VolumeRestrictionLib.sol"; contract VolumeRestrictionTM is VolumeRestrictionTMStorage, ITransferManager { diff --git a/contracts/storage/VolumeRestrictionTMStorage.sol b/contracts/storage/VolumeRestrictionTMStorage.sol index 9eb776ff0..9718c2c09 100644 --- a/contracts/storage/VolumeRestrictionTMStorage.sol +++ b/contracts/storage/VolumeRestrictionTMStorage.sol @@ -1,7 +1,5 @@ pragma solidity ^0.4.24; -import "../../libraries/VolumeRestrictionLib.sol"; - /** * @title Storage layout for VolumeRestrictionTM */ @@ -11,6 +9,20 @@ contract VolumeRestrictionTMStorage { enum TypeOfPeriod { MultipleDays, OneDay, Both } + struct RestrictedHolder { + // 1 represent true & 0 for false + uint8 seen; + // Type of period will be enum index of TypeOfPeriod enum + uint8 typeOfPeriod; + // Index of the array where the holder address lives + uint128 index; + } + + struct RestrictedData { + mapping(address => RestrictedHolder) restrictedHolders; + address[] restrictedAddresses; + } + struct VolumeRestriction { // If typeOfRestriction is `Percentage` then allowedTokens will be in // the % (w.r.t to totalSupply) with a multiplier of 10**16 . else it @@ -43,11 +55,9 @@ contract VolumeRestrictionTMStorage { mapping(address => BucketDetails) internal userToBucket; // Storing the information related to default restriction mapping(address => BucketDetails) internal defaultUserToBucket; - // List of wallets that are exempted from all the restrictions applied by the this contract - /* mapping(address => bool) public exemptList; */ // Restricted data (refernce from the VolumeRestrictionLib library ) - VolumeRestrictionLib.RestrictedData holderData; - // Holde exempt index + RestrictedData holderData; + // Hold exempt index mapping(address => uint256) exemptIndex; address[] public exemptAddresses; From 2795fafaa5b36542f7c12b60cb8978e5b5691ce8 Mon Sep 17 00:00:00 2001 From: satyam Date: Mon, 14 Jan 2019 17:22:56 +0530 Subject: [PATCH 5/5] remove _ prefix from public functions --- contracts/libraries/VolumeRestrictionLib.sol | 4 ++-- contracts/modules/TransferManager/VolumeRestrictionTM.sol | 8 ++++---- test/y_volume_restriction_tm.js | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/contracts/libraries/VolumeRestrictionLib.sol b/contracts/libraries/VolumeRestrictionLib.sol index bc89a5177..9f71d3fed 100644 --- a/contracts/libraries/VolumeRestrictionLib.sol +++ b/contracts/libraries/VolumeRestrictionLib.sol @@ -30,7 +30,7 @@ library VolumeRestrictionLib { ); } - function _deleteHolderFromList(VolumeRestrictionTMStorage.RestrictedData storage data, address _holder, uint8 _typeOfPeriod) public { + function deleteHolderFromList(VolumeRestrictionTMStorage.RestrictedData storage data, address _holder, uint8 _typeOfPeriod) public { // Deleting the holder if holder's type of Period is `Both` type otherwise // it will assign the given type `_typeOfPeriod` to the _holder typeOfPeriod // `_typeOfPeriod` it always be contrary to the removing restriction @@ -51,7 +51,7 @@ library VolumeRestrictionLib { } } - function _addRestrictionData(VolumeRestrictionTMStorage.RestrictedData storage data, address _holder, uint8 _callFrom, uint256 _endTime) public { + function addRestrictionData(VolumeRestrictionTMStorage.RestrictedData storage data, address _holder, uint8 _callFrom, uint256 _endTime) public { uint128 index = data.restrictedHolders[_holder].index; if (data.restrictedHolders[_holder].seen == 0) { data.restrictedAddresses.push(_holder); diff --git a/contracts/modules/TransferManager/VolumeRestrictionTM.sol b/contracts/modules/TransferManager/VolumeRestrictionTM.sol index 9051e66e5..69b036aa4 100644 --- a/contracts/modules/TransferManager/VolumeRestrictionTM.sol +++ b/contracts/modules/TransferManager/VolumeRestrictionTM.sol @@ -212,7 +212,7 @@ contract VolumeRestrictionTM is VolumeRestrictionTMStorage, ITransferManager { _endTime, RestrictionType(_restrictionType) ); - VolumeRestrictionLib._addRestrictionData(holderData, _holder, uint8(TypeOfPeriod.MultipleDays), individualRestriction[_holder].endTime); + VolumeRestrictionLib.addRestrictionData(holderData, _holder, uint8(TypeOfPeriod.MultipleDays), individualRestriction[_holder].endTime); emit AddIndividualRestriction( _holder, _allowedTokens, @@ -275,7 +275,7 @@ contract VolumeRestrictionTM is VolumeRestrictionTMStorage, ITransferManager { _endTime, RestrictionType(_restrictionType) ); - VolumeRestrictionLib._addRestrictionData(holderData, _holder, uint8(TypeOfPeriod.OneDay), individualRestriction[_holder].endTime); + VolumeRestrictionLib.addRestrictionData(holderData, _holder, uint8(TypeOfPeriod.OneDay), individualRestriction[_holder].endTime); emit AddIndividualDailyRestriction( _holder, _allowedTokens, @@ -447,7 +447,7 @@ contract VolumeRestrictionTM is VolumeRestrictionTMStorage, ITransferManager { require(_holder != address(0)); require(individualRestriction[_holder].endTime != 0); individualRestriction[_holder] = VolumeRestriction(0, 0, 0, 0, RestrictionType(0)); - VolumeRestrictionLib._deleteHolderFromList(holderData, _holder, uint8(TypeOfPeriod.OneDay)); + VolumeRestrictionLib.deleteHolderFromList(holderData, _holder, uint8(TypeOfPeriod.OneDay)); userToBucket[_holder].lastTradedDayTime = 0; userToBucket[_holder].sumOfLastPeriod = 0; userToBucket[_holder].daysCovered = 0; @@ -477,7 +477,7 @@ contract VolumeRestrictionTM is VolumeRestrictionTMStorage, ITransferManager { require(_holder != address(0)); require(individualDailyRestriction[_holder].endTime != 0); individualDailyRestriction[_holder] = VolumeRestriction(0, 0, 0, 0, RestrictionType(0)); - VolumeRestrictionLib._deleteHolderFromList(holderData, _holder, uint8(TypeOfPeriod.MultipleDays)); + VolumeRestrictionLib.deleteHolderFromList(holderData, _holder, uint8(TypeOfPeriod.MultipleDays)); userToBucket[_holder].dailyLastTradedDayTime = 0; emit IndividualDailyRestrictionRemoved(_holder); } diff --git a/test/y_volume_restriction_tm.js b/test/y_volume_restriction_tm.js index 335e76d1d..0a9894032 100644 --- a/test/y_volume_restriction_tm.js +++ b/test/y_volume_restriction_tm.js @@ -543,7 +543,7 @@ contract('VolumeRestrictionTransferManager', accounts => { await I_VolumeRestrictionTM.addIndividualRestrictionMulti( [account_investor2, account_delegate3, account_investor4], [web3.utils.toWei("12"), web3.utils.toWei("10"), web3.utils.toWei("15")], - [latestTime() + duration.seconds(2), latestTime() + duration.seconds(2), latestTime() + duration.seconds(2)], + [0, 0, 0], [3, 4, 5], [latestTime() + duration.days(5), latestTime() + duration.days(6), latestTime() + duration.days(7)], [0,0,0],