Skip to content
Business logic Audit finding Intermediate

Pair pre-creation disables Launchpad rewards hooks leading to no fees accrued or distributed

The pair factory only sets the Launchpad fee hooks when the Launchpad itself creates the token/quote pair; if anyone else creates that pair first, it becomes the canonical pair with zero hooks. As a result, the market never accrues or distributes Launchpad rewards to stakers.

0xAsen Follow with 0rpse, 0x_DyDx and 36 others

Originally disclosed on Code4rena

Submitted by 0xAsen, also found by 0rpse, 0x_DyDx, 0xanony, 0xMilenov, 0xNaN, 0xsai, aestheticbhai, Almanax, anchabadze, AvantGard, Bale, ChainSentry, codegpt, deccs, dimulski, EtherEngineer, gesha17, gizzy, jesjupyter, JuggerNaut63, lodelux, magbeans9, magiccentaur, metaBug, nonso72, PotEater, princekay, prk0, ret2basic, romans, saraswati, serial-coder, Stormy, Tofu, tralalelotralala, udogodwin, Web3Vikings, and ZeroEx

launchpad/uniswap/GTELaunchpadV2PairFactory.sol #L36-L37

The factory initializes Launchpad fee hooks (launchpadLp, launchpadFeeDistributor) only when createPair(tokenA, tokenB) is called by the Launchpad.

If anyone else creates the (token, quote) pair first, the factory initializes the pair with both hooks set to zero and locks it in getPair.

At graduation, liquidity is necessarily added to this canonical pair.

In the pair contract, fee accrual and forwarding to the Distributor are gated on launchpadFeeDistributor > 0, so no rewards ever accrue or distribute for that market, permanently.

Intended vs. actual logic

  • Intended: After graduation, the canonical pair accrues a Launchpad fee share and forwards it to the Distributor for stakers.
  • Actual: If the pair was pre-created by a non-Launchpad caller, the hooks are zero; the canonical market never accrues or forwards rewards.

Preconditions

  • Time window: any time before graduation.
  • Attacker only needs to call factory.createPair(token, quote). No token transfers / approvals required (pair creation deploys an empty pair; adding liquidity happens later).
  • Launchpad cannot recreate the pair later because getPair is already set (PAIR_EXISTS).

Root cause

(1) Caller-conditioned initialization in the factory

// GTELaunchpadV2PairFactory.createPair(...)
(address _lp, address _dist) =
    msg.sender == launchpad ? (launchpadLp, launchpadFeeDistributor) : (address(0), address(0));
bytes32 salt = keccak256(abi.encodePacked(token0, token1, _lp, _dist));
IUniswapV2Pair(pair).initialize(token0, token1, _lp, _dist);
getPair[token0][token1] = pair; // canonical

A non-Launchpad caller produces a pair permanently initialized with _lp = 0, _dist = 0, and locks it as canonical.

(2) Hard gating in the pair

// GTELaunchpadV2Pair.swap(...)
( uint112 fee0, uint112 fee1 ) =
    launchpadFeeDistributor > address(0) && rewardsPoolActive > 0
      ? _getLaunchpadFees(amount0In, amount1In)
      : (uint112(0), uint112(0));

// GTELaunchpadV2Pair._update(...)
if (launchpadFeeDistributor > address(0)) {
    if (totalLaunchpadFee0 | totalLaunchpadFee1 > 0) {
        delete accruedLaunchpadFee0;
        delete accruedLaunchpadFee1;
        _distributeLaunchpadFees(totalLaunchpadFee0, totalLaunchpadFee1);
    }
}

With launchpadFeeDistributor == 0, the pair never computes Launchpad fees and never calls _distributeLaunchpadFees.

Impact

  • Permanent reward suppression: All swaps in the market generate zero Launchpad rewards forever.
  • Trustless & cheap: Single pre-creation tx, no approvals, no liquidity needed.
  • Economic harm: Eliminates long-term reward stream to stakers (unbounded value depending on trading volume).

Scenario-based PoC

  • Pre-create pair from a non-Launchpad EOA -> factory.getPair(token, quote) points to the attacker-created pair.
  • Querying launchpadLp()/launchpadFeeDistributor() either reverts (vanilla pair, no hooks) or returns 0x0 (GTE pair created by non-Launchpad).
  • Attempting to re-create the pair from the Launchpad reverts with PAIR_EXISTS.

This is what the Foundry test test_submissionValidity() in the next section demonstrates.

Recommended mitigation steps

Restrict createPair for Launchpad markets to Launchpad only or always pass real launchpadLp and launchpadFeeDistributor to initialize(...) regardless of caller.

View detailed Proof of Concept


The original report as published on Code4rena, by 0xAsen. 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 factory decides whether to set the Launchpad fee hooks based on who calls createPair, and once a pair is stored in getPair it cannot be replaced.

Impact

All swaps in that market generate zero Launchpad rewards forever, removing the long-term reward stream to stakers; the attack is cheap and needs no approvals or liquidity.

What the attacker needed

Any time before graduation; no token transfers or approvals needed

The fix

The factory should restrict createPair for Launchpad markets to the Launchpad only, or always pass the real Launchpad fee hook addresses to initialize regardless of caller.

How it was found

  1. Before graduation, call the factory's createPair with the token and quote addresses from an account that is not the Launchpad.
  2. Observe that getPair now points to this attacker-created pair.
  3. Check that the pair's Launchpad fee hook addresses are zero or that the call reverts.
  4. Try to create the same pair from the Launchpad and see it revert with PAIR_EXISTS.

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 trading pair is a smart contract that holds two tokens and lets people swap between them. The factory that creates these pairs only attaches the reward-paying parts when the official Launchpad asks for the pair; if an ordinary user asks first, the pair is created without those parts and is then treated as the official one forever. Because the reward code checks for those missing parts, no trading fees are ever set aside for stakers.

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 0xAsen

View all

17 more disclosed reports, best first.

More from GTE Perps and Launchpad

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.