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

Chore: split dex execution from banking operations #NTRN-353 #611

Merged
merged 6 commits into from
Jul 18, 2024

Conversation

jcompagni10
Copy link
Contributor

@jcompagni10 jcompagni10 commented Jul 3, 2024

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

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
k.SetPool(ctx, pool)

if sharesToRemove.IsPositive() {
if err := k.BurnShares(ctx, callerAddr, sharesToRemove, poolDenom); err != nil {
Copy link
Contributor

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

@jcompagni10 jcompagni10 changed the title Chore: split dex execution from banking operations Chore: split dex execution from banking operations #NTRN-353 Jul 9, 2024
@jcompagni10
Copy link
Contributor Author

@pr0n00gler
Copy link
Collaborator

@pr0n00gler pr0n00gler merged commit 5def865 into main Jul 18, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants