types

package
v14.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2023 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ModuleName defines the module's name.
	ModuleName = "stridevesting"

	// AttributeValueCategory is an alias for the message event value.
	AttributeValueCategory = ModuleName

	// RouterKey defines the module's message routing key
	RouterKey = ModuleName
)

Variables

View Source
var (
	ErrInvalidLengthVesting        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowVesting          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupVesting = fmt.Errorf("proto: unexpected end of group")
)

Functions

func KeyTestPubAddr

func KeyTestPubAddr() (cryptotypes.PrivKey, cryptotypes.PubKey, sdk.AccAddress)

KeyTestPubAddr generates a test key pair

func NewTestCoins

func NewTestCoins() sdk.Coins

NewTestCoins coins to more than cover the fee

func NewTestMsg

func NewTestMsg(addrs ...sdk.AccAddress) *testdata.TestMsg

NewTestMsg generates a test message

func RegisterInterfaces

func RegisterInterfaces(registry types.InterfaceRegistry)

RegisterInterface associates protoName with AccountI and VestingAccount Interfaces and creates a registry of it's concrete implementations

func RegisterLegacyAminoCodec

func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino)

RegisterLegacyAminoCodec registers the vesting interfaces and concrete types on the provided LegacyAmino codec. These types are used for Amino JSON serialization

func RegisterMsgServer

func RegisterMsgServer(s grpc1.Server, srv MsgServer)

Types

type BankKeeper

type BankKeeper interface {
	IsSendEnabledCoins(ctx sdk.Context, coins ...sdk.Coin) error
	SendCoins(ctx sdk.Context, fromAddr sdk.AccAddress, toAddr sdk.AccAddress, amt sdk.Coins) error
	BlockedAddr(addr sdk.AccAddress) bool
}

BankKeeper defines the expected interface contract the vesting module requires for creating vesting accounts with funds.

type BaseVestingAccount

type BaseVestingAccount struct {
	*types.BaseAccount `protobuf:"bytes,1,opt,name=base_account,json=baseAccount,proto3,embedded=base_account" json:"base_account,omitempty"`
	OriginalVesting    github_com_cosmos_cosmos_sdk_types.Coins `` /* 174-byte string literal not displayed */
	DelegatedFree      github_com_cosmos_cosmos_sdk_types.Coins `` /* 166-byte string literal not displayed */
	DelegatedVesting   github_com_cosmos_cosmos_sdk_types.Coins `` /* 178-byte string literal not displayed */
	EndTime            int64                                    `protobuf:"varint,5,opt,name=end_time,json=endTime,proto3" json:"end_time,omitempty" yaml:"end_time"`
}

BaseVestingAccount implements the VestingAccount interface. It contains all the necessary fields needed for any vesting account implementation.

func NewBaseVestingAccount

func NewBaseVestingAccount(baseAccount *authtypes.BaseAccount, originalVesting sdk.Coins, endTime int64) *BaseVestingAccount

NewBaseVestingAccount creates a new BaseVestingAccount object. It is the callers responsibility to ensure the base account has sufficient funds with regards to the original vesting amount.

func (*BaseVestingAccount) Descriptor

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

func (BaseVestingAccount) GetDelegatedFree

func (bva BaseVestingAccount) GetDelegatedFree() sdk.Coins

GetDelegatedFree returns a vesting account's delegation amount that is not vesting.

func (BaseVestingAccount) GetDelegatedVesting

func (bva BaseVestingAccount) GetDelegatedVesting() sdk.Coins

GetDelegatedVesting returns a vesting account's delegation amount that is still vesting.

func (BaseVestingAccount) GetEndTime

func (bva BaseVestingAccount) GetEndTime() int64

GetEndTime returns a vesting account's end time

func (BaseVestingAccount) GetOriginalVesting

func (bva BaseVestingAccount) GetOriginalVesting() sdk.Coins

GetOriginalVesting returns a vesting account's original vesting amount

func (BaseVestingAccount) LockedCoinsFromVesting

func (bva BaseVestingAccount) LockedCoinsFromVesting(vestingCoins sdk.Coins) sdk.Coins

LockedCoinsFromVesting returns all the coins that are not spendable (i.e. locked) for a vesting account given the current vesting coins. If no coins are locked, an empty slice of Coins is returned.

CONTRACT: Delegated vesting coins and vestingCoins must be sorted.

func (*BaseVestingAccount) Marshal

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

func (*BaseVestingAccount) MarshalTo

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

func (*BaseVestingAccount) MarshalToSizedBuffer

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

