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]: Barebones concentrated liquidity pool interface implementation #3032

Closed
p0mvn opened this issue Oct 17, 2022 · 3 comments
Closed

[CL]: Barebones concentrated liquidity pool interface implementation #3032

p0mvn opened this issue Oct 17, 2022 · 3 comments
Labels
C:x/gamm Changes, features and bugs related to the gamm module. T:task ⚙️ A task belongs to a story

Comments

@p0mvn
Copy link
Member

p0mvn commented Oct 17, 2022

Background

We should implement a new concentrated liquidity pool in the pool-models package. Call it concentrated.

It should implement all of the methods defined on the pool interface.

Suggested Design

Implement pool interface

Panic in every method with "not implemented"

Acceptance Criteria

  • new pool-model added
  • named concentrated
  • each method panics
@p0mvn p0mvn added C:x/gamm Changes, features and bugs related to the gamm module. T:task ⚙️ A task belongs to a story labels Oct 17, 2022
@p0mvn
Copy link
Member Author

p0mvn commented Oct 18, 2022

Upon further evaluation with @mattverse and @czarcas7ic , we have decided to implement a new module for concentrating liquidity instead of trying to extend PoolI.

Problem Statement:

Option1: refactor PoolI so that we extract the existing JoinPool, ExitPool methods and change them into cfmm extenstions. Then we use refactored interface for concentrated liquidity.

Advantages:

  • Reduce code duplication that would happen when we create a separate module.
    • Pool ID management
    • Logic for managing pool addresses
    • Logic for transferring coins after LPing
    • IL protection
    • Swapping related API from PoolI

Option2: Make concentrated liquidity a separate module

Advantages:

  • PoolI and the current gamm structure is not efficient for storing the different stores that the concentrated liquidity pools need.
    • Concentrated liquidity pool needs 3 types of state:
      • Per-pool
      • Per-state
      • Per-tick
    • Integrating these states into the current design would constitute significant effort.
  • No need to change existing messages and tx for pools
  • Existing messages that we avoid changing if we were to implement concentrated liquidity:
    • JoinPool
    • ExitPool
    • JoinSwapExternAmountIn
    • JoinSwapShareAmountOut
    • ExitSwapExternAmountOut
    • ExitSwapShareAmountIn
  • Existing methods that we avoid extracting or refactoring:
    • JoinPool
    • JoinPoolNoSwap
    • CalcJoinPoolShares
    • CalcJoinPoolNoSwapShares
    • ExitPool
    • CalcExitPoolCoinsFromShares

@p0mvn p0mvn closed this as completed Oct 18, 2022
@p0mvn
Copy link
Member Author

p0mvn commented Oct 18, 2022

@ValarDragon FYI

@p0mvn
Copy link
Member Author

p0mvn commented Oct 18, 2022

After discussing this further with @sunnya97 , we have realized that swap messages must remain the same. Therefore, it might make sense to:

  • move swap messages and logic into its own module
  • implement concentrated liquidity module
  • on pool creation, register a map entry from pool id to the module (gamm or concentrated liquidity)
  • on swap, the swap module routes via map to the desired module

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C:x/gamm Changes, features and bugs related to the gamm module. T:task ⚙️ A task belongs to a story
Projects
Archived in project
Development

No branches or pull requests

1 participant