Skip to content
Business logic Audit finding Intermediate

Contract fails to deliver promised returns, due to changed MAX_CAP_PER_WALLET_PER_EPOCH_FACTOR

The contract's reward cap per wallet per epoch is set to 30 as a denominator, so the actual maximum claimable is about 3.3% of epoch rewards instead of the documented 30%. Additionally, the owner can change this cap at any time, and the new value applies to all past epochs, so users who wait to claim may receive less than expected.

Oxl33 Follow

Originally disclosed on Immunefi

  • Disclosed after under an hour

#41283 [SC-Low] Contract fails to deliver promised returns, due to changed `MAX_CAP_PER_WALLET_PER_EPOCH_FACTOR`

Submitted on Mar 13th 2025 at 10:34:06 UTC by @Oxl33 for Audit Comp | Yeet

Description

Description:

In the documentation it is stated:

There is a cap each day on what percentage of the daily emissions that an individual address can receive, set at 30%

But in reality MAX_CAP_PER_WALLET_PER_EPOCH_FACTOR is initialized as 30 and acts as a denominator, so maxClaimable is only ~3.3% of epoch rewards, not 30%.

This is where the value gets set initially:

Solidity
contract RewardSettings is Ownable2Step {
    /// @dev The max rewards a wallet can get per epoch
    uint256 public MAX_CAP_PER_WALLET_PER_EPOCH_FACTOR;

    event YeetRewardSettingsChanged(uint256 indexed maxCapPerWalletPerEpoch);

    constructor() Ownable(msg.sender) {
        /// @dev this is in percentage, 1/10 of the total rewards
@>      MAX_CAP_PER_WALLET_PER_EPOCH_FACTOR = 30;
    }

This is how the value gets used:

Solidity
    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()); // max cap initially set to 30, so `maxClaimable` will be ~3.3% of epoch rewards
            uint256 claimable = (userShare * epochRewards[epoch]) / scalingFactor;

            if (claimable > maxClaimable) {
                claimable = maxClaimable;
            }

            totalClaimable += claimable;
        }

        return totalClaimable;
    }

Of course the owner is able to change the value by calling RewardSettings::setYeetRewardsSettings, but still I am letting you know about it, because code and docs don't match.

Another issue arises due to the fact, that MAX_CAP_PER_WALLET_PER_EPOCH_FACTOR value is the same for every epoch when calculating maxClaimable amount.

Consider this scenario:

  • current max cap is 30%, user yeets big amounts of BERA in several different epochs, expecting to receive 30% of total rewards for each epoch they participated in
  • user waits a few days before claiming, which can happen due to various reasons (it is not mentioned in docs that users can get punished for waiting before they claim)
  • owner changes the max cap to e.g. 10%. This can be done due to various reasons, such as community/protocol team decision, rewarding smaller game participants, etc.
  • when user tries to claim, claimable will get set to maxClaimable, which is 10% of epoch rewards, even though the user has shares that represent 30%+ of the rewards
  • user will get less rewards than they expected, due to owner being able to set the cap at any time and this cap being used for all previous epochs

Impact:

Users will get smaller than expected rewards.

Recommended Mitigation:

Consider implementing a mechanism where each epoch can have its own MAX_CAP_PER_WALLET_PER_EPOCH_FACTOR value, or at least make it clear in the documentation that this value can be changed at any time and that it affects all previous epochs.

Proof of Concept

N/A

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 variable MAX_CAP_PER_WALLET_PER_EPOCH_FACTOR is used as a divisor instead of a percentage multiplier, and it is a single global value applied to all epochs, allowing retroactive changes.

Impact

Users will receive smaller than expected rewards, and the owner can reduce the cap retroactively, affecting all previous epochs.

What the attacker needed

User participates in multiple epochs; owner changes the cap; user delays claiming

The fix

The contract should be fixed by implementing a per-epoch cap value or clearly documenting that the cap can change and affects past epochs.

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.

This is a smart contract that rewards users based on how much they contribute each day. The documentation says a user can earn up to 30% of the daily rewards, but the code actually limits them to about 3.3% because of a maths mistake. Also, the owner can change this limit later, and it affects past days too, so users might get less than they thought.

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.