Skip to content

Commit

Permalink
testClaimRewardSucceed
Browse files Browse the repository at this point in the history
  • Loading branch information
anajuliabit committed Jun 15, 2024
1 parent 0ccb250 commit 29e4f4b
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions test/unit/StakingUnitTest.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ contract StakingUnitTest is Test {
address(shu),
1e18
);

// fund reward distribution
shu.transfer(rewardsDistributionProxy, 1_000_000 * 1e18);
}

/*//////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -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);
}
}

0 comments on commit 29e4f4b

Please sign in to comment.