Skip to content

Improve CurveMeta accuracy #57

@halo3mic

Description

@halo3mic

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions