Are you an LLM? Read llms.txt for a summary of the docs, or llms-full.txt for the full context.
Skip to content

Reference: sushi/evm V2 Pool

V2 pool exports provide deterministic local math for SushiSwap V2-style pools.

Exports

ExportPurpose
SushiSwapV2PoolPool class built from two token reserve amounts.
computeSushiSwapV2PoolAddressCompute pair address from factory/token/init code hash inputs.
V2 schemasSerialize/validate V2 pool data.

SushiSwapV2Pool

MemberPurpose
getAddress(tokenA, tokenB)Compute the SushiSwap V2 pool address (static).
constructor(amountA, amountB)Construct from current reserves.
liquidityTokenLP token representation.
swapGasCost, minLiquidityConstants used by pool logic.
involvesToken(token)Check whether token is in the pool.
token0Price, token1Price, priceOf(token)Mid-price helpers.
chainId, token0, token1, reserve0, reserve1Pool state accessors.
reserveOf(token)Reserve for a token.
getOutputAmount(inputAmount)Quote exact input and return updated pool.
getInputAmount(outputAmount)Quote exact output and return updated pool.
getLiquidityMinted(...)Compute LP tokens minted.
getLiquidityValue(...)Compute token value of LP liquidity.

Operations can throw for unsupported chains, token mismatches, zero reserves, insufficient input, insufficient reserves, or liquidity mismatches.