types

package
v0.5.20 Latest Latest
Warning

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

Go to latest
Published: May 13, 2022 License: Apache-2.0 Imports: 17 Imported by: 1

Documentation

Index

Constants

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

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")
)
View Source
var (

	// ModuleCdc references the global x/oracle module codec. Note, the codec should
	// ONLY be used in certain instances of tests and for JSON encoding as Amino is
	// still used for that purpose.
	//
	// The actual codec used for serialization should be provided to x/staking and
	// defined at the application level.
	ModuleCdc = codec.NewAminoCodec(amino)
)

Functions

func RegisterInterfaces

func RegisterInterfaces(registry codectypes.InterfaceRegistry)

RegisterInterfaces 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 account interfaces and concrete types on the provided LegacyAmino codec. These types are used for Amino JSON serialization

Types

type LazyGradedVestingAccount

type LazyGradedVestingAccount struct {
	*types.BaseVestingAccount ``               /* 147-byte string literal not displayed */
	VestingSchedules          VestingSchedules `` /* 154-byte string literal not displayed */
}

LazyGradedVestingAccount implements the LazyGradedVestingAccount interface. It vests all coins according to a predefined schedule.

func NewLazyGradedVestingAccount

func NewLazyGradedVestingAccount(baseAcc *authtypes.BaseAccount, originalVesting sdk.Coins, lazyVestingSchedules VestingSchedules) *LazyGradedVestingAccount

NewLazyGradedVestingAccount returns a new LazyGradedVestingAccount

func NewLazyGradedVestingAccountRaw

func NewLazyGradedVestingAccountRaw(baseVestingAcc *vesttypes.BaseVestingAccount, lazyVestingSchedules VestingSchedules) *LazyGradedVestingAccount

NewLazyGradedVestingAccountRaw creates a new LazyGradedVestingAccount object from BaseVestingAccount

func (*LazyGradedVestingAccount) Descriptor

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

func (LazyGradedVestingAccount) GetEndTime

func (lgva LazyGradedVestingAccount) GetEndTime() int64

GetEndTime returns zero since a lazy graded vesting account has no end time.

func (LazyGradedVestingAccount) GetStartTime

func (lgva LazyGradedVestingAccount) GetStartTime() int64

GetStartTime returns zero since a lazy graded vesting account has no start time.

func (LazyGradedVestingAccount) GetVestedCoins

func (lgva LazyGradedVestingAccount) GetVestedCoins(blockTime time.Time) sdk.Coins

GetVestedCoins returns the total amount of vested coins for a graded vesting account. All coins are vested continuously once the schedule's StartTime has elapsed until EndTime.

func (LazyGradedVestingAccount) GetVestingCoins

func (lgva LazyGradedVestingAccount) GetVestingCoins(blockTime time.Time) sdk.Coins

GetVestingCoins returns the total number of vesting coins for a graded vesting account.

func (LazyGradedVestingAccount) GetVestingSchedule

func (lgva LazyGradedVestingAccount) GetVestingSchedule(denom string) (VestingSchedule, bool)

GetVestingSchedule returns the VestingSchedule of the given denom

func (LazyGradedVestingAccount) GetVestingSchedules

func (lgva LazyGradedVestingAccount) GetVestingSchedules() VestingSchedules

GetVestingSchedules returns the VestingSchedules of the graded lazy vesting account

func (LazyGradedVestingAccount) LockedCoins

func (lgva LazyGradedVestingAccount) LockedCoins(blockTime time.Time) sdk.Coins

LockedCoins returns the set of coins that are not spendable (i.e. locked).

func (*LazyGradedVestingAccount) Marshal

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

func (*LazyGradedVestingAccount) MarshalTo

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

func (*LazyGradedVestingAccount) MarshalToSizedBuffer

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

func (LazyGradedVestingAccount) MarshalYAML

func (lgva LazyGradedVestingAccount) MarshalYAML() (interface{}, error)

MarshalYAML returns the YAML representation of a LazyGradedVestingAccount.

func (*LazyGradedVestingAccount) ProtoMessage

func (*LazyGradedVestingAccount) ProtoMessage()

func (*LazyGradedVestingAccount) Reset

func (m *LazyGradedVestingAccount) Reset()

func (*LazyGradedVestingAccount) Size

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

func (LazyGradedVestingAccount) String

func (lgva LazyGradedVestingAccount) String() string

String implements fmt.Stringer interface

func (*LazyGradedVestingAccount) TrackDelegation

func (lgva *LazyGradedVestingAccount) TrackDelegation(blockTime time.Time, balance, amount sdk.Coins)

TrackDelegation tracks a delegation amount for any given vesting account type given the amount of coins currently vesting. It returns the resulting base coins.

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

func (*LazyGradedVestingAccount) Unmarshal

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

