Swap / DEX·BNB Chain · Ethereum · Arbitrum · Base · Linea · zkSync Era · opBNB · Polygon zkEVM · Aptos
PancakeSwap
BNB Chain's largest DEX, expanded multi-chain. v2 is a Uniswap-v2-style AMM, v3 is concentrated liquidity, and PancakeSwap Infinity introduces a singleton pool manager with hooks (CLAMM and LBAMM pool types). The `@pancakeswap/smart-router` finds optimal cross-version routes.
- 01BNB Chain token swaps
- 02v3 concentrated liquidity LPing
- 03Infinity hook-powered pools
- 04multi-chain routing via Smart Router
- 05IFO / syrup pool launches
- pnpm add @pancakeswap/smart-router @pancakeswap/sdk @pancakeswap/v3-sdk viem
| Variable | Scope | Description |
|---|---|---|
| NEXT_PUBLIC_BNB_RPC_URL | Client | BNB Chain RPC URL used to query PancakeSwap factories, quoters, and the Universal Router. |
Use PancakeSwap for swaps and LPing across BNB Chain and supported EVM chains. With `@pancakeswap/smart-router`, call `SmartRouter.getBestTrade({ amount, currency, tradeType, gasPriceWei, allowedPoolTypes })` after fetching candidate pools via `SmartRouter.getV2CandidatePools`, `SmartRouter.getV3CandidatePools`, and `SmartRouter.getStableCandidatePools`. Encode calldata with `SwapRouter.swapCallParameters(trade, options)` and send to the PancakeSwap Universal Router (BNB: `0x1A0A18AC4BECDDbd6389559687d1A73d8927E416`) — for Infinity pools use the Infinity Universal Router. v3 pools are `(token0, token1, fee)` (fees: 100/500/2500/10000); the v3 `QuoterV2` provides on-chain quotes.
- ⚑Universal Router uses Permit2 — users approve Permit2 on the token once, then sign per-swap; calling ERC20 `approve` on the router itself doesn't work.
- ⚑The Smart Router routes across v2/v3/stable, but Infinity pools must be opted in via `allowedPoolTypes` and use a separate Infinity router; mixing the two requires the Infinity Universal Router.
- ⚑v3 has its own four fee tiers (1, 5, 25, 100 bps) — they don't match Uniswap v3 (5/30/100), so hardcoded UniV3 fee enums will silently miss the deepest pools.
- ⚑BSC produces blocks every ~3s and has aggressive sandwich bots; pass conservative `slippageTolerance` and consider private RPCs (e.g. Merkle, BloXroute) for large trades.
- ⚑CAKE token has multiple addresses across chains and the BNB-canonical CAKE is `0x0E09FaBB73Bd3Ade0a17ECC321fD13a19e81cE82` — bridged variants are not the canonical token and farms only recognize the chain-native CAKE.
- ⚑Syrup pools and v3 LP farms emit CAKE on a per-block basis; rewards stop when the pool's `bonusEndBlock` passes — re-stake into a fresh campaign or migrate to capture continued emissions.