-
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
BE-693 | Implement rankRoutesByDirectQuoteInGivenOut API #619
base: BE-692
Are you sure you want to change the base?
Conversation
Implements `rankRoutesByDirectQuoteInGivenOut` API for computing exact amount out quotes. This is smaller chunk of bigger PR-607 ( #607 ) implementing computing exact amount out quotes.
func (r *routerUseCaseImpl) rankRoutesByDirectQuoteInGivenOut(ctx context.Context, candidateRoutes ingesttypes.CandidateRoutes, tokenOut sdk.Coin, tokenInDenom string, maxSplitRoutes int) (domain.Quote, []route.RouteImpl, error) { | ||
// Note that retrieving pools and taker fees is done in separate transactions. | ||
// This is fine because taker fees don't change often. | ||
routes, err := r.poolsUsecase.GetRoutesFromCandidates(candidateRoutes, tokenOut.Denom, tokenInDenom) |
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.
Note for reviewer: this method is already covered with tests RoutesFromCandidates
return nil, nil, err | ||
} | ||
|
||
topQuote, routesWithAmtOut, err := r.estimateAndRankSingleRouteQuoteInGivenOut(ctx, routes, tokenOut, r.logger) |
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.
Note for reviewer: method estimateAndRankSingleRouteQuoteInGivenOut
is already covered with tests.
router/usecase/router_usecase.go
Outdated
// - fails to read taker fees | ||
// - fails to convert candidate routes to routes | ||
// - fails to estimate direct quotes | ||
func (r *routerUseCaseImpl) rankRoutesByDirectQuoteInGivenOut(ctx context.Context, candidateRoutes ingesttypes.CandidateRoutes, tokenOut sdk.Coin, tokenInDenom string, maxSplitRoutes int) (domain.Quote, []route.RouteImpl, 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.
Note for reviewer: this method is not tested at this moment since it gets tested once split routes are in place as it is currently with OutGivenIn and nolint:unused
directive will be removed at the same time as well.
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.
I think it's safe to merge this PR since internal details are already covered with existing tests and this function will get tested once split routes are in place.
|
Implements
rankRoutesByDirectQuoteInGivenOut
API for computing exact amount out quotes.This is smaller chunk of bigger PR-607 ( #607 ) implementing computing exact amount out quotes.