The claimRewards function in the FeeCollector contract incorrectly assigns the totalDistributed value to the userRewards mapping for a single user. This is incorrect and can lead to inaccurate reward calculations for other users.
The current claimRewards function in the FeeCollector contract is:
The line userRewards[user] = totalDistributed; incorrectly assigns the totalDistributed value to the userRewards mapping for a single user.
When the user tries to claim rewards again for the next batch, the _calculatePendingRewards function calculates the remaining amount of shares the user has to claim. If userRewards is greater than share, the user gets zero rewards.
The _calculatePendingRewards function is:
If userRewards[user] is greater than share, the user gets zero rewards.
Link to the issue:
Manual code review.
Update the claimRewards function to correctly assign the pending reward to the userRewards mapping for the user. The corrected function should be:
This ensures that the rewards are correctly assigned to the user without affecting the reward calculations for other users.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.