mocks

package
v21.0.1 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultSpreadFactor = osmomath.MustNewDecFromStr("0.005")

Functions

This section is empty.

Types

type MockRoutablePool

type MockRoutablePool struct {
	ChainPoolModel       poolmanagertypes.PoolI
	TickModel            *domain.TickModel
	ID                   uint64
	Balances             sdk.Coins
	Denoms               []string
	TotalValueLockedUSDC osmomath.Int
	PoolType             poolmanagertypes.PoolType
	TokenOutDenom        string
	TakerFee             osmomath.Dec
	SpreadFactor         osmomath.Dec
}

func WithChainPoolModel

func WithChainPoolModel(mockPool *MockRoutablePool, chainPool poolmanagertypes.PoolI) *MockRoutablePool

func WithDenoms

func WithDenoms(mockPool *MockRoutablePool, denoms []string) *MockRoutablePool

func WithPoolID

func WithPoolID(mockPool *MockRoutablePool, id uint64) *MockRoutablePool

func WithTakerFee

func WithTakerFee(mockPool *MockRoutablePool, takerFee osmomath.Dec) *MockRoutablePool

func WithTokenOutDenom

func WithTokenOutDenom(mockPool *MockRoutablePool, tokenOutDenom string) *MockRoutablePool

func (*MockRoutablePool) CalculateTokenOutByTokenIn

func (mp *MockRoutablePool) CalculateTokenOutByTokenIn(tokenIn sdk.Coin) (sdk.Coin, error)

CalculateTokenOutByTokenIn implements routerusecase.RoutablePool.

func (*MockRoutablePool) ChargeTakerFeeExactIn

func (*MockRoutablePool) ChargeTakerFeeExactIn(tokenIn sdk.Coin) (tokenInAfterFee sdk.Coin)

ChargeTakerFee implements domain.RoutablePool.

func (*MockRoutablePool) GetId

func (mp *MockRoutablePool) GetId() uint64

GetId implements domain.PoolI.

func (*MockRoutablePool) GetPoolDenoms

func (mp *MockRoutablePool) GetPoolDenoms() []string

GetPoolDenoms implements domain.PoolI.

func (*MockRoutablePool) GetSQSPoolModel

func (mp *MockRoutablePool) GetSQSPoolModel() domain.SQSPool

GetSQSPoolModel implements domain.PoolI.

func (*MockRoutablePool) GetSpreadFactor

func (mp *MockRoutablePool) GetSpreadFactor() math.LegacyDec

GetSpreadFactor implements domain.RoutablePool.

func (*MockRoutablePool) GetTakerFee

func (mp *MockRoutablePool) GetTakerFee() math.LegacyDec

GetTakerFee implements domain.PoolI.

func (*MockRoutablePool) GetTickModel

func (mp *MockRoutablePool) GetTickModel() (*domain.TickModel, error)

GetTickModel implements domain.RoutablePool.

func (*MockRoutablePool) GetTokenOutDenom

func (mp *MockRoutablePool) GetTokenOutDenom() string

GetTokenOutDenom implements routerusecase.RoutablePool.

func (*MockRoutablePool) GetTotalValueLockedUOSMO

func (mp *MockRoutablePool) GetTotalValueLockedUOSMO() math.Int

GetTotalValueLockedUOSMO implements domain.PoolI.

func (*MockRoutablePool) GetType

GetType implements domain.PoolI.

func (*MockRoutablePool) GetUnderlyingPool

func (mp *MockRoutablePool) GetUnderlyingPool() poolmanagertypes.PoolI

GetUnderlyingPool implements routerusecase.RoutablePool.

func (*MockRoutablePool) SetTickModel

func (mp *MockRoutablePool) SetTickModel(tickModel *domain.TickModel) error

SetTickModel implements domain.PoolI.

func (*MockRoutablePool) SetTokenOutDenom

func (*MockRoutablePool) SetTokenOutDenom(tokenOutDenom string)

SetTokenOutDenom implements domain.RoutablePool.

func (*MockRoutablePool) String

func (*MockRoutablePool) String() string

String implements domain.RoutablePool.

func (*MockRoutablePool) Validate

func (*MockRoutablePool) Validate(minUOSMOTVL math.Int) error

Validate implements domain.PoolI.

type PoolsUsecaseMock

type PoolsUsecaseMock struct {
	Pools        []domain.PoolI
	TickModelMap map[uint64]domain.TickModel
}

func (*PoolsUsecaseMock) GetAllPools

func (pm *PoolsUsecaseMock) GetAllPools(ctx context.Context) ([]domain.PoolI, error)

