PoolLib
Functions
uniqueOrderedTicksCheck
Check to ensure that the ticks are in ascending order and amount array is same length as tick array.
Parameters
ticks
int32[]
An array of int32 values representing ticks to be checked.
amountsLength
uint256
Amount array length.
binReserves
Compute bin reserves assuming the bin is not merged; not accurate reflection of reserves for merged bins.
Parameters
bin
IMaverickV2Pool.BinState
The storage reference to the state for this bin.
tick
IMaverickV2Pool.TickState
The memory reference to the state for this tick.
Returns
reserveA
uint128
The reserve amount for token A.
reserveB
uint128
The reserve amount for token B.
binReserves
Compute bin reserves assuming the bin is not merged; not accurate reflection of reserves for merged bins.
Parameters
tickBalance
uint128
Bin's balance in the tick.
tickReserveA
uint128
Tick's tokenA reserves.
tickReserveB
uint128
Tick's tokenB reserves.
tickTotalSupply
uint128
Tick total supply of bin balances.
reserveValue
Reserves of a bin in a tick.
Parameters
tickReserve
uint128
Tick reserve amount in a given token.
tickBalance
uint128
Bin's balance in the tick.
tickTotalSupply
uint128
Tick total supply of bin balances.
deltaTickBalanceFromDeltaLpBalance
Calculate delta A, delta B, and delta Tick Balance based on delta LP balance and the Tick/Bin state.
_setRequiredDeltaReservesForEmptyTick
Calculates deltaA = liquidity * (sqrt(upper) - sqrt(lower))
Calculates deltaB = liquidity / sqrt(lower) - liquidity / sqrt(upper),
i.e., liquidity * (sqrt(upper) - sqrt(lower)) / (sqrt(upper) * sqrt(lower))
we set liquidity = deltaLpBalance / (1.0001^(tick * tickspacing) - 1)
which simplifies the A/B amounts to:
deltaA = deltaLpBalance * sqrt(lower)
deltaB = deltaLpBalance / sqrt(upper)
Structs
AddLiquidityInfo
Last updated