Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ticks prices decimals #129

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

NicolasMahe
Copy link

@NicolasMahe NicolasMahe commented Aug 20, 2021

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)

@vercel
Copy link

vercel bot commented Aug 20, 2021

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

A member of the Team first needs to authorize it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants