The claimRewards() function incorrectly resets userRewards[user] to totalDistributed, causing users to be unable to claim rewards after the first claim. This results in incorrect reward calculations and prevents users from receiving their entitled rewards on subsequent claims.
The issue lies in the following line inside claimRewards():
This incorrectly resets the user's reward tracking, preventing them from claiming additional rewards in the future.
How It Works:
1.First Claim:
pendingReward = totalDistributed - userRewards[user]
userRewards[user] is updated to totalDistributed, making pendingReward = 0 on the next claim.
The user successfully claims their reward.
2.Second Claim:
pendingReward = totalDistributed - userRewards[user] → Results in 0
The function reverts with InsufficientBalance().
PoC
Users can only claim rewards once.
Any future rewards are lost, making staking and rewards distribution ineffective.
This severely impacts the integrity of the rewards mechanism.
Manual review Hardhat
Modify claimRewards() so that userRewards[user] is updated correctly without resetting the rewards.
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.