-
Notifications
You must be signed in to change notification settings - Fork 94
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
Chore: split dex execution from banking operations #NTRN-353 #611
Conversation
this makes it much easier to support simulation queries for all messages
Nice cleanup for monolithic core.go. Also makes future refactors a bit simpler
x/dex/keeper/withdraw.go
Outdated
k.SetPool(ctx, pool) | ||
|
||
if sharesToRemove.IsPositive() { | ||
if err := k.BurnShares(ctx, callerAddr, sharesToRemove, poolDenom); err != nil { |
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.
There is still a bank operation. On the other hand there is no such thing like QueryEstimateWithdraw
, so may be it's ok. But the top level comment is confusing
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.
fixed
TASK
https://hadronlabs.atlassian.net/browse/NTRN-353
This PR creates an execute method for each dex operation which performs all the core logic except event emission and banking operations.
This makes performing simulations (which do not want banking operations) much simpler.
It is a prerequisite for this PR: https://github.com/neutron-org/neutron/pull/543/files
It also begins a larger process of breaking down all of the core.go methods into more manageable (and readable) functions.
This PR also splits each of the dex messages into its own dedicated file for better readability and easier refactoring in the future.
This PR does not change any logic. It is largely just moving code around with a couple of small changes to event handling so that the ExecuteXX functions do not emit events.
Integration Tests
https://github.com/neutron-org/neutron-tests/actions/runs/9896108148