-
Notifications
You must be signed in to change notification settings - Fork 9
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
[MEX-663] Fix tokens liquidity #1549
Conversation
- return min(first_token_locked_value, second_token_locked_value) if difference between them is larger than 1mil
break; | ||
|
||
const relevantPairs = pairs.filter((pair) => | ||
[pair.firstTokenID, pair.secondTokenID].includes(tokenID), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitpicking, but a new array will be allocated at each iteration. either extract the array outside of the filter or refactor like:
tokenID === pair.firstTokenID || tokenID === pair.secondTokenID
new BigNumber(firstTokenLockedValueUSD) | ||
.minus(secondTokenLockedValueUSD) | ||
.abs() | ||
.gt(1000000) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we extract this in config, or at least a constant?
.abs() | ||
.gt(1000000) | ||
) { | ||
return BigNumber.min( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not accurate because it is missing the second half of the liquidity. We should use the common token from the pair to compute the total value locked for a pair in this scenario. In addition, we should consider the double of the common token as the whole liquidity locked in a pool
const secondTokenLockedValueUSD = | ||
allSecondTokensLockedValueUSD[index]; | ||
|
||
if ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should reconsider this check as it isn't accurate.
Reasoning
start
andend
dates used in the queries will differ at the benning of an hourProposed Changes
1000000
only use the smallest valueupdateHistoricPairsData
and decrease query cache warmer delay valueHow to test