For the complete documentation index, see llms.txt. This page is also available as Markdown.

PancakeSwap V2

The PancakeSwap V2 adapter reports an account's V2 LP across any pair as the dilution-adjusted pro-rata share of both reserves, emitted as one Supplied leg per token.

The PancakeSwap V2 adapter reports an account's V2 LP across any pair as the dilution-adjusted pro-rata share of both reserves, emitted as one Supplied leg per token. PancakeSwap V2 shares the Uniswap V2 Pair/Factory ABI and pro-rata math, so this is a thin subclass of the Uniswap V2 meta-adapter. It differs in two respects: the reported protocol slug, and its _mintFee protocol-fee fraction, which is not Uniswap's — it overrides the dilution coefficients accordingly. A single immutable meta-adapter serves every pair; the active pair set lives on NAVCalculator.

  • Type: Meta-adapter

  • protocolSubId: keccak256("pancakeswap-v2")

  • Instance key: the PancakeSwap V2 pair address, widened to bytes32.


Positions returned

Per pair instance, up to two legs:

Leg
PositionKind
isDebt
Description

token0 share

Supplied

false

Account's pro-rata share of reserve0

token1 share

Supplied

false

Account's pro-rata share of reserve1

Legs with zero amount, unregistered assets, or assets excluded by assetFilter are dropped.


Balance calculation

Flowchart of the PancakeSwap V2 balance adapter: read calls derive position legs into PositionBalance entries.
PancakeSwap V2 adapter — how the underlying balances reported to the NAV Calculator are derived.

Delegated to UniswapV2PairLib.pairAmounts(pair, account, ...), same as Uniswap V2 but with PancakeSwap's own _mintFee coefficients. The account's LP balance is converted to underlying reserves against an effective supply that includes the protocol fee LP the pair would mint on its next mint/burn:

with PancakeSwap V2's _mintFee coefficients (numFactor, rootKCoeff, rootKLastCoeff) = (8, 17, 8), overriding Uniswap's (1, 5, 1) via the _mintFeeConstants() hook:

PancakeSwap's protocol-fee fraction is larger than Uniswap's; using Uniswap's (1, 5, 1) constants would understate the dilution LP and slightly overstate the holder's reserve share whenever PancakeSwap's feeTo is set.

It is 0 when feeTo is unset, kLast == 0, or √k <= √kLast (read defensively).


Identity

  • positionId: abi.encode(address pair) — one positionId per pair instance (same schema as Uniswap V2).

  • positionKind: Supplied for both legs.

There is no labels field on the position. The adapter implements positionLabels(positionId), which returns ["AMM Liquidity Pool", "sym0/sym1"] from the pair's on-chain token symbols — surfaced only by the verbose reads (getAccountPositionsVerbose / getAccountNavVerbose); the full breadcrumb is [protocolName, ...labels].


Constructor

Parameter
Description

navCalculator_

NAVCalculator contract for asset-registry access

No protocol addresses are pinned — every pair is self-describing.


Registration

Register the adapter once with addMetaBalanceAdapter, then enable each pair with addMetaInstances. The instance coordinate is the PancakeSwap V2 pair address widened to bytes32. The adapter holds no instance state — it reads its active set from NAV_CALCULATOR.getMetaInstances(address(this)).

Last updated