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

Improve CurveMeta accuracy #57

Open
halo3mic opened this issue Sep 2, 2022 · 0 comments
Open

Improve CurveMeta accuracy #57

halo3mic opened this issue Sep 2, 2022 · 0 comments
Labels
help wanted Extra attention is needed

Comments

@halo3mic
Copy link
Member

halo3mic commented Sep 2, 2022

About

CurveMeta and SaddleMeta contracts work by meta-pool trading underlying assets through base-pool. To do that, the meta-pool holds base-pool LP tokens and withdraws underlying assets if the trader swaps into them. In meta-query methods (eg. get_dy_underlying, calculateSwapUnderlying) fee for withdrawing underlying assets is approximated and this causes a slight discrepancy between query amount-out and actual amount-out after the swap. This error varies, and adapters need to account for it by showing a slightly worse price than traders would actually get.

Ideally, we would want the adapter query to return the amount-out that the user actually receives and to do that adapter-query should mimic the logic of the base-pool withdraw method.

Adapter error accounting can be seen here for CurveMeta and here for SaddleMeta.

Requirements

  • For SaddleMeta and all CurveMeta adapters query returns amount-out that equals the amount user receives after swapping
  • All affected tests are updated
@halo3mic halo3mic added the help wanted Extra attention is needed label Sep 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant