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

Add utility to compute maximum liquidity for given amounts #5

Merged
merged 2 commits into from
Jan 4, 2024

Conversation

shuhuiluo
Copy link
Owner

This commit adds a new utility to compute the maximum amount of liquidity received for given amounts of two tokens. It provides two variants of computation, one precise and another imprecise, to accommodate both precise and fast computational needs. This utility will help in calculating how much liquidity will be received for given amounts of tokens at certain price boundaries. Tests are also added to verify the functionality of this module.

This commit adds a new utility to compute the maximum amount of liquidity received for given amounts of two tokens. It provides two variants of computation, one precise and another imprecise, to accommodate both precise and fast computational needs. This utility will help in calculating how much liquidity will be received for given amounts of tokens at certain price boundaries. Tests are also added to verify the functionality of this module.
@shuhuiluo shuhuiluo self-assigned this Jan 3, 2024
The code for calculating maximum liquidity for amounts was refactored to use the num_bigint::BigUint type instead of U256. This change resulted in several modifications in the max_liquidity_for_amounts.rs file. The adjustments were also reflected in the related tests to ensure consistency.
@shuhuiluo shuhuiluo marked this pull request as ready for review January 4, 2024 12:37
@shuhuiluo shuhuiluo requested a review from malik672 January 4, 2024 12:46
@shuhuiluo shuhuiluo merged commit a54e59a into master Jan 4, 2024
2 checks passed
@shuhuiluo shuhuiluo deleted the max_liquidity_for_amounts branch January 4, 2024 14:12
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