types

package
v0.19.1-testnet Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2022 License: Apache-2.0 Imports: 22 Imported by: 3

Documentation

Index

Constants

View Source
const (
	EventTypeMintDerivative = "mint_derivative"
	EventTypeBurnDerivative = "burn_derivative"

	AttributeValueCategory        = ModuleName
	AttributeKeyDelegator         = "delegator"
	AttributeKeyValidator         = "validator"
	AttributeKeySharesTransferred = "shares_transferred"
)
View Source
const (
	// ModuleName The name that will be used throughout the module
	ModuleName = "liquid"

	// RouterKey Top level router key
	RouterKey = ModuleName

	// ModuleAccountName is the module account's name
	ModuleAccountName = ModuleName

	DefaultDerivativeDenom = "bkava"

	DenomSeparator = "-"
)
View Source
const (
	// TypeMsgMintDerivative represents the type string for MsgMintDerivative
	TypeMsgMintDerivative = "mint_derivative"
	// TypeMsgBurnDerivative represents the type string for MsgBurnDerivative
	TypeMsgBurnDerivative = "burn_derivative"
)

Variables

View Source
var (
	ErrNoValidatorFound           = sdkerrors.New(ModuleName, 2, "validator does not exist")
	ErrNoDelegatorForAddress      = sdkerrors.New(ModuleName, 3, "delegator does not contain delegation")
	ErrInvalidDenom               = sdkerrors.New(ModuleName, 4, "invalid denom")
	ErrNotEnoughDelegationShares  = sdkerrors.New(ModuleName, 5, "not enough delegation shares")
	ErrRedelegationsNotCompleted  = sdkerrors.New(ModuleName, 6, "active redelegations cannot be transferred")
	ErrUntransferableShares       = sdkerrors.New(ModuleName, 7, "shares cannot be transferred")
	ErrSelfDelegationBelowMinimum = sdkerrors.Register(ModuleName, 8, "validator's self delegation must be greater than their minimum self delegation")
)
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 GetLiquidStakingTokenDenom

func GetLiquidStakingTokenDenom(bondDenom string, valAddr sdk.ValAddress) string

func ParseLiquidStakingTokenDenom

func ParseLiquidStakingTokenDenom(denom string) (sdk.ValAddress, error)

ParseLiquidStakingTokenDenom extracts a validator address from a derivative denom.

func RegisterInterfaces

func RegisterInterfaces(registry types.InterfaceRegistry)

RegisterInterfaces registers proto messages under their interfaces for unmarshalling, in addition to registering the msg service for handling tx msgs.

func RegisterLegacyAminoCodec

func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino)

RegisterLegacyAminoCodec registers all the necessary types and interfaces for the module.

func RegisterMsgServer

func RegisterMsgServer(s grpc1.Server, srv MsgServer)

Types

type AccountKeeper

type AccountKeeper interface {
	GetModuleAddress(moduleName string) sdk.AccAddress
	GetModuleAccount(ctx sdk.Context, name string) authtypes.ModuleAccountI
}

AccountKeeper defines the expected keeper interface for interacting with account

type BankKeeper

type BankKeeper interface {
	SendCoinsFromModuleToModule(ctx sdk.Context, senderModule, recipientModule string, amt sdk.Coins) error
	SendCoinsFromAccountToModule(ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error
	SendCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error
	SendCoins(ctx sdk.Context, fromAddr sdk.AccAddress, toAddr sdk.AccAddress, amt sdk.Coins) error

	MintCoins(ctx sdk.Context, moduleName string, amt sdk.Coins) error
	BurnCoins(ctx sdk.Context, moduleName string, amt sdk.Coins) error
	UndelegateCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error

	IterateTotalSupply(ctx sdk.Context, cb func(sdk.Coin) bool)
	GetSupply(ctx sdk.Context, denom string) sdk.Coin
}

BankKeeper defines the expected bank keeper

type DistributionKeeper

type DistributionKeeper interface {
	GetDelegatorWithdrawAddr(ctx sdk.Context, delAddr sdk.AccAddress) sdk.AccAddress
	WithdrawDelegationRewards(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) (sdk.Coins, error)
}

type MsgBurnDerivative

type MsgBurnDerivative struct {
	// sender is the owner of the derivatives to be converted
	Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"`
	// validator is the validator of the derivatives to be converted
	Validator string `protobuf:"bytes,2,opt,name=validator,proto3" json:"validator,omitempty"`
	// amount is the quantity of derivatives to be converted
	Amount types.Coin `protobuf:"bytes,3,opt,name=amount,proto3" json:"amount"`
}

MsgBurnDerivative defines the Msg/BurnDerivative request type.

func NewMsgBurnDerivative

func NewMsgBurnDerivative(sender sdk.AccAddress, validator sdk.ValAddress, amount sdk.Coin) MsgBurnDerivative

NewMsgBurnDerivative returns a new MsgBurnDerivative

func (*MsgBurnDerivative) Descriptor

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

func (*MsgBurnDerivative) GetAmount

func (m *MsgBurnDerivative) GetAmount() types.Coin

func (*MsgBurnDerivative) GetSender

func (m *MsgBurnDerivative) GetSender() string

func (MsgBurnDerivative) GetSignBytes

func (msg MsgBurnDerivative) GetSignBytes() []byte

GetSignBytes gets the canonical byte representation of the Msg.

func (MsgBurnDerivative) GetSigners

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

GetSigners returns the addresses of signers that must sign.

func (*MsgBurnDerivative) GetValidator

func (m *MsgBurnDerivative) GetValidator() string

func (*MsgBurnDerivative) Marshal

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

func (*MsgBurnDerivative) MarshalTo

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

func (*MsgBurnDerivative) MarshalToSizedBuffer

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

func (*MsgBurnDerivative) ProtoMessage

func (*MsgBurnDerivative) ProtoMessage()

func (*MsgBurnDerivative) Reset

func (m *MsgBurnDerivative) Reset()

func (MsgBurnDerivative) Route

func (msg MsgBurnDerivative) Route() string

Route return the message type used for routing the message.

func (*MsgBurnDerivative) Size

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

func (*MsgBurnDerivative) String

func (m *MsgBurnDerivative) String() string

func (MsgBurnDerivative) Type

func (msg MsgBurnDerivative) Type() string

Type returns a human-readable string for the message, intended for utilization within tags.

func (*MsgBurnDerivative) Unmarshal

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

func (MsgBurnDerivative) ValidateBasic

func (msg MsgBurnDerivative) ValidateBasic() error

ValidateBasic does a simple validation check that doesn't require access to any other information.

func (*MsgBurnDerivative) XXX_DiscardUnknown

func (m *MsgBurnDerivative) XXX_DiscardUnknown()

func (*MsgBurnDerivative) XXX_Marshal

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

func (*MsgBurnDerivative) XXX_Merge

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

func (*MsgBurnDerivative) XXX_Size

func (m *MsgBurnDerivative) XXX_Size() int

func (*MsgBurnDerivative) XXX_Unmarshal

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

type MsgBurnDerivativeResponse

type MsgBurnDerivativeResponse struct {
	// received is the number of delegation shares sent to the sender
	Received github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,1,opt,name=received,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"received"`
}

MsgBurnDerivativeResponse defines the Msg/BurnDerivative response type.

func (*MsgBurnDerivativeResponse) Descriptor

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

func (*MsgBurnDerivativeResponse) Marshal

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

func (*MsgBurnDerivativeResponse) MarshalTo

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

func (*MsgBurnDerivativeResponse) MarshalToSizedBuffer

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

func (*MsgBurnDerivativeResponse) ProtoMessage

func (*MsgBurnDerivativeResponse) ProtoMessage()

func (*MsgBurnDerivativeResponse) Reset

func (m *MsgBurnDerivativeResponse) Reset()

func (*MsgBurnDerivativeResponse) Size

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

func (*MsgBurnDerivativeResponse) String

func (m *MsgBurnDerivativeResponse) String() string

func (*MsgBurnDerivativeResponse) Unmarshal

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

func (*MsgBurnDerivativeResponse) XXX_DiscardUnknown

func (m *MsgBurnDerivativeResponse) XXX_DiscardUnknown()

func (*MsgBurnDerivativeResponse) XXX_Marshal

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

func (*MsgBurnDerivativeResponse) XXX_Merge

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

func (*MsgBurnDerivativeResponse) XXX_Size

func (m *MsgBurnDerivativeResponse) XXX_Size() int

func (*MsgBurnDerivativeResponse) XXX_Unmarshal

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

type MsgClient

type MsgClient interface {
	// MintDerivative defines a method for converting a delegation into staking deriviatives.
	MintDerivative(ctx context.Context, in *MsgMintDerivative, opts ...grpc.CallOption) (*MsgMintDerivativeResponse, error)
	// BurnDerivative defines a method for converting staking deriviatives into a delegation.
	BurnDerivative(ctx context.Context, in *MsgBurnDerivative, opts ...grpc.CallOption) (*MsgBurnDerivativeResponse, 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 MsgMintDerivative

type MsgMintDerivative struct {
	// sender is the owner of the delegation to be converted
	Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"`
	// validator is the validator of the delegation to be converted
	Validator string `protobuf:"bytes,2,opt,name=validator,proto3" json:"validator,omitempty"`
	// amount is the quantity of staked assets to be converted
	Amount types.Coin `protobuf:"bytes,3,opt,name=amount,proto3" json:"amount"`
}

MsgMintDerivative defines the Msg/MintDerivative request type.

func NewMsgMintDerivative

func NewMsgMintDerivative(sender sdk.AccAddress, validator sdk.ValAddress, amount sdk.Coin) MsgMintDerivative

NewMsgMintDerivative returns a new MsgMintDerivative

func (*MsgMintDerivative) Descriptor

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

func (*MsgMintDerivative) GetAmount

func (m *MsgMintDerivative) GetAmount() types.Coin

func (*MsgMintDerivative) GetSender

func (m *MsgMintDerivative) GetSender() string

func (MsgMintDerivative) GetSignBytes

func (msg MsgMintDerivative) GetSignBytes() []byte

GetSignBytes gets the canonical byte representation of the Msg.

func (MsgMintDerivative) GetSigners

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

GetSigners returns the addresses of signers that must sign.

func (*MsgMintDerivative) GetValidator

func (m *MsgMintDerivative) GetValidator() string

func (*MsgMintDerivative) Marshal

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

func (*MsgMintDerivative) MarshalTo

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

func (*MsgMintDerivative) MarshalToSizedBuffer

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

func (*MsgMintDerivative) ProtoMessage

func (*MsgMintDerivative) ProtoMessage()

func (*MsgMintDerivative) Reset

func (m *MsgMintDerivative) Reset()

func (MsgMintDerivative) Route

func (msg MsgMintDerivative) Route() string

Route return the message type used for routing the message.

func (*MsgMintDerivative) Size

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

func (*MsgMintDerivative) String

func (m *MsgMintDerivative) String() string

func (MsgMintDerivative) Type

func (msg MsgMintDerivative) Type() string

Type returns a human-readable string for the message, intended for utilization within tags.

func (*MsgMintDerivative) Unmarshal

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

func (MsgMintDerivative) ValidateBasic

func (msg MsgMintDerivative) ValidateBasic() error

ValidateBasic does a simple validation check that doesn't require access to any other information.

func (*MsgMintDerivative) XXX_DiscardUnknown

func (m *MsgMintDerivative) XXX_DiscardUnknown()

func (*MsgMintDerivative) XXX_Marshal

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

func (*MsgMintDerivative) XXX_Merge

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

func (*MsgMintDerivative) XXX_Size

func (m *MsgMintDerivative) XXX_Size() int

func (*MsgMintDerivative) XXX_Unmarshal

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

type MsgMintDerivativeResponse

type MsgMintDerivativeResponse struct {
	// received is the amount of staking derivative minted and sent to the sender
	Received types.Coin `protobuf:"bytes,1,opt,name=received,proto3" json:"received"`
}

MsgMintDerivativeResponse defines the Msg/MintDerivative response type.

func (*MsgMintDerivativeResponse) Descriptor

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

func (*MsgMintDerivativeResponse) GetReceived

func (m *MsgMintDerivativeResponse) GetReceived() types.Coin

func (*MsgMintDerivativeResponse) Marshal

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

func (*MsgMintDerivativeResponse) MarshalTo

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

func (*MsgMintDerivativeResponse) MarshalToSizedBuffer

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

func (*MsgMintDerivativeResponse) ProtoMessage

func (*MsgMintDerivativeResponse) ProtoMessage()

func (*MsgMintDerivativeResponse) Reset

func (m *MsgMintDerivativeResponse) Reset()

func (*MsgMintDerivativeResponse) Size

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

func (*MsgMintDerivativeResponse) String

func (m *MsgMintDerivativeResponse) String() string

func (*MsgMintDerivativeResponse) Unmarshal

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

func (*MsgMintDerivativeResponse) XXX_DiscardUnknown

func (m *MsgMintDerivativeResponse) XXX_DiscardUnknown()

func (*MsgMintDerivativeResponse) XXX_Marshal

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

func (*MsgMintDerivativeResponse) XXX_Merge

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

func (*MsgMintDerivativeResponse) XXX_Size

func (m *MsgMintDerivativeResponse) XXX_Size() int

func (*MsgMintDerivativeResponse) XXX_Unmarshal

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

type MsgServer

type MsgServer interface {
	// MintDerivative defines a method for converting a delegation into staking deriviatives.
	MintDerivative(context.Context, *MsgMintDerivative) (*MsgMintDerivativeResponse, error)
	// BurnDerivative defines a method for converting staking deriviatives into a delegation.
	BurnDerivative(context.Context, *MsgBurnDerivative) (*MsgBurnDerivativeResponse, error)
}

MsgServer is the server API for Msg service.

type StakingKeeper

type StakingKeeper interface {
	BondDenom(ctx sdk.Context) (res string)

	GetValidator(ctx sdk.Context, addr sdk.ValAddress) (validator stakingtypes.Validator, found bool)
	GetDelegation(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) (delegation types.Delegation, found bool)
	HasReceivingRedelegation(ctx sdk.Context, delAddr sdk.AccAddress, valDstAddr sdk.ValAddress) bool

	ValidateUnbondAmount(
		ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress, amt sdk.Int,
	) (shares sdk.Dec, err error)

	Delegate(
		ctx sdk.Context, delAddr sdk.AccAddress, bondAmt sdk.Int, tokenSrc stakingtypes.BondStatus,
		validator stakingtypes.Validator, subtractAccount bool,
	) (newShares sdk.Dec, err error)
	Unbond(
		ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress, shares sdk.Dec,
	) (amount sdk.Int, err error)
}

StakingKeeper defines the expected keeper interface for interacting with staking

type UnimplementedMsgServer

type UnimplementedMsgServer struct {
}

UnimplementedMsgServer can be embedded to have forward compatible implementations.

func (*UnimplementedMsgServer) BurnDerivative

func (*UnimplementedMsgServer) MintDerivative

Jump to

Keyboard shortcuts

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