PoolLib
Last updated
Last updated
Check to ensure that the ticks are in ascending order and amount array is same length as tick array.
Parameters
Name | Type | Description |
---|---|---|
Compute bin reserves assuming the bin is not merged; not accurate reflection of reserves for merged bins.
Parameters
Name | Type | Description |
---|---|---|
Returns
Compute bin reserves assuming the bin is not merged; not accurate reflection of reserves for merged bins.
Parameters
Reserves of a bin in a tick.
Parameters
Calculate delta A, delta B, and delta Tick Balance based on delta LP balance and the Tick/Bin state.
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)
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
ticks
int32[]
An array of int32 values representing ticks to be checked.
amountsLength
uint256
Amount array length.
bin
IMaverickV2Pool.BinState
The storage reference to the state for this bin.
tick
IMaverickV2Pool.TickState
The memory reference to the state for this tick.
reserveA
uint128
The reserve amount for token A.
reserveB
uint128
The reserve amount for token B.
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.
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.