Tick to square-root price
get_sqrt_price_at_tick starts from the fixed-point unit and conditionally multiplies precomputed constants according to the absolute tick’s bits. Positive and negative ticks use reciprocal directions.
The function supports the configured domain from -400000 through 400000. Sentinel ticks lie outside the position domain and are list anchors, not price boundaries for user positions.
Square-root price to tick
get_tick_at_sqrt_price:
- Finds the most significant bit.
- Normalizes the value into the expected fixed-point interval.
- Computes fractional logarithm bits.
- Divides by the logarithm of the tick base.
- Checks the next tick boundary.
- Corrects a possible one-tick high estimate.
Pool creation interval
Pool creation does not accept an arbitrary tick and price pair. Forinitial_tick = t, it requires:
MAX_TICK.