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

Query and Actual batch swaps of boosted pools are different sometimes #738

Open
joaobrunoah opened this issue Jul 4, 2024 · 1 comment

Comments

@joaobrunoah
Copy link
Contributor

Sometimes, a batch swap query in a boosted pool returns a slightly different result from the actual swap. It happens because the batch swap of a boosted pool is composed of three steps:

  • Wrap TokenIn
  • Trade wrapped TokenIn by wrapped TokenOut
  • Unwrap TokenOut

In the query mode, the first and third steps (wrap/unwrap) are only previews; we don't execute them, so the rate of the wrapped tokens doesn't change. However, the wrap/unwrap is executed in the actual operation so the total supply and total assets of the wrapped tokens change, and it introduces rounding issues in the order of 1 wei to the token rate. This rounding issue propagates to the boosted pool (2nd step) which uses a fixed 18 decimals rate, so it amplifies the error a bit for 18 decimal tokens.

@jubeira
Copy link
Contributor

jubeira commented Sep 3, 2024

I think this is addressed already right?

There's still a difference that can't really be solved without moving tokens around, but that's expected.

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

No branches or pull requests

2 participants