Component: cetus_clmm/tick.move
Description
The tick module is responsible for managing ticks within pools using the TickManager. Each tick contains price information, liquidity amounts, and growth data for fees, points, and rewards. The module provides functionality to create, modify, and remove ticks as well as query tick data across specific price ranges. These ticks serve as boundaries for liquidity positions and are crucial for the concentrated-liquidity mechanism. The module tracks liquidity changes at each tick, fee accumulation, and reward distribution. When swaps cross price thresholds, the module updates liquidity and fee accounting of the ticks.
Invariants
For any tick,
liquidity_grossmust be positive. When it reaches zero, the tick is removed from the tick list.Fee and reward accounting must remain accurate across all tick crossings.
When a tick is crossed during a swap, its fee and reward-growth values are properly updated.
The fee and reward-growth parameters cannot be manipulated directly, as access is restricted by the
friendmodifier to ensure only the pool module can call functions requiring these parameters.
Test coverage
Cases covered
Tick initialization and default values
Liquidity addition to ticks (
increase_liquidity)Liquidity removal from ticks (
decrease_liquidity)Tick crossing during swaps
Fee, point, and reward calculation within specific tick ranges
Tick-spacing validation
Points calculation for reward distribution