GetAllPools implements domain.PoolsUsecase.

func (*PoolsUsecaseMock) GetPool

func (pm *PoolsUsecaseMock) GetPool(ctx context.Context, poolID uint64) (domain.PoolI, error)

GetPool implements mvc.PoolsUsecase.

func (*PoolsUsecaseMock) GetRoutesFromCandidates

func (pm *PoolsUsecaseMock) GetRoutesFromCandidates(ctx context.Context, candidateRoutes route.CandidateRoutes, takerFeeMap domain.TakerFeeMap, tokenInDenom string, tokenOutDenom string) ([]route.RouteImpl, error)

GetRoutesFromCandidates implements mvc.PoolsUsecase. Note that taker fee are ignored and not set Note that tick models are not set

func (*PoolsUsecaseMock) GetTickModelMap

func (pm *PoolsUsecaseMock) GetTickModelMap(ctx context.Context, poolIDs []uint64) (map[uint64]domain.TickModel, error)

GetTickModelMap implements mvc.PoolsUsecase.

type RedisPoolsRepositoryMock

type RedisPoolsRepositoryMock struct {
	Pools     []domain.PoolI
	TickModel map[uint64]domain.TickModel
}

func (*RedisPoolsRepositoryMock) ClearAllPools

func (*RedisPoolsRepositoryMock) ClearAllPools(ctx context.Context, tx mvc.Tx) error

ClearAllPools implements domain.PoolsRepository.

func (*RedisPoolsRepositoryMock) GetAllPools

GetAllPools implements domain.PoolsRepository.

func (*RedisPoolsRepositoryMock) GetPools

func (r *RedisPoolsRepositoryMock) GetPools(ctx context.Context, poolIDs map[uint64]struct{}) (map[uint64]domain.PoolI, error)

GetPools implements mvc.PoolsRepository.

func (*RedisPoolsRepositoryMock) GetTickModelForPools

func (r *RedisPoolsRepositoryMock) GetTickModelForPools(ctx context.Context, pools []uint64) (map[uint64]domain.TickModel, error)

GetTickModelForPools implements mvc.PoolsRepository.

func (*RedisPoolsRepositoryMock) StorePools

func (r *RedisPoolsRepositoryMock) StorePools(ctx context.Context, tx mvc.Tx, allPools []domain.PoolI) error

StorePools implements domain.PoolsRepository.

type RedisRouterRepositoryMock

type RedisRouterRepositoryMock struct {
	TakerFees domain.TakerFeeMap
	Routes    map[domain.DenomPair]route.CandidateRoutes
}

func (*RedisRouterRepositoryMock) GetAllTakerFees

func (r *RedisRouterRepositoryMock) GetAllTakerFees(ctx context.Context) (domain.TakerFeeMap, error)

GetAllTakerFees implements domain.RouterRepository.

func (*RedisRouterRepositoryMock) GetRoutes

func (r *RedisRouterRepositoryMock) GetRoutes(ctx context.Context, denom0 string, denom1 string) (route.CandidateRoutes, error)

GetRoutes implements domain.RouterRepository.

func (*RedisRouterRepositoryMock) GetTakerFee

func (r *RedisRouterRepositoryMock) GetTakerFee(ctx context.Context, denom0 string, denom1 string) (math.LegacyDec, error)

GetTakerFee implements domain.RouterRepository.

func (*RedisRouterRepositoryMock) SetRoutes

func (r *RedisRouterRepositoryMock) SetRoutes(ctx context.Context, denom0 string, denom1 string, routes route.CandidateRoutes) error

SetRoutes implements domain.RouterRepository.

func (*RedisRouterRepositoryMock) SetRoutesTx

func (r *RedisRouterRepositoryMock) SetRoutesTx(ctx context.Context, tx mvc.Tx, denom0 string, denom1 string, routes route.CandidateRoutes) error

SetRoutesTx implements domain.RouterRepository.

func (*RedisRouterRepositoryMock) SetTakerFee

func (r *RedisRouterRepositoryMock) SetTakerFee(ctx context.Context, tx mvc.Tx, denom0 string, denom1 string, takerFee math.LegacyDec) error

SetTakerFee implements domain.RouterRepository.

type TokensUseCaseMock

type TokensUseCaseMock struct {
	// contains filtered or unexported fields
}

func (*TokensUseCaseMock) GetDenomPrecisions

func (tu *TokensUseCaseMock) GetDenomPrecisions(ctx context.Context) (map[string]int, error)

GetDenomPrecisions implements domain.TokensUsecase.

Jump to

Keyboard shortcuts

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