@@ -5,8 +5,8 @@ import "forge-std/Test.sol";
5
5
6
6
import "@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol " ;
7
7
import "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol " ;
8
- import "../harnesses/EigenHarness.sol " ;
9
8
9
+ import "../../contracts/token/Eigen.sol " ;
10
10
import "../../contracts/token/BackingEigen.sol " ;
11
11
12
12
contract EigenWrappingTests is Test {
@@ -17,17 +17,17 @@ contract EigenWrappingTests is Test {
17
17
18
18
ProxyAdmin proxyAdmin;
19
19
20
- EigenHarness eigenImpl;
20
+ Eigen eigenImpl;
21
21
Eigen eigen;
22
22
23
23
BackingEigen bEIGENImpl;
24
24
BackingEigen bEIGEN;
25
25
26
26
uint totalSupply = 1.67e9 ether ;
27
27
28
- // EVENTS FROM EIGEN .sol
29
- /// @notice event emitted when a minter mints
30
- event Mint (address indexed minter , uint amount );
28
+ // EVENTS FROM BackingEigen .sol
29
+ /// @notice event emitted when a minter status is modified
30
+ event IsMinterModified (address indexed minterAddress , bool newStatus );
31
31
32
32
modifier filterAddress (address fuzzedAddress ) {
33
33
vm.assume (! fuzzedOutAddresses[fuzzedAddress]);
@@ -43,13 +43,40 @@ contract EigenWrappingTests is Test {
43
43
bEIGEN = BackingEigen (address (new TransparentUpgradeableProxy (address (proxyAdmin), address (proxyAdmin), "" )));
44
44
45
45
// deploy impls
46
- eigenImpl = new EigenHarness (IERC20 (address (bEIGEN)));
47
- bEIGENImpl = new BackingEigen (IERC20 ( address (eigen)) );
46
+ eigenImpl = new Eigen (IERC20 (address (bEIGEN)));
47
+ bEIGENImpl = new BackingEigen ();
48
48
49
49
// upgrade proxies
50
50
proxyAdmin.upgrade (ITransparentUpgradeableProxy (payable (address (eigen))), address (eigenImpl));
51
51
proxyAdmin.upgrade (ITransparentUpgradeableProxy (payable (address (bEIGEN))), address (bEIGENImpl));
52
52
53
+ // initialize bEIGEN - this will mint the entire supply to the Eigen contract
54
+ bEIGEN.initialize (minter1);
55
+
56
+ // set minters (for future minting if needed)
57
+ vm.expectEmit (true , false , false , false );
58
+ emit IsMinterModified (minter1, true );
59
+ bEIGEN.setIsMinter (minter1, true );
60
+
61
+ vm.expectEmit (true , false , false , false );
62
+ emit IsMinterModified (minter2, true );
63
+ bEIGEN.setIsMinter (minter2, true );
64
+
65
+ // initialize eigen with empty arrays since we don't need minting anymore
66
+ eigen.initialize (minter1);
67
+
68
+ // Mint and wrap tokens for minter1
69
+ vm.startPrank (minter1);
70
+ bEIGEN.mint (minter1, totalSupply / 2 );
71
+ bEIGEN.approve (address (eigen), totalSupply / 2 );
72
+ eigen.wrap (totalSupply / 2 );
73
+ vm.stopPrank ();
74
+
75
+ // Mint and wrap tokens for minter2
76
+ vm.startPrank (minter2);
77
+ bEIGEN.mint (minter2, totalSupply / 2 );
78
+ bEIGEN.approve (address (eigen), totalSupply / 2 );
79
+ eigen.wrap (totalSupply / 2 );
53
80
vm.stopPrank ();
54
81
55
82
fuzzedOutAddresses[minter1] = true ;
@@ -63,11 +90,6 @@ contract EigenWrappingTests is Test {
63
90
function test_AnyoneCanUnwrap (address unwrapper , uint unwrapAmount ) public filterAddress (unwrapper) {
64
91
vm.assume (unwrapper != address (0 ));
65
92
66
- _simulateMint ();
67
-
68
- // initialize bEIGEN
69
- bEIGEN.initialize (minter1);
70
-
71
93
// minter1 balance
72
94
uint minter1Balance = eigen.balanceOf (minter1);
73
95
@@ -100,11 +122,6 @@ contract EigenWrappingTests is Test {
100
122
function test_AnyoneCanWrap (address wrapper , uint wrapAmount ) public filterAddress (wrapper) {
101
123
vm.assume (wrapper != address (0 ));
102
124
103
- _simulateMint ();
104
-
105
- // initialize bEIGEN
106
- bEIGEN.initialize (minter1);
107
-
108
125
// initial bEIGEN balance
109
126
uint initialBEIGENBalanceOfEigenToken = bEIGEN.balanceOf (address (eigen));
110
127
// minter1 balance
@@ -139,11 +156,6 @@ contract EigenWrappingTests is Test {
139
156
}
140
157
141
158
function test_CannotUnwrapMoreThanBalance (address unwrapper , uint unwrapAmount ) public filterAddress (unwrapper) {
142
- _simulateMint ();
143
-
144
- // initialize bEIGEN
145
- bEIGEN.initialize (minter1);
146
-
147
159
// unwrap amount should be less than minter1 balance
148
160
unwrapAmount = unwrapAmount % eigen.balanceOf (minter1);
149
161
@@ -158,11 +170,6 @@ contract EigenWrappingTests is Test {
158
170
}
159
171
160
172
function test_CannotWrapMoreThanBalance (address wrapper , uint wrapAmount ) public filterAddress (wrapper) {
161
- _simulateMint ();
162
-
163
- // initialize bEIGEN
164
- bEIGEN.initialize (minter1);
165
-
166
173
// wrap amount should be less than minter1 balance
167
174
wrapAmount = wrapAmount % eigen.balanceOf (minter1);
168
175
@@ -181,10 +188,4 @@ contract EigenWrappingTests is Test {
181
188
eigen.wrap (wrapAmount + 1 );
182
189
vm.stopPrank ();
183
190
}
184
-
185
- function _simulateMint () internal {
186
- // dummy mint
187
- EigenHarness (address (eigen)).mint (minter1, totalSupply / 2 );
188
- EigenHarness (address (eigen)).mint (minter2, totalSupply / 2 );
189
- }
190
191
}
0 commit comments