TickMath
Functions
tickSqrtPrices
Compute the lower and upper sqrtPrice of a tick.
Parameters
Name | Type | Description |
---|---|---|
|
| The tick spacing used for calculations. |
|
| The input tick value. |
subTickIndex
Compute the base tick value from the pool tick and the tickSpacing. Revert if base tick is beyond the max tick boundary.
Parameters
Name | Type | Description |
---|---|---|
|
| The tick spacing used for calculations. |
|
| The input tick value. |
tickSqrtPrice
Calculate the square root price for a given tick and tick spacing.
Parameters
Name | Type | Description |
---|---|---|
|
| The tick spacing used for calculations. |
|
| The input tick value. |
Returns
Name | Type | Description |
---|---|---|
|
| The square root price. |
getTickL
Calculate liquidity of a tick.
Parameters
Name | Type | Description |
---|---|---|
|
| Tick reserve of token A. |
|
| Tick reserve of token B. |
|
| The square root price of the lower tick edge. |
|
| The square root price of the upper tick edge. |
getSqrtPrice
Calculate square root price of a tick. Returns left edge of the tick if the tick has no reserves.
Parameters
Name | Type | Description |
---|---|---|
|
| Tick reserve of token A. |
|
| Tick reserve of token B. |
|
| The square root price of the lower tick edge. |
|
| The square root price of the upper tick edge. |
|
|
Returns
Name | Type | Description |
---|---|---|
|
| The calculated square root price. |
getTickSqrtPriceAndL
Calculate square root price of a tick. Returns left edge of the tick if the tick has no reserves.
Parameters
Name | Type | Description |
---|---|---|
|
| Tick reserve of token A. |
|
| Tick reserve of token B. |
|
| The square root price of the lower tick edge. |
|
| The square root price of the upper tick edge. |
Returns
Name | Type | Description |
---|---|---|
|
| The calculated square root price. |
|
| The calculated liquidity. |
Errors
TickMaxExceeded
Last updated