Skip to content
Business logic Audit finding Beginner

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.

Oxl33 Follow

Originally disclosed on Immunefi

Informational View original
  • 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

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:

Solidity
    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.

Source: https://github.com/immunefi-team/audit-comp-yeet/blob/da15231cdefd8f385fcdb85c27258b5f0d0cc270/src/Reward.sol#L190

The original report as published on Immunefi, by Oxl33. Images and videos are our own copies; raw HTML is shown as text. View it on Immunefi.

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.

More by Oxl33

View all

4 more disclosed reports, best first.

More from Yeet

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Business logic flaws

The lesson behind this report.

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.