func (BaseVestingAccount) MarshalYAML

func (bva BaseVestingAccount) MarshalYAML() (interface{}, error)

MarshalYAML returns the YAML representation of a BaseVestingAccount.

func (*BaseVestingAccount) ProtoMessage

func (*BaseVestingAccount) ProtoMessage()

func (*BaseVestingAccount) Reset

func (m *BaseVestingAccount) Reset()

func (*BaseVestingAccount) Size

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

func (BaseVestingAccount) String

func (bva BaseVestingAccount) String() string

func (*BaseVestingAccount) TrackDelegation

func (bva *BaseVestingAccount) TrackDelegation(balance, vestingCoins, amount sdk.Coins)

TrackDelegation tracks a delegation amount for any given vesting account type given the amount of coins currently vesting and the current account balance of the delegation denominations.

CONTRACT: The account's coins, delegation coins, vesting coins, and delegated vesting coins must be sorted.

func (*BaseVestingAccount) TrackUndelegation

func (bva *BaseVestingAccount) TrackUndelegation(amount sdk.Coins)

TrackUndelegation tracks an undelegation amount by setting the necessary values by which delegated vesting and delegated vesting need to decrease and by which amount the base coins need to increase.

NOTE: The undelegation (bond refund) amount may exceed the delegated vesting (bond) amount due to the way undelegation truncates the bond refund, which can increase the validator's sharesToTokens rate slightly if the undelegated tokens are non-integral.

CONTRACT: The account's coins and undelegation coins must be sorted.

func (*BaseVestingAccount) Unmarshal

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

func (BaseVestingAccount) Validate

func (bva BaseVestingAccount) Validate() error

Validate checks for errors on the account fields

func (*BaseVestingAccount) XXX_DiscardUnknown

func (m *BaseVestingAccount) XXX_DiscardUnknown()

func (*BaseVestingAccount) XXX_Marshal

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

func (*BaseVestingAccount) XXX_Merge

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

func (*BaseVestingAccount) XXX_Size

func (m *BaseVestingAccount) XXX_Size() int

func (*BaseVestingAccount) XXX_Unmarshal

func (m *BaseVestingAccount) 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 Period

