Integration

BnbX Launchpad Docs

Integrate BnbX Launch on BNB Chain — launch tokens, trade on the bonding curve, and route post-graduation swaps through Uniswap V3 or BnbX.

Deployed contracts

Each launch also deploys a unique BondingCurve and Bnbx via CREATE2. Token addresses always end in …056.

Architecture

  1. Launch — call BnbxFactory.createLaunch to deploy curve + token.
  2. Bonding curve — users buy/sell on the curve until 13.5 BNB is raised (2% trade fee).
  3. Graduation — when the 13.5 BNB target is reached, ~13.16 BNB seeds a Uniswap V3 pool whose LP is locked permanently in BnbX Vault; the small remainder covers the BnbX Vault lock and splits 80% creator / 20% platform.
  4. LP fees — the graduation LP is locked in BnbX Vault forever, but its Uniswap V3 trading fees never stop accruing and stay claimable for as long as the pool trades (collectFees() has no time gate): token side burned, WBNB side split 80% creator / 20% platform on each collect.
  5. DEX trading — after graduation, trade the token/WBNB pool on canonical Uniswap V3 (1% tier) or via BnbX.

Fees & custody. BnbX is non-custodial — every create, buy, sell, and graduation runs on-chain straight from your wallet, and the platform contract never holds your funds. Fees settle directly: the 0.0016 BNB launch fee and the platform's 1% of the 2% curve trade tax go to the fee wallet, the creator's matching 1% to the creator, and the graduation cut splits per the waterfall above. Because the LP is locked without a time gate, the position itself can never be withdrawn — only its trading fees are ever collected, and those keep flowing 80% creator / 20% platform.

1. Launch a token

Call createLaunch on the launchpad. Pay at least 0.0016 BNB launch fee; any extra BNB in the same tx is used as an optional creator dev-buy.

// BnbxFactory.createLaunch
function createLaunch(
  string name,
  string symbol,
  string metadataURI,   // ipfs:// or https:// JSON with name, symbol, image, socials
  uint256 minTokensOut, // slippage guard for optional dev-buy (0 if no dev-buy)
  bytes32 curveSalt,    // CREATE2 salt — curve address must end in 056
  bytes32 tokenSalt     // CREATE2 salt — token address must end in 056
) external payable returns (address curve, address token);

// Example (viem / wagmi)
await writeContract({
  address: "0x0000000000000000000000000000000000000000",
  abi: launchpadAbi,
  functionName: "createLaunch",
  args: [name, symbol, metadataURI, 0n, curveSalt, tokenSalt],
  value: parseEther("0.0016"), // launch fee only
});

Read launch metadata: launchpad.launches(launchId) or launchpad.curveToLaunchId(curve). Resolve token → curve: Bnbx(token).curve().

2. Buy on bonding curve (pre-graduation)

Send BNB to the curve's buy function. 2% fee is taken (1% platform BNB + 1% creator BNB accrued from curve trading).

// BondingCurve.buy — curve must not be graduated
function buy(uint256 minTokensOut) external payable;

await writeContract({
  address: curveAddress,
  abi: bondingCurveAbi,
  functionName: "buy",
  args: [minTokensOut],
  value: parseEther("0.1"),
});

// Quote before sending
const [tokensOut] = await readContract({
  address: curveAddress,
  abi: bondingCurveAbi,
  functionName: "quoteBuy",
  args: [parseEther("0.1")],
});

3. Sell on bonding curve (pre-graduation)

Approve the curve to spend tokens, then call sell.

// 1. Approve curve to spend tokens
await writeContract({
  address: tokenAddress,
  abi: erc20Abi,
  functionName: "approve",
  args: [curveAddress, tokenAmount],
});

// 2. Sell
function sell(uint256 tokenAmount, uint256 minEthOut) external;

await writeContract({
  address: curveAddress,
  abi: bondingCurveAbi,
  functionName: "sell",
  args: [tokenAmount, minEthOut],
});

4. Trade after graduation (Uniswap V3)

Once curve.graduated() == true, trade the token/WBNB pool directly on canonical Uniswap V3 (the pool is created at graduation with the 1% fee tier).

// Post-graduation trading is plain canonical Uniswap V3 — pool: token/WBNB, 1% fee tier.
const SWAP_ROUTER = "0xB971eF87ede563556b2ED4b1C0b0019111Dd85d2"; // canonical SwapRouter02

await writeContract({
  address: SWAP_ROUTER,
  abi: swapRouter02Abi,
  functionName: "exactInputSingle",
  args: [{
    tokenIn: WUSDT0, tokenOut: tokenAddress, fee: 10000,
    recipient: me, amountIn, amountOutMinimum, sqrtPriceLimitX96: 0n,
  }],
});

5. Read on-chain state

// BondingCurve views
curve.token()            // Bnbx address
curve.creator()          // launch creator
curve.graduated()        // true after migration
curve.uniswapPool()      // V3 pool (zero before grad)
curve.currentPrice()     // spot price in wei per token
curve.tokensRemaining()  // unsold sale inventory (800M cap)
curve.ethCollected()     // net BNB in curve
curve.tokensSold()
curve.graduationTarget() // 13.5 BNB target

// Bnbx
token.curve()            // bonding curve address

// Creator fees accrue on the CURVE in native BNB (1% of every trade) —
curve.claimCreatorFees() // permissionless; pays the accrued fees to the creator

6. Index trades (events)

Pre-graduation trades emit on the curve contract:

event Buy(address indexed buyer, uint256 ethIn, uint256 tokensOut, uint256 newPrice);
event Sell(address indexed seller, uint256 tokensIn, uint256 ethOut, uint256 newPrice);
event DevBuy(address indexed creator, uint256 ethIn, uint256 tokensOut, uint256 newPrice);
event Graduated(address pool, uint256 ethLiquidity, uint256 tokenLiquidity, uint256 ethToDev);

// Launchpad
event LaunchCreated(uint256 indexed launchId, address curve, address token, address creator, string name, string symbol);

Fetch historical logs from the explorer or any RPC eth_getLogs against the curve address.

7. Token supply & curve math

  • Total supply: 1,000,000,000 tokens
  • Bonding curve sale: 800,000,000 tokens
  • Uniswap LP allocation: 200,000,000 tokens (minted to curve, migrated at graduation)
  • Virtual reserves: 4.606875 BNB + 1,073,000,000 virtual tokens (constant-product AMM)
  • Graduation target: 13.5 BNB net collected