cosmos-sdk: github.com/cosmos/cosmos-sdk/x/auth/vesting/types Index | Files

package types

import "github.com/cosmos/cosmos-sdk/x/auth/vesting/types"

nolint noalias

Index

Package Files

codec.go period.go test_common.go vesting_account.go

Variables

var VestingCdc *codec.Codec

VestingCdc module wide codec

func KeyTestPubAddr Uses

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

KeyTestPubAddr generates a test key pair

func NewTestCoins Uses

func NewTestCoins() sdk.Coins

NewTestCoins coins to more than cover the fee

func NewTestMsg Uses

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

NewTestMsg generates a test message

func RegisterCodec Uses

func RegisterCodec(cdc *codec.Codec)

RegisterCodec registers concrete types on the codec

type BaseVestingAccount Uses

type BaseVestingAccount struct {
    *authtypes.BaseAccount

    OriginalVesting  sdk.Coins `json:"original_vesting" yaml:"original_vesting"`   // coins in account upon initialization
    DelegatedFree    sdk.Coins `json:"delegated_free" yaml:"delegated_free"`       // coins that are vested and delegated
    DelegatedVesting sdk.Coins `json:"delegated_vesting" yaml:"delegated_vesting"` // coins that vesting and delegated
    EndTime          int64     `json:"end_time" yaml:"end_time"`                   // when the coins become unlocked
}

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

func NewBaseVestingAccount Uses

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

NewBaseVestingAccount creates a new BaseVestingAccount object

func (BaseVestingAccount) GetDelegatedFree Uses

func (bva BaseVestingAccount) GetDelegatedFree() sdk.Coins

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

func (BaseVestingAccount) GetDelegatedVesting Uses

func (bva BaseVestingAccount) GetDelegatedVesting() sdk.Coins

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

func (BaseVestingAccount) GetEndTime Uses

func (bva BaseVestingAccount) GetEndTime() int64

GetEndTime returns a vesting account's end time

func (BaseVestingAccount) GetOriginalVesting Uses

func (bva BaseVestingAccount) GetOriginalVesting() sdk.Coins

GetOriginalVesting returns a vesting account's original vesting amount

func (BaseVestingAccount) MarshalJSON Uses

func (bva BaseVestingAccount) MarshalJSON() ([]byte, error)

MarshalJSON returns the JSON representation of a BaseVestingAccount.

func (BaseVestingAccount) MarshalYAML Uses

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

MarshalYAML returns the YAML representation of a BaseVestingAccount.

func (BaseVestingAccount) SpendableCoinsVestingAccount Uses

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

SpendableCoinsVestingAccount returns all the spendable coins for a vesting account given a set of vesting coins.

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

func (BaseVestingAccount) String Uses

func (bva BaseVestingAccount) String() string

func (*BaseVestingAccount) TrackDelegation Uses

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

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

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

func (*BaseVestingAccount) TrackUndelegation Uses

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 exchange rate (tokens/shares) slightly if the undelegated tokens are non-integral.

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

func (*BaseVestingAccount) UnmarshalJSON Uses

func (bva *BaseVestingAccount) UnmarshalJSON(bz []byte) error

UnmarshalJSON unmarshals raw JSON bytes into a BaseVestingAccount.

func (BaseVestingAccount) Validate Uses

func (bva BaseVestingAccount) Validate() error

Validate checks for errors on the account fields

type ContinuousVestingAccount Uses

type ContinuousVestingAccount struct {
    *BaseVestingAccount

    StartTime int64 `json:"start_time" yaml:"start_time"` // when the coins start to vest
}

ContinuousVestingAccount implements the VestingAccount interface. It continuously vests by unlocking coins linearly with respect to time.

func NewContinuousVestingAccount Uses

func NewContinuousVestingAccount(baseAcc *authtypes.BaseAccount, startTime, endTime int64) *ContinuousVestingAccount

NewContinuousVestingAccount returns a new ContinuousVestingAccount

func NewContinuousVestingAccountRaw Uses

func NewContinuousVestingAccountRaw(bva *BaseVestingAccount, startTime int64) *ContinuousVestingAccount

NewContinuousVestingAccountRaw creates a new ContinuousVestingAccount object from BaseVestingAccount

func (ContinuousVestingAccount) GetStartTime Uses

func (cva ContinuousVestingAccount) GetStartTime() int64

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

func (ContinuousVestingAccount) GetVestedCoins Uses

func (cva ContinuousVestingAccount) GetVestedCoins(blockTime time.Time) sdk.Coins

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

func (ContinuousVestingAccount) GetVestingCoins Uses

func (cva ContinuousVestingAccount) GetVestingCoins(blockTime time.Time) sdk.Coins

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

func (ContinuousVestingAccount) MarshalJSON Uses

func (cva ContinuousVestingAccount) MarshalJSON() ([]byte, error)

MarshalJSON returns the JSON representation of a ContinuousVestingAccount.

func (ContinuousVestingAccount) MarshalYAML Uses

func (cva ContinuousVestingAccount) MarshalYAML() (interface{}, error)

MarshalYAML returns the YAML representation of a ContinuousVestingAccount.

func (ContinuousVestingAccount) SpendableCoins Uses

func (cva ContinuousVestingAccount) SpendableCoins(blockTime time.Time) sdk.Coins

SpendableCoins returns the total number of spendable coins per denom for a continuous vesting account.

func (ContinuousVestingAccount) String Uses

func (cva ContinuousVestingAccount) String() string

func (*ContinuousVestingAccount) TrackDelegation Uses

func (cva *ContinuousVestingAccount) 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 (*ContinuousVestingAccount) UnmarshalJSON Uses

func (cva *ContinuousVestingAccount) UnmarshalJSON(bz []byte) error

UnmarshalJSON unmarshals raw JSON bytes into a ContinuousVestingAccount.

func (ContinuousVestingAccount) Validate Uses

func (cva ContinuousVestingAccount) Validate() error

Validate checks for errors on the account fields

type DelayedVestingAccount Uses

type DelayedVestingAccount struct {
    *BaseVestingAccount
}

DelayedVestingAccount implements the VestingAccount interface. It vests all coins after a specific time, but non prior. In other words, it keeps them locked until a specified time.

func NewDelayedVestingAccount Uses

func NewDelayedVestingAccount(baseAcc *authtypes.BaseAccount, endTime int64) *DelayedVestingAccount

NewDelayedVestingAccount returns a DelayedVestingAccount

func NewDelayedVestingAccountRaw Uses

func NewDelayedVestingAccountRaw(bva *BaseVestingAccount) *DelayedVestingAccount

NewDelayedVestingAccountRaw creates a new DelayedVestingAccount object from BaseVestingAccount

func (DelayedVestingAccount) GetStartTime Uses

func (dva DelayedVestingAccount) GetStartTime() int64

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

func (DelayedVestingAccount) GetVestedCoins Uses

func (dva DelayedVestingAccount) GetVestedCoins(blockTime time.Time) sdk.Coins

GetVestedCoins returns the total amount of vested coins for a delayed vesting account. All coins are only vested once the schedule has elapsed.

func (DelayedVestingAccount) GetVestingCoins Uses

func (dva DelayedVestingAccount) GetVestingCoins(blockTime time.Time) sdk.Coins

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

func (DelayedVestingAccount) MarshalJSON Uses

func (dva DelayedVestingAccount) MarshalJSON() ([]byte, error)

MarshalJSON returns the JSON representation of a DelayedVestingAccount.

func (DelayedVestingAccount) SpendableCoins Uses

func (dva DelayedVestingAccount) SpendableCoins(blockTime time.Time) sdk.Coins

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

func (*DelayedVestingAccount) TrackDelegation Uses

func (dva *DelayedVestingAccount) 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 (*DelayedVestingAccount) UnmarshalJSON Uses

func (dva *DelayedVestingAccount) UnmarshalJSON(bz []byte) error

UnmarshalJSON unmarshals raw JSON bytes into a DelayedVestingAccount.

func (DelayedVestingAccount) Validate Uses

func (dva DelayedVestingAccount) Validate() error

Validate checks for errors on the account fields

type Period Uses

type Period struct {
    Length int64     `json:"length" yaml:"length"` // length of the period, in seconds
    Amount sdk.Coins `json:"amount" yaml:"amount"` // amount of coins vesting during this period
}

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

func (Period) String Uses

func (p Period) String() string

String Period implements stringer interface

type PeriodicVestingAccount Uses

type PeriodicVestingAccount struct {
    *BaseVestingAccount
    StartTime      int64   `json:"start_time" yaml:"start_time"`           // when the coins start to vest
    VestingPeriods Periods `json:"vesting_periods" yaml:"vesting_periods"` // the vesting schedule
}

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

func NewPeriodicVestingAccount Uses

func NewPeriodicVestingAccount(baseAcc *authtypes.BaseAccount, startTime int64, periods Periods) *PeriodicVestingAccount

NewPeriodicVestingAccount returns a new PeriodicVestingAccount

func NewPeriodicVestingAccountRaw Uses

func NewPeriodicVestingAccountRaw(bva *BaseVestingAccount, startTime int64, periods Periods) *PeriodicVestingAccount

NewPeriodicVestingAccountRaw creates a new PeriodicVestingAccount object from BaseVestingAccount

func (PeriodicVestingAccount) GetStartTime Uses

func (pva PeriodicVestingAccount) GetStartTime() int64

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

func (PeriodicVestingAccount) GetVestedCoins Uses

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

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

func (PeriodicVestingAccount) GetVestingCoins Uses

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

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

func (PeriodicVestingAccount) GetVestingPeriods Uses

func (pva PeriodicVestingAccount) GetVestingPeriods() Periods

GetVestingPeriods returns vesting periods associated with periodic vesting account.

func (PeriodicVestingAccount) MarshalJSON Uses

func (pva PeriodicVestingAccount) MarshalJSON() ([]byte, error)

MarshalJSON returns the JSON representation of a PeriodicVestingAccount.

func (PeriodicVestingAccount) MarshalYAML Uses

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

MarshalYAML returns the YAML representation of a PeriodicVestingAccount.

func (PeriodicVestingAccount) SpendableCoins Uses

func (pva PeriodicVestingAccount) SpendableCoins(blockTime time.Time) sdk.Coins

SpendableCoins returns the total number of spendable coins per denom for a periodic vesting account.

func (PeriodicVestingAccount) String Uses

func (pva PeriodicVestingAccount) String() string

func (*PeriodicVestingAccount) TrackDelegation Uses

func (pva *PeriodicVestingAccount) 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 (*PeriodicVestingAccount) UnmarshalJSON Uses

func (pva *PeriodicVestingAccount) UnmarshalJSON(bz []byte) error

UnmarshalJSON unmarshals raw JSON bytes into a PeriodicVestingAccount.

func (PeriodicVestingAccount) Validate Uses

func (pva PeriodicVestingAccount) Validate() error

Validate checks for errors on the account fields

type Periods Uses

type Periods []Period

Periods stores all vesting periods passed as part of a PeriodicVestingAccount

func (Periods) String Uses

func (vp Periods) String() string

String Periods implements stringer interface

Package types imports 13 packages (graph) and is imported by 3 packages. Updated 2019-12-08. Refresh now. Tools for package owners.