The FeeCollector contract maintains a lastClaimTime
mapping that tracks when users last claimed rewards, but this mapping is never updated when claims occur. The mapping has an associated internal function _updateLastClaimTime()
that's never called, making the time tracking functionality completely ineffective.
The issue centers around the contract's reward distribution and claiming mechanism. Let's break down the relevant components:
The contract has a time-tracking mapping:
And an internal function to update it, _updateLastClaimTime:
However, in the claimRewards function where users claim their rewards, there's no call to _updateLastClaimTime
:
This creates several issues;
The FeeCollector contract also uses the TimeWeightedAverage library for distribution periods, but without proper time tracking, the weight calculations may be inaccurate.
The FeeCollector also loses the ability to track when users are claiming rewards, which could be important for prevention of reward exploitation, implementation of time-based restrictions or bonuses or tracking of reward distributions
The current reward calculation relies solely on the difference between a user's share of totalDistributed
and their userRewards
balance:
Alice has voting power and is eligible for rewards
A distribution period starts with 1000 tokens
Alice claims her rewards
lastClaimTime[Alice]
remains at 0 despite the claim
Another distribution occurs
Contract has no way to determine when Alice last claimed, potentially affecting time-weighted calculations
Loss of time-based tracking functionality
Inaccurate reward calculations if time-weighted mechanics are added
Wasted gas on unused storage
Potential for future integration issues
Manual code review
properly implement time tracking in the claimRewards
function:
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.