Current reward claiming mechainsm prevents some users from claiming their share of the rewards.
To claim rewards users calls claimRewards.
claimRewards uses _calculatePendingRewards to calculate user's rewards. It considers user's current voting power and total voting power to calcualte user's share of the totalDistributed tokens.
The issue is that claimRewards sets totalDistributed as user's claimed rewards. It prevents user from future reward claims.
Example:
First claim:
Alice voting power = 100
Bob voting power = 100
Total voting power = 200
totalDistributed = 100
Alice and Bob receive 50 tokens from totalDistributed and for both of them the userRewards is set to 100.
Second claim:
Alice voting power = 100
Bob voting power = 900
Total voting power = 1000
totalDistributed = 200 -> 100 more tokens are now distributed for 1000 total voting power
Alice should receive 20 tokens from new totalDistributed and Bob should receive 180 tokens.
For Bob the calculations are (180 > 100 so) 180 - 100 (userRewards) = 80 and he will receive his rewards.
For Alice the calculations are (20 < 100 so) _calculatePendingRewards will return 0.
_calculatePendingRewards will block some users from claiming part of their rewards.
Manual Review, Hardhat
Fix _calculatePendingRewards so that users can claim their 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.