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 amount0 and amount1 calculation with improved price range checks #955

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

nigeldelviero
Copy link

Related Issue

#954

Description of changes

  1. Fixed Calculation Logic in getMaxAmountInForPool:
  • Ensured correct order of sqrtPriceX96 values by adding conditional checks.
  • Added validation to verify that the current price is within the tick range.
  • Improved handling of edge cases such as price being exactly at boundaries.
  1. Enhanced Error Handling:
  • Added require statements to check if the price is within the acceptable range.
  • Proper error messages for out-of-range prices.

@nigeldelviero nigeldelviero requested a review from a team as a code owner February 26, 2025 07:37
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.

3 participants