#41823 [SC-Low] Changing the reward settings has a retroactive impact
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;
>> 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#41766 [SC-Insight] In `Yeet.sol`, storage slots only set in constructor should be declared `immutable`.Next#41788 [SC-Medium] Yield theft because of compound function design
Was this helpful?