-
Notifications
You must be signed in to change notification settings - Fork 13
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
[SQS-Routing] API to force quote over a given route #132
Comments
@deividaspetraitis would you be interested in this one? Instead of creating a new endpoint, we can modify the existing one:
However, we would need to ensure backwards compatibility |
Sure! Please feel free to assign me and let me take a close look once I'm back to my PC, I think I might have a few questions. |
hey @p0mvn, I just wanted to clarify a few details to make sure I understand task and scope correctly. As per my understanding the idea is to have a Swagger API that allows to force quote from token A to token B over given pool IDs / routes, which is basically the functionally of
In case I am on the right track with above, I was wondering what specific new pools do we need add to support? Is that about Custom CosmWasm Pools? I am sorry for my ignorance. :) |
You're pretty much spot on here. Please note that, currently, we support Note, that this I suggest that we add In terms of how this would work, consider an example where we may want to force an OSMO -> USDC swap over pool IDs 1, 5, 7. Assume pool 1 contains tokens OSMO/ATOM, pool 5 ATOM/KUJI and 7 KUJI/USDC. As a result, we can construct and force a route over such pool. If, on the other hand, pool 5 was ATOM/AKT, the logic would fail since we cannot get to the final token out by going through this pool. I suggest implementing a new method similar to this that would iterate over the given pools and try to use Please make sure to add table-driven unit tests. Check out the Once the core logic is complete, exposing swagger is another component that is in scope of this work. I don't think you need to worry about the custom CosmWasm pools for the context of this task but lmk if you have any specific questions about them. If something is missing context/docs, please don't hesitate to ping |
Thank you for detailed explanation, it's clear for now and I'm on it then! |
Hey @p0mvn, Just a few more clarifying questions, to make sure I am on the right track.
I will keep building on your example, so if the client provides pool IDs of If what was said above is a case, I was wondering, is there already any algorithm in place for swapping tokens through given specific route? As per my understanding this functionality just calculates a quote, maybe we can reuse some of the logic from actual implementation if any. How final output to the client should look like? Is it something like following ( basically just adding more entries to the {
"amount_in": {
"denom": "uosmo",
"amount": "1000000"
},
"amount_out": "98645",
"route": [
{
"pools": [
{
"id": 1,
"type": 2,
"balances": [],
"spread_factor": "0.000500000000000000",
"token_out_denom": "ATOM",
"taker_fee": "0.001000000000000000"
},
{
"id": 5,
"type": 2,
"balances": [],
"spread_factor": "0.000500000000000000",
"token_out_denom": "KUJI",
"taker_fee": "0.001000000000000000"
},
{
"id": 7,
"type": 2,
"balances": [],
"spread_factor": "0.000500000000000000",
"token_out_denom": "USDC",
"taker_fee": "0.001000000000000000"
}
],
"has-cw-pool": false,
"out_amount": "98645",
"in_amount": "1000000"
}
],
"effective_fee": "0.001500000000000000",
"price_impact": "-0.000504853187504351",
"in_base_out_quote_spot_price": "0.098793620017714781"
} |
Hey @deividaspetraitis .
This should be abstracted away by the existing logic that we should be able to reuse. We have this function that can be utilized. It does the checks for token presence in the pool, simplifying the scope of work needed to achieve the final result. I recommend the following change: make current The output should be of the type For testing, I suggest referencing this example and try running it with a debugger. Note the mainnetState thing that mocks out the production environment from json files located here Let me know if you have any follow up questions |
We have frequent requests claiming that another route might be more performant without a streamlined way to confirm it.
To make the discussions more productive and to avoid investigating the details of route differences, we should have a Swagger API that allows to force quote from token A to token B over given pool IDs / routes.
Acceptance Criteria
custom-direct-quote
. Simply extending it to support more poolsThe text was updated successfully, but these errors were encountered: