types

package
v15.7.0 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2023 License: Apache-2.0 Imports: 25 Imported by: 1

Documentation

Index

Constants

View Source
const (
	ModuleName = "poolmanager"

	StoreKey = ModuleName

	RouterKey = ModuleName
)
View Source
const (
	TypeMsgSwapExactAmountIn  = "swap_exact_amount_in"
	TypeMsgSwapExactAmountOut = "swap_exact_amount_out"
)

constants.

View Source
const (
	AttributeValueCategory = ModuleName
)

Variables

View Source
var (
	ErrEmptyRoutes       = errors.New("provided empty routes")
	ErrInvalidPool       = errors.New("attempting to create an invalid pool")
	ErrTooFewPoolAssets  = errors.New("pool should have at least 2 assets, as they must be swapping between at least two assets")
	ErrTooManyPoolAssets = errors.New("pool has too many assets (currently capped at 8 assets per pool)")
)
View Source
var (
	ErrInvalidLengthGenesis        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowGenesis          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupGenesis = fmt.Errorf("proto: unexpected end of group")
)
View Source
var (
	// KeyNextGlobalPoolId defines key to store the next Pool ID to be used.
	KeyNextGlobalPoolId = []byte{0x01}

	// SwapModuleRouterPrefix defines prefix to store pool id to swap module mappings.
	SwapModuleRouterPrefix = []byte{0x02}
)
View Source
var (
	ErrInvalidLengthModuleRoute        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowModuleRoute          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupModuleRoute = fmt.Errorf("proto: unexpected end of group")
)
View Source
var (
	ErrInvalidLengthSwapRoute        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowSwapRoute          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupSwapRoute = fmt.Errorf("proto: unexpected end of group")
)
View Source
var (
	ErrInvalidLengthTx        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowTx          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupTx = fmt.Errorf("proto: unexpected end of group")
)
View Source
var (
	KeyPoolCreationFee = []byte("PoolCreationFee")
)

Parameter store keys.

View Source
var (
	ModuleCdc = codec.NewAminoCodec(amino)
)
View Source
var PoolType_name = map[int32]string{
	0: "Balancer",
	1: "Stableswap",
	2: "Concentrated",
	3: "CosmWasm",
}
View Source
var PoolType_value = map[string]int32{
	"Balancer":     0,
	"Stableswap":   1,
	"Concentrated": 2,
	"CosmWasm":     3,
}

Functions

func FormatModuleRouteKey

func FormatModuleRouteKey(poolId uint64) []byte

ModuleRouteToBytes serializes moduleRoute to bytes.

func NewPoolAddress added in v15.3.0

func NewPoolAddress(poolId uint64) sdk.AccAddress

NewPoolAddress returns an address for a pool from a given id.

func ParamKeyTable

func ParamKeyTable() paramtypes.KeyTable

ParamTable for gamm module.

func RegisterInterfaces

func RegisterInterfaces(registry types.InterfaceRegistry)

func RegisterLegacyAminoCodec

func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino)

RegisterLegacyAminoCodec registers the necessary x/gamm interfaces and concrete types on the provided LegacyAmino codec. These types are used for Amino JSON serialization.

func RegisterMsgServer

func RegisterMsgServer(s grpc1.Server, srv MsgServer)

Types

type AccountI

type AccountI interface {
	NewAccount(sdk.Context, authtypes.AccountI) authtypes.AccountI
	GetAccount(ctx sdk.Context, addr sdk.AccAddress) authtypes.AccountI
	SetAccount(ctx sdk.Context, acc authtypes.AccountI)
}

AccountI defines the account contract that must be fulfilled when creating a x/gamm keeper.

type BankI

type BankI interface {
	SendCoins(ctx sdk.Context, fromAddr sdk.AccAddress, toAddr sdk.AccAddress, amt sdk.Coins) error
	SetDenomMetaData(ctx sdk.Context, denomMetaData banktypes.Metadata)
}

BankI defines the banking contract that must be fulfilled when creating a x/gamm keeper.

type CommunityPoolI

type CommunityPoolI interface {
	FundCommunityPool(ctx sdk.Context, amount sdk.Coins, sender sdk.AccAddress) error
}

CommunityPoolI defines the contract needed to be fulfilled for distribution keeper.

type CreatePoolMsg

