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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 justavax_amonut * avax_price
due to a race condition (#13). This fixes itFix 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 aliquidityTokenTotalSupply
that is equal to 0. The ownershipNaN
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.