#41707 [SC-Insight] Code differs from documentation in `Reward::getClaimableAmount` function
Description
function getClaimableAmount(address user) public view returns (uint256) {
uint256 totalClaimable;
uint256 scalingFactor = 1e18;
for (uint256 epoch = lastClaimedForEpoch[user] + 1; epoch < currentEpoch; epoch++) {
if (totalYeetVolume[epoch] == 0) continue;
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;
@> // @audit info: surplus tokens are not burned, but in docs said otherwise
}
totalClaimable += claimable;
}
return totalClaimable;
}Proof of Concept
Previous#41699 [SC-Insight] Silent Transfer Failures in Native Token HandlingNext#41741 [SC-Insight] Improper Input Validation in zapInNative Leads to Theft of Residual Funds
Was this helpful?