@@ -3,27 +3,12 @@ pragma solidity ^0.4.24;
33import "./BokkyPooBahsDateTimeLibrary.sol " ;
44import "openzeppelin-solidity/contracts/math/SafeMath.sol " ;
55import "../interfaces/ISecurityToken.sol " ;
6+ import "../storage/VolumeRestrictionTMStorage.sol " ;
67
78library VolumeRestrictionLib {
89
910 using SafeMath for uint256 ;
1011
11- enum TypeOfPeriod { MultipleDays, OneDay, Both }
12-
13- struct RestrictedHolder {
14- // 1 represent true & 0 for false
15- uint8 seen;
16- // Type of period will be enum index of TypeOfPeriod enum
17- uint8 typeOfPeriod;
18- // Index of the array where the holder address lives
19- uint128 index;
20- }
21-
22- struct RestrictedData {
23- mapping (address => RestrictedHolder) restrictedHolders;
24- address [] restrictedAddresses;
25- }
26-
2712 function _checkLengthOfArray (
2813 address [] _holders ,
2914 uint256 [] _allowedTokens ,
@@ -45,14 +30,14 @@ library VolumeRestrictionLib {
4530 );
4631 }
4732
48- function _deleteHolderFromList ( RestrictedData storage data , address _holder , uint8 _typeOfPeriod ) public {
33+ function deleteHolderFromList (VolumeRestrictionTMStorage. RestrictedData storage data , address _holder , uint8 _typeOfPeriod ) public {
4934 // Deleting the holder if holder's type of Period is `Both` type otherwise
5035 // it will assign the given type `_typeOfPeriod` to the _holder typeOfPeriod
5136 // `_typeOfPeriod` it always be contrary to the removing restriction
5237 // if removing restriction is individual then typeOfPeriod is TypeOfPeriod.OneDay
5338 // in uint8 its value is 1. if removing restriction is daily individual then typeOfPeriod
5439 // is TypeOfPeriod.MultipleDays in uint8 its value is 0.
55- if (data.restrictedHolders[_holder].typeOfPeriod != uint8 (TypeOfPeriod.Both)) {
40+ if (data.restrictedHolders[_holder].typeOfPeriod != uint8 (VolumeRestrictionTMStorage. TypeOfPeriod.Both)) {
5641 uint128 index = data.restrictedHolders[_holder].index;
5742 uint256 _len = data.restrictedAddresses.length ;
5843 if (index != _len) {
@@ -66,22 +51,22 @@ library VolumeRestrictionLib {
6651 }
6752 }
6853
69- function _addRestrictionData ( RestrictedData storage data , address _holder , uint8 _callFrom , uint256 _endTime ) public {
54+ function addRestrictionData (VolumeRestrictionTMStorage. RestrictedData storage data , address _holder , uint8 _callFrom , uint256 _endTime ) public {
7055 uint128 index = data.restrictedHolders[_holder].index;
7156 if (data.restrictedHolders[_holder].seen == 0 ) {
7257 data.restrictedAddresses.push (_holder);
7358 index = uint128 (data.restrictedAddresses.length );
7459 }
7560 uint8 _type = _getTypeOfPeriod (data.restrictedHolders[_holder].typeOfPeriod, _callFrom, _endTime);
76- data.restrictedHolders[_holder] = RestrictedHolder (uint8 (1 ), _type, index);
61+ data.restrictedHolders[_holder] = VolumeRestrictionTMStorage. RestrictedHolder (uint8 (1 ), _type, index);
7762 }
7863
7964 function _getTypeOfPeriod (uint8 _currentTypeOfPeriod , uint8 _callFrom , uint256 _endTime ) internal pure returns (uint8 ) {
8065 if (_currentTypeOfPeriod != _callFrom && _endTime != uint256 (0 ))
81- return uint8 (TypeOfPeriod.Both);
66+ return uint8 (VolumeRestrictionTMStorage. TypeOfPeriod.Both);
8267 else
8368 return _callFrom;
8469 }
85-
8670
87- }
71+
72+ }
0 commit comments