Code differs from documentation in Reward::getClaimableAmount function
The reward calculation caps each user's claimable amount per epoch, but the surplus tokens above that cap are left in the contract rather than burned. The documentation states surplus tokens are burned, so the code and the stated behaviour disagree.
- Disclosed after under an hour
#41707 [SC-Insight] Code differs from documentation in `Reward::getClaimableAmount` function
Submitted on Mar 17th 2025 at 17:32:38 UTC by @Oxl33 for Audit Comp | Yeet
- Report ID: #41707
- Report Type: Smart Contract
- Report severity: Insight
- Target: https://github.com/immunefi-team/audit-comp-yeet/blob/main/src/Reward.sol
- Impacts:
Description
Description:
Statement from documentation:
- There is a cap each day on what percentage of the daily emissions that an individual address can receive, set at 30%
- Surplus token are burned
Source: https://docs.yeetit.xyz/yeet/yeet-game/mechanics
Now take a look at the code:
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;
}
As you can see, claimable is set to maxClaimable, but the surplus tokens are not burned and they remain in the contract.
Recommended Mitigation:
Consider actually burning the surplus tokens or remove the Surplus token are burned statement from documentation, to avoid misleading users.
Proof of Concept
Proof of Concept:
Surplus tokens are not burned, but documentation states that they are.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the cap logic simply truncates the claimable amount without any follow-up step to burn the excess, so the documented burn behaviour was never implemented.
Impact
Surplus tokens above the per-epoch cap remain in the contract instead of being burned, contradicting the published documentation and potentially misleading users.
What the attacker needed
None
The fix
Either implement the burning of surplus tokens or remove the statement that surplus tokens are burned from the documentation.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
A smart contract is a program that runs on a blockchain and holds tokens. The documentation promised that any reward tokens above a daily limit would be destroyed (burned), but the code only stops the user claiming them and leaves them sitting in the contract. This is a mismatch between what users were told and what the code does, not an exploit.
What is Business logic?
The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.