Skip to content

Commit

Permalink
Add ragequit test
Browse files Browse the repository at this point in the history
  • Loading branch information
akshatmittal committed May 10, 2024
1 parent 91edc23 commit 8f1b291
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions test/GenericMultiRewardsVault.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -854,4 +854,24 @@ contract GenericMultiRewardsVaultTest is Test {
assertEq(staking.accruedRewards(alice, iRewardToken1), 0);
assertEq(rewardToken1.balanceOf(alice), 5 ether);
}

function test_Ragequit() public {
_addRewardToken(rewardToken1);
stakingToken.mint(alice, 5 ether);

vm.startPrank(alice);
stakingToken.approve(address(staking), 5 ether);
staking.deposit(1 ether, alice);

// 10% of rewards paid out
vm.warp(block.timestamp + 10);

staking.ragequit();

(, , , , uint256 index, uint256 ONE) = staking.rewardInfos(iRewardToken1);

assertEq(index, ONE * SCALAR);
assertEq(staking.accruedRewards(alice, iRewardToken1), 0);
assertEq(rewardToken1.balanceOf(alice), 0);
}
}

0 comments on commit 8f1b291

Please sign in to comment.