Users can only claim rewards once in FeeCollector.sol
due to incorrect update of userRewards
mapping, leading to loss of subsequent rewards.
In the claimRewards
function, after calculating and transferring pendingReward
to the user, the userRewards
mapping is incorrectly updated. It is set to totalDistributed
instead of updating it to reflect the cumulative claimed rewards. This incorrect update prevents users from claiming rewards more than once, as subsequent calls to claimRewards
will calculate pendingReward
as zero or a very small amount.
Problematic Code Snippet:
The line userRewards[user] = totalDistributed;
incorrectly resets the user's reward record, making it impossible to claim future rewards.
Loss of Rewards for Users: Users are unable to claim rewards accumulated after their first claim.
Broken Reward System: The intended continuous reward mechanism is broken, leading to an unfair distribution of protocol fees.
Manual code review.
Correctly update the userRewards
mapping in the claimRewards
function. The intended logic should likely be to update userRewards[user]
to the user's new cumulative reward balance after claiming.
Suggested Fix:
By adding pendingReward
to the existing userRewards[user]
, the user's reward balance is correctly updated, allowing them to claim rewards in subsequent periods.
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.