type CreatePoolMsg interface {
	// GetPoolType returns the type of the pool to create.
	GetPoolType() PoolType
	// The creator of the pool, who pays the PoolCreationFee, provides initial liquidity,
	// and gets the initial LP shares.
	PoolCreator() sdk.AccAddress
	// A stateful validation function.
	Validate(ctx sdk.Context) error
	// Initial Liquidity for the pool that the sender is required to send to the pool account
	InitialLiquidity() sdk.Coins
	// CreatePool creates a pool implementing PoolI, using data from the message.
	CreatePool(ctx sdk.Context, poolID uint64) (PoolI, error)
}

CreatePoolMsg defines an interface that every CreatePool transaction should implement. The gamm logic will use this to create a pool.

type FailedToFindRouteError

type FailedToFindRouteError struct {
	PoolId uint64
}

func (FailedToFindRouteError) Error

func (e FailedToFindRouteError) Error() string

type GenesisState

type GenesisState struct {
	// the next_pool_id
	NextPoolId uint64 `protobuf:"varint,1,opt,name=next_pool_id,json=nextPoolId,proto3" json:"next_pool_id,omitempty"`
	// params is the container of poolmanager parameters.
	Params Params `protobuf:"bytes,2,opt,name=params,proto3" json:"params"`
	// pool_routes is the container of the mappings from pool id to pool type.
	PoolRoutes []ModuleRoute `protobuf:"bytes,3,rep,name=pool_routes,json=poolRoutes,proto3" json:"pool_routes"`
}

GenesisState defines the poolmanager module's genesis state.

func DefaultGenesis

func DefaultGenesis() *GenesisState

DefaultGenesis returns the default poolmanager genesis state.

func (*GenesisState) Descriptor

func (*GenesisState) Descriptor() ([]byte, []int)

func (*GenesisState) GetNextPoolId

func (m *GenesisState) GetNextPoolId() uint64

func (*GenesisState) GetParams

func (m *GenesisState) GetParams() Params

func (*GenesisState) GetPoolRoutes

func (m *GenesisState) GetPoolRoutes() []ModuleRoute

func (*GenesisState) Marshal

func (m *GenesisState) Marshal() (dAtA []byte, err error)

func (*GenesisState) MarshalTo

func (m *GenesisState) MarshalTo(dAtA []byte) (int, error)

func (*GenesisState) MarshalToSizedBuffer

func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*GenesisState) ProtoMessage

func (*GenesisState) ProtoMessage()

func (*GenesisState) Reset

func (m *GenesisState) Reset()

func (*GenesisState) Size

func (m *GenesisState) Size() (n int)

func (*GenesisState) String

func (m *GenesisState) String() string

func (*GenesisState) Unmarshal

func (m *GenesisState) Unmarshal(dAtA []byte) error

func (GenesisState) Validate

func (gs GenesisState) Validate() error

Validate performs basic genesis state validation returning an error upon any failure.

func (*GenesisState) XXX_DiscardUnknown

func (m *GenesisState) XXX_DiscardUnknown()

func (*GenesisState) XXX_Marshal

func (m *GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*GenesisState) XXX_Merge

func (m *GenesisState) XXX_Merge(src proto.Message)

func (*GenesisState) XXX_Size

func (m *GenesisState) XXX_Size() int

func (*GenesisState) XXX_Unmarshal

func (m *GenesisState) XXX_Unmarshal(b []byte) error

type ModuleRoute

type ModuleRoute struct {
	// pool_type specifies the type of the pool
	PoolType PoolType `` /* 128-byte string literal not displayed */
	PoolId   uint64   `protobuf:"varint,2,opt,name=pool_id,json=poolId,proto3" json:"pool_id,omitempty" yaml:"pool_id"`
}

ModuleRouter defines a route encapsulating pool type. It is used as the value of a mapping from pool id to the pool type, allowing the pool manager to know which module to route swaps to given the pool id.

func ParseModuleRouteFromBz

func ParseModuleRouteFromBz(bz []byte) (ModuleRoute, error)

ParseModuleRouteFromBz parses the raw bytes into ModuleRoute. Returns error if fails to parse or if the bytes are empty.

func (*ModuleRoute) Descriptor

func (*ModuleRoute) Descriptor() ([]byte, []int)

func (*ModuleRoute) GetPoolId

func (m *ModuleRoute) GetPoolId() uint64

func (*ModuleRoute) GetPoolType

func (m *ModuleRoute) GetPoolType() PoolType

func (*ModuleRoute) Marshal

func (m *ModuleRoute) Marshal() (dAtA []byte, err error)

func (*ModuleRoute) MarshalTo

func (m *ModuleRoute) MarshalTo(dAtA []byte) (int, error)

func (*ModuleRoute) MarshalToSizedBuffer

func (m *ModuleRoute) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*ModuleRoute) ProtoMessage

func (*ModuleRoute) ProtoMessage()

func (*ModuleRoute) Reset

func (m *ModuleRoute) Reset()

func (*ModuleRoute) Size

func (m *ModuleRoute) Size() (n int)

func (*ModuleRoute) String

func (m *ModuleRoute) String() string

func (*ModuleRoute) Unmarshal

func (m *ModuleRoute) Unmarshal(dAtA []byte) error

func (*ModuleRoute) XXX_DiscardUnknown

func (m *ModuleRoute) XXX_DiscardUnknown()

func (*ModuleRoute) XXX_Marshal

func (m *ModuleRoute) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*ModuleRoute) XXX_Merge

func (m *ModuleRoute) XXX_Merge(src proto.Message)

func (*ModuleRoute) XXX_Size

func (m *ModuleRoute) XXX_Size() int

func (*ModuleRoute) XXX_Unmarshal

func (m *ModuleRoute) XXX_Unmarshal(b []byte) error

type MsgClient

type MsgClient interface {
	SwapExactAmountIn(ctx context.Context, in *MsgSwapExactAmountIn, opts ...grpc.CallOption) (*MsgSwapExactAmountInResponse, error)
	SwapExactAmountOut(ctx context.Context, in *MsgSwapExactAmountOut, opts ...grpc.CallOption) (*MsgSwapExactAmountOutResponse, error)
}

MsgClient is the client API for Msg service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.

func NewMsgClient

func NewMsgClient(cc grpc1.ClientConn) MsgClient

type MsgServer

type MsgServer interface {
	SwapExactAmountIn(context.Context, *MsgSwapExactAmountIn) (*MsgSwapExactAmountInResponse, error)
	SwapExactAmountOut(context.Context, *MsgSwapExactAmountOut) (*MsgSwapExactAmountOutResponse, error)
}

MsgServer is the server API for Msg service.

type MsgSwapExactAmountIn

type MsgSwapExactAmountIn struct {
	Sender            string                                 `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty" yaml:"sender"`
	Routes            []SwapAmountInRoute                    `protobuf:"bytes,2,rep,name=routes,proto3" json:"routes"`
	TokenIn           types.Coin                             `protobuf:"bytes,3,opt,name=token_in,json=tokenIn,proto3" json:"token_in" yaml:"token_in"`
	TokenOutMinAmount github_com_cosmos_cosmos_sdk_types.Int `` /* 184-byte string literal not displayed */
}

===================== MsgSwapExactAmountIn

func (*MsgSwapExactAmountIn) Descriptor

func (*MsgSwapExactAmountIn) Descriptor() ([]byte, []int)

func (*MsgSwapExactAmountIn) GetRoutes

func (m *MsgSwapExactAmountIn) GetRoutes() []SwapAmountInRoute

func (*MsgSwapExactAmountIn) GetSender

func (m *MsgSwapExactAmountIn) GetSender() string

func (MsgSwapExactAmountIn) GetSignBytes

func (msg MsgSwapExactAmountIn) GetSignBytes() []byte

func (MsgSwapExactAmountIn) GetSigners

func (msg MsgSwapExactAmountIn) GetSigners() []sdk.AccAddress

func (*MsgSwapExactAmountIn) GetTokenIn

func (m *MsgSwapExactAmountIn) GetTokenIn() types.Coin

func (*MsgSwapExactAmountIn) Marshal

func (m *MsgSwapExactAmountIn) Marshal() (dAtA []byte, err error)

func (*MsgSwapExactAmountIn) MarshalTo

func (m *MsgSwapExactAmountIn) MarshalTo(dAtA []byte) (int, error)

func (*MsgSwapExactAmountIn) MarshalToSizedBuffer

func (m *MsgSwapExactAmountIn) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*MsgSwapExactAmountIn) ProtoMessage

func (*MsgSwapExactAmountIn) ProtoMessage()

func (*MsgSwapExactAmountIn) Reset

func (m *MsgSwapExactAmountIn) Reset()

func (MsgSwapExactAmountIn) Route

func (msg MsgSwapExactAmountIn) Route() string

func (*MsgSwapExactAmountIn) Size

func (m *MsgSwapExactAmountIn) Size() (n int)

func (*MsgSwapExactAmountIn) String

func (m *MsgSwapExactAmountIn) String() string

func (MsgSwapExactAmountIn) Type

func (msg MsgSwapExactAmountIn) Type() string

func (*MsgSwapExactAmountIn) Unmarshal

func (m *MsgSwapExactAmountIn) Unmarshal(dAtA []byte) error

func (MsgSwapExactAmountIn) ValidateBasic

func (msg MsgSwapExactAmountIn) ValidateBasic() error

func (*MsgSwapExactAmountIn) XXX_DiscardUnknown

func (m *MsgSwapExactAmountIn) XXX_DiscardUnknown()

func (*MsgSwapExactAmountIn) XXX_Marshal

func (m *MsgSwapExactAmountIn) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*MsgSwapExactAmountIn) XXX_Merge

func (m *MsgSwapExactAmountIn) XXX_Merge(src proto.Message)

func (*MsgSwapExactAmountIn) XXX_Size

func (m *MsgSwapExactAmountIn) XXX_Size() int

func (*MsgSwapExactAmountIn) XXX_Unmarshal

func (m *MsgSwapExactAmountIn) XXX_Unmarshal(b []byte) error

type MsgSwapExactAmountInResponse

type MsgSwapExactAmountInResponse struct {
	TokenOutAmount github_com_cosmos_cosmos_sdk_types.Int `` /* 169-byte string literal not displayed */
}

func (*MsgSwapExactAmountInResponse) Descriptor

func (*MsgSwapExactAmountInResponse) Descriptor() ([]byte, []int)

func (*MsgSwapExactAmountInResponse) Marshal

func (m *MsgSwapExactAmountInResponse) Marshal() (dAtA []byte, err error)

func (*MsgSwapExactAmountInResponse) MarshalTo

func (m *MsgSwapExactAmountInResponse) MarshalTo(dAtA []byte) (int, error)

func (*MsgSwapExactAmountInResponse) MarshalToSizedBuffer

func (m *MsgSwapExactAmountInResponse) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*MsgSwapExactAmountInResponse) ProtoMessage

func (*MsgSwapExactAmountInResponse) ProtoMessage()

func (*MsgSwapExactAmountInResponse) Reset

func (m *MsgSwapExactAmountInResponse) Reset()

func (*MsgSwapExactAmountInResponse) Size

func (m *MsgSwapExactAmountInResponse) Size() (n int)

func (*MsgSwapExactAmountInResponse) String

func (*MsgSwapExactAmountInResponse) Unmarshal

func (m *MsgSwapExactAmountInResponse) Unmarshal(dAtA []byte) error

func (*MsgSwapExactAmountInResponse) XXX_DiscardUnknown

func (m *MsgSwapExactAmountInResponse) XXX_DiscardUnknown()

func (*MsgSwapExactAmountInResponse) XXX_Marshal

func (m *MsgSwapExactAmountInResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*MsgSwapExactAmountInResponse) XXX_Merge

func (m *MsgSwapExactAmountInResponse) XXX_Merge(src proto.Message)

func (*MsgSwapExactAmountInResponse) XXX_Size

func (m *MsgSwapExactAmountInResponse) XXX_Size() int

func (*MsgSwapExactAmountInResponse) XXX_Unmarshal

func (m *MsgSwapExactAmountInResponse) XXX_Unmarshal(b []byte) error

type MsgSwapExactAmountOut

type MsgSwapExactAmountOut struct {
	Sender           string                                 `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty" yaml:"sender"`
	Routes           []SwapAmountOutRoute                   `protobuf:"bytes,2,rep,name=routes,proto3" json:"routes"`
	TokenInMaxAmount github_com_cosmos_cosmos_sdk_types.Int `` /* 180-byte string literal not displayed */
	TokenOut         types.Coin                             `protobuf:"bytes,4,opt,name=token_out,json=tokenOut,proto3" json:"token_out" yaml:"token_out"`
}

===================== MsgSwapExactAmountOut

func (*MsgSwapExactAmountOut) Descriptor

func (*MsgSwapExactAmountOut) Descriptor() ([]byte, []int)

func (*MsgSwapExactAmountOut) GetRoutes

func (m *MsgSwapExactAmountOut) GetRoutes() []SwapAmountOutRoute

func (*MsgSwapExactAmountOut) GetSender

func (m *MsgSwapExactAmountOut) GetSender() string

func (MsgSwapExactAmountOut) GetSignBytes

func (msg MsgSwapExactAmountOut) GetSignBytes() []byte

func (MsgSwapExactAmountOut) GetSigners

func (msg MsgSwapExactAmountOut) GetSigners() []sdk.AccAddress

func (*MsgSwapExactAmountOut) GetTokenOut

func (m *MsgSwapExactAmountOut) GetTokenOut() types.Coin

func (*MsgSwapExactAmountOut) Marshal

func (m *MsgSwapExactAmountOut) Marshal() (dAtA []byte, err error)

func (*MsgSwapExactAmountOut) MarshalTo

func (m *MsgSwapExactAmountOut) MarshalTo(dAtA []byte) (int, error)

func (*MsgSwapExactAmountOut) MarshalToSizedBuffer

func (m *MsgSwapExactAmountOut) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*MsgSwapExactAmountOut) ProtoMessage

func (*MsgSwapExactAmountOut) ProtoMessage()

func (*MsgSwapExactAmountOut) Reset

func (m *MsgSwapExactAmountOut) Reset()

func (MsgSwapExactAmountOut) Route

func (msg MsgSwapExactAmountOut) Route() string

func (*MsgSwapExactAmountOut) Size

func (m *MsgSwapExactAmountOut) Size() (n int)

func (*MsgSwapExactAmountOut) String

func (m *MsgSwapExactAmountOut) String() string

func (MsgSwapExactAmountOut) Type

func (msg MsgSwapExactAmountOut) Type() string

func (*MsgSwapExactAmountOut) Unmarshal

func (m *MsgSwapExactAmountOut) Unmarshal(dAtA []byte) error

func (MsgSwapExactAmountOut) ValidateBasic

func (msg MsgSwapExactAmountOut) ValidateBasic() error

func (*MsgSwapExactAmountOut) XXX_DiscardUnknown

func (m *MsgSwapExactAmountOut) XXX_DiscardUnknown()

func (*MsgSwapExactAmountOut) XXX_Marshal

func (m *MsgSwapExactAmountOut) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*MsgSwapExactAmountOut) XXX_Merge

func (m *MsgSwapExactAmountOut) XXX_Merge(src proto.Message)

func (*MsgSwapExactAmountOut) XXX_Size

func (m *MsgSwapExactAmountOut) XXX_Size() int

func (*MsgSwapExactAmountOut) XXX_Unmarshal

func (m *MsgSwapExactAmountOut) XXX_Unmarshal(b []byte) error

type MsgSwapExactAmountOutResponse

type MsgSwapExactAmountOutResponse struct {
	TokenInAmount github_com_cosmos_cosmos_sdk_types.Int `` /* 165-byte string literal not displayed */
}

func (*MsgSwapExactAmountOutResponse) Descriptor

func (*MsgSwapExactAmountOutResponse) Descriptor() ([]byte, []int)

func (*MsgSwapExactAmountOutResponse) Marshal

func (m *MsgSwapExactAmountOutResponse) Marshal() (dAtA []byte, err error)

func (*MsgSwapExactAmountOutResponse) MarshalTo

func (m *MsgSwapExactAmountOutResponse) MarshalTo(dAtA []byte) (int, error)

func (*MsgSwapExactAmountOutResponse) MarshalToSizedBuffer

func (m *MsgSwapExactAmountOutResponse) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*MsgSwapExactAmountOutResponse) ProtoMessage

func (*MsgSwapExactAmountOutResponse) ProtoMessage()

func (*MsgSwapExactAmountOutResponse) Reset

func (m *MsgSwapExactAmountOutResponse) Reset()

func (*MsgSwapExactAmountOutResponse) Size

func (m *MsgSwapExactAmountOutResponse) Size() (n int)

func (*MsgSwapExactAmountOutResponse) String

func (*MsgSwapExactAmountOutResponse) Unmarshal

func (m *MsgSwapExactAmountOutResponse) Unmarshal(dAtA []byte) error

func (*MsgSwapExactAmountOutResponse) XXX_DiscardUnknown

func (m *MsgSwapExactAmountOutResponse) XXX_DiscardUnknown()

func (*MsgSwapExactAmountOutResponse) XXX_Marshal

func (m *MsgSwapExactAmountOutResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*MsgSwapExactAmountOutResponse) XXX_Merge

func (m *MsgSwapExactAmountOutResponse) XXX_Merge(src proto.Message)

func (*MsgSwapExactAmountOutResponse) XXX_Size

func (m *MsgSwapExactAmountOutResponse) XXX_Size() int

func (*MsgSwapExactAmountOutResponse) XXX_Unmarshal

func (m *MsgSwapExactAmountOutResponse) XXX_Unmarshal(b []byte) error

