Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
feat: fix estimateXX dex queries #NTRN-318 #543
feat: fix estimateXX dex queries #NTRN-318 #543
Changes from 6 commits
e3ac929
33b5549
9083cde
8ff24d2
cf0ccf6
fe1ab28
fcf9feb
4d67e6f
d236ce9
4d540e1
8a9aed7
ffcec4f
cd8d9e6
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
lets rename the file to grpc_query_estimate_place_limit_order_test to get exact before grpc_query_estimate_place_limit_order.go in listing
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.
it's out of scope of the pr, but
EstimatePlaceLimitOrder
looks outdated, TickIndexInToOut is not marked as deprecated andlimit_sell_price
is missed.What do you think about to unify these quries with something like
to not copypaste whole bunch of fields. The only downside i can see you can get rid of
creator
andreceiver
in a queryThere 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.
What is this address?
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.
Just a random valid address. Will add a comment. But let me know if there's a more preferable way to do this. I agree it's a bit odd.
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.
Probably need to create another message
QueryMultiHopSwap
with it's own validate and reusing validate logic somehow if possible.Otherwise kinda ugly
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.
do we do that bank keeper substitution only because of these module<>bankKeeper interactions? also I can see that we use a cached context to not update the dex keeper's state. if yes, I think we should rethink the way we implemented the code.
for example, speaking of the MultiHopSwapCore method: the logic for a simulation and for a real swap is mostly the same:
1. calc the best route (common logic for both cases)
2. write route context (mutate dex storage as far as I understand)
3. send coins between receiver, caller and module account
4. emit events
why don't we create a separate method that does only the 1. step and is used in both simulation and real swap? in simulation we only call this method and return the result, but in the real swap we follow it up with the remaining necessary steps?
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.
more or less the same for PlaceLimitOrderCore
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.
Agree, i prefer a pure function that does estimation.