Documentation ¶
Index ¶
- Constants
- Variables
- func CreateTestAddrs(numAddrs int) []sdk.AccAddress
- func CreateTestPubKeys(numPubKeys int) []crypto.PubKey
- func NewPubKey(pk string) (res crypto.PubKey)
- func RegisterCodec(cdc *codec.Codec)
- func TestAddr(addr string, bech string) sdk.AccAddress
- func ValidateGenesis(data GenesisState) error
- func ValidatorVestingAccountKey(addr sdk.AccAddress) []byte
- type AccountKeeper
- type BankKeeper
- type BaseQueryParams
- type CurrentPeriodProgress
- type GenesisState
- type StakingKeeper
- type SupplyKeeper
- type ValidatorVestingAccount
- func (vva ValidatorVestingAccount) GetFailedVestedCoins() sdk.Coins
- func (vva ValidatorVestingAccount) GetVestedCoins(blockTime time.Time) sdk.Coins
- func (vva ValidatorVestingAccount) GetVestingCoins(blockTime time.Time) sdk.Coins
- func (vva ValidatorVestingAccount) MarshalJSON() ([]byte, error)
- func (vva ValidatorVestingAccount) MarshalYAML() (interface{}, error)
- func (vva ValidatorVestingAccount) SpendableCoins(blockTime time.Time) sdk.Coins
- func (vva ValidatorVestingAccount) String() string
- func (vva *ValidatorVestingAccount) TrackDelegation(blockTime time.Time, amount sdk.Coins)
- func (vva *ValidatorVestingAccount) UnmarshalJSON(bz []byte) error
- func (vva ValidatorVestingAccount) Validate() error
- type VestingProgress
Constants ¶
const ( EventTypeBeginBlockError = "begin_blocker_error" AttributeValueCategory = "validator-vesting" AttributeKeyError = "error_message" )
Event types for validator vesting module
const ( // ModuleName name used throughout module ModuleName = "validatorvesting" // StoreKey to be used when creating the KVStore StoreKey = ModuleName // QuerierRoute should be set to module name QuerierRoute = ModuleName // QueryPath shortened name for public API (cli and REST) QueryPath = "vesting" )
const ( QueryCirculatingSupply = "circulating-supply" QueryTotalSupply = "total-supply" )
Querier routes for the validator vesting module
Variables ¶
var ( // BlocktimeKey key for the time of the previous block BlocktimeKey = []byte{0x00} // ValidatorVestingAccountPrefix store prefix for validator vesting accounts ValidatorVestingAccountPrefix = []byte{0x01} )
var ( // ErrFailedUndelegation error for delegations that fail to unbond ErrFailedUndelegation = sdkerrors.Register(ModuleName, 2, "undelegation failed") )
var ModuleCdc *codec.Codec
ModuleCdc module wide codec
Functions ¶
func RegisterCodec ¶
RegisterCodec registers concrete types on the codec
func TestAddr ¶
func TestAddr(addr string, bech string) sdk.AccAddress
TestAddr for incode address generation
func ValidateGenesis ¶
func ValidateGenesis(data GenesisState) error
ValidateGenesis returns nil because accounts are validated by auth
func ValidatorVestingAccountKey ¶
func ValidatorVestingAccountKey(addr sdk.AccAddress) []byte
ValidatorVestingAccountKey returns the account address bytes prefixed by ValidatorVestingAccountPrefix
Types ¶
type AccountKeeper ¶
type AccountKeeper interface { GetAccount(sdk.Context, sdk.AccAddress) authexported.Account SetAccount(sdk.Context, authexported.Account) GetAllAccounts(ctx sdk.Context) (accounts []authexported.Account) IterateAccounts(ctx sdk.Context, cb func(account authexported.Account) (stop bool)) }
AccountKeeper defines the expected account keeper (noalias)
type BankKeeper ¶
type BankKeeper interface {
SendCoins(ctx sdk.Context, fromAddr sdk.AccAddress, toAddr sdk.AccAddress, amt sdk.Coins) error
}
BankKeeper defines the expected bank keeper (noalias)
type BaseQueryParams ¶
type BaseQueryParams struct { Page int `json:"page" yaml:"page"` Limit int `json:"limit" yaml:"limit"` }
QueryCirculatingSupplyParams defines the parameters necessary for querying for all Evidence.
func NewBaseQueryParams ¶
func NewBaseQueryParams(page, limit int) BaseQueryParams
type CurrentPeriodProgress ¶
type CurrentPeriodProgress struct { MissedBlocks int64 `json:"missed_blocks" yaml:"missed_blocks"` TotalBlocks int64 `json:"total_blocks" yaml:"total_blocks"` }
CurrentPeriodProgress tracks the progress of the current vesting period
func (CurrentPeriodProgress) GetSignedPercentage ¶
func (cpp CurrentPeriodProgress) GetSignedPercentage() sdk.Dec
GetSignedPercentage returns the percentage of blocks signed for the current vesting period
func (CurrentPeriodProgress) SignedPercetageIsOverThreshold ¶
func (cpp CurrentPeriodProgress) SignedPercetageIsOverThreshold(threshold int64) bool
SignedPercetageIsOverThreshold checks if the signed percentage exceeded the threshold
type GenesisState ¶
type GenesisState struct {
PreviousBlockTime time.Time `json:"previous_block_time" yaml:"previous_block_time"`
}
GenesisState - all auth state that must be provided at genesis
func DefaultGenesisState ¶
func DefaultGenesisState() GenesisState
DefaultGenesisState - Return a default genesis state
func NewGenesisState ¶
func NewGenesisState(prevBlockTime time.Time) GenesisState
NewGenesisState - Create a new genesis state
func (GenesisState) Equal ¶
func (data GenesisState) Equal(data2 GenesisState) bool
Equal checks whether two gov GenesisState structs are equivalent
func (GenesisState) IsEmpty ¶
func (data GenesisState) IsEmpty() bool
IsEmpty returns true if a GenesisState is empty
type StakingKeeper ¶
type StakingKeeper interface { IterateDelegations(ctx sdk.Context, delegator sdk.AccAddress, fn func(index int64, delegation stakingexported.DelegationI) (stop bool)) Undelegate( ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress, sharesAmount sdk.Dec, ) (time.Time, error) }
StakingKeeper defines the expected staking keeper (noalias)
type SupplyKeeper ¶
type SupplyKeeper interface { SendCoinsFromAccountToModule(ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error BurnCoins(ctx sdk.Context, name string, amt sdk.Coins) error SetModuleAccount(sdk.Context, supplyexported.ModuleAccountI) GetSupply(ctx sdk.Context) (supply supplyexported.SupplyI) }
SupplyKeeper defines the expected supply keeper for module accounts (noalias)
type ValidatorVestingAccount ¶
type ValidatorVestingAccount struct { *vestingtypes.PeriodicVestingAccount ValidatorAddress sdk.ConsAddress `json:"validator_address" yaml:"validator_address"` ReturnAddress sdk.AccAddress `json:"return_address" yaml:"return_address"` SigningThreshold int64 `json:"signing_threshold" yaml:"signing_threshold"` CurrentPeriodProgress CurrentPeriodProgress `json:"current_period_progress" yaml:"current_period_progress"` VestingPeriodProgress []VestingProgress `json:"vesting_period_progress" yaml:"vesting_period_progress"` DebtAfterFailedVesting sdk.Coins `json:"debt_after_failed_vesting" yaml:"debt_after_failed_vesting"` }
ValidatorVestingAccount implements the VestingAccount interface. It conditionally vests by unlocking coins during each specified period, provided that the validator address has validated at least **SigningThreshold** blocks during the previous vesting period. The signing threshold takes values 0 to 100 are represents the percentage of blocks that must be signed each period for the vesting to complete successfully. If the validator has not signed at least the threshold percentage of blocks during a period, the coins are returned to the return address, or burned if the return address is null.
func NewValidatorVestingAccount ¶
func NewValidatorVestingAccount(baseAcc *authtypes.BaseAccount, startTime int64, periods vestingtypes.Periods, validatorAddress sdk.ConsAddress, returnAddress sdk.AccAddress, signingThreshold int64) *ValidatorVestingAccount
NewValidatorVestingAccount creates a ValidatorVestingAccount object from a BaseAccount
func NewValidatorVestingAccountRaw ¶
func NewValidatorVestingAccountRaw(bva *vestingtypes.BaseVestingAccount, startTime int64, periods vestingtypes.Periods, validatorAddress sdk.ConsAddress, returnAddress sdk.AccAddress, signingThreshold int64) *ValidatorVestingAccount
NewValidatorVestingAccountRaw creates a new ValidatorVestingAccount object from BaseVestingAccount
func (ValidatorVestingAccount) GetFailedVestedCoins ¶
func (vva ValidatorVestingAccount) GetFailedVestedCoins() sdk.Coins
GetFailedVestedCoins returns the total number of coins for which the vesting period has passed but the vesting threshold was not met.
func (ValidatorVestingAccount) GetVestedCoins ¶
func (vva ValidatorVestingAccount) GetVestedCoins(blockTime time.Time) sdk.Coins
GetVestedCoins returns the total number of vested coins.
func (ValidatorVestingAccount) GetVestingCoins ¶
func (vva ValidatorVestingAccount) GetVestingCoins(blockTime time.Time) sdk.Coins
GetVestingCoins returns the total number of vesting coins. For validator vesting accounts, this excludes coins for which the vesting period has passed, but the vesting threshold was not met.
func (ValidatorVestingAccount) MarshalJSON ¶
func (vva ValidatorVestingAccount) MarshalJSON() ([]byte, error)
MarshalJSON returns the JSON representation of a PeriodicVestingAccount.
func (ValidatorVestingAccount) MarshalYAML ¶
func (vva ValidatorVestingAccount) MarshalYAML() (interface{}, error)
MarshalYAML returns the YAML representation of an account.
func (ValidatorVestingAccount) SpendableCoins ¶
func (vva ValidatorVestingAccount) SpendableCoins(blockTime time.Time) sdk.Coins
SpendableCoins returns the total number of spendable coins per denom for a periodic vesting account.
func (ValidatorVestingAccount) String ¶ added in v0.11.0
func (vva ValidatorVestingAccount) String() string
func (*ValidatorVestingAccount) TrackDelegation ¶
func (vva *ValidatorVestingAccount) 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 (*ValidatorVestingAccount) UnmarshalJSON ¶
func (vva *ValidatorVestingAccount) UnmarshalJSON(bz []byte) error
UnmarshalJSON unmarshals raw JSON bytes into a ValidatorVestingAccount.
func (ValidatorVestingAccount) Validate ¶
func (vva ValidatorVestingAccount) Validate() error
Validate checks for errors on the account fields
type VestingProgress ¶
type VestingProgress struct { PeriodComplete bool `json:"period_complete" yaml:"period_complete"` VestingSuccessful bool `json:"vesting_successful" yaml:"vesting_successful"` }
VestingProgress tracks the status of each vesting period