Closed Cazs03 closed 2 years ago
Property sqrtPriceX96 It is supposed to be the price of the token.
Reading the docs https://docs.uniswap.org/sdk/guides/fetching-prices And similar post https://github.com/Uniswap/v3-sdk/issues/40
I am trying to convert the value to human readable format. But I can't find documentation or references to do it with the etherjs library.
SOLVED: var tokenPrice0 = sqrtPriceX96 2 / 2 192; //token0 var tokenPrice1 = 2 192 / sqrtPriceX96 2; // WETH
Property sqrtPriceX96 It is supposed to be the price of the token.
Reading the docs https://docs.uniswap.org/sdk/guides/fetching-prices And similar post https://github.com/Uniswap/v3-sdk/issues/40
I am trying to convert the value to human readable format. But I can't find documentation or references to do it with the etherjs library.
SOLVED:
var tokenPrice0 = sqrtPriceX96 2 / 2 192; //token0 var tokenPrice1 = 2 192 / sqrtPriceX96 2; // WETH