PancakeSwap V3
A meta-adapter that reports an account's PancakeSwap V3 concentrated-liquidity LP across every configured pool — the in-range liquidity (Supplied) and the full uncollected fees (Fees) of each NFT posi
A meta-adapter that reports an account's PancakeSwap V3 concentrated-liquidity LP — both the in-range liquidity (Supplied) and the full uncollected fees (Fees) of every NFT position the account holds. PancakeSwap V3 is a Uniswap V3 fork; this adapter subclasses the Uniswap V3 meta-adapter. It differs in exactly two ways: it reports the pancakeswap-v3 brand/product slug instead of uniswap-v3, and it overrides the _slot0 read to handle PancakeSwap's ABI divergence (below). Everything else — the on-chain NPM enumeration, the live-slot0 pricing, the full-fee accounting, the per-pool fault isolation — is identical.
Type: Meta-adapter
protocolSubId:
keccak256("pancakeswap-v3")(brandpancakeswap, ecosystempancakeswap-v3)Instance key: the PancakeSwap V3 pool address, widened to bytes32.
This subclass overrides the _slot0 read because PancakeSwap declares slot0().feeProtocol as uint32 vs Uniswap's uint8, so the strict full-tuple decode needs a PancakeSwap-specific ABI. The base reads the pool's live slot0 to compute instantaneous in-range amounts, so this override is what lets the shared valuation path work unchanged against PancakeSwap pools. It changes how the tuple is decoded, not which price is used.
Positions returned
Per NFT the account holds in a configured pool, up to four legs (token0/token1 × liquidity/fees):
token0 liquidity
Supplied
false
false
token0 amount of the position's in-range liquidity
token1 liquidity
Supplied
false
false
token1 amount of the position's in-range liquidity
token0 fees
Fees
false
false
Full uncollected token0 fees (settled tokensOwed0 + feeGrowthInside delta)
token1 fees
Fees
false
false
Full uncollected token1 fees (settled tokensOwed1 + feeGrowthInside delta)
Both pool tokens must be registered in NAVCalculator or the whole instance is dropped (the liquidity split needs both prices). Each pool's fan-out is isolated by the meta base's per-instance try/catch, so a bad/unfeeded instance discards only that pool, never the account's whole LP set. Legs with zero amount, or assets excluded by assetFilter, are dropped. isLocked is false for every leg. The NFT tokenId rides in each leg's positionInstanceId. Per-account discovery is bounded by MAX_POSITIONS (1000) — see Uniswap V3.
Balance calculation
Identical to Uniswap V3, except for the _slot0 decode override. For each configured pool the adapter enumerates the account's NPM NFTs, keeps those in the pool, reads NPM.positions(tokenId) and the pool's live slot0, and derives the legs via UniswapV3PoolLib.positionAmounts(...).
Liquidity legs (Supplied) — the in-range token0/token1 amounts computed from the pool's live slot0 price (sqrtPriceX96, tick) — the instantaneous on-chain withdrawable split. See the Uniswap V3 note on why reading the live spot is safe under the async NAV-consumer model.
Fee legs (Fees) — the full uncollected fees: settled tokensOwed0 / tokensOwed1 plus the feeGrowthInside delta accrued since the position's last interaction, from the pool's current tick.
Identity
positionId:
abi.encode(address pool)— the pool address (the instance coordinate). Each fee tier is its own pool; all of an account's NFTs in the same pool share one positionId and sum.positionInstanceId:
bytes32(tokenId)— the NFT id, the ephemeral per-item handle (excluded from the identity key); not inpositionIdand not inlabels.positionKind:
Suppliedfor liquidity legs,Feesfor fee legs.labels: there is no
labelsfield on the position. The adapter implementspositionLabels(positionId), which returns["AMM Liquidity Pool", "<sym0>/<sym1> <fee>%"]— token symbols + fee tier read live from the pool, surfaced only by the verbose reads.
Constructor
positionManager_
The PancakeSwap V3 NonfungiblePositionManager (canonical CREATE2 address) — the chain-level constant. Must be a contract
navCalculator_
NAVCalculator contract for asset-registry access. Must be a contract
The pool addresses are not pinned — they are the governed instance set on NAVCalculator. Like its base, this adapter is GPL-2.0-or-later (it links the Uniswap V3 math libraries).
Registration
Register the adapter once with addMetaBalanceAdapter(adapter, pools), then enable each pool with addMetaInstances(adapter, pools) and drop coverage with removeMetaInstances. The instance coordinate is the PancakeSwap V3 pool address widened to bytes32. The adapter reads its active set from NAV_CALCULATOR.getMetaInstances(address(this)). See Meta balance adapters.
Last updated