types

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2020 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

nolint noalias

Index

Constants

This section is empty.

Variables

View Source
var VestingCdc *codec.Codec

VestingCdc module wide codec

Functions

func KeyTestPubAddr

func KeyTestPubAddr() (crypto.PrivKey, crypto.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) *sdk.TestMsg

NewTestMsg generates a test message

func RegisterCodec

func RegisterCodec(cdc *codec.Codec)

RegisterCodec registers concrete types on the codec

Types

type LazyGradedVestingAccount

type LazyGradedVestingAccount struct {
	*vesttypes.BaseVestingAccount

	VestingSchedules VestingSchedules `json:"vesting_schedules"`
}

LazyGradedVestingAccount implements the VestingAccount interface. It vests tokens according to a predefined set of vesting schedule.

func NewLazyGradedVestingAccount

func NewLazyGradedVestingAccount(baseAcc *authtypes.BaseAccount, 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) 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) MarshalJSON

func (lgva LazyGradedVestingAccount) MarshalJSON() ([]byte, error)

MarshalJSON returns the JSON representation of a LazyGradedVestingAccount.

func (LazyGradedVestingAccount) MarshalYAML

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

MarshalYAML returns the YAML representation of a LazyGradedVestingAccount.

func (LazyGradedVestingAccount) SpendableCoins

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

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

func (LazyGradedVestingAccount) String

func (lgva LazyGradedVestingAccount) String() string

String implements fmt.Stringer interface

func (*LazyGradedVestingAccount) TrackDelegation

func (lgva *LazyGradedVestingAccount) TrackDelegation(blockTime time.Time, 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 (*LazyGradedVestingAccount) UnmarshalJSON

func (lgva *LazyGradedVestingAccount) UnmarshalJSON(bz []byte) error

UnmarshalJSON unmarshals raw JSON bytes into a LazyGradedVestingAccount.

func (LazyGradedVestingAccount) Validate

func (lgva LazyGradedVestingAccount) Validate() error

Validate checks for errors on the account fields

type LazySchedule

type LazySchedule struct {
	StartTime int64   `json:"start_time"`
	EndTime   int64   `json:"end_time"`
	Ratio     sdk.Dec `json:"ratio"`
}

LazySchedule defines a vesting schedule which is used for LazyGradedVestingAccount

func NewLazySchedule

func NewLazySchedule(startTime, endTime int64, ratio sdk.Dec) LazySchedule

NewLazySchedule returns new LazySchedule instance

func (LazySchedule) GetEndTime

func (s LazySchedule) GetEndTime() int64

GetEndTime returns end time

func (LazySchedule) GetRatio

func (s LazySchedule) GetRatio() sdk.Dec

GetRatio returns ratio

func (LazySchedule) GetStartTime

func (s LazySchedule) GetStartTime() int64

GetStartTime returns start time

func (LazySchedule) String

func (s LazySchedule) String() string

String implements fmt.Stringer interface

func (LazySchedule) Validate

func (s LazySchedule) Validate() error

Validate checks that the lazy schedule is valid.

type LazySchedules

type LazySchedules []LazySchedule

LazySchedules stores all lazy schedules

func (LazySchedules) String

func (vs LazySchedules) String() string

String implements stringer interface

type VestingSchedule

type VestingSchedule struct {
	Denom         string        `json:"denom"`
	LazySchedules LazySchedules `json:"schedules"` // maps blocktime to percentage vested. Should sum to 1.
}

VestingSchedule maps the ratio of tokens that becomes vested by blocktime (in seconds) from genesis. The sum of values in the LazySchedule should sum to 1.0. CONTRACT: assumes that entries are

func NewVestingSchedule

func NewVestingSchedule(denom string, lazySchedules LazySchedules) VestingSchedule

NewVestingSchedule creates a new vesting lazy schedule instance.

func (VestingSchedule) GetDenom

func (vs VestingSchedule) GetDenom() string

GetDenom returns the denom of vesting layz 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) String

func (vs VestingSchedule) String() string

String implements fmt.Stringer interface

func (VestingSchedule) Validate

func (vs VestingSchedule) Validate() error

Validate checks that the vesting lazy schedule is valid.

type VestingSchedules

type VestingSchedules []VestingSchedule

VestingSchedules stores all vesting schedules passed as part of a LazyGradedVestingAccount

func (VestingSchedules) String

func (vs VestingSchedules) String() string

String implements stringer interface

Jump to

Keyboard shortcuts

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