-
Notifications
You must be signed in to change notification settings - Fork 107
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
NTRN-188 refactor dex module keeper #400
Conversation
x/dex/keeper/pool.go
Outdated
return types.NewPool(pairID, centerTickIndexNormalized, fee, poolID) | ||
} | ||
|
||
func (k Keeper) initializePoolMetadata( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe move this to keeper/pool_metadata.go ?
@@ -85,7 +118,6 @@ func (k Keeper) GetPool( | |||
case lowerTickFound && !upperTickFound: | |||
upperTick = types.NewPoolReservesFromCounterpart(lowerTick) | |||
case !lowerTickFound && !upperTickFound: | |||
// Pool has already been initialized before so we can safely assume that pool creation doesn't throw an error |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe just personal preference, but I like comments explaining why we chose to use a method that panics. Otherwise, it can look like a mistake to someone later.
x/dex/keeper/pool.go
Outdated
return poolID | ||
} | ||
|
||
func (k Keeper) storePoolID( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we call this storePoolIDRef? Seems a bit more clear.
TASK
Get poolByID is currently inefficient.It currently makes an unnecessary call to k.GetPoolIDByParams as part of k.GetPool
This code should be refactored.
I also refactored InitPool & SetPool functions because I can