Skip to content
Business logic Audit finding Intermediate

Unsynchronized LaunchpadLPVault address leading to Loss of fee to Stakers of new launchPad token

The Launchpad contract can change its LP vault address, but the pair factory stores the vault address immutably. New pairs created after the update therefore calculate fees using the old vault while LP tokens are sent to the new vault, so no fees accrue for those pairs.

gizzy Follow with 0xMilenov, AvantGard and 2 others

Originally disclosed on Code4rena

Submitted by gizzy, also found by 0xMilenov, AvantGard, Bale, and nem0TheFinder

launchpad/Launchpad.sol #L414

The Launchpad contract can update its launchpadLPVault address, but the GTELaunchpadV2PairFactory has an immutable launchpadLp field. This creates a desynchronization where new pairs created after vault update reference the old vault for fee calculations while LP tokens go to the new vault, resulting in zero fee accrual for all new pairs.

Root Cause Analysis

The Problem

  1. Immutable Factory Settings: GTELaunchpadV2PairFactory.launchpadLp is immutable and set during deployment
  2. Mutable Launchpad Settings: Launchpad.launchpadLPVault can be updated via updateLaunchpadLPVault()
  3. Pair Fee Calculation: Pairs use their stored launchpadLp (from factory) to calculate fee shares
  4. Result: After vault update, new pairs reference the old vault but LP tokens go to the new vault during adding of liquidity, creating a mismatch

GTELaunchpadV2PairFactory.sol:9-10

address immutable launchpadLp;
address immutable launchpadFeeDistributor;

GTELaunchpadV2PairFactory.sol:36-37

(address _launchpadLp, address _launchpadFeeDistributor) =
    msg.sender == launchpad ? (launchpadLp, launchpadFeeDistributor) : (address(0), address(0));

GTELaunchpadV2Pair.sol:282-285

uint256 launchpadLpBal = this.balanceOf(launchpadLp) + MINIMUM_LIQUIDITY;

if (amount0In > 0) fee0 = uint112(amount0In.mul(REWARDS_FEE_SHARE).mul(launchpadLpBal) / (totalLpBal * 1000));
if (amount1In > 0) fee1 = uint112(amount1In.mul(REWARDS_FEE_SHARE).mul(launchpadLpBal) / (totalLpBal * 1000));

sends lp to the updated launchpadLPVault

Launchpad.sol:414-416

function updateLaunchpadLPVault(address newLaunchpadLPVault) external onlyOwner {
    launchpadLPVault = LaunchpadLPVault(newLaunchpadLPVault);
}

    function _createPairAndSwapRemaining(
        address token,
        IUniswapV2Pair pair,
        LaunchData memory data,
        uint256 remainingBase,
        uint256 remainingQuote,
        address recipient
    ) internal returns (uint256 additionalQuoteUsed) {
       //rest of the code

        uniV2Router.addLiquidity({
            tokenA: token,
            tokenB: address(data.quote),
            amountADesired: tokensToLock,
            amountBDesired: quoteToLock,
            amountAMin: 0,
            amountBMin: 0,
            to: address(launchpadLPVault),
            deadline: block.timestamp
        });

        //rest of the code

}

Impact Analysis

  • Zero fee accrual after vault update (100% loss of launchpad rewards) for new pair
  • Breaks Protocol Accounting

Recommended mitigation steps

// In Launchpad.sol
function updateLaunchpadLPVault(address newLaunchpadLPVault) external onlyOwner {
    launchpadLPVault = LaunchpadLPVault(newLaunchpadLPVault);

    // Update factory settings
    if (address(uniV2Factory) != address(0)) {
        GTELaunchpadV2PairFactory(address(uniV2Factory)).updateLaunchpadSettings(
            address(launchpadLPVault),
            address(distributor)
        );
    }
}

View detailed Proof of Concept


The original report as published on Code4rena, by gizzy. 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's launchpadLp address is immutable while the Launchpad's launchpadLPVault is mutable, so the two fall out of sync after an update.

Impact

New pairs created after the vault update accrue zero launchpad fees, causing a 100% loss of launchpad rewards for those pairs and breaking protocol accounting.

What the attacker needed

Owner updates the LP vault address; a new pair is created afterwards

The fix

The update function should also call the factory to update its launchpad settings so both contracts point to the same vault.

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 called the Launchpad can point to a new vault (a contract that holds funds) for liquidity tokens. But a separate factory contract that creates trading pairs has the old vault address baked in and cannot change it. So new pairs look at the old vault when working out fees, find nothing there, and the people who staked tokens earn nothing from those pairs.

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 gizzy

View all

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