model

package
v23.0.3 Latest Latest
Warning

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

Go to latest
Published: Feb 29, 2024 License: Apache-2.0 Imports: 25 Imported by: 3

Documentation

Index

Constants

View Source
const (
	TypeMsgCreateCosmWasmPool = "create_cosmwasm_pool"
)

constants.

Variables

View Source
var (
	ErrInvalidLengthPool        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowPool          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupPool = 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 (
	ModuleCdc = codec.NewAminoCodec(amino)
)

Functions

func RegisterCodec

func RegisterCodec(cdc *codec.LegacyAmino)

func RegisterInterfaces

func RegisterInterfaces(registry cdctypes.InterfaceRegistry)

func RegisterMsgCreatorServer

func RegisterMsgCreatorServer(s grpc1.Server, srv MsgCreatorServer)

Types

type CosmWasmPool

type CosmWasmPool struct {
	ContractAddress string `` /* 130-byte string literal not displayed */
	PoolId          uint64 `protobuf:"varint,2,opt,name=pool_id,json=poolId,proto3" json:"pool_id,omitempty"`
	CodeId          uint64 `protobuf:"varint,3,opt,name=code_id,json=codeId,proto3" json:"code_id,omitempty"`
	InstantiateMsg  []byte `` /* 126-byte string literal not displayed */
}

CosmWasmPool represents the data serialized into state for each CW pool.

Note: CW Pool has 2 pool models: - CosmWasmPool which is a proto-generated store model used for serialization into state. - Pool struct that encapsulates the CosmWasmPool and wasmKeeper for calling the contract.

CosmWasmPool implements the poolmanager.PoolI interface but it panics on all methods. The reason is that access to wasmKeeper is required to call the contract.

Instead, all interactions and poolmanager.PoolI methods are to be performed on the Pool struct. The reason why we cannot have a Pool struct only is because it cannot be serialized into state due to having a non-serializable wasmKeeper field.

func (*CosmWasmPool) AsSerializablePool

func (p *CosmWasmPool) AsSerializablePool() poolmanagertypes.PoolI

func (*CosmWasmPool) Descriptor

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

func (CosmWasmPool) GetAddress

func (p CosmWasmPool) GetAddress() sdk.AccAddress

func (CosmWasmPool) GetCodeId

func (p CosmWasmPool) GetCodeId() uint64

func (CosmWasmPool) GetContractAddress

func (p CosmWasmPool) GetContractAddress() string

func (CosmWasmPool) GetExitFee

func (p CosmWasmPool) GetExitFee(ctx sdk.Context) osmomath.Dec

func (CosmWasmPool) GetId

func (p CosmWasmPool) GetId() uint64

func (CosmWasmPool) GetInstantiateMsg

func (p CosmWasmPool) GetInstantiateMsg() []byte

func (*CosmWasmPool) GetPoolDenoms

func (p *CosmWasmPool) GetPoolDenoms(ctx sdk.Context) []string

GetPoolDenoms implements types.PoolI.

func (CosmWasmPool) GetSpreadFactor

func (p CosmWasmPool) GetSpreadFactor(ctx sdk.Context) osmomath.Dec

func (CosmWasmPool) GetStoreModel

func (p CosmWasmPool) GetStoreModel() poolmanagertypes.PoolI

func (CosmWasmPool) GetTotalPoolLiquidity

func (p CosmWasmPool) GetTotalPoolLiquidity(ctx sdk.Context) sdk.Coins

func (CosmWasmPool) GetType

func (CosmWasmPool) IsActive

func (p CosmWasmPool) IsActive(ctx sdk.Context) bool

func (*CosmWasmPool) Marshal

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

func (*CosmWasmPool) MarshalTo

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

func (*CosmWasmPool) MarshalToSizedBuffer

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

func (*CosmWasmPool) ProtoMessage

func (*CosmWasmPool) ProtoMessage()

func (*CosmWasmPool) Reset

func (m *CosmWasmPool) Reset()

func (*CosmWasmPool) SetContractAddress

func (p *CosmWasmPool) SetContractAddress(contractAddress string)

func (CosmWasmPool) SetWasmKeeper

func (p CosmWasmPool) SetWasmKeeper(wasmKeeper types.WasmKeeper)

func (*CosmWasmPool) Size

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

func (CosmWasmPool) SpotPrice

func (p CosmWasmPool) SpotPrice(ctx sdk.Context, baseAssetDenom string, quoteAssetDenom string) (osmomath.BigDec, error)

func (CosmWasmPool) String

func (p CosmWasmPool) String() string

String returns the json marshalled string of the pool

func (*CosmWasmPool) Unmarshal

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

func (*CosmWasmPool) XXX_DiscardUnknown

func (m *CosmWasmPool) XXX_DiscardUnknown()

func (*CosmWasmPool) XXX_Marshal

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

func (*CosmWasmPool) XXX_Merge

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

func (*CosmWasmPool) XXX_Size

func (m *CosmWasmPool) XXX_Size() int

func (*CosmWasmPool) XXX_Unmarshal

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

type MsgCreateCosmWasmPool

type MsgCreateCosmWasmPool struct {
	CodeId         uint64 `protobuf:"varint,1,opt,name=code_id,json=codeId,proto3" json:"code_id,omitempty" yaml:"code_id"`
	InstantiateMsg []byte `` /* 126-byte string literal not displayed */
	Sender         string `protobuf:"bytes,3,opt,name=sender,proto3" json:"sender,omitempty" yaml:"sender"`
}

===================== MsgCreateCosmwasmPool

func NewMsgCreateCosmWasmPool

func NewMsgCreateCosmWasmPool(
	codeId uint64,
	sender sdk.AccAddress,
	instantiateMsg []byte,
) MsgCreateCosmWasmPool

func (MsgCreateCosmWasmPool) CreatePool

func (msg MsgCreateCosmWasmPool) CreatePool(ctx sdk.Context, poolID uint64) (poolmanagertypes.PoolI, error)

func (*MsgCreateCosmWasmPool) Descriptor

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

func (*MsgCreateCosmWasmPool) GetCodeId

func (m *MsgCreateCosmWasmPool) GetCodeId() uint64

func (*MsgCreateCosmWasmPool) GetInstantiateMsg

func (m *MsgCreateCosmWasmPool) GetInstantiateMsg() []byte

func (MsgCreateCosmWasmPool) GetPoolType

func (*MsgCreateCosmWasmPool) GetSender

func (m *MsgCreateCosmWasmPool) GetSender() string

func (MsgCreateCosmWasmPool) GetSignBytes

func (msg MsgCreateCosmWasmPool) GetSignBytes() []byte

func (MsgCreateCosmWasmPool) GetSigners

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

func (MsgCreateCosmWasmPool) InitialLiquidity

func (msg MsgCreateCosmWasmPool) InitialLiquidity() sdk.Coins

func (*MsgCreateCosmWasmPool) Marshal

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

func (*MsgCreateCosmWasmPool) MarshalTo

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

func (*MsgCreateCosmWasmPool) MarshalToSizedBuffer

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

func (MsgCreateCosmWasmPool) PoolCreator

func (msg MsgCreateCosmWasmPool) PoolCreator() sdk.AccAddress

Implement the CreatePoolMsg interface

func (*MsgCreateCosmWasmPool) ProtoMessage

func (*MsgCreateCosmWasmPool) ProtoMessage()

func (*MsgCreateCosmWasmPool) Reset

func (m *MsgCreateCosmWasmPool) Reset()

func (MsgCreateCosmWasmPool) Route

func (msg MsgCreateCosmWasmPool) Route() string

func (*MsgCreateCosmWasmPool) Size

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

func (*MsgCreateCosmWasmPool) String

func (m *MsgCreateCosmWasmPool) String() string

func (MsgCreateCosmWasmPool) Type

func (msg MsgCreateCosmWasmPool) Type() string

func (*MsgCreateCosmWasmPool) Unmarshal

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

func (MsgCreateCosmWasmPool) Validate

func (msg MsgCreateCosmWasmPool) Validate(ctx sdk.Context) error

func (MsgCreateCosmWasmPool) ValidateBasic

func (msg MsgCreateCosmWasmPool) ValidateBasic() error

func (*MsgCreateCosmWasmPool) XXX_DiscardUnknown

func (m *MsgCreateCosmWasmPool) XXX_DiscardUnknown()

func (*MsgCreateCosmWasmPool) XXX_Marshal

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

func (*MsgCreateCosmWasmPool) XXX_Merge

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

func (*MsgCreateCosmWasmPool) XXX_Size

func (m *MsgCreateCosmWasmPool) XXX_Size() int

func (*MsgCreateCosmWasmPool) XXX_Unmarshal

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

type MsgCreateCosmWasmPoolResponse

type MsgCreateCosmWasmPoolResponse struct {
	PoolID uint64 `protobuf:"varint,1,opt,name=pool_id,json=poolId,proto3" json:"pool_id,omitempty"`
}

Returns a unique poolID to identify the pool with.

func (*MsgCreateCosmWasmPoolResponse) Descriptor

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

func (*MsgCreateCosmWasmPoolResponse) GetPoolID

func (m *MsgCreateCosmWasmPoolResponse) GetPoolID() uint64

func (*MsgCreateCosmWasmPoolResponse) Marshal

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

func (*MsgCreateCosmWasmPoolResponse) MarshalTo

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

func (*MsgCreateCosmWasmPoolResponse) MarshalToSizedBuffer

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

func (*MsgCreateCosmWasmPoolResponse) ProtoMessage

func (*MsgCreateCosmWasmPoolResponse) ProtoMessage()

func (*MsgCreateCosmWasmPoolResponse) Reset

func (m *MsgCreateCosmWasmPoolResponse) Reset()

func (*MsgCreateCosmWasmPoolResponse) Size

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

func (*MsgCreateCosmWasmPoolResponse) String

func (*MsgCreateCosmWasmPoolResponse) Unmarshal

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

func (*MsgCreateCosmWasmPoolResponse) XXX_DiscardUnknown

func (m *MsgCreateCosmWasmPoolResponse) XXX_DiscardUnknown()

func (*MsgCreateCosmWasmPoolResponse) XXX_Marshal

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

func (*MsgCreateCosmWasmPoolResponse) XXX_Merge

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

func (*MsgCreateCosmWasmPoolResponse) XXX_Size

func (m *MsgCreateCosmWasmPoolResponse) XXX_Size() int

func (*MsgCreateCosmWasmPoolResponse) XXX_Unmarshal

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

type MsgCreatorClient

type MsgCreatorClient interface {
	CreateCosmWasmPool(ctx context.Context, in *MsgCreateCosmWasmPool, opts ...grpc.CallOption) (*MsgCreateCosmWasmPoolResponse, error)
}

MsgCreatorClient is the client API for MsgCreator service.

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

func NewMsgCreatorClient

func NewMsgCreatorClient(cc grpc1.ClientConn) MsgCreatorClient

type MsgCreatorServer

type MsgCreatorServer interface {
	CreateCosmWasmPool(context.Context, *MsgCreateCosmWasmPool) (*MsgCreateCosmWasmPoolResponse, error)
}

MsgCreatorServer is the server API for MsgCreator service.

type Pool

type Pool struct {
	CosmWasmPool
	WasmKeeper types.WasmKeeper
}

Pool encapsulates all data and behavior for interacting with a CW pool.

Note: CW Pool has 2 pool models: - CosmWasmPool which is a proto-generated store model used for serialization into state. - Pool struct that encapsulates the CosmWasmPool and wasmKeeper for calling the contract.

CosmWasmPool implements the poolmanager.PoolI interface but it panics on all methods. The reason is that access to wasmKeeper is required to call the contract.

Instead, all interactions and poolmanager.PoolI methods are to be performed on the Pool struct. The reason why we cannot have a Pool struct only is because it cannot be serialized into state due to having a non-serializable wasmKeeper field.

func NewCosmWasmPool

func NewCosmWasmPool(poolId uint64, codeId uint64, instantiateMsg []byte) *Pool

NewCosmWasmPool creates a new CosmWasm pool with the specified parameters.

func (Pool) AsSerializablePool

func (p Pool) AsSerializablePool() poolmanagertypes.PoolI

func (Pool) GetAddress

func (p Pool) GetAddress() sdk.AccAddress

GetAddress returns the address of the cosmwasm pool

func (Pool) GetCodeId

func (p Pool) GetCodeId() uint64

func (Pool) GetContractAddress

func (p Pool) GetContractAddress() string

func (Pool) GetId

func (p Pool) GetId() uint64

GetId returns the id of the cosmwasm pool

func (Pool) GetInstantiateMsg

func (p Pool) GetInstantiateMsg() []byte

func (*Pool) GetPoolDenoms

func (p *Pool) GetPoolDenoms(ctx sdk.Context) []string

GetPoolDenoms implements types.PoolI.

func (Pool) GetSpreadFactor

func (p Pool) GetSpreadFactor(ctx sdk.Context) osmomath.Dec

GetSpreadFactor returns the swap fee of the pool.

func (Pool) GetStoreModel

func (p Pool) GetStoreModel() poolmanagertypes.PoolI

func (Pool) GetTotalPoolLiquidity

func (p Pool) GetTotalPoolLiquidity(ctx sdk.Context) sdk.Coins

GetTotalPoolLiquidity returns the total pool liquidity

func (Pool) GetType

func (p Pool) GetType() poolmanagertypes.PoolType

GetType returns the type of the pool.

func (Pool) IsActive

func (p Pool) IsActive(ctx sdk.Context) bool

IsActive returns true if the pool is active

func (*Pool) SetContractAddress

func (p *Pool) SetContractAddress(contractAddress string)

func (*Pool) SetWasmKeeper

func (p *Pool) SetWasmKeeper(wasmKeeper types.WasmKeeper)

Set the wasm keeper.

func (Pool) SpotPrice

func (p Pool) SpotPrice(ctx sdk.Context, quoteAssetDenom string, baseAssetDenom string) (osmomath.BigDec, error)

SpotPrice returns the spot price of the pool.

func (Pool) String

func (p Pool) String() string

String returns the json marshalled string of the pool

type UnimplementedMsgCreatorServer

type UnimplementedMsgCreatorServer struct {
}

UnimplementedMsgCreatorServer can be embedded to have forward compatible implementations.

func (*UnimplementedMsgCreatorServer) CreateCosmWasmPool

Jump to

Keyboard shortcuts

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