1

When providing liquidity to an already-created Uniswap V3 pool, you are offered the option to provide liquidity across the price range [0,∞] (effectively performing as a Uniswap V2 LP position). My question is why is the created LP position assigned a tickLower of -887272 and tickUpper of 887272? I'm interested in why those specific tick values were chosen to represent the price range [0,∞].

1 Answer 1

2

In Uniswap V3, the formula for calculating the price from a given tick is the following:

enter image description here

By looking up Uniswap V3's codebase, we find that the price is represented by the variable sqrtPriceX96 of type uint160. Where:

enter image description here

And:

enter image description here

By using both formulas above and plugging in the maximum tick value of 887272, we find the following:

enter image description here

enter image description here

We know that in Solidity, the conventional way of representing the value of ∞ would be to use the maximum integer value allowed by a type. The max number we could obtain with a uint160(i.e. the type of sqrtPriceX96) is:

enter image description here

Therefore, we conclude that the chosen maximum tick of 887272 is just enough to produce a sqrtPriceX96 that is still lower than the maximum value allowed by the type uint160. And most likely, the minimum tick value of -887272 was chosen to represent a price of zero for symmetry.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.