Skip to content
Business logic Audit finding Intermediate

1e10 fixed farming reward in GaugeFactoryCL

The GaugeFactoryCL contract hardcodes a reward amount of 1e10 raw units when creating eternal farming incentives, without accounting for the reward token's decimals. For low-decimal tokens like USDC or WBTC, this results in an excessively large reward rate, causing a huge loss for the protocol.

danzero Follow

Originally disclosed on Code4rena

Submitted by danzero

https://github.com/code-423n4/2025-05-blackhole/blob/92fff849d3b266e609e6d63478c4164d9f608e91/contracts/AlgebraCLVe33/GaugeFactoryCL.sol#L75

Finding descriptions and impact

Below is the implementation of the createEternalFarming function in GaugeFactoryCL.sol:

    function createEternalFarming(address _pool, address _algebraEternalFarming, address _rewardToken, address _bonusRewardToken) internal {
        IAlgebraPool algebraPool = IAlgebraPool(_pool);
        uint24 tickSpacing = uint24(algebraPool.tickSpacing());
        address pluginAddress = algebraPool.plugin();
        IncentiveKey memory incentivekey = getIncentiveKey(_rewardToken, _bonusRewardToken, _pool, _algebraEternalFarming);
        uint256 remainingTimeInCurrentEpoch = BlackTimeLibrary.epochNext(block.timestamp) - block.timestamp;
        uint128 reward = 1e10;
        uint128 rewardRate = uint128(reward/remainingTimeInCurrentEpoch);

        IERC20(_rewardToken).safeApprove(_algebraEternalFarming, reward);
        address customDeployer = IAlgebraPoolAPIStorage(algebraPoolAPIStorage).pairToDeployer(_pool);
        IAlgebraEternalFarming.IncentiveParams memory incentiveParams =
            IAlgebraEternalFarming.IncentiveParams(reward, 0, rewardRate, 0, tickSpacing);
        IAlgebraEternalFarmingCustom(_algebraEternalFarming).createEternalFarming(incentivekey, incentiveParams, pluginAddress, customDeployer);
    }

This function is responsible for setting up initial incentives for Algebra concentrated liquidity farms, it uses a hardcoded reward amount of 1e10 raw units. This fixed amount is then used to determine the rewardRate for the initial seeding of the Algebra farm (rewardRate = uint128(reward/remainingTimeInCurrentEpoch)).

The core issue is that 1e10 raw units represent a vastly different actual value and intended incentive level depending on the _rewardToken number of decimals:

  • For an 18-decimal token: 1e10 raw units is 0.00000001 of a full token. This is typically an insignificant “dust” amount.
  • For a 6-decimal token (e.g., USDC): 1e10 raw units is 10,000 full tokens ($10,000 if 1 token = $1).
  • For an 8-decimal token (e.g., WBTC): 1e10 raw units is 100 full tokens ($10,000,000 if 1 token = $100,000).

This fixed raw unit amount does not adapt to the specific _rewardToken being used for the gauge. As a result, if _rewardToken is low decimal token such as USDC or WBTC the resulting rewardRate will be astronomically high which cause a huge loss for the protocol.

Recommended mitigation steps

Modify the GaugeFactoryCL.createGauge function to accept an initial reward amount parameter. This allows the caller to specify an appropriate seed amount tailored to the specific _rewardToken, its decimals, and its value.

Blackhole mitigated

Status: Mitigation confirmed. Full details in reports from maxvzuvex.


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

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

The reward amount is hardcoded as 1e10 raw units without adjusting for the reward token's decimals, so the actual value varies wildly across tokens.

Impact

If the reward token has low decimals such as USDC or WBTC, the reward rate becomes astronomically high, causing a huge loss for the protocol.

What the attacker needed

Reward token has low decimals (e.g., USDC, WBTC); gauge creation uses createEternalFarming

The fix

The createGauge function should accept an initial reward amount parameter so the caller can specify an appropriate seed amount for the specific token.

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.

Smart contracts often use raw numbers to represent token amounts, and the number of decimals determines the actual value. A fixed number like 1e10 means a tiny amount for an 18-decimal token but a huge amount for a 6-decimal token like USDC. This bug means the protocol could accidentally give away far more tokens than intended when setting up farming rewards.

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 danzero

View all

1 more disclosed report, best first.

More from Blackhole

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.