v3-info icon indicating copy to clipboard operation
v3-info copied to clipboard

Fix ticks prices decimals

Open NicolasMahe opened this issue 3 years ago • 1 comments

This PR fixes the number of decimals used to calculate the ticks' prices.

It was harcoded to use only 4 decimals, now it uses the token's decimals.

The tick's price1 is used to calculate the TVL locked amount0. The loss of precision is causing the amount0 to be incorrectly calculated.

https://github.com/Uniswap/uniswap-v3-info/blob/93eaaf001dbcc4981c3605f2ac8ad3593e310f8c/src/components/DensityChart/index.tsx#L162

I also replaced the formatting of prices that used toLocaleString with formatAmount(priceX, 4)

NicolasMahe avatar Aug 20 '21 08:08 NicolasMahe

@NicolasMahe is attempting to deploy a commit to the Uniswap Team on Vercel.

A member of the Team first needs to authorize it.

vercel[bot] avatar Aug 20 '21 08:08 vercel[bot]