@@ -3,27 +3,12 @@ pragma solidity ^0.4.24;
3
3
import "./BokkyPooBahsDateTimeLibrary.sol " ;
4
4
import "openzeppelin-solidity/contracts/math/SafeMath.sol " ;
5
5
import "../interfaces/ISecurityToken.sol " ;
6
+ import "../storage/VolumeRestrictionTMStorage.sol " ;
6
7
7
8
library VolumeRestrictionLib {
8
9
9
10
using SafeMath for uint256 ;
10
11
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
-
27
12
function _checkLengthOfArray (
28
13
address [] _holders ,
29
14
uint256 [] _allowedTokens ,
@@ -45,14 +30,14 @@ library VolumeRestrictionLib {
45
30
);
46
31
}
47
32
48
- function _deleteHolderFromList ( RestrictedData storage data , address _holder , uint8 _typeOfPeriod ) public {
33
+ function deleteHolderFromList (VolumeRestrictionTMStorage. RestrictedData storage data , address _holder , uint8 _typeOfPeriod ) public {
49
34
// Deleting the holder if holder's type of Period is `Both` type otherwise
50
35
// it will assign the given type `_typeOfPeriod` to the _holder typeOfPeriod
51
36
// `_typeOfPeriod` it always be contrary to the removing restriction
52
37
// if removing restriction is individual then typeOfPeriod is TypeOfPeriod.OneDay
53
38
// in uint8 its value is 1. if removing restriction is daily individual then typeOfPeriod
54
39
// 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)) {
56
41
uint128 index = data.restrictedHolders[_holder].index;
57
42
uint256 _len = data.restrictedAddresses.length ;
58
43
if (index != _len) {
@@ -66,22 +51,22 @@ library VolumeRestrictionLib {
66
51
}
67
52
}
68
53
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 {
70
55
uint128 index = data.restrictedHolders[_holder].index;
71
56
if (data.restrictedHolders[_holder].seen == 0 ) {
72
57
data.restrictedAddresses.push (_holder);
73
58
index = uint128 (data.restrictedAddresses.length );
74
59
}
75
60
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);
77
62
}
78
63
79
64
function _getTypeOfPeriod (uint8 _currentTypeOfPeriod , uint8 _callFrom , uint256 _endTime ) internal pure returns (uint8 ) {
80
65
if (_currentTypeOfPeriod != _callFrom && _endTime != uint256 (0 ))
81
- return uint8 (TypeOfPeriod.Both);
66
+ return uint8 (VolumeRestrictionTMStorage. TypeOfPeriod.Both);
82
67
else
83
68
return _callFrom;
84
69
}
85
-
86
70
87
- }
71
+
72
+ }
0 commit comments