types

package
v0.19.0-rc0 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2022 License: Apache-2.0 Imports: 35 Imported by: 8

Documentation

Overview

Package types is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

View Source
const (
	AttributeValueCategory = ModuleName
	EventTypeVaultDeposit  = "vault_deposit"
	EventTypeVaultWithdraw = "vault_withdraw"
	AttributeKeyVaultDenom = "vault_denom"
	AttributeKeyDepositor  = "depositor"
	AttributeKeyShares     = "shares"
	AttributeKeyOwner      = "owner"
)

Event types for earn module

View Source
const (
	// ModuleName name that will be used throughout the module
	ModuleName = "earn"

	// ModuleAccountName name of module account used to hold liquidity
	ModuleAccountName = "earn"

	// StoreKey Top level store key where all module items will be stored
	StoreKey = ModuleName

	// RouterKey Top level router key
	RouterKey = ModuleName

	// QuerierRoute Top level query string
	QuerierRoute = ModuleName

	// DefaultParamspace default name for parameter store
	DefaultParamspace = ModuleName
)
View Source
const (
	TypeMsgDeposit  = "earn_msg_deposit"
	TypeMsgWithdraw = "earn_msg_withdraw"
)

legacy message types

View Source
const (
	// ProposalTypeCommunityPoolDeposit defines the type for a CommunityPoolDepositProposal
	ProposalTypeCommunityPoolDeposit = "CommunityPoolDeposit"
	// ProposalTypeCommunityPoolWithdraw defines the type for a CommunityPoolDepositProposal
	ProposalTypeCommunityPoolWithdraw = "CommunityPoolWithdraw"
)

Variables

View Source
var (
	ErrInvalidVaultDenom        = sdkerrors.Register(ModuleName, 2, "invalid vault denom")
	ErrInvalidVaultStrategy     = sdkerrors.Register(ModuleName, 3, "vault does not support this strategy")
	ErrInsufficientAmount       = sdkerrors.Register(ModuleName, 4, "insufficient amount")
	ErrInsufficientValue        = sdkerrors.Register(ModuleName, 5, "insufficient vault account value")
	ErrVaultRecordNotFound      = sdkerrors.Register(ModuleName, 6, "vault record not found")
	ErrVaultShareRecordNotFound = sdkerrors.Register(ModuleName, 7, "vault share record not found")
	ErrAccountDepositNotAllowed = sdkerrors.Register(ModuleName, 8, "account is not allowed to deposit to this vault")
)

earn module errors

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 (
	VaultRecordKeyPrefix      = []byte{0x01} // denom -> vault
	VaultShareRecordKeyPrefix = []byte{0x02} // depositor address -> vault shares
)

key prefixes for store

View Source
var (
	KeyAllowedVaults     = []byte("AllowedVaults")
	DefaultAllowedVaults = AllowedVaults{}
)

Parameter keys and default values

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 (
	ErrInvalidLengthProposal        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowProposal          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupProposal = fmt.Errorf("proto: unexpected end of group")
)
View Source
var (
	ErrInvalidLengthQuery        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowQuery          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupQuery = 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 (
	ErrInvalidLengthVault        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowVault          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupVault = fmt.Errorf("proto: unexpected end of group")
)
View Source
var (

	// ModuleCdc represents the legacy amino codec for the module
	ModuleCdc = codec.NewAminoCodec(amino)
)
View Source
var StrategyType_name = map[int32]string{
	0: "STRATEGY_TYPE_UNSPECIFIED",
	1: "STRATEGY_TYPE_HARD",
	2: "STRATEGY_TYPE_SAVINGS",
}
View Source
var StrategyType_value = map[string]int32{
	"STRATEGY_TYPE_UNSPECIFIED": 0,
	"STRATEGY_TYPE_HARD":        1,
	"STRATEGY_TYPE_SAVINGS":     2,
}

Functions

func DepositorVaultSharesKey

func DepositorVaultSharesKey(depositor sdk.AccAddress) []byte

DepositorVaultSharesKey returns a key from a depositor address

func ParamKeyTable

func ParamKeyTable() paramtypes.KeyTable

ParamKeyTable for earn module.

func RegisterInterfaces

func RegisterInterfaces(registry types.InterfaceRegistry)

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

func RegisterLegacyAminoCodec

func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino)

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

func RegisterMsgServer

func RegisterMsgServer(s grpc1.Server, srv MsgServer)

func RegisterQueryHandler

func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error

RegisterQueryHandler registers the http handlers for service Query to "mux". The handlers forward requests to the grpc endpoint over "conn".

func RegisterQueryHandlerClient

func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error

RegisterQueryHandlerClient registers the http handlers for service Query to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "QueryClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "QueryClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "QueryClient" to call the correct interceptors.

func RegisterQueryHandlerFromEndpoint

func RegisterQueryHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)

RegisterQueryHandlerFromEndpoint is same as RegisterQueryHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.

func RegisterQueryHandlerServer

func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error

RegisterQueryHandlerServer registers the http handlers for service Query to "mux". UnaryRPC :call QueryServer directly. StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. Note that using this registration option will cause many gRPC library features (such as grpc.SendHeader, etc) to stop working. Consider using RegisterQueryHandlerFromEndpoint instead.

func RegisterQueryServer

func RegisterQueryServer(s grpc1.Server, srv QueryServer)

func VaultKey

func VaultKey(denom string) []byte

VaultKey returns a key generated from a vault denom

Types

type AccountKeeper

type AccountKeeper interface {
	GetAccount(ctx sdk.Context, addr sdk.AccAddress) types.AccountI
	SetModuleAccount(sdk.Context, types.ModuleAccountI)
	GetModuleAddress(name string) sdk.AccAddress
	GetModuleAccount(ctx sdk.Context, name string) types.ModuleAccountI
}

AccountKeeper defines the expected account keeper

type AllowedVault

type AllowedVault struct {
	// Denom is the only supported denomination of the vault for deposits and withdrawals.
	Denom string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty"`
	// VaultStrategy is the strategy used for this vault.
	Strategies StrategyTypes `` /* 144-byte string literal not displayed */
	// IsPrivateVault is true if the vault only allows depositors contained in
	// AllowedDepositors.
	IsPrivateVault bool `protobuf:"varint,3,opt,name=is_private_vault,json=isPrivateVault,proto3" json:"is_private_vault,omitempty"`
	// AllowedDepositors is a list of addresses that are allowed to deposit to
	// this vault if IsPrivateVault is true. Addresses not contained in this list
	// are not allowed to deposit into this vault. If IsPrivateVault is false,
	// this should be empty and ignored.
	AllowedDepositors []github_com_cosmos_cosmos_sdk_types.AccAddress `` /* 167-byte string literal not displayed */
}

AllowedVault is a vault that is allowed to be created. These can be modified via parameter governance.

func NewAllowedVault

func NewAllowedVault(
	denom string,
	strategyTypes StrategyTypes,
	isPrivateVault bool,
	allowedDepositors []sdk.AccAddress,
) AllowedVault

NewAllowedVault returns a new AllowedVault with the given values.

func (*AllowedVault) Descriptor

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

func (*AllowedVault) GetAllowedDepositors

func (m *AllowedVault) GetAllowedDepositors() []github_com_cosmos_cosmos_sdk_types.AccAddress

func (*AllowedVault) GetDenom

func (m *AllowedVault) GetDenom() string

func (*AllowedVault) GetIsPrivateVault

func (m *AllowedVault) GetIsPrivateVault() bool

func (*AllowedVault) GetStrategies

func (m *AllowedVault) GetStrategies() StrategyTypes

func (*AllowedVault) IsAccountAllowed

func (a *AllowedVault) IsAccountAllowed(account sdk.AccAddress) bool

IsAccountAllowed returns true if the given account is allowed to deposit into the vault.

func (*AllowedVault) IsStrategyAllowed

func (a *AllowedVault) IsStrategyAllowed(strategy StrategyType) bool

IsStrategyAllowed returns true if the given strategy type is allowed for the vault.

func (*AllowedVault) Marshal

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

func (*AllowedVault) MarshalTo

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

func (*AllowedVault) MarshalToSizedBuffer

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

func (*AllowedVault) ProtoMessage

func (*AllowedVault) ProtoMessage()

func (*AllowedVault) Reset

func (m *AllowedVault) Reset()

func (*AllowedVault) Size

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

func (*AllowedVault) String

func (m *AllowedVault) String() string

func (*AllowedVault) Unmarshal

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

func (*AllowedVault) Validate

func (a *AllowedVault) Validate() error

Validate returns an error if the AllowedVault is invalid

func (*AllowedVault) XXX_DiscardUnknown

func (m *AllowedVault) XXX_DiscardUnknown()

func (*AllowedVault) XXX_Marshal

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

func (*AllowedVault) XXX_Merge

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

func (*AllowedVault) XXX_Size

func (m *AllowedVault) XXX_Size() int

func (*AllowedVault) XXX_Unmarshal

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

type AllowedVaults

type AllowedVaults []AllowedVault

AllowedVaults is a slice of AllowedVault.

func (AllowedVaults) Validate

func (a AllowedVaults) Validate() error

Validate returns an error if the AllowedVaults is invalid.

type BankKeeper

type BankKeeper interface {
	GetAllBalances(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins

	SendCoinsFromModuleToModule(ctx sdk.Context, senderModule, recipientModule string, amt sdk.Coins) error
	SendCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error
	SendCoinsFromAccountToModule(ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error
}

BankKeeper defines the expected interface needed to retrieve account balances.

type CommunityPoolDepositProposal

type CommunityPoolDepositProposal 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"`
	Amount      types.Coin `protobuf:"bytes,3,opt,name=amount,proto3" json:"amount"`
}

CommunityPoolDepositProposal deposits from the community pool into an earn vault

func NewCommunityPoolDepositProposal

func NewCommunityPoolDepositProposal(title, description string, amount sdk.Coin) *CommunityPoolDepositProposal

NewCommunityPoolDepositProposal creates a new community pool deposit proposal.

func (*CommunityPoolDepositProposal) Descriptor

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

func (*CommunityPoolDepositProposal) GetDescription

func (cdp *CommunityPoolDepositProposal) GetDescription() string

GetDescription returns the description of a community pool deposit proposal.

func (*CommunityPoolDepositProposal) GetTitle

func (cdp *CommunityPoolDepositProposal) GetTitle() string

GetTitle returns the title of a community pool deposit proposal.

func (*CommunityPoolDepositProposal) Marshal

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

func (*CommunityPoolDepositProposal) MarshalTo

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

func (*CommunityPoolDepositProposal) MarshalToSizedBuffer

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

func (*CommunityPoolDepositProposal) ProposalRoute

func (cdp *CommunityPoolDepositProposal) ProposalRoute() string

GetDescription returns the routing key of a community pool deposit proposal.

func (*CommunityPoolDepositProposal) ProposalType

func (cdp *CommunityPoolDepositProposal) ProposalType() string

ProposalType returns the type of a community pool deposit proposal.

func (*CommunityPoolDepositProposal) ProtoMessage

func (*CommunityPoolDepositProposal) ProtoMessage()

func (*CommunityPoolDepositProposal) Reset

func (m *CommunityPoolDepositProposal) Reset()

func (*CommunityPoolDepositProposal) Size

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

func (*CommunityPoolDepositProposal) String

func (cdp *CommunityPoolDepositProposal) String() string

String implements fmt.Stringer

func (*CommunityPoolDepositProposal) Unmarshal

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

func (*CommunityPoolDepositProposal) ValidateBasic

func (cdp *CommunityPoolDepositProposal) ValidateBasic() error

ValidateBasic stateless validation of a community pool multi-spend proposal.

func (*CommunityPoolDepositProposal) XXX_DiscardUnknown

func (m *CommunityPoolDepositProposal) XXX_DiscardUnknown()

func (*CommunityPoolDepositProposal) XXX_Marshal

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

func (*CommunityPoolDepositProposal) XXX_Merge

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

func (*CommunityPoolDepositProposal) XXX_Size

func (m *CommunityPoolDepositProposal) XXX_Size() int

func (*CommunityPoolDepositProposal) XXX_Unmarshal

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

type CommunityPoolDepositProposalJSON

type CommunityPoolDepositProposalJSON 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"`
	Amount      types.Coin                               `protobuf:"bytes,3,opt,name=amount,proto3" json:"amount"`
	Deposit     github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,4,rep,name=deposit,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"deposit"`
}

CommunityPoolDepositProposalJSON defines a CommunityPoolDepositProposal with a deposit

func (*CommunityPoolDepositProposalJSON) Descriptor

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

func (*CommunityPoolDepositProposalJSON) Marshal

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

func (*CommunityPoolDepositProposalJSON) MarshalTo

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

func (*CommunityPoolDepositProposalJSON) MarshalToSizedBuffer

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

func (*CommunityPoolDepositProposalJSON) ProtoMessage

func (*CommunityPoolDepositProposalJSON) ProtoMessage()

func (*CommunityPoolDepositProposalJSON) Reset

func (*CommunityPoolDepositProposalJSON) Size

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

func (*CommunityPoolDepositProposalJSON) String

func (*CommunityPoolDepositProposalJSON) Unmarshal

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

func (*CommunityPoolDepositProposalJSON) XXX_DiscardUnknown

func (m *CommunityPoolDepositProposalJSON) XXX_DiscardUnknown()

func (*CommunityPoolDepositProposalJSON) XXX_Marshal

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

func (*CommunityPoolDepositProposalJSON) XXX_Merge

func (*CommunityPoolDepositProposalJSON) XXX_Size

func (m *CommunityPoolDepositProposalJSON) XXX_Size() int

func (*CommunityPoolDepositProposalJSON) XXX_Unmarshal

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

type CommunityPoolWithdrawProposal

type CommunityPoolWithdrawProposal 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"`
	Amount      types.Coin `protobuf:"bytes,3,opt,name=amount,proto3" json:"amount"`
}

CommunityPoolWithdrawProposal withdraws from an earn vault back to community pool

func NewCommunityPoolWithdrawProposal

func NewCommunityPoolWithdrawProposal(title, description string, amount sdk.Coin) *CommunityPoolWithdrawProposal

NewCommunityPoolWithdrawProposal creates a new community pool deposit proposal.

func (*CommunityPoolWithdrawProposal) Descriptor

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

func (*CommunityPoolWithdrawProposal) GetDescription

func (cdp *CommunityPoolWithdrawProposal) GetDescription() string

GetDescription returns the description of a community pool withdraw proposal.

func (*CommunityPoolWithdrawProposal) GetTitle

func (cdp *CommunityPoolWithdrawProposal) GetTitle() string

GetTitle returns the title of a community pool withdraw proposal.

func (*CommunityPoolWithdrawProposal) Marshal

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

func (*CommunityPoolWithdrawProposal) MarshalTo

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

func (*CommunityPoolWithdrawProposal) MarshalToSizedBuffer

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

func (*CommunityPoolWithdrawProposal) ProposalRoute

func (cdp *CommunityPoolWithdrawProposal) ProposalRoute() string

GetDescription returns the routing key of a community pool withdraw proposal.

func (*CommunityPoolWithdrawProposal) ProposalType

func (cdp *CommunityPoolWithdrawProposal) ProposalType() string

ProposalType returns the type of a community pool withdraw proposal.

func (*CommunityPoolWithdrawProposal) ProtoMessage

func (*CommunityPoolWithdrawProposal) ProtoMessage()

func (*CommunityPoolWithdrawProposal) Reset

func (m *CommunityPoolWithdrawProposal) Reset()

func (*CommunityPoolWithdrawProposal) Size

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

func (*CommunityPoolWithdrawProposal) String

func (cdp *CommunityPoolWithdrawProposal) String() string

String implements fmt.Stringer

func (*CommunityPoolWithdrawProposal) Unmarshal

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

func (*CommunityPoolWithdrawProposal) ValidateBasic

func (cdp *CommunityPoolWithdrawProposal) ValidateBasic() error

ValidateBasic stateless validation of a community pool multi-spend proposal.

func (*CommunityPoolWithdrawProposal) XXX_DiscardUnknown

func (m *CommunityPoolWithdrawProposal) XXX_DiscardUnknown()

func (*CommunityPoolWithdrawProposal) XXX_Marshal

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

func (*CommunityPoolWithdrawProposal) XXX_Merge

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

func (*CommunityPoolWithdrawProposal) XXX_Size

func (m *CommunityPoolWithdrawProposal) XXX_Size() int

func (*CommunityPoolWithdrawProposal) XXX_Unmarshal

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

type CommunityPoolWithdrawProposalJSON

type CommunityPoolWithdrawProposalJSON 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"`
	Amount      types.Coin                               `protobuf:"bytes,3,opt,name=amount,proto3" json:"amount"`
	Deposit     github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,4,rep,name=deposit,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"deposit"`
}

CommunityPoolWithdrawProposalJSON defines a CommunityPoolWithdrawProposal with a deposit

func (*CommunityPoolWithdrawProposalJSON) Descriptor

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

func (*CommunityPoolWithdrawProposalJSON) Marshal

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

func (*CommunityPoolWithdrawProposalJSON) MarshalTo

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

func (*CommunityPoolWithdrawProposalJSON) MarshalToSizedBuffer

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

func (*CommunityPoolWithdrawProposalJSON) ProtoMessage

func (*CommunityPoolWithdrawProposalJSON) ProtoMessage()

func (*CommunityPoolWithdrawProposalJSON) Reset

func (*CommunityPoolWithdrawProposalJSON) Size

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

func (*CommunityPoolWithdrawProposalJSON) String

func (*CommunityPoolWithdrawProposalJSON) Unmarshal

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

func (*CommunityPoolWithdrawProposalJSON) XXX_DiscardUnknown

func (m *CommunityPoolWithdrawProposalJSON) XXX_DiscardUnknown()

func (*CommunityPoolWithdrawProposalJSON) XXX_Marshal

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

func (*CommunityPoolWithdrawProposalJSON) XXX_Merge

func (*CommunityPoolWithdrawProposalJSON) XXX_Size

func (m *CommunityPoolWithdrawProposalJSON) XXX_Size() int

func (*CommunityPoolWithdrawProposalJSON) XXX_Unmarshal

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

type DepositResponse

type DepositResponse struct {
	// depositor represents the owner of the deposit.
	Depositor string `protobuf:"bytes,1,opt,name=depositor,proto3" json:"depositor,omitempty"`
	// Shares represent the issued shares from their corresponding vaults.
	Shares VaultShares `protobuf:"bytes,2,rep,name=shares,proto3,castrepeated=VaultShares" json:"shares"`
	// Value represents the total accumulated value of denom coins supplied to
	// vaults. This may be greater than or equal to amount_supplied depending on
	// the strategy.
	Value github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,3,rep,name=value,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"value"`
}

DepositResponse defines a deposit query response type.

func (*DepositResponse) Descriptor

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

func (*DepositResponse) Marshal

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

func (*DepositResponse) MarshalTo

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

func (*DepositResponse) MarshalToSizedBuffer

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

func (*DepositResponse) ProtoMessage

func (*DepositResponse) ProtoMessage()

func (*DepositResponse) Reset

func (m *DepositResponse) Reset()

func (*DepositResponse) Size

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

func (*DepositResponse) String

func (m *DepositResponse) String() string

func (*DepositResponse) Unmarshal

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

func (*DepositResponse) XXX_DiscardUnknown

func (m *DepositResponse) XXX_DiscardUnknown()

func (*DepositResponse) XXX_Marshal

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

func (*DepositResponse) XXX_Merge

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

func (*DepositResponse) XXX_Size

func (m *DepositResponse) XXX_Size() int

func (*DepositResponse) XXX_Unmarshal

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

type DistributionKeeper

type DistributionKeeper interface {
	GetFeePool(ctx sdk.Context) (feePool disttypes.FeePool)
	SetFeePool(ctx sdk.Context, feePool disttypes.FeePool)
	GetDistributionAccount(ctx sdk.Context) types.ModuleAccountI
	DistributeFromFeePool(ctx sdk.Context, amount sdk.Coins, receiveAddr sdk.AccAddress) error
}

DistributionKeeper defines the expected interface needed for community-pool deposits to earn vaults

type EarnHooks

type EarnHooks interface {
	AfterVaultDepositCreated(ctx sdk.Context, vaultDenom string, depositor sdk.AccAddress, sharesOwned sdk.Dec)
	BeforeVaultDepositModified(ctx sdk.Context, vaultDenom string, depositor sdk.AccAddress, sharesOwned sdk.Dec)
}

EarnHooks are event hooks called when a user's deposit to a earn vault changes.

type GenesisState

type GenesisState struct {
	// params defines all the paramaters related to earn
	Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"`
	// vault_records defines the available vaults
	VaultRecords VaultRecords `protobuf:"bytes,2,rep,name=vault_records,json=vaultRecords,proto3,castrepeated=VaultRecords" json:"vault_records"`
	// share_records defines the owned shares of each vault
	VaultShareRecords VaultShareRecords `` /* 135-byte string literal not displayed */
}

GenesisState defines the earn module's genesis state.

func DefaultGenesisState

func DefaultGenesisState() GenesisState

DefaultGenesisState returns a default genesis state

func NewGenesisState

func NewGenesisState(
	params Params,
	vaultRecords VaultRecords,
	vaultShareRecords VaultShareRecords,
) GenesisState

NewGenesisState creates a new genesis state.

func (*GenesisState) Descriptor

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

func (*GenesisState) GetParams

func (m *GenesisState) GetParams() Params

func (*GenesisState) GetVaultRecords

func (m *GenesisState) GetVaultRecords() VaultRecords

func (*GenesisState) GetVaultShareRecords

func (m *GenesisState) GetVaultShareRecords() VaultShareRecords

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 validates the module's genesis state

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 HardKeeper

type HardKeeper interface {
	Deposit(ctx sdk.Context, depositor sdk.AccAddress, coins sdk.Coins) error
	Withdraw(ctx sdk.Context, depositor sdk.AccAddress, coins sdk.Coins) error

	GetSyncedDeposit(ctx sdk.Context, depositor sdk.AccAddress) (hardtypes.Deposit, bool)
}

HardKeeper defines the expected interface needed for the hard strategy.

type LiquidKeeper

type LiquidKeeper interface {
	GetStakedTokensForDerivatives(ctx sdk.Context, derivatives sdk.Coins) (sdk.Coin, error)
	IsDerivativeDenom(ctx sdk.Context, denom string) bool
}

LiquidKeeper defines the expected interface needed for derivative to staked token conversions.

type MsgClient

type MsgClient interface {
	// Deposit defines a method for depositing assets into a vault
	Deposit(ctx context.Context, in *MsgDeposit, opts ...grpc.CallOption) (*MsgDepositResponse, error)
	// Withdraw defines a method for withdrawing assets into a vault
	Withdraw(ctx context.Context, in *MsgWithdraw, opts ...grpc.CallOption) (*MsgWithdrawResponse, 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 MsgDeposit

type MsgDeposit struct {
	// depositor represents the address to deposit funds from
	Depositor string `protobuf:"bytes,1,opt,name=depositor,proto3" json:"depositor,omitempty"`
	// Amount represents the token to deposit. The vault corresponds to the denom
	// of the amount coin.
	Amount types.Coin `protobuf:"bytes,2,opt,name=amount,proto3" json:"amount"`
	// Strategy is the vault strategy to use.
	Strategy StrategyType `protobuf:"varint,3,opt,name=strategy,proto3,enum=kava.earn.v1beta1.StrategyType" json:"strategy,omitempty"`
}

MsgDeposit represents a message for depositing assedts into a vault

func NewMsgDeposit

func NewMsgDeposit(depositor string, amount sdk.Coin, strategy StrategyType) *MsgDeposit

NewMsgDeposit returns a new MsgDeposit.

func (*MsgDeposit) Descriptor

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

func (MsgDeposit) GetSignBytes

func (msg MsgDeposit) GetSignBytes() []byte

GetSignBytes gets the canonical byte representation of the Msg.

func (MsgDeposit) GetSigners

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

GetSigners returns the addresses of signers that must sign.

func (*MsgDeposit) Marshal

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

func (*MsgDeposit) MarshalTo

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

func (*MsgDeposit) MarshalToSizedBuffer

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

func (*MsgDeposit) ProtoMessage

func (*MsgDeposit) ProtoMessage()

func (*MsgDeposit) Reset

func (m *MsgDeposit) Reset()

func (MsgDeposit) Route

func (msg MsgDeposit) Route() string

Route implements the LegacyMsg.Route method.

func (*MsgDeposit) Size

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

func (*MsgDeposit) String

func (m *MsgDeposit) String() string

func (MsgDeposit) Type

func (msg MsgDeposit) Type() string

Type implements the LegacyMsg.Type method.

func (*MsgDeposit) Unmarshal

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

func (MsgDeposit) ValidateBasic

func (msg MsgDeposit) ValidateBasic() error

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

func (*MsgDeposit) XXX_DiscardUnknown

func (m *MsgDeposit) XXX_DiscardUnknown()

func (*MsgDeposit) XXX_Marshal

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

func (*MsgDeposit) XXX_Merge

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

func (*MsgDeposit) XXX_Size

func (m *MsgDeposit) XXX_Size() int

func (*MsgDeposit) XXX_Unmarshal

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

type MsgDepositResponse

type MsgDepositResponse struct {
	Shares VaultShare `protobuf:"bytes,1,opt,name=shares,proto3" json:"shares"`
}

MsgDepositResponse defines the Msg/Deposit response type.

func (*MsgDepositResponse) Descriptor

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

func (*MsgDepositResponse) GetShares

func (m *MsgDepositResponse) GetShares() VaultShare

func (*MsgDepositResponse) Marshal

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

func (*MsgDepositResponse) MarshalTo

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

func (*MsgDepositResponse) MarshalToSizedBuffer

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

func (*MsgDepositResponse) ProtoMessage

func (*MsgDepositResponse) ProtoMessage()

func (*MsgDepositResponse) Reset

func (m *MsgDepositResponse) Reset()

func (*MsgDepositResponse) Size

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

func (*MsgDepositResponse) String

func (m *MsgDepositResponse) String() string

func (*MsgDepositResponse) Unmarshal

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

func (*MsgDepositResponse) XXX_DiscardUnknown

func (m *MsgDepositResponse) XXX_DiscardUnknown()

func (*MsgDepositResponse) XXX_Marshal

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

func (*MsgDepositResponse) XXX_Merge

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

func (*MsgDepositResponse) XXX_Size

func (m *MsgDepositResponse) XXX_Size() int

func (*MsgDepositResponse) XXX_Unmarshal

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

type MsgServer

type MsgServer interface {
	// Deposit defines a method for depositing assets into a vault
	Deposit(context.Context, *MsgDeposit) (*MsgDepositResponse, error)
	// Withdraw defines a method for withdrawing assets into a vault
	Withdraw(context.Context, *MsgWithdraw) (*MsgWithdrawResponse, error)
}

MsgServer is the server API for Msg service.

type MsgWithdraw

type MsgWithdraw struct {
	// from represents the address we are withdrawing for
	From string `protobuf:"bytes,1,opt,name=from,proto3" json:"from,omitempty"`
	// Amount represents the token to withdraw. The vault corresponds to the denom
	// of the amount coin.
	Amount types.Coin `protobuf:"bytes,2,opt,name=amount,proto3" json:"amount"`
	// Strategy is the vault strategy to use.
	Strategy StrategyType `protobuf:"varint,3,opt,name=strategy,proto3,enum=kava.earn.v1beta1.StrategyType" json:"strategy,omitempty"`
}

MsgWithdraw represents a message for withdrawing liquidity from a vault

func NewMsgWithdraw

func NewMsgWithdraw(from string, amount sdk.Coin, strategy StrategyType) *MsgWithdraw

NewMsgWithdraw returns a new MsgWithdraw.

func (*MsgWithdraw) Descriptor

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

func (MsgWithdraw) GetSignBytes

func (msg MsgWithdraw) GetSignBytes() []byte

GetSignBytes gets the canonical byte representation of the Msg.

func (MsgWithdraw) GetSigners

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

GetSigners returns the addresses of signers that must sign.

func (*MsgWithdraw) Marshal

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

func (*MsgWithdraw) MarshalTo

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

func (*MsgWithdraw) MarshalToSizedBuffer

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

func (*MsgWithdraw) ProtoMessage

func (*MsgWithdraw) ProtoMessage()

func (*MsgWithdraw) Reset

func (m *MsgWithdraw) Reset()

func (MsgWithdraw) Route

func (msg MsgWithdraw) Route() string

Route implements the LegacyMsg.Route method.

func (*MsgWithdraw) Size

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

func (*MsgWithdraw) String

func (m *MsgWithdraw) String() string

func (MsgWithdraw) Type

func (msg MsgWithdraw) Type() string

Type implements the LegacyMsg.Type method.

func (*MsgWithdraw) Unmarshal

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

func (MsgWithdraw) ValidateBasic

func (msg MsgWithdraw) ValidateBasic() error

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

func (*MsgWithdraw) XXX_DiscardUnknown

func (m *MsgWithdraw) XXX_DiscardUnknown()

func (*MsgWithdraw) XXX_Marshal

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

func (*MsgWithdraw) XXX_Merge

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

func (*MsgWithdraw) XXX_Size

func (m *MsgWithdraw) XXX_Size() int

func (*MsgWithdraw) XXX_Unmarshal

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

type MsgWithdrawResponse

type MsgWithdrawResponse struct {
	Shares VaultShare `protobuf:"bytes,1,opt,name=shares,proto3" json:"shares"`
}

MsgWithdrawResponse defines the Msg/Withdraw response type.

func (*MsgWithdrawResponse) Descriptor

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

func (*MsgWithdrawResponse) GetShares

func (m *MsgWithdrawResponse) GetShares() VaultShare

func (*MsgWithdrawResponse) Marshal

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

func (*MsgWithdrawResponse) MarshalTo

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

func (*MsgWithdrawResponse) MarshalToSizedBuffer

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

func (*MsgWithdrawResponse) ProtoMessage

func (*MsgWithdrawResponse) ProtoMessage()

func (*MsgWithdrawResponse) Reset

func (m *MsgWithdrawResponse) Reset()

func (*MsgWithdrawResponse) Size

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

func (*MsgWithdrawResponse) String

func (m *MsgWithdrawResponse) String() string

func (*MsgWithdrawResponse) Unmarshal

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

func (*MsgWithdrawResponse) XXX_DiscardUnknown

func (m *MsgWithdrawResponse) XXX_DiscardUnknown()

func (*MsgWithdrawResponse) XXX_Marshal

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

func (*MsgWithdrawResponse) XXX_Merge

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

func (*MsgWithdrawResponse) XXX_Size

func (m *MsgWithdrawResponse) XXX_Size() int

func (*MsgWithdrawResponse) XXX_Unmarshal

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

type Params

type Params struct {
	AllowedVaults AllowedVaults `protobuf:"bytes,1,rep,name=allowed_vaults,json=allowedVaults,proto3,castrepeated=AllowedVaults" json:"allowed_vaults"`
}

Params defines the parameters of the earn module.

func DefaultParams

func DefaultParams() Params

DefaultParams returns default params for earn module

func NewParams

func NewParams(allowedVaults AllowedVaults) Params

NewParams returns a new params object

func (*Params) Descriptor

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

func (*Params) GetAllowedVaults

func (m *Params) GetAllowedVaults() AllowedVaults

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

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 checks that the parameters have valid values.

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 QueryClient

type QueryClient interface {
	// Params queries all parameters of the earn module.
	Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error)
	// Vaults queries all vaults
	Vaults(ctx context.Context, in *QueryVaultsRequest, opts ...grpc.CallOption) (*QueryVaultsResponse, error)
	// Vault queries a single vault based on the vault denom
	Vault(ctx context.Context, in *QueryVaultRequest, opts ...grpc.CallOption) (*QueryVaultResponse, error)
	// Deposits queries deposit details based on depositor address and vault
	Deposits(ctx context.Context, in *QueryDepositsRequest, opts ...grpc.CallOption) (*QueryDepositsResponse, error)
}

QueryClient is the client API for Query service.

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

func NewQueryClient

func NewQueryClient(cc grpc1.ClientConn) QueryClient

type QueryDepositsRequest

type QueryDepositsRequest struct {
	// depositor optionally filters deposits by depositor
	Depositor string `protobuf:"bytes,1,opt,name=depositor,proto3" json:"depositor,omitempty"`
	// denom optionally filters deposits by vault denom
	Denom string `protobuf:"bytes,2,opt,name=denom,proto3" json:"denom,omitempty"`
	// respond with vault value in ukava for bkava vaults
	ValueInStakedTokens bool `protobuf:"varint,3,opt,name=value_in_staked_tokens,json=valueInStakedTokens,proto3" json:"value_in_staked_tokens,omitempty"`
	// pagination defines an optional pagination for the request.
	Pagination *query.PageRequest `protobuf:"bytes,4,opt,name=pagination,proto3" json:"pagination,omitempty"`
}

QueryDepositsRequest is the request type for the Query/Deposits RPC method.

func NewQueryDepositsRequest

func NewQueryDepositsRequest(
	depositor string,
	denom string,
	ValueInStakedTokens bool,
	pagination *query.PageRequest,
) *QueryDepositsRequest

NewQueryDepositsRequest returns a new QueryDepositsRequest

func (*QueryDepositsRequest) Descriptor

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

func (*QueryDepositsRequest) Marshal

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

func (*QueryDepositsRequest) MarshalTo

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

func (*QueryDepositsRequest) MarshalToSizedBuffer

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

func (*QueryDepositsRequest) ProtoMessage

func (*QueryDepositsRequest) ProtoMessage()

func (*QueryDepositsRequest) Reset

func (m *QueryDepositsRequest) Reset()

func (*QueryDepositsRequest) Size

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

func (*QueryDepositsRequest) String

func (m *QueryDepositsRequest) String() string

func (*QueryDepositsRequest) Unmarshal

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

func (*QueryDepositsRequest) XXX_DiscardUnknown

func (m *QueryDepositsRequest) XXX_DiscardUnknown()

func (*QueryDepositsRequest) XXX_Marshal

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

func (*QueryDepositsRequest) XXX_Merge

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

func (*QueryDepositsRequest) XXX_Size

func (m *QueryDepositsRequest) XXX_Size() int

func (*QueryDepositsRequest) XXX_Unmarshal

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

type QueryDepositsResponse

type QueryDepositsResponse struct {
	// deposits returns the deposits matching the requested parameters
	Deposits []DepositResponse `protobuf:"bytes,1,rep,name=deposits,proto3" json:"deposits"`
	// pagination defines the pagination in the response.
	Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"`
}

QueryDepositsResponse is the response type for the Query/Deposits RPC method.

func (*QueryDepositsResponse) Descriptor

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

func (*QueryDepositsResponse) Marshal

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

func (*QueryDepositsResponse) MarshalTo

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

func (*QueryDepositsResponse) MarshalToSizedBuffer

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

func (*QueryDepositsResponse) ProtoMessage

func (*QueryDepositsResponse) ProtoMessage()

func (*QueryDepositsResponse) Reset

func (m *QueryDepositsResponse) Reset()

func (*QueryDepositsResponse) Size

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

func (*QueryDepositsResponse) String

func (m *QueryDepositsResponse) String() string

func (*QueryDepositsResponse) Unmarshal

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

func (*QueryDepositsResponse) XXX_DiscardUnknown

func (m *QueryDepositsResponse) XXX_DiscardUnknown()

func (*QueryDepositsResponse) XXX_Marshal

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

func (*QueryDepositsResponse) XXX_Merge

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

func (*QueryDepositsResponse) XXX_Size

func (m *QueryDepositsResponse) XXX_Size() int

func (*QueryDepositsResponse) XXX_Unmarshal

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

type QueryParamsRequest

type QueryParamsRequest struct {
}

QueryParamsRequest defines the request type for querying x/earn parameters.

func NewQueryParamsRequest

func NewQueryParamsRequest() *QueryParamsRequest

NewQueryParamsRequest returns a new QueryParamsRequest

func (*QueryParamsRequest) Descriptor

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

func (*QueryParamsRequest) Marshal

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

func (*QueryParamsRequest) MarshalTo

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

func (*QueryParamsRequest) MarshalToSizedBuffer

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

func (*QueryParamsRequest) ProtoMessage

func (*QueryParamsRequest) ProtoMessage()

func (*QueryParamsRequest) Reset

func (m *QueryParamsRequest) Reset()

func (*QueryParamsRequest) Size

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

func (*QueryParamsRequest) String

func (m *QueryParamsRequest) String() string

func (*QueryParamsRequest) Unmarshal

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

func (*QueryParamsRequest) XXX_DiscardUnknown

func (m *QueryParamsRequest) XXX_DiscardUnknown()

func (*QueryParamsRequest) XXX_Marshal

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

func (*QueryParamsRequest) XXX_Merge

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

func (*QueryParamsRequest) XXX_Size

func (m *QueryParamsRequest) XXX_Size() int

func (*QueryParamsRequest) XXX_Unmarshal

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

type QueryParamsResponse

type QueryParamsResponse struct {
	// params represents the earn module parameters
	Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"`
}

QueryParamsResponse defines the response type for querying x/earn parameters.

func (*QueryParamsResponse) Descriptor

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

func (*QueryParamsResponse) Marshal

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

func (*QueryParamsResponse) MarshalTo

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

func (*QueryParamsResponse) MarshalToSizedBuffer

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

func (*QueryParamsResponse) ProtoMessage

func (*QueryParamsResponse) ProtoMessage()

func (*QueryParamsResponse) Reset

func (m *QueryParamsResponse) Reset()

func (*QueryParamsResponse) Size

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

func (*QueryParamsResponse) String

func (m *QueryParamsResponse) String() string

func (*QueryParamsResponse) Unmarshal

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

func (*QueryParamsResponse) XXX_DiscardUnknown

func (m *QueryParamsResponse) XXX_DiscardUnknown()

func (*QueryParamsResponse) XXX_Marshal

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

func (*QueryParamsResponse) XXX_Merge

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

func (*QueryParamsResponse) XXX_Size

func (m *QueryParamsResponse) XXX_Size() int

func (*QueryParamsResponse) XXX_Unmarshal

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

type QueryServer

type QueryServer interface {
	// Params queries all parameters of the earn module.
	Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error)
	// Vaults queries all vaults
	Vaults(context.Context, *QueryVaultsRequest) (*QueryVaultsResponse, error)
	// Vault queries a single vault based on the vault denom
	Vault(context.Context, *QueryVaultRequest) (*QueryVaultResponse, error)
	// Deposits queries deposit details based on depositor address and vault
	Deposits(context.Context, *QueryDepositsRequest) (*QueryDepositsResponse, error)
}

QueryServer is the server API for Query service.

type QueryVaultRequest

type QueryVaultRequest struct {
	// vault filters vault by denom
	Denom string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty"`
}

QueryVaultRequest is the request type for the Query/Vault RPC method.

func NewQueryVaultRequest

func NewQueryVaultRequest(denom string) *QueryVaultRequest

NewQueryVaultRequest returns a new QueryVaultRequest

func (*QueryVaultRequest) Descriptor

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

func (*QueryVaultRequest) Marshal

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

func (*QueryVaultRequest) MarshalTo

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

func (*QueryVaultRequest) MarshalToSizedBuffer

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

func (*QueryVaultRequest) ProtoMessage

func (*QueryVaultRequest) ProtoMessage()

func (*QueryVaultRequest) Reset

func (m *QueryVaultRequest) Reset()

func (*QueryVaultRequest) Size

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

func (*QueryVaultRequest) String

func (m *QueryVaultRequest) String() string

func (*QueryVaultRequest) Unmarshal

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

func (*QueryVaultRequest) XXX_DiscardUnknown

func (m *QueryVaultRequest) XXX_DiscardUnknown()

func (*QueryVaultRequest) XXX_Marshal

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

func (*QueryVaultRequest) XXX_Merge

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

func (*QueryVaultRequest) XXX_Size

func (m *QueryVaultRequest) XXX_Size() int

func (*QueryVaultRequest) XXX_Unmarshal

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

type QueryVaultResponse

type QueryVaultResponse struct {
	// vault represents the queried earn module vault
	Vault VaultResponse `protobuf:"bytes,1,opt,name=vault,proto3" json:"vault"`
}

QueryVaultResponse is the response type for the Query/Vault RPC method.

func (*QueryVaultResponse) Descriptor

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

func (*QueryVaultResponse) Marshal

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

func (*QueryVaultResponse) MarshalTo

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

func (*QueryVaultResponse) MarshalToSizedBuffer

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

func (*QueryVaultResponse) ProtoMessage

func (*QueryVaultResponse) ProtoMessage()

func (*QueryVaultResponse) Reset

func (m *QueryVaultResponse) Reset()

func (*QueryVaultResponse) Size

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

func (*QueryVaultResponse) String

func (m *QueryVaultResponse) String() string

func (*QueryVaultResponse) Unmarshal

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

func (*QueryVaultResponse) XXX_DiscardUnknown

func (m *QueryVaultResponse) XXX_DiscardUnknown()

func (*QueryVaultResponse) XXX_Marshal

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

func (*QueryVaultResponse) XXX_Merge

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

func (*QueryVaultResponse) XXX_Size

func (m *QueryVaultResponse) XXX_Size() int

func (*QueryVaultResponse) XXX_Unmarshal

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

type QueryVaultsRequest

type QueryVaultsRequest struct {
}

QueryVaultsRequest is the request type for the Query/Vaults RPC method.

func NewQueryVaultsRequest

func NewQueryVaultsRequest() *QueryVaultsRequest

NewQueryVaultsRequest returns a new QueryVaultsRequest

func (*QueryVaultsRequest) Descriptor

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

func (*QueryVaultsRequest) Marshal

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

func (*QueryVaultsRequest) MarshalTo

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

func (*QueryVaultsRequest) MarshalToSizedBuffer

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

func (*QueryVaultsRequest) ProtoMessage

func (*QueryVaultsRequest) ProtoMessage()

func (*QueryVaultsRequest) Reset

func (m *QueryVaultsRequest) Reset()

func (*QueryVaultsRequest) Size

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

func (*QueryVaultsRequest) String

func (m *QueryVaultsRequest) String() string

func (*QueryVaultsRequest) Unmarshal

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

func (*QueryVaultsRequest) XXX_DiscardUnknown

func (m *QueryVaultsRequest) XXX_DiscardUnknown()

func (*QueryVaultsRequest) XXX_Marshal

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

func (*QueryVaultsRequest) XXX_Merge

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

func (*QueryVaultsRequest) XXX_Size

func (m *QueryVaultsRequest) XXX_Size() int

func (*QueryVaultsRequest) XXX_Unmarshal

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

type QueryVaultsResponse

