types

package
v0.3.7 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2020 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ModuleCdc *codec.Codec

ModuleCdc defines module wide codec

Functions

func RegisterCodec

func RegisterCodec(cdc *codec.Codec)

RegisterCodec registers concrete types on the codec

Types

type BaseLazyGradedVestingAccount

type BaseLazyGradedVestingAccount struct {
	*auth.BaseVestingAccount

	VestingSchedules []VestingSchedule `json:"vesting_schedules"`
}

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

func NewBaseLazyGradedVestingAccount

func NewBaseLazyGradedVestingAccount(baseAcc *auth.BaseAccount, lazyVestingSchedules []VestingSchedule) *BaseLazyGradedVestingAccount

NewBaseLazyGradedVestingAccount returns a new BaseLazyGradedVestingAccount

func NewBaseLazyGradedVestingAccountRaw

func NewBaseLazyGradedVestingAccountRaw(baseVestingAcc *auth.BaseVestingAccount, lazyVestingSchedules []VestingSchedule) *BaseLazyGradedVestingAccount

NewBaseLazyGradedVestingAccountRaw creates a new BaseLazyGradedVestingAccount object from BaseVestingAccount

func (BaseLazyGradedVestingAccount) GetEndTime

func (lgva BaseLazyGradedVestingAccount) GetEndTime() int64

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

func (BaseLazyGradedVestingAccount) GetStartTime

func (lgva BaseLazyGradedVestingAccount) GetStartTime() int64

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

func (BaseLazyGradedVestingAccount) GetVestedCoins

func (lgva BaseLazyGradedVestingAccount) 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 (BaseLazyGradedVestingAccount) GetVestingCoins

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

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

func (BaseLazyGradedVestingAccount) GetVestingSchedule

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

GetVestingSchedule returns the VestingSchedule of the given denom

func (BaseLazyGradedVestingAccount) GetVestingSchedules

func (lgva BaseLazyGradedVestingAccount) GetVestingSchedules() []VestingSchedule

GetVestingSchedules returns the VestingSchedules of the graded lazy vesting account

func (BaseLazyGradedVestingAccount) SpendableCoins

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

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

func (BaseLazyGradedVestingAccount) String

func (lgva BaseLazyGradedVestingAccount) String() string

String implements fmt.Stringer interface

func (*BaseLazyGradedVestingAccount) TrackDelegation

func (lgva *BaseLazyGradedVestingAccount) 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.

type LazyGradedVestingAccount

type LazyGradedVestingAccount interface {
	auth.VestingAccount

	GetVestingSchedules() []VestingSchedule
	GetVestingSchedule(denom string) (VestingSchedule, bool)
}

LazyGradedVestingAccount defines an account type that vests coins via a graded vesting lazy schedule.

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) IsValid

func (s LazySchedule) IsValid() bool

IsValid checks that the lazy schedule is valid.

func (LazySchedule) String

func (s LazySchedule) String() string

String implements fmt.Stringer interface

type SupplyKeeper

type SupplyKeeper interface {
	SendCoinsFromAccountToModule(ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) sdk.Error
	GetModuleAccount(ctx sdk.Context, moduleName string) supply.ModuleAccountI
	GetModuleAddress(moduleName string) sdk.AccAddress
}

SupplyKeeper defines the expected supply Keeper (noalias)

type TreasuryKeeper

type TreasuryKeeper interface {
	GetTaxRate(ctx sdk.Context) (rate sdk.Dec)
	GetTaxCap(ctx sdk.Context, denom string) (taxCap sdk.Int)
	RecordEpochTaxProceeds(ctx sdk.Context, delta sdk.Coins)
}

TreasuryKeeper is expected keeper for treasury

type VestingSchedule

type VestingSchedule struct {
	Denom         string         `json:"denom"`
	LazySchedules []LazySchedule `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 []LazySchedule) 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) IsValid

func (vs VestingSchedule) IsValid() bool

IsValid checks that the vesting lazy schedule is valid.

func (VestingSchedule) String

func (vs VestingSchedule) String() string

String implements fmt.Stringer interface

Jump to

Keyboard shortcuts

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