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: a edge case for testSwap #43

Merged
merged 1 commit into from
May 13, 2024
Merged

fix: a edge case for testSwap #43

merged 1 commit into from
May 13, 2024

Conversation

chefburger
Copy link
Collaborator

@chefburger chefburger commented May 13, 2024

This should fix #38

Context:

The error happens when:

  1. swapParams.amountSpecified is greater than type(int128).max i.e. 170141183460469231731687303715884105727
  2. Pool has enough liquidity to digest all the amountSpecified
  3. In this case, amountSpecified will be exactly either balanceDelta.amount0 or balanceDelta.amount1 which is int128
  4. It results in the call toInt128() failed

CleanShot 2024-05-13 at 16 06 53@2x

@chefburger chefburger merged commit 8c19261 into main May 13, 2024
2 checks passed
@chefburger chefburger deleted the fix/testSwap branch May 13, 2024 08:18
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.

Investigate test failure in CLPool.t.sol
2 participants