func (LazyGradedVestingAccount) Validate

func (lgva LazyGradedVestingAccount) Validate() error

Validate checks for errors on the account fields

func (*LazyGradedVestingAccount) XXX_DiscardUnknown

func (m *LazyGradedVestingAccount) XXX_DiscardUnknown()

func (*LazyGradedVestingAccount) XXX_Marshal

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

func (*LazyGradedVestingAccount) XXX_Merge

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

func (*LazyGradedVestingAccount) XXX_Size

func (m *LazyGradedVestingAccount) XXX_Size() int

func (*LazyGradedVestingAccount) XXX_Unmarshal

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

type Schedule

type Schedule struct {
	StartTime int64                                  `protobuf:"varint,1,opt,name=start_time,json=startTime,proto3" json:"start_time,omitempty" yaml:"start_time"`
	EndTime   int64                                  `protobuf:"varint,2,opt,name=end_time,json=endTime,proto3" json:"end_time,omitempty" yaml:"end_time"`
	Ratio     github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,3,opt,name=ratio,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"ratio" yaml:"ratio"`
}

Schedule - represent single schedule data for a vesting schedule

func NewSchedule

func NewSchedule(startTime, endTime int64, ratio sdk.Dec) Schedule

NewSchedule returns new Schedule instance

func (*Schedule) Descriptor

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

func (Schedule) GetEndTime

func (s Schedule) GetEndTime() int64

GetEndTime returns end time

func (Schedule) GetRatio

func (s Schedule) GetRatio() sdk.Dec

GetRatio returns ratio

func (Schedule) GetStartTime

func (s Schedule) GetStartTime() int64

GetStartTime returns start time

func (*Schedule) Marshal

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

func (*Schedule) MarshalTo

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

func (*Schedule) MarshalToSizedBuffer

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

func (*Schedule) ProtoMessage

func (*Schedule) ProtoMessage()

func (*Schedule) Reset

func (m *Schedule) Reset()

func (*Schedule) Size

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

func (*Schedule) String

func (m *Schedule) String() string

func (*Schedule) Unmarshal

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

func (Schedule) Validate

func (s Schedule) Validate() error

Validate checks that the lazy schedule is valid.

func (*Schedule) XXX_DiscardUnknown

func (m *Schedule) XXX_DiscardUnknown()

func (*Schedule) XXX_Marshal

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

func (*Schedule) XXX_Merge

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

func (*Schedule) XXX_Size

func (m *Schedule) XXX_Size() int

func (*Schedule) XXX_Unmarshal

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

type Schedules

type Schedules []Schedule

Schedules stores all lazy schedules

type VestingSchedule

type VestingSchedule struct {
	Denom     string    `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty" yaml:"start_time"`
	Schedules Schedules `protobuf:"bytes,2,rep,name=schedules,proto3,castrepeated=Schedules" json:"schedules" yaml:"schedules"`
}

VestingSchedule defines vesting schedule for a denom

func NewVestingSchedule

func NewVestingSchedule(denom string, schedules Schedules) VestingSchedule

NewVestingSchedule creates a new vesting lazy schedule instance.

func (*VestingSchedule) Descriptor

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

func (VestingSchedule) GetDenom

func (vs VestingSchedule) GetDenom() string

GetDenom returns the denom of vesting schedule

func (VestingSchedule) GetVestedRatio

func (vs VestingSchedule) GetVestedRatio(blockTime int64) sdk.Dec

GetVestedRatio returns the ratio of tokens that have vested by blockTime.

func (*VestingSchedule) Marshal

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

func (*VestingSchedule) MarshalTo

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

func (*VestingSchedule) MarshalToSizedBuffer

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

func (*VestingSchedule) ProtoMessage

func (*VestingSchedule) ProtoMessage()

func (*VestingSchedule) Reset

func (m *VestingSchedule) Reset()

func (*VestingSchedule) Size

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

func (*VestingSchedule) String

func (m *VestingSchedule) String() string

func (*VestingSchedule) Unmarshal

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

func (VestingSchedule) Validate

func (vs VestingSchedule) Validate() error

Validate checks that the vesting lazy schedule is valid.

func (*VestingSchedule) XXX_DiscardUnknown

func (m *VestingSchedule) XXX_DiscardUnknown()

func (*VestingSchedule) XXX_Marshal

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

func (*VestingSchedule) XXX_Merge

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

func (*VestingSchedule) XXX_Size

func (m *VestingSchedule) XXX_Size() int

func (*VestingSchedule) XXX_Unmarshal

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

type VestingSchedules

type VestingSchedules []VestingSchedule

VestingSchedules stores all vesting schedules passed as part of a LazyGradedVestingAccount

Jump to

Keyboard shortcuts

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