Documentation ¶
Index ¶
- Variables
- func NewRouterUsecase(timeout time.Duration, routerRepository mvc.RouterRepository, ...) mvc.RouterUsecase
- type CurrentTokenOutDenomNotInPoolError
- type NoPoolsInRouteError
- type Pool
- type PreviousTokenOutDenomNotInPoolError
- type RoutePoolWithTokenInDenomError
- type RoutePoolWithTokenOutDenomError
- type RouteWithOutAmount
- type Router
- func (r Router) GetCandidateRoutes(tokenInDenom, tokenOutDenom string) (route.CandidateRoutes, error)
- func (r Router) GetLogger() log.Logger
- func (r Router) GetMaxHops() int
- func (r Router) GetMaxRoutes() int
- func (r Router) GetMaxSplitIterations() int
- func (r Router) GetSortedPools() []domain.PoolI
- func (r *Router) GetSplitQuote(routes []route.RouteImpl, tokenIn sdk.Coin) (domain.Quote, error)
- type SortedPoolsAndPoolsInRouteLengthMismatchError
- type SortedPoolsAndPoolsUsedLengthMismatchError
- type Split
- type TokenOutDenomMatchesTokenInDenomError
- type TokenOutMismatchBetweenRoutesError
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func NewRouterUsecase ¶
func NewRouterUsecase(timeout time.Duration, routerRepository mvc.RouterRepository, poolsUsecase mvc.PoolsUsecase, config domain.RouterConfig, logger log.Logger) mvc.RouterUsecase
NewRouterUsecase will create a new pools use case object
Types ¶
type CurrentTokenOutDenomNotInPoolError ¶
type CurrentTokenOutDenomNotInPoolError struct { RouteIndex int PoolId uint64 CurrentTokenOutDenom string }
func (CurrentTokenOutDenomNotInPoolError) Error ¶
func (e CurrentTokenOutDenomNotInPoolError) Error() string
type NoPoolsInRouteError ¶
type NoPoolsInRouteError struct {
RouteIndex int
}
func (NoPoolsInRouteError) Error ¶
func (e NoPoolsInRouteError) Error() string
type PreviousTokenOutDenomNotInPoolError ¶
type PreviousTokenOutDenomNotInPoolError struct { RouteIndex int PoolId uint64 PreviousTokenOutDenom string }
func (PreviousTokenOutDenomNotInPoolError) Error ¶
func (e PreviousTokenOutDenomNotInPoolError) Error() string
type RoutePoolWithTokenInDenomError ¶
func (RoutePoolWithTokenInDenomError) Error ¶
func (e RoutePoolWithTokenInDenomError) Error() string
type RoutePoolWithTokenOutDenomError ¶
func (RoutePoolWithTokenOutDenomError) Error ¶
func (e RoutePoolWithTokenOutDenomError) Error() string
type RouteWithOutAmount ¶
type RouteWithOutAmount struct { route.RouteImpl OutAmount osmomath.Int "json:\"out_amount\"" InAmount osmomath.Int "json:\"in_amount\"" }
func (RouteWithOutAmount) GetAmountIn ¶
func (r RouteWithOutAmount) GetAmountIn() osmomath.Int
GetAmountIn implements domain.SplitRoute.
func (RouteWithOutAmount) GetAmountOut ¶
func (r RouteWithOutAmount) GetAmountOut() math.Int
GetAmountOut implements domain.SplitRoute.
type Router ¶
type Router struct {
// contains filtered or unexported fields
}
func NewRouter ¶
func NewRouter(preferredPoolIDs []uint64, maxHops, maxRoutes, maxSplitRoutes, maxSplitIterations int, minOSMOTVL int, logger log.Logger) *Router
NewRouter returns a new Router. It initialized the routable pools where the given preferredPoolIDs take precedence. The rest of the pools are sorted by TVL. Each pool has a flag indicating whether there was an error in estimating its on-chain TVL. If that is the case, the pool is to be sorted towards the end. However, the preferredPoolIDs overwrites this rule and prioritizes the preferred pools.
func WithPoolsUsecase ¶
func WithPoolsUsecase(router *Router, poolsUsecase mvc.PoolsUsecase) *Router
WithPoolsUsecase instruments router by setting a pools usecase on it and returns the router.
func WithRouterRepository ¶
func WithRouterRepository(router *Router, routerRepository mvc.RouterRepository) *Router
WithRouterRepository instruments router by setting a router repository on it and returns the router.
func (Router) GetCandidateRoutes ¶
func (r Router) GetCandidateRoutes(tokenInDenom, tokenOutDenom string) (route.CandidateRoutes, error)
GetCandidateRoutes returns candidate routes from tokenInDenom to tokenOutDenom using BFS.
func (Router) GetMaxHops ¶
GetMaxHops returns the maximum number of hops configured.
func (Router) GetMaxRoutes ¶
GetMaxRoutes returns the maximum number of routes configured.
func (Router) GetMaxSplitIterations ¶
GetMaxSplitIterations returns the maximum number of iterations when searching for split routes.
func (Router) GetSortedPools ¶
type SortedPoolsAndPoolsInRouteLengthMismatchError ¶
func (SortedPoolsAndPoolsInRouteLengthMismatchError) Error ¶
func (e SortedPoolsAndPoolsInRouteLengthMismatchError) Error() string
type SortedPoolsAndPoolsUsedLengthMismatchError ¶
func (SortedPoolsAndPoolsUsedLengthMismatchError) Error ¶
func (e SortedPoolsAndPoolsUsedLengthMismatchError) Error() string
type TokenOutDenomMatchesTokenInDenomError ¶
type TokenOutDenomMatchesTokenInDenomError struct {
Denom string
}
func (TokenOutDenomMatchesTokenInDenomError) Error ¶
func (e TokenOutDenomMatchesTokenInDenomError) Error() string
type TokenOutMismatchBetweenRoutesError ¶
type TokenOutMismatchBetweenRoutesError struct { TokenOutDenomRouteA string TokenOutDenomRouteB string }
func (TokenOutMismatchBetweenRoutesError) Error ¶
func (e TokenOutMismatchBetweenRoutesError) Error() string