PoolLib
Functions
uniqueOrderedTicksCheck
Check to ensure that the ticks are in ascending order and amount array is same length as tick array.
Parameters
binReserves
Compute bin reserves assuming the bin is not merged; not accurate reflection of reserves for merged bins.
Parameters
Returns
binReserves
Compute bin reserves assuming the bin is not merged; not accurate reflection of reserves for merged bins.
Parameters
reserveValue
Reserves of a bin in a tick.
Parameters
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