type Period struct {
	StartTime  int64                                    `protobuf:"varint,1,opt,name=start_time,json=startTime,proto3" json:"start_time,omitempty"`
	Length     int64                                    `protobuf:"varint,2,opt,name=length,proto3" json:"length,omitempty"`
	Amount     github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,3,rep,name=amount,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"amount"`
	ActionType int32                                    `protobuf:"varint,4,opt,name=action_type,json=actionType,proto3" json:"action_type,omitempty"`
}

Period defines a length of time and amount of coins that will vest.

func (*Period) Descriptor

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

func (Period) Duration

func (p Period) Duration() time.Duration

Duration is converts the period Length from seconds to a time.Duration

func (*Period) GetActionType

func (m *Period) GetActionType() int32

func (*Period) GetAmount

func (*Period) GetLength

func (m *Period) GetLength() int64

func (*Period) GetStartTime

func (m *Period) GetStartTime() int64

func (*Period) Marshal

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

func (*Period) MarshalTo

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

func (*Period) MarshalToSizedBuffer

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

func (*Period) ProtoMessage

func (*Period) ProtoMessage()

func (*Period) Reset

func (m *Period) Reset()

func (*Period) Size

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

func (Period) String

func (p Period) String() string

String implements the fmt.Stringer interface

func (*Period) Unmarshal

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

func (*Period) XXX_DiscardUnknown

func (m *Period) XXX_DiscardUnknown()

func (*Period) XXX_Marshal

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

func (*Period) XXX_Merge

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

func (*Period) XXX_Size

func (m *Period) XXX_Size() int

func (*Period) XXX_Unmarshal

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

type Periods

type Periods []Period

Periods stores all vesting periods passed as part of a StridePeriodicVestingAccount

func (Periods) String

func (p Periods) String() string

String implements the fmt.Stringer interface

func (Periods) TotalAmount

func (p Periods) TotalAmount() sdk.Coins

TotalDuration returns the sum of coins for the period

func (Periods) TotalDuration

func (p Periods) TotalDuration() time.Duration

TotalDuration returns the total duration of the period

func (Periods) TotalLength

func (p Periods) TotalLength() int64

TotalLength return the total length in seconds for a period

type StridePeriodicVestingAccount

type StridePeriodicVestingAccount struct {
	*BaseVestingAccount ``       /* 147-byte string literal not displayed */
	VestingPeriods      []Period `protobuf:"bytes,3,rep,name=vesting_periods,json=vestingPeriods,proto3" json:"vesting_periods" yaml:"vesting_periods"`
}

StridePeriodicVestingAccount implements the VestingAccount interface. It periodically vests by unlocking coins during each specified period.

func NewStridePeriodicVestingAccount

func NewStridePeriodicVestingAccount(baseAcc *authtypes.BaseAccount, originalVesting sdk.Coins, periods Periods) *StridePeriodicVestingAccount

NewStridePeriodicVestingAccount returns a new StridePeriodicVestingAccount

func NewStridePeriodicVestingAccountRaw

func NewStridePeriodicVestingAccountRaw(bva *BaseVestingAccount, startTime int64, periods Periods) *StridePeriodicVestingAccount

NewStridePeriodicVestingAccountRaw creates a new StridePeriodicVestingAccount object from BaseVestingAccount

func (*StridePeriodicVestingAccount) AddNewGrant

func (pva *StridePeriodicVestingAccount) AddNewGrant(grantedPeriod Period)

AddNewGrant adds a new grant

func (*StridePeriodicVestingAccount) Descriptor

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

func (StridePeriodicVestingAccount) GetStartTime

func (pva StridePeriodicVestingAccount) GetStartTime() int64

GetStartTime returns the time when vesting starts for a periodic vesting account.

func (StridePeriodicVestingAccount) GetVestedCoins

func (pva StridePeriodicVestingAccount) GetVestedCoins(blockTime time.Time) sdk.Coins

GetVestedCoins returns the total number of vested coins. If no coins are vested, nil is returned.

func (StridePeriodicVestingAccount) GetVestingCoins

func (pva StridePeriodicVestingAccount) GetVestingCoins(blockTime time.Time) sdk.Coins

GetVestingCoins returns the total number of vesting coins. If no coins are vesting, nil is returned.

func (StridePeriodicVestingAccount) GetVestingPeriods

func (pva StridePeriodicVestingAccount) GetVestingPeriods() Periods

GetVestingPeriods returns vesting periods associated with periodic vesting account.

func (StridePeriodicVestingAccount) LockedCoins

func (pva StridePeriodicVestingAccount) LockedCoins(blockTime time.Time) sdk.Coins

LockedCoins returns the set of coins that are not spendable (i.e. locked), defined as the vesting coins that are not delegated.

func (*StridePeriodicVestingAccount) Marshal

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

func (*StridePeriodicVestingAccount) MarshalTo

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

func (*StridePeriodicVestingAccount) MarshalToSizedBuffer

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

func (StridePeriodicVestingAccount) MarshalYAML

func (pva StridePeriodicVestingAccount) MarshalYAML() (interface{}, error)

MarshalYAML returns the YAML representation of a StridePeriodicVestingAccount.

func (*StridePeriodicVestingAccount) ProtoMessage

func (*StridePeriodicVestingAccount) ProtoMessage()

func (*StridePeriodicVestingAccount) Reset

func (m *StridePeriodicVestingAccount) Reset()

func (*StridePeriodicVestingAccount) Size

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

func (StridePeriodicVestingAccount) String

func (pva StridePeriodicVestingAccount) String() string

func (*StridePeriodicVestingAccount) TrackDelegation

func (pva *StridePeriodicVestingAccount) TrackDelegation(blockTime time.Time, balance, amount sdk.Coins)

TrackDelegation tracks a desired delegation amount by setting the appropriate values for the amount of delegated vesting, delegated free, and reducing the overall amount of base coins.

func (*StridePeriodicVestingAccount) Unmarshal

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

func (StridePeriodicVestingAccount) Validate

func (pva StridePeriodicVestingAccount) Validate() error

Validate checks for errors on the account fields

func (*StridePeriodicVestingAccount) XXX_DiscardUnknown

func (m *StridePeriodicVestingAccount) XXX_DiscardUnknown()

func (*StridePeriodicVestingAccount) XXX_Marshal

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

func (*StridePeriodicVestingAccount) XXX_Merge

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

func (*StridePeriodicVestingAccount) XXX_Size

func (m *StridePeriodicVestingAccount) XXX_Size() int

func (*StridePeriodicVestingAccount) XXX_Unmarshal

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

type UnimplementedMsgServer

type UnimplementedMsgServer struct {
}

UnimplementedMsgServer can be embedded to have forward compatible implementations.

Jump to

Keyboard shortcuts

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