type MultihopRoute

type MultihopRoute interface {
	Length() int
	PoolIds() []uint64
	IntermediateDenoms() []string
}

type Params

type Params struct {
	PoolCreationFee github_com_cosmos_cosmos_sdk_types.Coins `` /* 177-byte string literal not displayed */
}

Params holds parameters for the poolmanager module

func DefaultParams

func DefaultParams() Params

DefaultParams are the default poolmanager module parameters.

func NewParams

func NewParams(poolCreationFee sdk.Coins) Params

func (*Params) Descriptor

func (*Params) Descriptor() ([]byte, []int)

func (*Params) GetPoolCreationFee

func (m *Params) GetPoolCreationFee() github_com_cosmos_cosmos_sdk_types.Coins

func (*Params) Marshal

func (m *Params) Marshal() (dAtA []byte, err error)

func (*Params) MarshalTo

func (m *Params) MarshalTo(dAtA []byte) (int, error)

func (*Params) MarshalToSizedBuffer

func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Params) ParamSetPairs

func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs

Implements params.ParamSet.

func (*Params) ProtoMessage

func (*Params) ProtoMessage()

func (*Params) Reset

func (m *Params) Reset()

func (*Params) Size

func (m *Params) Size() (n int)

func (*Params) String

func (m *Params) String() string

func (*Params) Unmarshal

func (m *Params) Unmarshal(dAtA []byte) error

func (Params) Validate

func (p Params) Validate() error

validate params.

func (*Params) XXX_DiscardUnknown

func (m *Params) XXX_DiscardUnknown()

func (*Params) XXX_Marshal

func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Params) XXX_Merge

func (m *Params) XXX_Merge(src proto.Message)

func (*Params) XXX_Size

func (m *Params) XXX_Size() int

func (*Params) XXX_Unmarshal

func (m *Params) XXX_Unmarshal(b []byte) error

type PoolCreationListener

type PoolCreationListener interface {
	// AfterPoolCreated is called after CreatePool
	AfterPoolCreated(ctx sdk.Context, sender sdk.AccAddress, poolId uint64)
}

type PoolCreationListeners

type PoolCreationListeners []PoolCreationListener

func NewPoolCreationListeners

func NewPoolCreationListeners(listeners ...PoolCreationListener) PoolCreationListeners

Creates hooks for the Gamm Module.

func (PoolCreationListeners) AfterPoolCreated

func (l PoolCreationListeners) AfterPoolCreated(ctx sdk.Context, sender sdk.AccAddress, poolId uint64)

type PoolI

type PoolI interface {
	proto.Message

	GetAddress() sdk.AccAddress
	String() string
	GetId() uint64
	// GetSwapFee returns the pool's swap fee, based on the current state.
	// Pools may choose to make their swap fees dependent upon state
	// (prior TWAPs, network downtime, other pool states, etc.)
	// hence Context is provided as an argument.
	GetSwapFee(ctx sdk.Context) sdk.Dec
	// Returns whether the pool has swaps enabled at the moment
	IsActive(ctx sdk.Context) bool

	// Returns the spot price of the 'base asset' in terms of the 'quote asset' in the pool,
	// errors if either baseAssetDenom, or quoteAssetDenom does not exist.
	// For example, if this was a UniV2 50-50 pool, with 2 ETH, and 8000 UST
	// pool.SpotPrice(ctx, "eth", "ust") = 4000.00
	SpotPrice(ctx sdk.Context, quoteAssetDenom string, baseAssetDenom string) (sdk.Dec, error)
	// GetType returns the type of the pool (Balancer, Stableswap, Concentrated, etc.)
	GetType() PoolType
}

PoolI defines an interface for pools that hold tokens.

type PoolIncentivesKeeperI

type PoolIncentivesKeeperI interface {
	IsPoolIncentivized(ctx sdk.Context, poolId uint64) bool
}

type PoolModuleI added in v15.3.0

type PoolModuleI interface {
	InitializePool(ctx sdk.Context, pool PoolI, creatorAddress sdk.AccAddress) error

	GetPool(ctx sdk.Context, poolId uint64) (PoolI, error)

	GetPools(ctx sdk.Context) ([]PoolI, error)

	GetPoolDenoms(ctx sdk.Context, poolId uint64) (denoms []string, err error)
	CalculateSpotPrice(
		ctx sdk.Context,
		poolId uint64,
		quoteAssetDenom string,
		baseAssetDenom string,
	) (price sdk.Dec, err error)

	SwapExactAmountIn(
		ctx sdk.Context,
		sender sdk.AccAddress,
		pool PoolI,
		tokenIn sdk.Coin,
		tokenOutDenom string,
		tokenOutMinAmount sdk.Int,
		swapFee sdk.Dec,
	) (sdk.Int, error)
	// CalcOutAmtGivenIn calculates the amount of tokenOut given tokenIn and the pool's current state.
	// Returns error if the given pool is not a CFMM pool. Returns error on internal calculations.
	CalcOutAmtGivenIn(
		ctx sdk.Context,
		poolI PoolI,
		tokenIn sdk.Coin,
		tokenOutDenom string,
		swapFee sdk.Dec,
	) (tokenOut sdk.Coin, err error)

	SwapExactAmountOut(
		ctx sdk.Context,
		sender sdk.AccAddress,
		pool PoolI,
		tokenInDenom string,
		tokenInMaxAmount sdk.Int,
		tokenOut sdk.Coin,
		swapFee sdk.Dec,
	) (tokenInAmount sdk.Int, err error)
	// CalcInAmtGivenOut calculates the amount of tokenIn given tokenOut and the pool's current state.
	// Returns error if the given pool is not a CFMM pool. Returns error on internal calculations.
	CalcInAmtGivenOut(
		ctx sdk.Context,
		poolI PoolI,
		tokenOut sdk.Coin,
		tokenInDenom string,
		swapFee sdk.Dec,
	) (tokenIn sdk.Coin, err error)

	// GetTotalPoolLiquidity returns the coins in the pool owned by all LPs
	GetTotalPoolLiquidity(ctx sdk.Context, poolId uint64) (sdk.Coins, error)
}

PoolModuleI is the interface that must be fulfillled by the module storing and containing the pools.

type PoolType

type PoolType int32

PoolType is an enumeration of all supported pool types.

const (
	// Balancer is the standard xy=k curve. Its pool model is defined in x/gamm.
	Balancer PoolType = 0
	// Stableswap is the Solidly cfmm stable swap curve. Its pool model is defined
	// in x/gamm.
	Stableswap PoolType = 1
	// Concentrated is the pool model specific to concentrated liquidity. It is
	// defined in x/concentrated-liquidity.
	Concentrated PoolType = 2
	// CosmWasm is the pool model specific to CosmWasm. It is defined in
	// x/cosmwasmpool.
	CosmWasm PoolType = 3
)

func (PoolType) EnumDescriptor

func (PoolType) EnumDescriptor() ([]byte, []int)

func (PoolType) String

func (x PoolType) String() string

type SwapAmountInRoute

type SwapAmountInRoute struct {
	PoolId        uint64 `protobuf:"varint,1,opt,name=pool_id,json=poolId,proto3" json:"pool_id,omitempty" yaml:"pool_id"`
	TokenOutDenom string `protobuf:"bytes,2,opt,name=token_out_denom,json=tokenOutDenom,proto3" json:"token_out_denom,omitempty" yaml:"token_out_denom"`
}

func (*SwapAmountInRoute) Descriptor

func (*SwapAmountInRoute) Descriptor() ([]byte, []int)

func (*SwapAmountInRoute) GetPoolId

func (m *SwapAmountInRoute) GetPoolId() uint64

func (*SwapAmountInRoute) GetTokenOutDenom

func (m *SwapAmountInRoute) GetTokenOutDenom() string

func (*SwapAmountInRoute) Marshal

func (m *SwapAmountInRoute) Marshal() (dAtA []byte, err error)

func (*SwapAmountInRoute) MarshalTo

func (m *SwapAmountInRoute) MarshalTo(dAtA []byte) (int, error)

func (*SwapAmountInRoute) MarshalToSizedBuffer

func (m *SwapAmountInRoute) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*SwapAmountInRoute) ProtoMessage

func (*SwapAmountInRoute) ProtoMessage()

func (*SwapAmountInRoute) Reset

func (m *SwapAmountInRoute) Reset()

func (*SwapAmountInRoute) Size

func (m *SwapAmountInRoute) Size() (n int)

func (*SwapAmountInRoute) String

func (m *SwapAmountInRoute) String() string

func (*SwapAmountInRoute) Unmarshal

func (m *SwapAmountInRoute) Unmarshal(dAtA []byte) error

func (*SwapAmountInRoute) XXX_DiscardUnknown

func (m *SwapAmountInRoute) XXX_DiscardUnknown()

func (*SwapAmountInRoute) XXX_Marshal

