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

Price-filtered, sorted pools query #3554

Closed
Tracked by #4624
jonator opened this issue Nov 28, 2022 · 6 comments
Closed
Tracked by #4624

Price-filtered, sorted pools query #3554

jonator opened this issue Nov 28, 2022 · 6 comments

Comments

@jonator
Copy link
Member

jonator commented Nov 28, 2022

Background

We implemented a pools filter query for v23 (#3324), however it's somewhat naive in that it expects an exhaustive list of min liquidity amounts to be used to filter each respective pool. This forces frontend teams to maintain a list of min amounts that they'd like to use to filter, which may change as liquidity shifts. We get the performance benefits of less pools, but now must maintain more frontend config.

Suggested Design

Update the new ../filtered_pools query to accept a singe min amount, as well as a sorting key (i.e. liquidity). Perhaps the query could maintain a cache of token prices, and we could admit that this cache is only periodically updated with new prices as filtering pools is a non-critical use of token prices and the prices of major assets shouldn't shift much in within the cache lifetime.

Acceptance Criteria

The query...

  1. Accepts a single arbitrary coin amount, and uses that amount to filter pool TVL that is at least the same price as the provided amount.
  2. Accepts a preference to sort by liquidity, thus preventing this sorting work from being done on client side.
@jonator jonator moved this to Needs Review 🔍 in Osmosis Chain Development Nov 28, 2022
@jonator jonator changed the title Filtered, sorted pools query Price-filtered, sorted pools query Nov 28, 2022
@stackman27
Copy link
Contributor

@mattverse are you looking into this? if not i can take this issue

@mattverse
Copy link
Member

@stackman27 yeah! Feel free to take the issue!

@ValarDragon
Copy link
Member

ValarDragon commented Dec 1, 2022

The front-end does need to maintain at least the list of denoms it wants, right? (Since its the case that the front-end is going to have trim pools with assets not in in its assetlist)

I suggest we notice that all main front-end pools have as a component:

  • osmo
  • atom
  • usdc

So we first-pass just expect the front-end to provide min-liquidity in those three assets. (And the filter returns pools with sufficient liquidity in that asset AND all assets in front-end provided assetlist filter)
In a second pass, we can actually get the atom and USDC amounts based off of the osmo price, using the pool specified in whitelisted_fee_token registry.

@stackman27
Copy link
Contributor

@ValarDragon does that mean the prices for assetlist will be calculated in the frontend or should we still expose query for this?

@hieuvubk
Copy link
Contributor

Is anyone working on this?

@jonator
Copy link
Member Author

jonator commented Mar 27, 2023

I believe we've decided against this for now. Mainly for performance reasons, we'll need to use indexing services instead of processing data directly on the node.

@jonator jonator closed this as completed Mar 27, 2023
@czarcas7ic czarcas7ic moved this from Needs Triage 🔍 to Done ✅ in Osmosis Chain Development May 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

No branches or pull requests

6 participants