Skip to content

"Calculating Liquidity" formula question #38

Discussion options

You must be logged in to vote

The sqrtps are stored as Q64.96. To get back to a "normal" number (not in Q64.96), you need to "compensate" for that q96 conversion.

For liquidity0(), you have two sqrtps multiplied together in the numerator, one of them is cancelled out by the lot of sqrtp in the denominator, so there is still one conversion of q96 left to be "compensated" for, and thus you just divide by q96 to cancel it out.

For liquidity1(), you only have the lot of sqrtp in the denominator, and to compensate for that you multiply by q96 to cancel it out.

For the decimals, I think it's just for simplicity that 18 decimals are assumed for both tokens, and thus it's not the real USDC ERC20 definition. If you want to use…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by Jeiwan
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants