types

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: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TypeEvtUploadedCosmwasmPoolCode = "uploaded_cosmwasm_pool_code"
	TypeEvtMigratedCosmwasmPoolCode = "migrated_cosmwasm_pool_code"

	AttributeValueCategory      = ModuleName
	AttributeKeyCodeID          = "code_id"
	AttributeKeyChecksum        = "checksum"
	AttributeKeyPoolIDsMigrated = "pool_ids_migrated"
)
View Source
const (
	ProposalTypeUploadCosmWasmPoolCodeAndWhiteList = "UploadCosmWasmPoolCodeAndWhiteListProposal"
	ProposalTypeMigratePoolContractsProposal       = "MigratePoolContractsProposal"
)
View Source
const (
	ModuleName = "cosmwasmpool"

	StoreKey = ModuleName

	RouterKey = ModuleName
)
View Source
const (
	// DefaultPoolMigrationLimit is the max number of pools that can be migrated at once.
	// Note that 20 was chosen arbitrarily to have a constant bound on the number of pools migrated.
	DefaultPoolMigrationLimit = 20
)

Variables

View Source
var (
	ErrEmptyPoolIds                         = errors.New("pool id list cannot be empty")
	ErrNoneOfCodeIdAndContractCodeSpecified = errors.New("both code id and byte code are unset. Only one must be specified.")
	ErrBothOfCodeIdAndContractCodeSpecified = errors.New("both code id and byte code are set. Only one must be specified.")
)
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 (
	ErrInvalidLengthGov        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowGov          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupGov = fmt.Errorf("proto: unexpected end of group")
)
View Source
var (
	// PoolsKey defines the store key for pools.
	PoolsKey = []byte{0x01}

	// CodeIdWhiteListKey defines the store key for code id whitelist.
	CodeIdWhiteListKey = []byte{0x02}
)
View Source
var (
	KeyCodeIdWhitelist    = []byte("CodeIdWhitelist")
	KeyPoolMigrationLimit = []byte("PoolMigrationLimit")
)

Parameter store keys.

View Source
var (
	ErrInvalidLengthParams        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowParams          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupParams = fmt.Errorf("proto: unexpected end of group")
)
View Source
var (
	ModuleCdc = codec.NewAminoCodec(amino)
)

Functions

func FormatCodeIdWhitelistPrefix

func FormatCodeIdWhitelistPrefix(codeId uint64) []byte

func FormatPoolsPrefix

func FormatPoolsPrefix(poolId uint64) []byte

func NewMigratePoolContractsProposal

func NewMigratePoolContractsProposal(title, description string, poolCodeIds []uint64, newCodeId uint64, wasmByteCode []byte) govtypesv1.Content

NewMigratePoolContractsProposal returns a new instance of a contact code migration proposal.

func NewUploadCosmWasmPoolCodeAndWhiteListProposal

func NewUploadCosmWasmPoolCodeAndWhiteListProposal(title, description string, wasmByteCode []byte) govtypesv1.Content

NewUploadCosmWasmPoolCodeAndWhiteListProposal returns a new instance of an upload cosmwasm pool code and whitelist proposal struct.

func ParamKeyTable

func ParamKeyTable() paramtypes.KeyTable

ParamTable for cosmwasmpool module.

func RegisterCodec

func RegisterCodec(cdc *codec.LegacyAmino)

func RegisterInterfaces

func RegisterInterfaces(registry types.InterfaceRegistry)

func RegisterMsgServer

func RegisterMsgServer(s grpc1.Server, srv MsgServer)

func ValidateMigrationProposalConfiguration

func ValidateMigrationProposalConfiguration(poolIds []uint64, newCodeId uint64, uploadByteCode []byte) error

ValidateMigrationProposalConfiguration validates the migration proposal configuration. It has two options to perform the migration.

1. If the codeID is non-zero, it will migrate the pool contracts to a given codeID assuming that it has already been uploaded. uploadByteCode must be empty in such a case. Fails if codeID does not exist. Fails if uploadByteCode is not empty.

2. If the codeID is zero, it will upload the given uploadByteCode and use the new resulting code id to migrate the pool to. Errors if uploadByteCode is empty or invalid.

For any of the options, it also validates that pool id list is not empty. Returns error if it is.

Types

type AccountKeeper

type AccountKeeper interface {
	GetModuleAddress(moduleName string) sdk.AccAddress
}

AccountKeeper defines the contract needed for AccountKeeper related APIs. Interface provides support to use non-sdk AccountKeeper for AnteHandler's decorators.

type BankKeeper

type BankKeeper interface {
	SendCoins(ctx sdk.Context, fromAddr sdk.AccAddress, toAddr sdk.AccAddress, amt sdk.Coins) error
}

BankKeeper defines the banking contract that must be fulfilled when creating a x/cosmwasmpool keeper.

type CodeIdNotWhitelistedError

type CodeIdNotWhitelistedError struct {
	CodeId uint64
}

func (CodeIdNotWhitelistedError) Error

type ContractKeeper

type ContractKeeper interface {
	Instantiate(
		ctx sdk.Context,
		codeID uint64,
		creator, admin sdk.AccAddress,
		initMsg []byte,
		label string,
		deposit sdk.Coins,
	) (sdk.AccAddress, []byte, error)

	Sudo(ctx sdk.Context, contractAddress sdk.AccAddress, msg []byte) ([]byte, error)

	Execute(ctx sdk.Context, contractAddress sdk.AccAddress, caller sdk.AccAddress, msg []byte, coins sdk.Coins) ([]byte, error)

	Create(ctx sdk.Context, creator sdk.AccAddress, wasmCode []byte, instantiateAccess *wasmtypes.AccessConfig) (codeID uint64, checksum []byte, err error)

	Migrate(ctx sdk.Context, contractAddress sdk.AccAddress, caller sdk.AccAddress, newCodeID uint64, msg []byte) ([]byte, error)
}

ContractKeeper defines the interface needed to be fulfilled for the contract keeper.

type CosmWasmExtension

type CosmWasmExtension interface {
	poolmanagertypes.PoolI

	GetCodeId() uint64

	GetInstantiateMsg() []byte

	GetContractAddress() string

	SetContractAddress(contractAddress string)

	GetStoreModel() poolmanagertypes.PoolI

	SetWasmKeeper(wasmKeeper WasmKeeper)

	GetTotalPoolLiquidity(ctx sdk.Context) sdk.Coins
}

CosmWasmExtension

type GenesisState

type GenesisState struct {
	// params is the container of cosmwasmpool parameters.
	Params Params       `protobuf:"bytes,1,opt,name=params,proto3" json:"params"`
	Pools  []*types.Any `protobuf:"bytes,2,rep,name=pools,proto3" json:"pools,omitempty"`
}

GenesisState defines the cosmwasmpool module's genesis state.

func DefaultGenesis

func DefaultGenesis() *GenesisState

DefaultGenesis returns the default GenesisState for the concentrated-liquidity module.

func (*GenesisState) Descriptor

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

func (*GenesisState) GetParams

func (m *GenesisState) GetParams() Params

func (*GenesisState) GetPools

func (m *GenesisState) GetPools() []*types.Any

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 InvalidPoolTypeError

type InvalidPoolTypeError struct {
	ActualPool interface{}
}

func (InvalidPoolTypeError) Error

func (e InvalidPoolTypeError) Error() string

type MigratePoolContractsProposal

type MigratePoolContractsProposal struct {
	Title       string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"`
	Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"`
	// pool_ids are the pool ids of the contracts to be migrated
	// either to the new_code_id that is already uploaded to chain or to
	// the given wasm_byte_code.
	PoolIds []uint64 `protobuf:"varint,3,rep,packed,name=pool_ids,json=poolIds,proto3" json:"pool_ids,omitempty"`
	// new_code_id is the code id of the contract code to migrate to.
	// Assumes that the code is already uploaded to chain. Only one of
	// new_code_id and wasm_byte_code should be set.
	NewCodeId uint64 `protobuf:"varint,4,opt,name=new_code_id,json=newCodeId,proto3" json:"new_code_id,omitempty"`
	// WASMByteCode can be raw or gzip compressed. Assumes that the code id
	// has not been uploaded yet so uploads the given code and migrates to it.
	// Only one of new_code_id and wasm_byte_code should be set.
	WASMByteCode []byte `protobuf:"bytes,5,opt,name=wasm_byte_code,json=wasmByteCode,proto3" json:"wasm_byte_code,omitempty"`
	// MigrateMsg migrate message to be used for migrating the pool contracts.
	MigrateMsg []byte `protobuf:"bytes,6,opt,name=migrate_msg,json=migrateMsg,proto3" json:"migrate_msg,omitempty"`
}

MigratePoolContractsProposal is a gov Content type for migrating given pools to the new contract code and adding to internal whitelist if needed. It has two options to perform the migration:

1. If the codeID is non-zero, it will migrate the pool contracts to a given codeID assuming that it has already been uploaded. uploadByteCode must be empty in such a case. Fails if codeID does not exist. Fails if uploadByteCode is not empty.

2. If the codeID is zero, it will upload the given uploadByteCode and use the new resulting code id to migrate the pool to. Errors if uploadByteCode is empty or invalid.

In both cases, if one of the pools specified by the given poolID does not exist, the proposal fails.

The reason for having poolIDs be a slice of ids is to account for the potential need for emergency migration of all old code ids associated with particular pools to new code ids, or simply having the flexibility of migrating multiple older pool contracts to a new one at once when there is a release.

poolD count to be submitted at once is gated by a governance paramets (20 at launch). The proposal fails if more. Note that 20 was chosen arbitrarily to have a constant bound on the number of pools migrated at once. This size will be configured by a module parameter so it can be changed by a constant.

func (*MigratePoolContractsProposal) Descriptor

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

func (*MigratePoolContractsProposal) Equal

func (this *MigratePoolContractsProposal) Equal(that interface{}) bool

func (*MigratePoolContractsProposal) GetDescription

func (p *MigratePoolContractsProposal) GetDescription() string

GetDescription gets the description of the proposal

func (*MigratePoolContractsProposal) GetTitle

func (p *MigratePoolContractsProposal) GetTitle() string

func (*MigratePoolContractsProposal) Marshal

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

func (*MigratePoolContractsProposal) MarshalTo

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

func (*MigratePoolContractsProposal) MarshalToSizedBuffer

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

func (*MigratePoolContractsProposal) ProposalRoute

func (p *MigratePoolContractsProposal) ProposalRoute() string

ProposalRoute returns the router key for the proposal

func (*MigratePoolContractsProposal) ProposalType

func (p *MigratePoolContractsProposal) ProposalType() string

ProposalType returns the type of the proposal

func (*MigratePoolContractsProposal) ProtoMessage

func (*MigratePoolContractsProposal) ProtoMessage()

func (*MigratePoolContractsProposal) Reset

func (m *MigratePoolContractsProposal) Reset()

func (*MigratePoolContractsProposal) Size

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

func (MigratePoolContractsProposal) String

String returns a string containing the pool incentives proposal.

func (*MigratePoolContractsProposal) Unmarshal

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

func (*MigratePoolContractsProposal) ValidateBasic

func (p *MigratePoolContractsProposal) ValidateBasic() error

ValidateBasic validates a governance proposal's abstract and basic contents

func (*MigratePoolContractsProposal) XXX_DiscardUnknown

func (m *MigratePoolContractsProposal) XXX_DiscardUnknown()

func (*MigratePoolContractsProposal) XXX_Marshal

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

func (*MigratePoolContractsProposal) XXX_Merge

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

func (*MigratePoolContractsProposal) XXX_Size

func (m *MigratePoolContractsProposal) XXX_Size() int

func (*MigratePoolContractsProposal) XXX_Unmarshal

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

type MsgClient

type MsgClient interface {
}

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 {
}

MsgServer is the server API for Msg service.

type NegativeExcessiveTokenInAmountError

type NegativeExcessiveTokenInAmountError struct {
	TokenInMaxAmount       osmomath.Int
	TokenInRequiredAmount  osmomath.Int
	TokenInExcessiveAmount osmomath.Int
}

func (NegativeExcessiveTokenInAmountError) Error

type Params

type Params struct {
	// code_ide_whitelist contains the list of code ids that are allowed to be
	// instantiated.
	CodeIdWhitelist []uint64 `` /* 141-byte string literal not displayed */
	// pool_migration_limit is the maximum number of pools that can be migrated
	// at once via governance proposal. This is to have a constant bound on the
	// number of pools that can be migrated at once and remove the possibility
	// of an unlikely scenario of causing a chain halt due to a large migration.
	PoolMigrationLimit uint64 `` /* 146-byte string literal not displayed */
}

func DefaultParams

func DefaultParams() Params

DefaultParams are the default cosmwasmpool module parameters.

func NewParams

func NewParams() Params

func (*Params) Descriptor

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

func (*Params) GetCodeIdWhitelist

func (m *Params) GetCodeIdWhitelist() []uint64

func (*Params) GetPoolMigrationLimit

func (m *Params) GetPoolMigrationLimit() uint64

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 validates 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 PoolManagerKeeper

type PoolManagerKeeper interface {
	CreatePool(ctx sdk.Context, msg poolmanagertypes.CreatePoolMsg) (uint64, error)
	GetNextPoolId(ctx sdk.Context) uint64
}

PoolManagerKeeper defines the interface needed to be fulfilled for the poolmanager keeper.

type PoolNotFoundError

type PoolNotFoundError struct {
	PoolId uint64
}

func (PoolNotFoundError) Error

func (e PoolNotFoundError) Error() string

type UnimplementedMsgServer

type UnimplementedMsgServer struct {
}

UnimplementedMsgServer can be embedded to have forward compatible implementations.

type UploadCosmWasmPoolCodeAndWhiteListProposal

type UploadCosmWasmPoolCodeAndWhiteListProposal struct {
	Title       string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"`
	Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"`
	// WASMByteCode can be raw or gzip compressed
	WASMByteCode []byte `protobuf:"bytes,3,opt,name=wasm_byte_code,json=wasmByteCode,proto3" json:"wasm_byte_code,omitempty"`
}

UploadCosmWasmPoolCodeAndWhiteListProposal is a gov Content type for uploading coswasm pool code and adding it to internal whitelist. Only the code ids created by this message are eligible for being x/cosmwasmpool pools.

func (*UploadCosmWasmPoolCodeAndWhiteListProposal) Descriptor

func (*UploadCosmWasmPoolCodeAndWhiteListProposal) Equal

func (this *UploadCosmWasmPoolCodeAndWhiteListProposal) Equal(that interface{}) bool

func (*UploadCosmWasmPoolCodeAndWhiteListProposal) GetDescription

GetDescription gets the description of the proposal

func (*UploadCosmWasmPoolCodeAndWhiteListProposal) GetTitle

func (*UploadCosmWasmPoolCodeAndWhiteListProposal) Marshal

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

func (*UploadCosmWasmPoolCodeAndWhiteListProposal) MarshalTo

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

func (*UploadCosmWasmPoolCodeAndWhiteListProposal) MarshalToSizedBuffer

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

func (*UploadCosmWasmPoolCodeAndWhiteListProposal) ProposalRoute

ProposalRoute returns the router key for the proposal

func (*UploadCosmWasmPoolCodeAndWhiteListProposal) ProposalType

ProposalType returns the type of the proposal

func (*UploadCosmWasmPoolCodeAndWhiteListProposal) ProtoMessage

func (*UploadCosmWasmPoolCodeAndWhiteListProposal) Reset

func (*UploadCosmWasmPoolCodeAndWhiteListProposal) Size

func (UploadCosmWasmPoolCodeAndWhiteListProposal) String

String returns a string containing the pool incentives proposal.

func (*UploadCosmWasmPoolCodeAndWhiteListProposal) Unmarshal

func (*UploadCosmWasmPoolCodeAndWhiteListProposal) ValidateBasic

ValidateBasic validates a governance proposal's abstract and basic contents

func (*UploadCosmWasmPoolCodeAndWhiteListProposal) XXX_DiscardUnknown

func (m *UploadCosmWasmPoolCodeAndWhiteListProposal) XXX_DiscardUnknown()

func (*UploadCosmWasmPoolCodeAndWhiteListProposal) XXX_Marshal

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

func (*UploadCosmWasmPoolCodeAndWhiteListProposal) XXX_Merge

func (*UploadCosmWasmPoolCodeAndWhiteListProposal) XXX_Size

func (*UploadCosmWasmPoolCodeAndWhiteListProposal) XXX_Unmarshal

type WasmKeeper

type WasmKeeper interface {
	QuerySmart(ctx sdk.Context, contractAddress sdk.AccAddress, queryMsg []byte) ([]byte, error)
	QueryGasLimit() storetypes.Gas

	GetContractInfo(ctx sdk.Context, contractAddress sdk.AccAddress) *wasmtypes.ContractInfo
}

ContractKeeper defines the interface needed to be fulfilled for the WasmKeeper.

Jump to

Keyboard shortcuts

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