type QueryVaultsResponse struct {
	// vaults represents the earn module vaults
	Vaults []VaultResponse `protobuf:"bytes,1,rep,name=vaults,proto3" json:"vaults"`
}

QueryVaultsResponse is the response type for the Query/Vaults RPC method.

func (*QueryVaultsResponse) Descriptor

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

func (*QueryVaultsResponse) Marshal

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

func (*QueryVaultsResponse) MarshalTo

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

func (*QueryVaultsResponse) MarshalToSizedBuffer

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

func (*QueryVaultsResponse) ProtoMessage

func (*QueryVaultsResponse) ProtoMessage()

func (*QueryVaultsResponse) Reset

func (m *QueryVaultsResponse) Reset()

func (*QueryVaultsResponse) Size

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

func (*QueryVaultsResponse) String

func (m *QueryVaultsResponse) String() string

func (*QueryVaultsResponse) Unmarshal

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

func (*QueryVaultsResponse) XXX_DiscardUnknown

func (m *QueryVaultsResponse) XXX_DiscardUnknown()

func (*QueryVaultsResponse) XXX_Marshal

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

func (*QueryVaultsResponse) XXX_Merge

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

func (*QueryVaultsResponse) XXX_Size

func (m *QueryVaultsResponse) XXX_Size() int

func (*QueryVaultsResponse) XXX_Unmarshal

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

type SavingsKeeper

type SavingsKeeper interface {
	Deposit(ctx sdk.Context, depositor sdk.AccAddress, coins sdk.Coins) error
	Withdraw(ctx sdk.Context, depositor sdk.AccAddress, coins sdk.Coins) error

	GetDeposit(ctx sdk.Context, depositor sdk.AccAddress) (savingstypes.Deposit, bool)
}

SavingsKeeper defines the expected interface needed for the savings strategy.

type StrategyType

type StrategyType int32

StrategyType is the type of strategy that a vault uses to optimize yields.

const (
	// STRATEGY_TYPE_UNSPECIFIED represents an unspecified or invalid strategy type.
	STRATEGY_TYPE_UNSPECIFIED StrategyType = 0
	// STRATEGY_TYPE_HARD represents the strategy that deposits assets in the Hard
	// module.
	STRATEGY_TYPE_HARD StrategyType = 1
	// STRATEGY_TYPE_SAVINGS represents the strategy that deposits assets in the
	// Savings module.
	STRATEGY_TYPE_SAVINGS StrategyType = 2
)

func NewStrategyTypeFromString

func NewStrategyTypeFromString(str string) StrategyType

NewStrategyTypeFromString converts string to StrategyType type

func (StrategyType) EnumDescriptor

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

func (StrategyType) IsValid

func (s StrategyType) IsValid() bool

IsValid returns true if the StrategyType status is valid and false otherwise.

func (StrategyType) String

func (x StrategyType) String() string

func (StrategyType) Validate

func (s StrategyType) Validate() error

Validate returns an error if the StrategyType is invalid.

type StrategyTypes

type StrategyTypes []StrategyType

StrategyTypes defines a slice of StrategyType

func (StrategyTypes) Validate

func (strategies StrategyTypes) Validate() error

Validate returns an error if StrategyTypes are invalid.

type UnimplementedMsgServer

type UnimplementedMsgServer struct {
}

UnimplementedMsgServer can be embedded to have forward compatible implementations.

func (*UnimplementedMsgServer) Deposit

func (*UnimplementedMsgServer) Withdraw

type UnimplementedQueryServer

type UnimplementedQueryServer struct {
}

UnimplementedQueryServer can be embedded to have forward compatible implementations.

func (*UnimplementedQueryServer) Deposits

func (*UnimplementedQueryServer) Params

func (*UnimplementedQueryServer) Vault

func (*UnimplementedQueryServer) Vaults

type VaultRecord

type VaultRecord struct {
	// TotalShares is the total distributed number of shares in the vault.
	TotalShares VaultShare `protobuf:"bytes,1,opt,name=total_shares,json=totalShares,proto3" json:"total_shares"`
}

VaultRecord is the state of a vault.

func NewVaultRecord

func NewVaultRecord(vaultDenom string, amount sdk.Dec) VaultRecord

NewVaultRecord returns a new VaultRecord with 0 supply.

func (*VaultRecord) Descriptor

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

func (*VaultRecord) GetTotalShares

func (m *VaultRecord) GetTotalShares() VaultShare

func (*VaultRecord) Marshal

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

func (*VaultRecord) MarshalTo

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

func (*VaultRecord) MarshalToSizedBuffer

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

func (*VaultRecord) ProtoMessage

func (*VaultRecord) ProtoMessage()

func (*VaultRecord) Reset

func (m *VaultRecord) Reset()

func (*VaultRecord) Size

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

func (*VaultRecord) String

func (m *VaultRecord) String() string

func (*VaultRecord) Unmarshal

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

func (*VaultRecord) Validate

func (vr *VaultRecord) Validate() error

Validate returns an error if a VaultRecord is invalid.

func (*VaultRecord) XXX_DiscardUnknown

func (m *VaultRecord) XXX_DiscardUnknown()

func (*VaultRecord) XXX_Marshal

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

func (*VaultRecord) XXX_Merge

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

func (*VaultRecord) XXX_Size

func (m *VaultRecord) XXX_Size() int

func (*VaultRecord) XXX_Unmarshal

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

type VaultRecords

type VaultRecords []VaultRecord

VaultRecords is a slice of VaultRecord.

func (VaultRecords) Validate

func (vrs VaultRecords) Validate() error

Validate returns an error if a slice of VaultRecords is invalid.

type VaultResponse

type VaultResponse struct {
	// denom represents the denom of the vault
	Denom string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty"`
	// VaultStrategy is the strategy used for this vault.
	Strategies StrategyTypes `` /* 144-byte string literal not displayed */
	// IsPrivateVault is true if the vault only allows depositors contained in
	// AllowedDepositors.
	IsPrivateVault bool `protobuf:"varint,3,opt,name=is_private_vault,json=isPrivateVault,proto3" json:"is_private_vault,omitempty"`
	// AllowedDepositors is a list of addresses that are allowed to deposit to
	// this vault if IsPrivateVault is true. Addresses not contained in this list
	// are not allowed to deposit into this vault. If IsPrivateVault is false,
	// this should be empty and ignored.
	AllowedDepositors []string `protobuf:"bytes,4,rep,name=allowed_depositors,json=allowedDepositors,proto3" json:"allowed_depositors,omitempty"`
	// TotalShares is the total amount of shares issued to depositors.
	TotalShares string `protobuf:"bytes,5,opt,name=total_shares,json=totalShares,proto3" json:"total_shares,omitempty"`
	// TotalValue is the total value of denom coins supplied to the vault if the
	// vault were to be liquidated.
	TotalValue github_com_cosmos_cosmos_sdk_types.Int `` /* 131-byte string literal not displayed */
}

VaultResponse is the response type for a vault.

func (*VaultResponse) Descriptor

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

func (*VaultResponse) Marshal

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

func (*VaultResponse) MarshalTo

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

func (*VaultResponse) MarshalToSizedBuffer

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

func (*VaultResponse) ProtoMessage

func (*VaultResponse) ProtoMessage()

func (*VaultResponse) Reset

func (m *VaultResponse) Reset()

func (*VaultResponse) Size

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

func (*VaultResponse) String

