Why does the price input automatically round?#
CenturionDEX v3 divides prices into intervals known as ticks. When you add liquidity, your input price always rounds to the nearest tick.
The tick spacing is double the size of the fee tier. For example, a tick for the 0.30% fee tier pool is 0.60% in size. This does not apply to the 0.01% fee tier, which has a size of 0.01%.
There is a tick for every price 1.0001^n, where n is an integer. This is the number generally quoted on exchanges and data sources, representing the price of 1 token0 relative to 1 token1.
Here are the pricing formulas:
price = 1.0001^tick
tick = floor( log(price) / log(1.0001) )Worked example#
A liquidity provider wants to deposit into a CTN/stablecoin pool with:
- the 0.30% fee tier
- a price range of 1,000 to 5,000 stablecoin per CTN
The nearest low-price tick for 1,000 is 207240. Applying the price formula gives a stablecoin price of 1000.302013.
The nearest high-price tick for 5,000 is 191160. Applying the price formula gives a stablecoin price of 4993.922001.
So with price inputs of 1,000 and 5,000, the position's price inputs round to 1000.3 and 4993.92 stablecoin per CTN.