@@ -58,14 +58,16 @@ contract MigrationVestingVaultTest is Test {
5858 );
5959
6060 // Deploy migration vault
61- uint256 globalExpiration = block .number + (VESTING_DURATION / 12 );
61+ uint256 startBlock = block .number ;
62+ uint256 expiration = block .number + (VESTING_DURATION / 12 );
6263 vault = new MigrationVestingVault (
6364 deployer,
6465 IERC20 (address (hdToken)), // Cast HDToken to IERC20
6566 ELFI,
6667 STALE_BLOCKS,
6768 CONVERSION_MULTIPLIER,
68- globalExpiration
69+ startBlock,
70+ expiration
6971 );
7072 vault.initialize (deployer, deployer);
7173
@@ -153,7 +155,7 @@ contract MigrationVestingVaultTest is Test {
153155 assertEq (grant.allocation, amount * CONVERSION_MULTIPLIER, "Wrong allocation " );
154156 assertEq (grant.withdrawn, 0 , "Should not have withdrawals " );
155157 assertEq (grant.cliff, grant.created, "Cliff should equal creation block " );
156- assertEq (grant.expiration, vault.globalExpiration (), "Wrong expiration " );
158+ assertEq (grant.expiration, vault.expiration (), "Wrong expiration " );
157159 assertEq (grant.delegatee, bob, "Wrong delegatee " );
158160
159161 // Verify token transfers.
@@ -174,7 +176,7 @@ contract MigrationVestingVaultTest is Test {
174176 uint256 vaultHDBalanceBefore = hdToken.balanceOf (address (vault));
175177 uint256 votingPowerBefore = vault.queryVotePower (bob, block .number , "" );
176178 vm.startPrank (bob);
177- uint256 halfwayBlock = (block .number + vault.globalExpiration ()) / 2 ;
179+ uint256 halfwayBlock = (block .number + vault.expiration ()) / 2 ;
178180 vm.roll (halfwayBlock);
179181 vault.claim ();
180182
@@ -189,7 +191,7 @@ contract MigrationVestingVaultTest is Test {
189191
190192 // The other half of the three months passes.
191193 vm.startPrank (bob);
192- vm.roll (vault.globalExpiration ());
194+ vm.roll (vault.expiration ());
193195 vault.claim ();
194196
195197 // Ensure that Bob received the other half of the HD grant and that his
@@ -211,6 +213,10 @@ contract MigrationVestingVaultTest is Test {
211213 uint256 vaultElfiBalanceBefore = ELFI.balanceOf (address (vault));
212214 uint256 aliceElfiBalanceBefore = ELFI.balanceOf (alice);
213215
216+ // Half of the three months passes and Alice migrates her ELFI.
217+ uint256 halfwayBlock = (block .number + vault.expiration ()) / 2 ;
218+ vm.roll (halfwayBlock);
219+
214220 // Alice migrates some of her ELFI tokens. She sets Bob as the destination
215221 // address.
216222 vm.startPrank (alice);
@@ -219,15 +225,11 @@ contract MigrationVestingVaultTest is Test {
219225 emit Transfer (alice, address (vault), amount);
220226 vault.migrate (amount, bob);
221227 vm.stopPrank ();
222-
223- // Half of the three months passes and Alice migrates her ELFI.
224- uint256 halfwayBlock = (block .number + vault.globalExpiration ()) / 2 ;
225- vm.roll (halfwayBlock);
226228 VestingVaultStorage.Grant memory grant = vault.getGrant (bob);
227229 assertEq (grant.allocation, amount * CONVERSION_MULTIPLIER, "Wrong allocation " );
228230 assertEq (grant.withdrawn, 0 , "Should not have withdrawals " );
229231 assertEq (grant.cliff, grant.created, "Cliff should equal creation block " );
230- assertEq (grant.expiration, vault.globalExpiration (), "Wrong expiration " );
232+ assertEq (grant.expiration, vault.expiration (), "Wrong expiration " );
231233 assertEq (grant.delegatee, bob, "Wrong delegatee " );
232234
233235 // Verify token transfers.
@@ -260,7 +262,7 @@ contract MigrationVestingVaultTest is Test {
260262
261263 // The other half of the three months passes.
262264 vm.startPrank (bob);
263- vm.roll (vault.globalExpiration ());
265+ vm.roll (vault.expiration ());
264266 vault.claim ();
265267
266268 // Ensure that Bob received the other half of the HD grant and that his
@@ -282,6 +284,9 @@ contract MigrationVestingVaultTest is Test {
282284 uint256 vaultElfiBalanceBefore = ELFI.balanceOf (address (vault));
283285 uint256 aliceElfiBalanceBefore = ELFI.balanceOf (alice);
284286
287+ // Four months passes and Alice migrates her ELFI.
288+ vm.roll (vault.expiration ());
289+
285290 // Alice migrates some of her ELFI tokens. She sets Bob as the destination
286291 // address.
287292 vm.startPrank (alice);
@@ -290,14 +295,11 @@ contract MigrationVestingVaultTest is Test {
290295 emit Transfer (alice, address (vault), amount);
291296 vault.migrate (amount, bob);
292297 vm.stopPrank ();
293-
294- // Four months passes and Alice migrates her ELFI.
295- vm.roll (vault.globalExpiration ());
296298 VestingVaultStorage.Grant memory grant = vault.getGrant (bob);
297299 assertEq (grant.allocation, amount * CONVERSION_MULTIPLIER, "Wrong allocation " );
298300 assertEq (grant.withdrawn, 0 , "Should not have withdrawals " );
299301 assertEq (grant.cliff, grant.created, "Cliff should equal creation block " );
300- assertEq (grant.expiration, vault.globalExpiration (), "Wrong expiration " );
302+ assertEq (grant.expiration, vault.expiration (), "Wrong expiration " );
301303 assertEq (grant.delegatee, bob, "Wrong delegatee " );
302304
303305 // Verify token transfers.
@@ -315,7 +317,6 @@ contract MigrationVestingVaultTest is Test {
315317 // Bob can claim all of the tokens immediately.
316318 uint256 bobHDBalanceBefore = hdToken.balanceOf (address (bob));
317319 uint256 vaultHDBalanceBefore = hdToken.balanceOf (address (vault));
318- uint256 votingPowerBefore = vault.queryVotePower (bob, block .number , "" );
319320 vm.startPrank (bob);
320321 vault.claim ();
321322
@@ -396,7 +397,7 @@ contract MigrationVestingVaultTest is Test {
396397 vm.stopPrank ();
397398
398399 // Move to middle of vesting period
399- uint256 halfwayBlock = (block .number + vault.globalExpiration ()) / 2 ;
400+ uint256 halfwayBlock = (block .number + vault.expiration ()) / 2 ;
400401 vm.roll (halfwayBlock);
401402
402403 // Check voting power is maintained through vesting
0 commit comments