From 29e4f4b395e22164c01473d4729c6a77a6336306 Mon Sep 17 00:00:00 2001 From: Ana Julia Date: Sat, 15 Jun 2024 19:36:29 -0300 Subject: [PATCH] testClaimRewardSucceed --- test/unit/StakingUnitTest.t.sol | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/test/unit/StakingUnitTest.t.sol b/test/unit/StakingUnitTest.t.sol index b288468..163482c 100644 --- a/test/unit/StakingUnitTest.t.sol +++ b/test/unit/StakingUnitTest.t.sol @@ -58,6 +58,9 @@ contract StakingUnitTest is Test { address(shu), 1e18 ); + + // fund reward distribution + shu.transfer(rewardsDistributionProxy, 1_000_000 * 1e18); } /*////////////////////////////////////////////////////////////// @@ -85,5 +88,21 @@ contract StakingUnitTest is Test { ); staking.stake(minStake); + + vm.stopPrank(); + } + + function testClaimRewardSucceed() public { + testStakeSucceed(); + + vm.warp(block.timestamp + 1000); // 1000 seconds later + + uint256 claimAmount = 1_000e18; // 1 SHU per second is distributed + + vm.expectEmit(true, true, true, true, address(staking)); + emit IStaking.ClaimRewards(keyper, address(shu), claimAmount); + + vm.prank(keyper); + staking.claimReward(shu, claimAmount); } }