Overview of how Ticks work on Duality
Ticks serve as a way to index and store liquidity data as well and a convenient way to price liquidity. Each token pair consists of a unique tick for every integer between -X and +X. The price of liquidity being stored at tick
is determined by the function:
- Price of tick
- Price of tick:
- Price of tick 2:
Among other benefits, building ticks in this way is a natural way to scale tick growth based on the tick number. Additionally this is how Uniswap V3's ranged liquidity is spaced so it would be natural to add ranged liquidity in as an additional option to LPing if governance votes to do so.
Each tick number maps to liquidity that can be traded at that price.
Each token pair has two current ticks, one for each direction. The current tick tells the module what is the best priced liquidity that can be swapped through. On a swap, once the liquidity at the current tick is swapped through completely, the next best priced tick with liquidity in it is found and updated to be the current tick.