From c7e5aeaeb5b98b8604c09e1615aa243461b7e2fe Mon Sep 17 00:00:00 2001 From: Flocqst Date: Tue, 29 Oct 2024 17:29:00 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=91=B7=20mock=20accrued=20rewards?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/mocks/MockStakingRewards.sol | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/test/mocks/MockStakingRewards.sol b/test/mocks/MockStakingRewards.sol index 0470e9d..ce72f5d 100644 --- a/test/mocks/MockStakingRewards.sol +++ b/test/mocks/MockStakingRewards.sol @@ -42,4 +42,18 @@ contract MockStakingRewards { return stakedBalances[account]; } + /// @notice Simulates rewards being added to a staker's balance + /// @dev This function also increases the total staked amount and requires + /// the reward tokens to be transferred to this contract first + /// @param staker The address receiving the rewards + /// @param amount The amount of rewards to add + function addRewardToStaker(address staker, uint256 amount) external { + require( + stakingToken.balanceOf(address(this)) >= amount, + "Insufficient reward tokens" + ); + stakedBalances[staker] += amount; + totalStaked += amount; + } + }