func (m *VaultResponse) String() string

func (*VaultResponse) Unmarshal

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

func (*VaultResponse) XXX_DiscardUnknown

func (m *VaultResponse) XXX_DiscardUnknown()

func (*VaultResponse) XXX_Marshal

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

func (*VaultResponse) XXX_Merge

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

func (*VaultResponse) XXX_Size

func (m *VaultResponse) XXX_Size() int

func (*VaultResponse) XXX_Unmarshal

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

type VaultShare

type VaultShare struct {
	Denom  string                                 `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty"`
	Amount github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,2,opt,name=amount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"amount"`
}

VaultShare defines shares of a vault owned by a depositor.

func NewVaultShare

func NewVaultShare(denom string, amount sdk.Dec) VaultShare

NewVaultShare returns a new VaultShare

func (VaultShare) Add

func (share VaultShare) Add(vsB VaultShare) VaultShare

Add adds amounts of two vault shares with same denom. If the shares differ in denom then it panics.

func (*VaultShare) Descriptor

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

func (*VaultShare) GetDenom

func (m *VaultShare) GetDenom() string

func (VaultShare) IsNegative

func (share VaultShare) IsNegative() bool

IsNegative returns true if the share amount is negative and false otherwise.

func (VaultShare) IsPositive

func (share VaultShare) IsPositive() bool

func (VaultShare) IsValid

func (share VaultShare) IsValid() bool

IsValid returns true if the VaultShare is valid

func (VaultShare) IsZero

func (share VaultShare) IsZero() bool

IsZero returns if this represents no shares

func (*VaultShare) Marshal

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

func (*VaultShare) MarshalTo

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

func (*VaultShare) MarshalToSizedBuffer

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

func (*VaultShare) ProtoMessage

func (*VaultShare) ProtoMessage()

func (*VaultShare) Reset

func (m *VaultShare) Reset()

func (*VaultShare) Size

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

func (VaultShare) String

func (share VaultShare) String() string

func (VaultShare) Sub

func (share VaultShare) Sub(vsB VaultShare) VaultShare

Sub subtracts amounts of two vault shares with same denom. If the shares differ in denom then it panics.

func (*VaultShare) Unmarshal

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

func (VaultShare) Validate

func (share VaultShare) Validate() error

Validate returns an error if a VaultShare is invalid.

func (*VaultShare) XXX_DiscardUnknown

func (m *VaultShare) XXX_DiscardUnknown()

func (*VaultShare) XXX_Marshal

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

func (*VaultShare) XXX_Merge

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

func (*VaultShare) XXX_Size

func (m *VaultShare) XXX_Size() int

func (*VaultShare) XXX_Unmarshal

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

type VaultShareRecord

type VaultShareRecord struct {
	// Depositor represents the owner of the shares
	Depositor github_com_cosmos_cosmos_sdk_types.AccAddress `` /* 126-byte string literal not displayed */
	// Shares represent the vault shares owned by the depositor.
	Shares VaultShares `protobuf:"bytes,2,rep,name=shares,proto3,castrepeated=VaultShares" json:"shares"`
}

VaultShareRecord defines the vault shares owned by a depositor.

func NewVaultShareRecord

func NewVaultShareRecord(depositor sdk.AccAddress, shares VaultShares) VaultShareRecord

NewVaultShareRecord returns a new VaultShareRecord with the provided supplied coins.

func (*VaultShareRecord) Descriptor

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

func (*VaultShareRecord) GetDepositor

func (*VaultShareRecord) GetShares

func (m *VaultShareRecord) GetShares() VaultShares

func (*VaultShareRecord) Marshal

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

func (*VaultShareRecord) MarshalTo

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

func (*VaultShareRecord) MarshalToSizedBuffer

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

func (*VaultShareRecord) ProtoMessage

func (*VaultShareRecord) ProtoMessage()

func (*VaultShareRecord) Reset

func (m *VaultShareRecord) Reset()

func (*VaultShareRecord) Size

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

func (*VaultShareRecord) String

func (m *VaultShareRecord) String() string

func (*VaultShareRecord) Unmarshal

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

func (VaultShareRecord) Validate

func (vsr VaultShareRecord) Validate() error

Validate returns an error if an VaultShareRecord is invalid.

func (*VaultShareRecord) XXX_DiscardUnknown

func (m *VaultShareRecord) XXX_DiscardUnknown()

func (*VaultShareRecord) XXX_Marshal

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

func (*VaultShareRecord) XXX_Merge

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

func (*VaultShareRecord) XXX_Size

func (m *VaultShareRecord) XXX_Size() int

func (*VaultShareRecord) XXX_Unmarshal

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

type VaultShareRecords

type VaultShareRecords []VaultShareRecord

VaultShareRecords is a slice of VaultShareRecord.

func (VaultShareRecords) Validate

func (vsrs VaultShareRecords) Validate() error

Validate returns an error if a slice of VaultRecords is invalid.

type VaultShares

type VaultShares []VaultShare

VaultShares is a slice of VaultShare.

func NewVaultShares

func NewVaultShares(shares ...VaultShare) VaultShares

NewVaultShares returns new VaultShares

func (VaultShares) Add

func (shares VaultShares) Add(sharesB ...VaultShare) VaultShares

Add adds two sets of VaultShares.

func (VaultShares) AmountOf

func (shares VaultShares) AmountOf(denom string) sdk.Dec

AmountOf returns the amount of shares of the given denom.

func (VaultShares) GetShare

func (shares VaultShares) GetShare(denom string) VaultShare

GetShare the single share of the given denom.

func (VaultShares) IsAnyNegative

func (shares VaultShares) IsAnyNegative() bool

IsAnyNegative returns true if there is at least one share whose amount is negative; returns false otherwise. It returns false if the share set is empty too.

func (VaultShares) IsValid

func (shares VaultShares) IsValid() bool

IsValid returns true if the VaultShares are valid

func (VaultShares) IsZero

func (shares VaultShares) IsZero() bool

IsZero returns true if the VaultShares is empty.

func (VaultShares) Len

func (shares VaultShares) Len() int

func (VaultShares) Less

func (shares VaultShares) Less(i, j int) bool

Less implements sort.Interface for VaultShares

func (VaultShares) SafeSub

func (shares VaultShares) SafeSub(sharesB VaultShares) (VaultShares, bool)

SafeSub performs the same arithmetic as Sub but returns a boolean if any negative share amount was returned. The function panics if `shares` or `sharesB` are not sorted (ascending).

func (VaultShares) Sort

func (shares VaultShares) Sort() VaultShares

Sort is a helper function to sort the set of vault shares in-place

func (VaultShares) String

func (shares VaultShares) String() string

func (VaultShares) Sub

func (shares VaultShares) Sub(sharesB ...VaultShare) VaultShares

Sub subtracts a set of shares from another.

e.g. {2A, 3B} - {A} = {A, 3B} {2A} - {0B} = {2A} {A, B} - {A} = {B}

CONTRACT: Sub will never return Shares where one Share has a non-positive amount. In otherwords, IsValid will always return true.

func (VaultShares) Swap

func (shares VaultShares) Swap(i, j int)

Swap implements sort.Interface for VaultShares

func (VaultShares) Validate

func (shares VaultShares) Validate() error

Validate returns an error if a slice of VaultShares is invalid.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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