Tick
Contains functions for managing tick processes and relevant calculations
Functions
tickSpacingToMaxLiquidityPerTick
Derives max liquidity per tick from given tick spacing
Executed within the pool constructor
Parameters:
Name | Type | Description |
---|---|---|
| int24 | The amount of required tick separation, realized in multiples of |
Return Values:
Type | Description |
---|---|
uint128 | max liquidity per tick |
getFeeGrowthInside
Retrieves fee growth data
Parameters:
Name | Type | Description |
---|---|---|
| mapping(int24 => struct Tick.Info) | The mapping containing all tick information for initialized ticks |
| int24 | The lower tick boundary of the position |
| int24 | The upper tick boundary of the position |
| int24 | The current tick |
| uint256 | The all-time global fee growth, per unit of liquidity, in token0 |
| uint256 | The all-time global fee growth, per unit of liquidity, in token1 |
Return Values:
Name | Type | Description |
---|---|---|
| uint256 | The all-time fee growth in token0, per unit of liquidity, inside the position's tick boundaries |
| uint256 | The all-time fee growth in token1, per unit of liquidity, inside the position's tick boundaries |
update
Updates a tick and returns true if the tick was flipped from initialized to uninitialized, or vice versa
Parameters:
Name | Type | Description |
---|---|---|
| mapping(int24 => struct Tick.Info) | The mapping containing all tick information for initialized ticks |
| int24 | The tick that will be updated |
| int24 | The current tick |
| int128 | A new amount of liquidity to be added (subtracted) when tick is crossed from left to right (right to left) |
| uint256 | The all-time global fee growth, per unit of liquidity, in token0 |
| uint256 | The all-time global fee growth, per unit of liquidity, in token1 |
| bool | true for updating a position's upper tick, or false for updating a position's lower tick |
| uint128 | The maximum liquidity allocation for a single tick |
Return Values:
Name | Type | Description |
---|---|---|
| bool | Whether the tick was flipped from initialized to uninitialized, or vice versa |
clear
Clears tick data
Parameters:
Name | Type | Description |
---|---|---|
| mapping(int24 => struct Tick.Info) | The mapping containing all initialized tick information for initialized ticks |
| int24 | The tick that will be cleared |
cross
Transitions to next tick as needed by price movement
Parameters:
Name | Type | Description |
---|---|---|
| mapping(int24 => struct Tick.Info) | The mapping containing all tick information for initialized ticks |
| int24 | The destination tick of the transition |
| uint256 | The all-time global fee growth, per unit of liquidity, in token0 |
| uint256 | The all-time global fee growth, per unit of liquidity, in token1 |
Return Values:
Name | Type | Description |
---|---|---|
| int128 | The amount of liquidity added (subtracted) when tick is crossed from left to right (right to left) |
Last updated