Submitted by cccz, also found by csanuragjain and pashov
Similar to https://github.com/code-423n4/2022-02-concur-findings/issues/209
In the current implementation, the contract only checks if balanceOf rewardsToken is greater than or equal to the future rewards.
However, under normal circumstances, since users can not withdraw all their rewards in time, the balance in the contract contains rewards that belong to the users but have not been withdrawn yet. This means the current checks can not be sufficient enough to make sure the contract has enough amount of rewardsToken.
As a result, if the rewardsDistribution mistakenly notifyRewardAmount with a larger amount, the contract may end up in a wrong state that makes some users unable to claim their rewards.
Given:
Expected Results:
The tx in step 5 should revert.
https://github.com/code-423n4/2022-09-y2k-finance/blob/ac3e86f07bc2f1f51148d2265cc897e8b494adf7/src/rewards/StakingRewards.sol#L201-L205
Consider changing the function notifyRewardAmount to addRward and use transferFrom to transfer rewardsToken into the contract:
MiguelBits (Y2K Finance) disputed 
