#42462 [SC-Low] Potential loss of unclaimed rewards due to updating setting `MAX_CAP_PER_WALLET_PER_EPOCH_FACTOR`
Description
Brief/Intro
Vulnerability Details
function getClaimableAmount(address user) public view returns (uint256) {
uint256 totalClaimable;
// Fixed-point arithmetic for more precision
uint256 scalingFactor = 1e18;
for (uint256 epoch = lastClaimedForEpoch[user] + 1; epoch < currentEpoch; epoch++) {
if (totalYeetVolume[epoch] == 0) continue; // Avoid division by zero
uint256 userVolume = userYeetVolume[epoch][user];
uint256 totalVolume = totalYeetVolume[epoch];
uint256 userShare = (userVolume * scalingFactor) / totalVolume;
>> consider max cap >> uint256 maxClaimable = (epochRewards[epoch] / rewardsSettings.MAX_CAP_PER_WALLET_PER_EPOCH_FACTOR());
uint256 claimable = (userShare * epochRewards[epoch]) / scalingFactor;
if (claimable > maxClaimable) {
claimable = maxClaimable;
}
totalClaimable += claimable;
}
return totalClaimable;
}Impact Details
References
Proof of Concept
Proof of Concept
Previous#42443 [SC-Critical] Vested `$YEET` are susceptible of being impossible to unstakeNext#42487 [SC-Insight] Redundant Slippage Check in `compound` Function
Was this helpful?