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

Remove sqrtpricelimit from v4 router #365

Merged
merged 4 commits into from
Oct 18, 2024
Merged

Remove sqrtpricelimit from v4 router #365

merged 4 commits into from
Oct 18, 2024

Conversation

hensha256
Copy link
Contributor

No description provided.

@hensha256 hensha256 requested review from ewilz and snreynolds October 15, 2024 19:14
sqrtPriceLimitX96 == 0
? (zeroForOne ? TickMath.MIN_SQRT_PRICE + 1 : TickMath.MAX_SQRT_PRICE - 1)
: sqrtPriceLimitX96
zeroForOne, amountSpecified, zeroForOne ? TickMath.MIN_SQRT_PRICE + 1 : TickMath.MAX_SQRT_PRICE - 1
Copy link
Member

Choose a reason for hiding this comment

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

Could we leave a comment somewhere explaining motivation for this? Its an edge case for sure, but maybe like "for protection of end users, this contract automatically sets a maximum value for the sqrtPriceLimit, and slippage checks are relied on to enforce proper amount out checks" or something..

Copy link
Member

@snreynolds snreynolds left a comment

Choose a reason for hiding this comment

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

Clean.

Would just like to document in this PR though that IF a pool's price is initialized to an undesired price and there is no liquidity, then setting the sqrtPriceLimitX96 can be used to push the pool's price to a desired value. With this change, someone would need to do that outside of this router.

@snreynolds snreynolds merged commit 0c162a0 into main Oct 18, 2024
3 checks passed
@snreynolds snreynolds deleted the remove-price-limit branch October 18, 2024 00:41
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