route

package
v21.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 3, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CandidatePool

type CandidatePool struct {
	ID            uint64
	TokenOutDenom string
}

CandidatePool is a data structure representing a candidate pool to be used for routing.

type CandidateRoute

type CandidateRoute struct {
	Pools []CandidatePool
}

CandidateRoute is a data structure representing a candidate route to be used for routing.

type CandidateRoutes

type CandidateRoutes struct {
	Routes        []CandidateRoute
	UniquePoolIDs map[uint64]struct{}
}

CandidateRoutes is a data structure representing a list of candidate routes to be used for routing. Additionally, it encapsulates a map of unique pool IDs contained in the routes.

type RouteImpl

type RouteImpl struct {
	Pools []domain.RoutablePool "json:\"pools\""
}

func (*RouteImpl) AddPool

func (r *RouteImpl) AddPool(pool domain.PoolI, tokenOutDenom string, takerFee osmomath.Dec)

func (*RouteImpl) CalculateTokenOutByTokenIn

func (r *RouteImpl) CalculateTokenOutByTokenIn(tokenIn sdk.Coin) (tokenOut sdk.Coin, err error)

CalculateTokenOutByTokenIn implements Route.

func (*RouteImpl) GetPools

func (r *RouteImpl) GetPools() []domain.RoutablePool

GetPools implements Route.

func (*RouteImpl) GetTokenOutDenom

func (r *RouteImpl) GetTokenOutDenom() string

GetTokenOutDenom implements domain.Route. Returns token out denom of the last pool in the route. If route is empty, returns empty string.

func (*RouteImpl) PrepareResultPools

func (r *RouteImpl) PrepareResultPools() []domain.RoutablePool

PrepareResultPools implements domain.Route. Strips away unnecessary fields from each pool in the route, leaving only the data needed by client The following are the list of fields that are returned to the client in each pool: - ID - Type - Balances - Spread Factor - Token Out Denom - Taker Fee Note that it mutates the route. Returns the resulting pools.

func (*RouteImpl) String

func (r *RouteImpl) String() string

String implements domain.Route.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL