File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -283,4 +283,29 @@ contract UserFlowsTest is StakeManagerTest {
283
283
assertEq (ERC20 (stakeToken).balanceOf (address (user2Vault)), 0 );
284
284
assertEq (stakeManager.stakeSupply (), 0 );
285
285
}
286
+
287
+ function test_StakeWithLockUpTimeLocksStake () public {
288
+ // ensure users have funds
289
+ deal (stakeToken, testUser, 1000 );
290
+
291
+ StakeVault userVault = _createTestVault (testUser);
292
+
293
+ vm.startPrank (testUser);
294
+ // approve user vault to spend user tokens
295
+ ERC20 (stakeToken).approve (address (userVault), 100 );
296
+
297
+ // stake with lockup time of 12 weeks
298
+ userVault.stake (100 , 12 weeks);
299
+
300
+ // unstaking should fail as lockup time isn't over yet
301
+ vm.expectRevert (StakeManager.StakeManager__FundsLocked.selector );
302
+ userVault.unstake (100 );
303
+
304
+ // fast forward 12 weeks
305
+ skip (12 weeks + 1 );
306
+
307
+ userVault.unstake (100 );
308
+ assertEq (ERC20 (stakeToken).balanceOf (address (userVault)), 0 );
309
+ assertEq (stakeManager.stakeSupply (), 0 );
310
+ }
286
311
}
You can’t perform that action at this time.
0 commit comments