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

Compute correct swap fee for Astroport PCL pools #135

Open
p0mvn opened this issue Mar 18, 2024 · 0 comments
Open

Compute correct swap fee for Astroport PCL pools #135

p0mvn opened this issue Mar 18, 2024 · 0 comments

Comments

@p0mvn
Copy link
Member

p0mvn commented Mar 18, 2024

Astroport PCL pools have a dynamic fee

For pool 1572, it might vary 0.05% - 0.2%

However, currently, the contract simply returns zero from the standard Cosmwasm pool GetSwapFee API.

This is what SQS propagates to the clients as well.

Instead, we could compute the fee from parameters with the {"config":{}} query.

https://celatone.osmosis.zone/osmosis-1/query?contract=osmo16glf5aswrkzgf9ung6wkemq0yrz77rwwf9hrggm3nw62z5w2w9psxw5cur&msg=ewogICJjb25maWciOiB7fQp9

$ base64 -d <<<eyJhbXAiOiIxMCIsImdhbW1hIjoiMC4wMDAxODEyNSIsIm1pZF9mZWUiOiIwLjAwMDUiLCJvdXRfZmVlIjoiMC4wMDIiLCJmZWVfZ2FtbWEiOiIwLjAwMDIzIiwicmVwZWdfcHJvZml0X3RocmVzaG9sZCI6IjAuMDAwMDAwMiIsIm1pbl9wcmljZV9zY2FsZV9kZWx0YSI6IjAuMDAwMTQ2IiwicHJpY2Vfc2NhbGUiOiI3Ljc2NjE5OTY3NTkyOTg1NjIwNyIsIm1hX2hhbGZfdGltZSI6NjAwLCJ0cmFja19hc3NldF9iYWxhbmNlcyI6ZmFsc2UsImZlZV9zaGFyZSI6bnVsbH0= | jq
{
  "amp": "10",
  "gamma": "0.00018125",
  "mid_fee": "0.0005",
  "out_fee": "0.002",
  "fee_gamma": "0.00023",
  "repeg_profit_threshold": "0.0000002",
  "min_price_scale_delta": "0.000146",
  "price_scale": "7.766199675929856207",
  "ma_half_time": 600,
  "track_asset_balances": false,
  "fee_share": null
}

Mid_fee is the lower bound and out_fee is the upper bound

To determine exact fee contract needs swap size and denom_in parameters in get_swap_fee query. Specially because we can only show the right fee when simulating the swap. Worth to note that fee settings are permissionless and pool creator is free to choose wte they want (ofc in reasonable limits).

Acceptance Criteria

  • Decide on what fee to return for astroport PCL cosmwasm pools
    • tuple range of low and high)
    • Dynamically simulated one
    • Average between low and high ???
  • implement and test the chosen approach
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

1 participant