@@ -11,26 +11,24 @@ contract Eigen is OwnableUpgradeable, ERC20VotesUpgradeable {
11
11
IERC20 public immutable bEIGEN;
12
12
13
13
/// STORAGE
14
+ /// @dev Do not remove, deprecated storage.
14
15
/// @notice mapping of minter addresses to the timestamp after which they are allowed to mint
15
- mapping (address => uint256 ) public mintAllowedAfter;
16
+ mapping (address => uint256 ) internal __deprecated_mintAllowedAfter;
17
+ /// @dev Do not remove, deprecated storage.
16
18
/// @notice mapping of minter addresses to the amount of tokens they are allowed to mint
17
- mapping (address => uint256 ) public mintingAllowance ;
18
-
19
+ mapping (address => uint256 ) internal __deprecated_mintingAllowance ;
20
+ /// @dev Do not remove, deprecated storage.
19
21
/// @notice the timestamp after which transfer restrictions are disabled
20
- uint256 public transferRestrictionsDisabledAfter;
22
+ uint256 internal __deprecated_transferRestrictionsDisabledAfter;
23
+ /// @dev Do not remove, deprecated storage.
21
24
/// @notice mapping of addresses that are allowed to transfer tokens to any address
22
- mapping (address => bool ) public allowedFrom;
25
+ mapping (address => bool ) internal __deprecated_allowedFrom;
26
+ /// @dev Do not remove, deprecated storage.
23
27
/// @notice mapping of addresses that are allowed to receive tokens from any address
24
- mapping (address => bool ) public allowedTo ;
28
+ mapping (address => bool ) internal __deprecated_allowedTo ;
25
29
26
- /// @notice event emitted when the allowedFrom status of an address is set
27
- event SetAllowedFrom (address indexed from , bool isAllowedFrom );
28
- /// @notice event emitted when the allowedTo status of an address is set
29
- event SetAllowedTo (address indexed to , bool isAllowedTo );
30
30
/// @notice event emitted when a minter mints
31
31
event Mint (address indexed minter , uint256 amount );
32
- /// @notice event emitted when the transfer restrictions disabled
33
- event TransferRestrictionsDisabled ();
34
32
35
33
constructor (
36
34
IERC20 _bEIGEN
@@ -63,59 +61,19 @@ contract Eigen is OwnableUpgradeable, ERC20VotesUpgradeable {
63
61
minters.length == mintAllowedAfters.length ,
64
62
"Eigen.initialize: minters and mintAllowedAfters must be the same length "
65
63
);
66
- // set minting allowances for each minter
67
- for (uint256 i = 0 ; i < minters.length ; i++ ) {
68
- mintingAllowance[minters[i]] = mintingAllowances[i];
69
- mintAllowedAfter[minters[i]] = mintAllowedAfters[i];
70
- // allow each minter to transfer tokens
71
- allowedFrom[minters[i]] = true ;
72
- emit SetAllowedFrom (minters[i], true );
73
- }
74
-
75
- // set transfer restrictions to be disabled at type(uint256).max to be set down later
76
- transferRestrictionsDisabledAfter = type (uint256 ).max;
77
- }
78
-
79
- /**
80
- * @notice This function allows the owner to set the allowedFrom status of an address
81
- * @param from the address whose allowedFrom status is being set
82
- * @param isAllowedFrom the new allowedFrom status
83
- */
84
- function setAllowedFrom (address from , bool isAllowedFrom ) external onlyOwner {
85
- allowedFrom[from] = isAllowedFrom;
86
- emit SetAllowedFrom (from, isAllowedFrom);
87
- }
88
-
89
- /**
90
- * @notice This function allows the owner to set the allowedTo status of an address
91
- * @param to the address whose allowedTo status is being set
92
- * @param isAllowedTo the new allowedTo status
93
- */
94
- function setAllowedTo (address to , bool isAllowedTo ) external onlyOwner {
95
- allowedTo[to] = isAllowedTo;
96
- emit SetAllowedTo (to, isAllowedTo);
97
- }
98
-
99
- /**
100
- * @notice Allows the owner to disable transfer restrictions
101
- */
102
- function disableTransferRestrictions () external onlyOwner {
103
- require (
104
- transferRestrictionsDisabledAfter == type (uint256 ).max,
105
- "Eigen.disableTransferRestrictions: transfer restrictions are already disabled "
106
- );
107
- transferRestrictionsDisabledAfter = 0 ;
108
- emit TransferRestrictionsDisabled ();
109
64
}
110
65
111
66
/**
112
67
* @notice This function allows minter to mint tokens
113
68
*/
114
69
function mint () external {
115
- require (mintingAllowance[msg .sender ] > 0 , "Eigen.mint: msg.sender has no minting allowance " );
116
- require (block .timestamp > mintAllowedAfter[msg .sender ], "Eigen.mint: msg.sender is not allowed to mint yet " );
117
- uint256 amount = mintingAllowance[msg .sender ];
118
- mintingAllowance[msg .sender ] = 0 ;
70
+ require (__deprecated_mintingAllowance[msg .sender ] > 0 , "Eigen.mint: msg.sender has no minting allowance " );
71
+ require (
72
+ block .timestamp > __deprecated_mintAllowedAfter[msg .sender ],
73
+ "Eigen.mint: msg.sender is not allowed to mint yet "
74
+ );
75
+ uint256 amount = __deprecated_mintingAllowance[msg .sender ];
76
+ __deprecated_mintingAllowance[msg .sender ] = 0 ;
119
77
_mint (msg .sender , amount);
120
78
emit Mint (msg .sender , amount);
121
79
}
@@ -150,24 +108,6 @@ contract Eigen is OwnableUpgradeable, ERC20VotesUpgradeable {
150
108
}
151
109
}
152
110
153
- /**
154
- * @notice Overrides the beforeTokenTransfer function to enforce transfer restrictions
155
- * @param from the address tokens are being transferred from
156
- * @param to the address tokens are being transferred to
157
- * @param amount the amount of tokens being transferred
158
- */
159
- function _beforeTokenTransfer (address from , address to , uint256 amount ) internal override {
160
- // if transfer restrictions are enabled
161
- if (block .timestamp <= transferRestrictionsDisabledAfter) {
162
- // if both from and to are not whitelisted
163
- require (
164
- from == address (0 ) || to == address (0 ) || allowedFrom[from] || allowedTo[to],
165
- "Eigen._beforeTokenTransfer: from or to must be whitelisted "
166
- );
167
- }
168
- super ._beforeTokenTransfer (from, to, amount);
169
- }
170
-
171
111
/**
172
112
* @notice Overridden to return the total bEIGEN supply instead.
173
113
* @dev The issued supply of EIGEN should match the bEIGEN balance of this contract,
0 commit comments