Skip to main content

PairMath

Functions

getDualSidedMintLiquidityOutAmount

Refer to mint-math.md for more detail.

function getDualSidedMintLiquidityOutAmount(
uint256 totalLiquidity,
uint256 amountInA,
uint256 amountInB,
uint256 totalA,
uint256 totalB
) internal pure returns (uint256 liquidityOut);

getSingleSidedMintLiquidityOutAmountA

Refer to mint-math.md for more detail.

function getSingleSidedMintLiquidityOutAmountA(
uint256 totalLiquidity,
uint256 mintAmountA,
uint256 totalA,
uint256 totalB,
uint256 movingAveragePriceA
) internal pure returns (uint256 liquidityOut, uint256 swappedReservoirAmountB);

getSingleSidedMintLiquidityOutAmountB

Refer to mint-math.md for more detail.

function getSingleSidedMintLiquidityOutAmountB(
uint256 totalLiquidity,
uint256 mintAmountB,
uint256 totalA,
uint256 totalB,
uint256 movingAveragePriceA
) internal pure returns (uint256 liquidityOut, uint256 swappedReservoirAmountA);

getDualSidedBurnOutputAmounts

Refer to burn-math.md for more detail.

function getDualSidedBurnOutputAmounts(uint256 totalLiquidity, uint256 liquidityIn, uint256 totalA, uint256 totalB)
internal
pure
returns (uint256 amountOutA, uint256 amountOutB);

getSingleSidedBurnOutputAmountA

Refer to burn-math.md for more detail.

function getSingleSidedBurnOutputAmountA(
uint256 totalLiquidity,
uint256 liquidityIn,
uint256 totalA,
uint256 totalB,
uint256 movingAveragePriceA
) internal pure returns (uint256 amountOutA, uint256 swappedReservoirAmountA);

getSingleSidedBurnOutputAmountB

Refer to burn-math.md for more detail.

function getSingleSidedBurnOutputAmountB(
uint256 totalLiquidity,
uint256 liquidityIn,
uint256 totalA,
uint256 totalB,
uint256 movingAveragePriceA
) internal pure returns (uint256 amountOutB, uint256 swappedReservoirAmountB);

getProtocolFeeLiquidityMinted

Refer to fee-math.md for more detail.

function getProtocolFeeLiquidityMinted(uint256 totalLiquidity, uint256 kLast, uint256 k)
internal
pure
returns (uint256 liquidityOut);