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

refactor(x/gamm): remove CreatePool and pool id index boilerplate in gamm (merge) #3739

Merged
merged 14 commits into from
Dec 16, 2022

Conversation

p0mvn
Copy link
Member

@p0mvn p0mvn commented Dec 15, 2022

Closes: #XXX

What is the purpose of the change

Currently, we update the pool id index in both x/gamm and x/swaprouter. Since the goal is to fully migrate the index to x/swaproter, we start to remove any references it the old x/gamm index.

We still need to keep the state entry in x/gamm. However, every method, function or query, utilizing it can be refactored to either swithc to querying x/swaprouter index or be removed entirely.

Brief Changelog

As a result, of sunsetting the index in x/gamm , the folllowing changes have been made:

  • removed CreatePool method from x/gamm. Its callers instead use CreatePool in x/swaprouter.
  • removed GetNextPoolIdAndIncrement function in x/gamm since the updates to the index should not happen anymore
  • make pool-incentives keeper take swaprouter keeper instead of gamm for retrieving pool indexes

Testing and Verifying

This change is already covered by existing tests

Documentation and Release Note

  • Does this pull request introduce a new feature or user-facing behavior changes? no
  • Is a relevant changelog entry added to the Unreleased section in CHANGELOG.md? no
  • How is the feature or change documented? not applicable

@github-actions github-actions bot added C:app-wiring Changes to the app folder C:x/gamm Changes, features and bugs related to the gamm module. C:x/superfluid labels Dec 15, 2022
@github-actions github-actions bot added the C:x/twap Changes to the twap module label Dec 15, 2022
@@ -337,17 +350,6 @@ func (appKeepers *AppKeepers) InitNormalKeepers(
)
appKeepers.TokenFactoryKeeper = &tokenFactoryKeeper

appKeepers.SwapRouterKeeper = swaprouter.NewKeeper(
Copy link
Member Author

@p0mvn p0mvn Dec 15, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: Moved up top to be consistent with CL main. It is also convenient for initializing pool incentives keeper close to a similar logic in gamm

@p0mvn p0mvn added the V:state/breaking State machine breaking PR label Dec 15, 2022
@github-actions github-actions bot added the C:simulator Edits simulator or simulations label Dec 15, 2022
@@ -109,12 +109,12 @@ func (q Querier) Pools(
}, nil
}

// NumPools returns total number of pools.
// TODO: mark deprecated and move to swaprouter.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: tracked in #3556

@p0mvn p0mvn changed the title refactor(x/gamm): remove CreatePool and pool id index in gamm refactor(x/gamm): remove CreatePool and pool id index boilerplate in gamm Dec 16, 2022
@p0mvn p0mvn marked this pull request as ready for review December 16, 2022 00:53
@p0mvn p0mvn changed the title refactor(x/gamm): remove CreatePool and pool id index boilerplate in gamm refactor(x/gamm): remove CreatePool and pool id index boilerplate in gamm (merge) Dec 16, 2022
Copy link
Member

@czarcas7ic czarcas7ic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

app/keepers/keepers.go Outdated Show resolved Hide resolved
app/keepers/keepers.go Outdated Show resolved Hide resolved
@p0mvn
Copy link
Member Author

p0mvn commented Dec 16, 2022

Going to merge with 1 approval once CI passes. This has been QAed on concentrated-liquidity-main. Additionally, we discussed this change on the call with ValarDragon

@p0mvn p0mvn merged commit 0c9b83f into main Dec 16, 2022
@p0mvn p0mvn deleted the roman/remove-pool-index-gamm branch December 16, 2022 21:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C:app-wiring Changes to the app folder C:simulator Edits simulator or simulations C:x/gamm Changes, features and bugs related to the gamm module. C:x/pool-incentives C:x/superfluid C:x/swaprouter C:x/twap Changes to the twap module V:state/breaking State machine breaking PR
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants