Skip to content
This repository has been archived by the owner on Aug 29, 2023. It is now read-only.

Fix liquidity price conversion and fees calculation #15

Merged
merged 4 commits into from Mar 15, 2021
Merged

Fix liquidity price conversion and fees calculation #15

merged 4 commits into from Mar 15, 2021

Conversation

benber86
Copy link
Contributor

@benber86 benber86 commented Mar 15, 2021

Fix 1: The values displayed on the user account chart for liquidity on specific pools were equal to avax_amount * avax_price * avax_price instead of just avax_amonut * avax_price due to a race condition (#13). This fixes it

Fix 2: This is for an issue originally raised on Uniswap. The Pangolin code is the same so the issue is also present here.
If an account is the first to provide liquidity on a pair, the calculation of their ownership of the pool when they entered it will return a NaN because it will try to divide by a liquidityTokenTotalSupply that is equal to 0. The ownership NaN at t0 will then affect all subsequent calculations, including the sum of fees. Consequently the fees will not be displayed on the interface. Note: this should not affect #14 on which another user is currently working.

@bmino
Copy link
Contributor

bmino commented Mar 15, 2021

Am I missing something @benber86? This should fix #13

@benber86
Copy link
Contributor Author

benber86 commented Mar 15, 2021

apologies for bad formatting and bad communication, the note was copypasted from 1716d74 and only applied to it. 79ac297 should indeed fix #13
I'll edit the comment

Copy link
Contributor

@dasconnor dasconnor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work!

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

Successfully merging this pull request may close these issues.

4 participants