func (m *SwapAmountInRoute) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*SwapAmountInRoute) XXX_Merge

func (m *SwapAmountInRoute) XXX_Merge(src proto.Message)

func (*SwapAmountInRoute) XXX_Size

func (m *SwapAmountInRoute) XXX_Size() int

func (*SwapAmountInRoute) XXX_Unmarshal

func (m *SwapAmountInRoute) XXX_Unmarshal(b []byte) error

type SwapAmountInRoutes

type SwapAmountInRoutes []SwapAmountInRoute

func (SwapAmountInRoutes) IntermediateDenoms

func (routes SwapAmountInRoutes) IntermediateDenoms() []string

func (SwapAmountInRoutes) Length

func (routes SwapAmountInRoutes) Length() int

func (SwapAmountInRoutes) PoolIds

func (routes SwapAmountInRoutes) PoolIds() []uint64

func (SwapAmountInRoutes) Validate

func (routes SwapAmountInRoutes) Validate() error

type SwapAmountOutRoute

type SwapAmountOutRoute struct {
	PoolId       uint64 `protobuf:"varint,1,opt,name=pool_id,json=poolId,proto3" json:"pool_id,omitempty" yaml:"pool_id"`
	TokenInDenom string `protobuf:"bytes,2,opt,name=token_in_denom,json=tokenInDenom,proto3" json:"token_in_denom,omitempty" yaml:"token_in_denom"`
}

func (*SwapAmountOutRoute) Descriptor

func (*SwapAmountOutRoute) Descriptor() ([]byte, []int)

func (*SwapAmountOutRoute) GetPoolId

func (m *SwapAmountOutRoute) GetPoolId() uint64

func (*SwapAmountOutRoute) GetTokenInDenom

func (m *SwapAmountOutRoute) GetTokenInDenom() string

func (*SwapAmountOutRoute) Marshal

func (m *SwapAmountOutRoute) Marshal() (dAtA []byte, err error)

func (*SwapAmountOutRoute) MarshalTo

func (m *SwapAmountOutRoute) MarshalTo(dAtA []byte) (int, error)

func (*SwapAmountOutRoute) MarshalToSizedBuffer

func (m *SwapAmountOutRoute) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*SwapAmountOutRoute) ProtoMessage

func (*SwapAmountOutRoute) ProtoMessage()

func (*SwapAmountOutRoute) Reset

func (m *SwapAmountOutRoute) Reset()

func (*SwapAmountOutRoute) Size

func (m *SwapAmountOutRoute) Size() (n int)

func (*SwapAmountOutRoute) String

func (m *SwapAmountOutRoute) String() string

func (*SwapAmountOutRoute) Unmarshal

func (m *SwapAmountOutRoute) Unmarshal(dAtA []byte) error

func (*SwapAmountOutRoute) XXX_DiscardUnknown

func (m *SwapAmountOutRoute) XXX_DiscardUnknown()

func (*SwapAmountOutRoute) XXX_Marshal

func (m *SwapAmountOutRoute) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*SwapAmountOutRoute) XXX_Merge

func (m *SwapAmountOutRoute) XXX_Merge(src proto.Message)

func (*SwapAmountOutRoute) XXX_Size

func (m *SwapAmountOutRoute) XXX_Size() int

func (*SwapAmountOutRoute) XXX_Unmarshal

func (m *SwapAmountOutRoute) XXX_Unmarshal(b []byte) error

type SwapAmountOutRoutes

type SwapAmountOutRoutes []SwapAmountOutRoute

func (SwapAmountOutRoutes) IntermediateDenoms

func (routes SwapAmountOutRoutes) IntermediateDenoms() []string

func (SwapAmountOutRoutes) Length

func (routes SwapAmountOutRoutes) Length() int

func (SwapAmountOutRoutes) PoolIds

func (routes SwapAmountOutRoutes) PoolIds() []uint64

func (SwapAmountOutRoutes) Validate

func (routes SwapAmountOutRoutes) Validate() error

type UndefinedRouteError

type UndefinedRouteError struct {
	PoolType PoolType
	PoolId   uint64
}

func (UndefinedRouteError) Error

func (e UndefinedRouteError) Error() string

type UnimplementedMsgServer

type UnimplementedMsgServer struct {
}

UnimplementedMsgServer can be embedded to have forward compatible implementations.

func (*UnimplementedMsgServer) SwapExactAmountIn

func (*UnimplementedMsgServer) SwapExactAmountOut

Jump to

Keyboard shortcuts

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