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

[CL][Swap Router Module]: Pool ID routing #3097

Closed
mattverse opened this issue Oct 22, 2022 · 3 comments
Closed

[CL][Swap Router Module]: Pool ID routing #3097

mattverse opened this issue Oct 22, 2022 · 3 comments
Assignees
Labels
C:x/swap-router F: concentrated-liquidity Tracking the development of concentrated liquidity feature to improve filtering on the project board T:task ⚙️ A task belongs to a story

Comments

@mattverse
Copy link
Member

Background

 
The current design in the swap router has a boolean field in the keeper method for RouteMultihopSwapExactAmountIn and MultihopSwapExactAmountOut, that takes in the field isGamm as a boolean field, in which routes to the correct pool module: either the gamm module or the concentrated liquidity module.

This implementation is a half implementation of the swap router module.

We want to route the swap messages to the correct module given pool ID.

Suggested Design

There are two ways of doing this depending on which

  1. When Pool ID for concentrated liquidity is in a different form (ex. poolId = cl1 )

We are assuming two things in this case:

  • Pool ID for concentrated liquidity is in a different form(ex. cl1) instead of being in a form of uint64
  • Pool ID is kept across two different modules.

This case should be easy, we simply route the swap message to the correct pool type by referencing to the pool Id format.

  1. Use interface

If preconditions mentioned above are not fulfilled, we need to use interfaces to find out which pool model it is given pool id. We can achieve this by using interfaces: traditional amms and concentrated amms has different APIs and methods - we can abstract them as interfaces to see if each pool fulfills this and find out which pool model it is to route to the correct pool

  1. Use GetPoolById

The last possible approach of doing this is using GetPoolById. We can try calling GetPoolById method from each pool model module and use the pool returned, if error returned assume that it's the other module.

Acceptance Criteria

  • Have the message server or the keeper layer route to the correct pool module(either gamm module or the concentrated-liquidity module) given pool id
@mattverse mattverse added the F: concentrated-liquidity Tracking the development of concentrated liquidity feature to improve filtering on the project board label Oct 22, 2022
@osmo-bot osmo-bot moved this to Needs Review 🔍 in Osmosis Chain Development Oct 22, 2022
@p0mvn
Copy link
Member

p0mvn commented Oct 24, 2022

Adding this to milestone 4

@p0mvn
Copy link
Member

p0mvn commented Oct 25, 2022

We made the decision to move pool id management into the swap-router module. Investigation of the constraints is TBD

@p0mvn
Copy link
Member

p0mvn commented Nov 7, 2022

closed by #3238

@p0mvn p0mvn closed this as completed Nov 7, 2022
Repository owner moved this from Needs Review 🔍 to Done ✅ in Osmosis Chain Development Nov 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C:x/swap-router F: concentrated-liquidity Tracking the development of concentrated liquidity feature to improve filtering on the project board T:task ⚙️ A task belongs to a story
Projects
Archived in project
Development

No branches or pull requests

2 participants