@@ -87,6 +87,38 @@ contract StakeTest is StakeManagerTest {
87
87
stakeManager.stake (100 , 1 );
88
88
}
89
89
90
+ function test_StakeWithLockBonusMP () public {
91
+ uint256 stakeAmount = 10_000 ;
92
+ uint256 lockTime = stakeManager.MIN_LOCKUP_PERIOD ();
93
+
94
+ StakeVault userVault = _createStakingAccount (testUser, stakeAmount, 0 , stakeAmount);
95
+
96
+ (, uint256 balance , uint256 bonusMP , uint256 totalMP ,,,,) = stakeManager.accounts (address (userVault));
97
+ assertEq (balance, stakeAmount, "balance of user vault should be equal to stake amount after stake " );
98
+ assertEq (bonusMP, stakeAmount, "bonusMP of user vault should be equal to stake amount after stake if no lock " );
99
+ assertEq (totalMP, bonusMP, "totalMP of user vault should be equal to bonusMP after stake if no epochs passed " );
100
+
101
+ vm.prank (testUser);
102
+ userVault.lock (lockTime);
103
+ uint256 estimatedBonusMp = stakeAmount + stakeManager.calculateMPToMint (stakeAmount, lockTime);
104
+
105
+ (, balance, bonusMP, totalMP,,,,) = stakeManager.accounts (address (userVault));
106
+ assertEq (balance, stakeAmount, "balance of user vault should be equal to stake amount after lock " );
107
+ assertEq (bonusMP, estimatedBonusMp, "bonusMP of user vault should be equal to estimated bonusMP after lock " );
108
+ assertEq (totalMP, bonusMP, "totalMP of user vault should be equal to bonusMP after lock if no epochs passed " );
109
+
110
+ StakeVault userVault2 = _createStakingAccount (testUser, stakeAmount, lockTime, stakeAmount);
111
+
112
+ (, balance, bonusMP, totalMP,,,,) = stakeManager.accounts (address (userVault2));
113
+ assertEq (balance, stakeAmount, "balance of user vault should be equal to stake amount after stake locked " );
114
+ assertEq (
115
+ bonusMP, estimatedBonusMp, "bonusMP of user vault should be equal to estimated bonusMP after stake locked "
116
+ );
117
+ assertEq (
118
+ totalMP, bonusMP, "totalMP of user vault should be equal to bonusMP after stake locked if no epochs passed "
119
+ );
120
+ }
121
+
90
122
function test_RevertWhen_InvalidLockupPeriod () public {
91
123
// ensure user has funds
92
124
deal (stakeToken, testUser, 1000 );
0 commit comments