Documentation ¶
Overview ¶
nolint
Index ¶
- Constants
- Variables
- func AddressFromLastValidatorPowerKey(key []byte) []byte
- func Bech32ifyConsPub(pub crypto.PubKey) (string, error)
- func ErrAddSharesDuringProxy(delegator string, proxy string) sdk.EnvelopedErr
- func ErrAddSharesToDismission(valAddr string) sdk.Error
- func ErrAlreadyAddedShares(delAddr string) sdk.EnvelopedErr
- func ErrAlreadyBound(delAddr string) sdk.EnvelopedErr
- func ErrBadDelegationAmount() sdk.Error
- func ErrBadDenom() sdk.EnvelopedErr
- func ErrBadUnDelegationAmount() sdk.Error
- func ErrBadValidatorAddr() sdk.Error
- func ErrBondedPoolOrNotBondedIsNotExist() sdk.Error
- func ErrCommissionChangeRateGTMaxRate() sdk.Error
- func ErrCommissionChangeRateNegative() sdk.Error
- func ErrCommissionGTMaxChangeRate() sdk.Error
- func ErrCommissionGTMaxRate() sdk.Error
- func ErrCommissionHuge() sdk.Error
- func ErrCommissionNegative() sdk.Error
- func ErrCommissionUpdateTime() sdk.Error
- func ErrDelegatorEqualToProxyAddr() sdk.Error
- func ErrDescriptionIsEmpty() sdk.Error
- func ErrDescriptionLength(descriptor string, got, max int) sdk.Error
- func ErrDoubleProxy(delegator string) sdk.EnvelopedErr
- func ErrEmptyValidators() sdk.Error
- func ErrExceedValidatorAddrs(num int) sdk.EnvelopedErr
- func ErrGetConsPubKeyBech32() sdk.Error
- func ErrInsufficientDelegation(quantity, delLeft string) sdk.Error
- func ErrInsufficientQuantity(quantity, minLimit string) sdk.Error
- func ErrInvalidDelegation(delegator string) sdk.EnvelopedErr
- func ErrInvalidProxyUpdating() sdk.Error
- func ErrInvalidProxyWithdrawTotal(addr string) sdk.Error
- func ErrMinSelfDelegationInvalid() sdk.Error
- func ErrMoreMinSelfDelegation(valAddr string) sdk.Error
- func ErrNilDelegatorAddr() sdk.Error
- func ErrNilValidatorAddr() sdk.Error
- func ErrNoDelegationToAddShares(delegator string) sdk.EnvelopedErr
- func ErrNoDelegatorExisted(delAddr string) sdk.Error
- func ErrNoMinSelfDelegation(valAddr string) sdk.Error
- func ErrNoUnbondingDelegation() sdk.Error
- func ErrNoValidatorFound(valAddr string) sdk.EnvelopedErr
- func ErrNotInDelegating(addr string) sdk.Error
- func ErrProxyAlreadyExist(delegator string) sdk.EnvelopedErr
- func ErrProxyNotFound(delegator string) sdk.EnvelopedErr
- func ErrTargetValsDuplicate() sdk.Error
- func ErrUnknownStakingQueryType() sdk.Error
- func ErrValidatorOwnerExists() sdk.Error
- func ErrValidatorPubKeyExists() sdk.Error
- func ErrValidatorPubKeyTypeNotSupported(keyType string, supportedTypes []string) sdk.Error
- func GetCompleteTimeKey(timestamp time.Time) []byte
- func GetCompleteTimeWithAddrKey(timestamp time.Time, delAddr sdk.AccAddress) []byte
- func GetConsPubKeyBech32(pubkey string) (pk crypto.PubKey, err error)
- func GetDelegatorKey(delAddr sdk.AccAddress) []byte
- func GetLastValidatorPowerKey(operator sdk.ValAddress) []byte
- func GetProxyDelegatorKey(proxyAddr, delAddr sdk.AccAddress) []byte
- func GetSharesKey(valAddr sdk.ValAddress, delAddr sdk.AccAddress) []byte
- func GetSharesToValidatorsKey(valAddr sdk.ValAddress) []byte
- func GetUndelegationInfoKey(delAddr sdk.AccAddress) []byte
- func GetValidatorByConsAddrKey(addr sdk.ConsAddress) []byte
- func GetValidatorKey(operatorAddr sdk.ValAddress) []byte
- func GetValidatorQueueTimeKey(timestamp time.Time) []byte
- func GetValidatorsByPowerIndexKey(validator Validator) []byte
- func MustBech32ifyConsPub(pub crypto.PubKey) string
- func MustGetConsPubKeyBech32(pubkey string) (pk crypto.PubKey)
- func MustMarshalValidator(cdc *codec.Codec, validator Validator) []byte
- func RegisterCodec(cdc *codec.Codec)
- func SplitCompleteTimeWithAddrKey(key []byte) (time.Time, sdk.AccAddress)
- type AccountKeeper
- type Commission
- type CommissionRates
- type Delegator
- type Description
- type GenesisState
- type LastValidatorPower
- type MsgAddShares
- type MsgBindProxy
- type MsgCreateValidator
- func (msg MsgCreateValidator) GetSignBytes() []byte
- func (msg MsgCreateValidator) GetSigners() []sdk.AccAddress
- func (msg MsgCreateValidator) MarshalJSON() ([]byte, error)
- func (msg MsgCreateValidator) Route() string
- func (msg MsgCreateValidator) Type() string
- func (msg *MsgCreateValidator) UnmarshalJSON(bz []byte) error
- func (msg MsgCreateValidator) ValidateBasic() error
- type MsgDeposit
- type MsgDestroyValidator
- type MsgEditValidator
- type MsgRegProxy
- type MsgUnbindProxy
- type MsgWithdraw
- type MultiStakingHooks
- func (h MultiStakingHooks) AfterValidatorBeginUnbonding(ctx sdk.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress)
- func (h MultiStakingHooks) AfterValidatorBonded(ctx sdk.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress)
- func (h MultiStakingHooks) AfterValidatorCreated(ctx sdk.Context, valAddr sdk.ValAddress)
- func (h MultiStakingHooks) AfterValidatorDestroyed(ctx sdk.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress)
- func (h MultiStakingHooks) AfterValidatorRemoved(ctx sdk.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress)
- func (h MultiStakingHooks) BeforeValidatorModified(ctx sdk.Context, valAddr sdk.ValAddress)
- type OVPair
- type OVPairs
- type Params
- type Pool
- type ProxyDelegatorKeyExported
- type QueryDelegatorParams
- type QueryValidatorParams
- type QueryValidatorsParams
- type Shares
- type SharesExported
- type SharesResponse
- type SharesResponses
- type StakingHooks
- type StandardizedValidator
- type StandardizedValidators
- type SupplyKeeper
- type UndelegationInfo
- func DefaultUndelegation() UndelegationInfo
- func MustUnMarshalUndelegationInfo(cdc *codec.Codec, value []byte) UndelegationInfo
- func NewUndelegationInfo(delegatorAddr sdk.AccAddress, sharesQuantity Shares, completionTime time.Time) UndelegationInfo
- func UnmarshalUndelegationInfo(cdc *codec.Codec, value []byte) (undelegationInfo UndelegationInfo, err error)
- type Validator
- func (v Validator) ABCIValidatorUpdate() abci.ValidatorUpdate
- func (v Validator) ABCIValidatorUpdateByShares() abci.ValidatorUpdate
- func (v Validator) ABCIValidatorUpdateZero() abci.ValidatorUpdate
- func (v Validator) BondedTokens() sdk.Int
- func (v Validator) ConsAddress() sdk.ConsAddress
- func (v Validator) ConsensusPower() int64
- func (v Validator) ConsensusPowerByShares() int64
- func (v Validator) Export() ValidatorExported
- func (v Validator) GetBondedTokens() sdk.Int
- func (v Validator) GetCommission() sdk.Dec
- func (v Validator) GetConsAddr() sdk.ConsAddress
- func (v Validator) GetConsPubKey() crypto.PubKey
- func (v Validator) GetConsensusPower() int64
- func (v Validator) GetDelegatorShares() sdk.Dec
- func (v Validator) GetMinSelfDelegation() sdk.Dec
- func (v Validator) GetMoniker() string
- func (v Validator) GetOperator() sdk.ValAddress
- func (v Validator) GetStatus() sdk.BondStatus
- func (v Validator) GetTokens() sdk.Int
- func (v Validator) IsBonded() bool
- func (v Validator) IsJailed() bool
- func (v Validator) IsUnbonded() bool
- func (v Validator) IsUnbonding() bool
- func (v Validator) MarshalJSON() ([]byte, error)
- func (v Validator) MarshalYAML() (interface{}, error)
- func (v Validator) PotentialConsensusPowerByShares() int64
- func (v Validator) SetInitialCommission(commission Commission) (Validator, error)
- func (v Validator) SharesFromTokens(amt sdk.Int) (sdk.Dec, error)
- func (v Validator) SharesFromTokensTruncated(amt sdk.Int) (sdk.Dec, error)
- func (v Validator) Standardize() StandardizedValidator
- func (v Validator) String() string
- func (v Validator) TestEquivalent(v2 Validator) bool
- func (v Validator) TokensFromShares(shares sdk.Dec) sdk.Dec
- func (v Validator) TokensFromSharesRoundUp(shares sdk.Dec) sdk.Dec
- func (v Validator) TokensFromSharesTruncated(shares sdk.Dec) sdk.Dec
- func (v *Validator) UnmarshalJSON(data []byte) error
- func (v Validator) UpdateStatus(newStatus sdk.BondStatus) Validator
- type ValidatorExported
- type ValidatorSet
- type Validators
Constants ¶
const ( DefaultCodespace string = ModuleName CodeNoValidatorFound uint32 = 67000 CodeInvalidDelegation uint32 = 67001 CodeNilValidatorAddr uint32 = 67002 CodeBadValidatorAddr uint32 = 67003 CodeMoreMinSelfDelegation uint32 = 67004 CodeProxyNotFound uint32 = 67005 CodeEmptyValidators uint32 = 67006 CodeProxyAlreadyExist uint32 = 67007 CodeAddressNotEqual uint32 = 67009 CodeDescriptionIsEmpty uint32 = 67010 CodeGetConsPubKeyBech32Failed uint32 = 67011 CodeUnknownStakingQueryType uint32 = 67012 CodeValidatorOwnerExists uint32 = 67013 CodeValidatorPubKeyExists uint32 = 67014 CodeValidatorPubKeyTypeNotSupported uint32 = 67015 CodeBondedPoolOrNotBondedIsNotExist uint32 = 67016 CodeInvalidDescriptionLength uint32 = 67017 CodeCommissionNegative uint32 = 67018 CodeCommissionHuge uint32 = 67019 CodeCommissionGTMaxRate uint32 = 67020 CodeCommissionUpdateTime uint32 = 67021 CodeCommissionChangeRateNegative uint32 = 67022 CodeCommissionChangeRateGTMaxRate uint32 = 67023 CodeCommissionGTMaxChangeRate uint32 = 67024 CodeMinSelfDelegationInvalid uint32 = 67025 CodeNilDelegatorAddr uint32 = 67026 CodeDelegatorEqualToProxyAddr uint32 = 67027 CodeBadDenom uint32 = 67028 CodeBadDelegationAmount uint32 = 67029 CodeNoUnbondingDelegation uint32 = 67030 CodeDoubleProxy uint32 = 67033 CodeExceedValidatorAddrs uint32 = 67034 CodeNotInDelegating uint32 = 67036 CodeInsufficientDelegation uint32 = 67037 CodeInsufficientQuantity uint32 = 67038 CodeInvalidMinSelfDelegation uint32 = 67039 CodeBadUnDelegationAmount uint32 = 67040 CodeInvalidProxyUpdating uint32 = 67041 CodeInvalidProxyWithdrawTotal uint32 = 67042 CodeNoDelegatorExisted uint32 = 67044 CodeTargetValsDuplicate uint32 = 67045 CodeAlreadyBound uint32 = 67046 )
const ( EventTypeCompleteUnbonding = "complete_unbonding" EventTypeCreateValidator = "create_validator" EventTypeEditValidator = "edit_validator" EventTypeDelegate = "delegate" EventTypeUnbond = "unbond" AttributeKeyValidator = "validator" AttributeKeyCommissionRate = "commission_rate" AttributeKeyMinSelfDelegation = "min_self_delegation" AttributeKeyDelegator = "delegator" AttributeKeyCompletionTime = "completion_time" AttributeValueCategory = ModuleName )
staking module event types
const ( // ModuleName is the name of the staking module ModuleName = "staking" // StoreKey is the string store representation StoreKey = ModuleName // TStoreKey is the string transient store representation TStoreKey = "transient_" + ModuleName // QuerierRoute is the querier route for the staking module QuerierRoute = ModuleName // RouterKey is the msg router key for the staking module RouterKey = ModuleName )
const ( // Update the validator set every 252 blocks by default DefaultBlocksPerEpoch = 252 // Default maximum number of validators to vote DefaultMaxValsToVote = 30 // Default validate rate update interval by hours DefaultValidateRateUpdateInterval = 24 )
const ( // Default unbonding duration, 14 days DefaultUnbondingTime time.Duration = time.Hour * 24 * 7 * 2 // Default maximum number of bonded validators DefaultMaxValidators uint16 = 21 DefaultEpoch uint16 = DefaultBlocksPerEpoch )
Staking params default values
const ( NotBondedPoolName = "not_bonded_tokens_pool" BondedPoolName = "bonded_tokens_pool" )
names used as root for pool module accounts:
- NotBondedPool -> "not_bonded_tokens_pool"
- BondedPool -> "bonded_tokens_pool"
const ( QueryValidators = "validators" QueryValidator = "validator" QueryUnbondingDelegation = "unbondingDelegation" QueryPool = "pool" QueryParameters = "parameters" QueryAddress = "address" QueryForAddress = "validatorAddress" QueryForAccAddress = "validatorAccAddress" QueryProxy = "proxy" QueryDelegator = "delegator" )
query endpoints supported by the staking Querier
const ( // TODO: Why can't we just have one string description which can be JSON by convention MaxMonikerLength = 70 MaxIdentityLength = 3000 MaxWebsiteLength = 140 MaxDetailsLength = 280 )
nolint
const DoNotModifyDesc = "[do-not-modify]"
DoNotModifyDesc is the constant used in flags to indicate that description field should not be updated
Variables ¶
var ( // Keys for store prefixes // Last* values are constant during a block. LastValidatorPowerKey = []byte{0x11} // prefix for each key to a validator index, for bonded validators LastTotalPowerKey = []byte{0x12} // prefix for the total power ValidatorsKey = []byte{0x21} // prefix for each key to a validator ValidatorsByConsAddrKey = []byte{0x22} // prefix for each key to a validator index, by pubkey ValidatorsByPowerIndexKey = []byte{0x23} // prefix for each key to a validator index, sorted by power ValidatorQueueKey = []byte{0x43} // prefix for the timestamps in validator queue DelegatorKey = []byte{0x52} UnDelegationInfoKey = []byte{0x53} UnDelegateQueueKey = []byte{0x54} ProxyKey = []byte{0x55} // prefix key for vals info to enforce the update of validator-set ValidatorAbandonedKey = []byte{0x60} )
nolint
var ( // DefaultMinDelegation is the limit value of delegation or undelegation DefaultMinDelegation = sdk.NewDecWithPrec(1, 4) // DefaultMinSelfDelegation is the default value of each validator's msd (hard code) DefaultMinSelfDelegation = sdk.NewDec(10000) )
var ( KeyUnbondingTime = []byte("UnbondingTime") KeyMaxValidators = []byte("MaxValidators") KeyBondDenom = []byte("BondDenom") KeyEpoch = []byte("BlocksPerEpoch") // how many blocks each epoch has KeyTheEndOfLastEpoch = []byte("TheEndOfLastEpoch") // a block height that is the end of last epoch KeyMinDelegation = []byte("MinDelegation") KeyMinSelfDelegation = []byte("MinSelfDelegation") )
nolint - Keys for parameter access
var ModuleCdc *codec.Codec
ModuleCdc is generic sealed codec to be used throughout this module
Functions ¶
func AddressFromLastValidatorPowerKey ¶
AddressFromLastValidatorPowerKey gets the validator operator address from LastValidatorPowerKey
func Bech32ifyConsPub ¶
Bech32ifyConsPub returns a Bech32 encoded string containing the Bech32PrefixConsPub prefixfor a given consensus node's PubKey.
func ErrAddSharesDuringProxy ¶
func ErrAddSharesDuringProxy(delegator string, proxy string) sdk.EnvelopedErr
ErrAddSharesDuringProxy returns an error when a delegator who has bound tries to add shares to validators by itself
func ErrAddSharesToDismission ¶
ErrAddSharesToDismission returns an error when a zero-msd validator becomes the shares adding target
func ErrAlreadyAddedShares ¶
func ErrAlreadyAddedShares(delAddr string) sdk.EnvelopedErr
ErrAlreadyAddedShares returns an error when a delegator tries to bind proxy after adding shares
func ErrAlreadyBound ¶
func ErrAlreadyBound(delAddr string) sdk.EnvelopedErr
ErrAlreadyBound returns an error when a delegator keeps binding a proxy before proxy register
func ErrBadDelegationAmount ¶
ErrBadDelegationAmount returns an error when the amount of delegation isn't positive
func ErrBadDenom ¶
func ErrBadDenom() sdk.EnvelopedErr
ErrBadDenom returns an error when the coin denomination is invalid
func ErrBadUnDelegationAmount ¶
ErrBadUnDelegationAmount returns an error when the amount of delegation is not positive
func ErrBadValidatorAddr ¶
ErrBadValidatorAddr returns an error when an invalid validator address appears
func ErrBondedPoolOrNotBondedIsNotExist ¶
ErrBondedPoolOrNotBondedIsNotExist returns an error when bonded pool or not bonded pool is empty.
func ErrCommissionChangeRateGTMaxRate ¶
ErrCommissionChangeRateGTMaxRate returns an error when the commission change rate is greater than the max rate
func ErrCommissionChangeRateNegative ¶
ErrCommissionChangeRateNegative returns an error when the commission change rate is not positive
func ErrCommissionGTMaxChangeRate ¶
ErrCommissionGTMaxChangeRate returns an error when the new rate % points change is greater than the max change rate
func ErrCommissionGTMaxRate ¶
ErrCommissionGTMaxRate returns an error when the commission rate is greater than the max rate
func ErrCommissionHuge ¶
ErrCommissionHuge returns an error when the commission is greater than 100%
func ErrCommissionNegative ¶
ErrCommissionNegative returns an error when the commission is not positive
func ErrCommissionUpdateTime ¶
ErrCommissionUpdateTime returns an error when the commission is remodified within 24 hours
func ErrDelegatorEqualToProxyAddr ¶
ErrDelegatorEqualToProxyAddr returns an error when the address is not expected
func ErrDescriptionIsEmpty ¶
ErrDescriptionIsEmpty returns an error when description is empty.
func ErrDescriptionLength ¶
ErrDescriptionLength returns an error when the description of validator has a wrong length
func ErrDoubleProxy ¶
func ErrDoubleProxy(delegator string) sdk.EnvelopedErr
ErrDoubleProxy returns an error when a delegator trys to bind more than one proxy
func ErrEmptyValidators ¶
ErrEmptyValidators returns an error when none of the validators in shares adding list is available
func ErrExceedValidatorAddrs ¶
func ErrExceedValidatorAddrs(num int) sdk.EnvelopedErr
ErrExceedValidatorAddrs returns an error when the number of target validators exceeds the max limit
func ErrGetConsPubKeyBech32 ¶
ErrGetConsPubKeyBech32 returns an error when get bech32 consensus public key failed.
func ErrInsufficientDelegation ¶
ErrInsufficientDelegation returns an error when the delegation left is not enough for unbonding
func ErrInsufficientQuantity ¶
ErrInsufficientQuantity returns an error when the quantity is less than the min delegation limit
func ErrInvalidDelegation ¶
func ErrInvalidDelegation(delegator string) sdk.EnvelopedErr
ErrInvalidDelegation returns an error when the delegation is invalid
func ErrInvalidProxyUpdating ¶
ErrInvalidProxyUpdating returns an error when the total delegated tokens on a proxy are going to be negative
func ErrInvalidProxyWithdrawTotal ¶
ErrInvalidProxyWithdrawTotal returns an error when proxy withdraws total tokens
func ErrMinSelfDelegationInvalid ¶
ErrMinSelfDelegationInvalid returns an error when the msd isn't positive
func ErrMoreMinSelfDelegation ¶
ErrMoreMinSelfDelegation returns an error when the msd doesn't match the rest of shares on a validator
func ErrNilDelegatorAddr ¶
ErrNilDelegatorAddr returns an error when the delegator address is nil
func ErrNilValidatorAddr ¶
ErrNilValidatorAddr returns an error when an empty validator address appears
func ErrNoDelegationToAddShares ¶
func ErrNoDelegationToAddShares(delegator string) sdk.EnvelopedErr
ErrNoDelegationToAddShares returns an error when there's no delegation to support adding shares to validators
func ErrNoDelegatorExisted ¶
ErrNoDelegatorExisted returns an error when the info if a certain delegator doesn't exist
func ErrNoMinSelfDelegation ¶
ErrNoMinSelfDelegation returns an error when the msd has already been unbonded
func ErrNoUnbondingDelegation ¶
ErrNoUnbondingDelegation returns an error when the unbonding delegation doesn't exist
func ErrNoValidatorFound ¶
func ErrNoValidatorFound(valAddr string) sdk.EnvelopedErr
ErrNoValidatorFound returns an error when a validator doesn't exist
func ErrNotInDelegating ¶
ErrNotInDelegating returns an error when the UndelegationInfo doesn't exist during it's unbonding period
func ErrProxyAlreadyExist ¶
func ErrProxyAlreadyExist(delegator string) sdk.EnvelopedErr
ErrProxyAlreadyExist returns an error when a proxy tries to reg the second time
func ErrProxyNotFound ¶
func ErrProxyNotFound(delegator string) sdk.EnvelopedErr
ErrProxyNotFound returns an error when a delegator who's not a proxy tries to unreg
func ErrTargetValsDuplicate ¶
ErrTargetValsDuplicate returns an error when the target validators in voting list are duplicate
func ErrUnknownStakingQueryType ¶
ErrUnknownStakingQueryType returns an error when encounter unknown staking query type.
func ErrValidatorOwnerExists ¶
ErrValidatorOwnerExists returns an error when the validator address has been registered
func ErrValidatorPubKeyExists ¶
ErrValidatorPubKeyExists returns an error when the validator consensus pubkey has been registered
func ErrValidatorPubKeyTypeNotSupported ¶
ErrValidatorPubKeyTypeNotSupported returns an error when the type of pubkey was not supported
func GetCompleteTimeKey ¶
GetCompleteTimeKey get the key for the prefix of time
func GetCompleteTimeWithAddrKey ¶
func GetCompleteTimeWithAddrKey(timestamp time.Time, delAddr sdk.AccAddress) []byte
GetCompleteTimeWithAddrKey get the key for the complete time with delegator address
func GetConsPubKeyBech32 ¶
GetConsPubKeyBech32 creates a PubKey for a consensus node with a given public key string using the Bech32 Bech32PrefixConsPub prefix.
func GetDelegatorKey ¶
func GetDelegatorKey(delAddr sdk.AccAddress) []byte
GetDelegatorKey gets the key for Delegator
func GetLastValidatorPowerKey ¶
func GetLastValidatorPowerKey(operator sdk.ValAddress) []byte
GetLastValidatorPowerKey gets the bonded validator index key for an operator address
func GetProxyDelegatorKey ¶
func GetProxyDelegatorKey(proxyAddr, delAddr sdk.AccAddress) []byte
GetProxyDelegatorKey gets the key for the relationship between delegator and proxy
func GetSharesKey ¶
func GetSharesKey(valAddr sdk.ValAddress, delAddr sdk.AccAddress) []byte
GetSharesKey gets the whole key for an item of shares info
func GetSharesToValidatorsKey ¶
func GetSharesToValidatorsKey(valAddr sdk.ValAddress) []byte
GetSharesToValidatorsKey gets the first-prefix for an item of shares info
func GetUndelegationInfoKey ¶
func GetUndelegationInfoKey(delAddr sdk.AccAddress) []byte
GetUndelegationInfoKey gets the key for UndelegationInfo
func GetValidatorByConsAddrKey ¶
func GetValidatorByConsAddrKey(addr sdk.ConsAddress) []byte
GetValidatorByConsAddrKey gets the key for the validator with pubkey VALUE: validator operator address ([]byte)
func GetValidatorKey ¶
func GetValidatorKey(operatorAddr sdk.ValAddress) []byte
GetValidatorKey gets the key for the validator with address VALUE: staking/Validator
func GetValidatorQueueTimeKey ¶
GetValidatorQueueTimeKey gets the prefix for all unbonding delegations from a delegator
func GetValidatorsByPowerIndexKey ¶
GetValidatorsByPowerIndexKey gets the validator by power index Power index is the key used in the power-store, and represents the relative power ranking of the validator VALUE: validator operator address ([]byte)
func MustBech32ifyConsPub ¶
func MustGetConsPubKeyBech32 ¶
MustGetConsPubKeyBech32 returns the result of GetConsPubKeyBech32 panicing on failure.
func MustMarshalValidator ¶
MustMarshalValidator must return the marshaling bytes of a validator
func RegisterCodec ¶
RegisterCodec registers concrete types for codec
func SplitCompleteTimeWithAddrKey ¶
func SplitCompleteTimeWithAddrKey(key []byte) (time.Time, sdk.AccAddress)
SplitCompleteTimeWithAddrKey splits the key and returns the endtime and delegator address
Types ¶
type AccountKeeper ¶
type AccountKeeper interface {
IterateAccounts(ctx sdk.Context, process func(authexported.Account) (stop bool))
}
AccountKeeper defines the expected account keeper (noalias)
type Commission ¶
type Commission struct { CommissionRates `json:"commission_rates" yaml:"commission_rates"` UpdateTime time.Time `json:"update_time" yaml:"update_time"` // the last time the commission rate was changed }
Commission defines a commission parameters for a given validator
func NewCommission ¶
func NewCommission(rate, maxRate, maxChangeRate sdk.Dec) Commission
NewCommission returns an initialized validator commission.
func NewCommissionWithTime ¶
func NewCommissionWithTime(rate, maxRate, maxChangeRate sdk.Dec, updatedAt time.Time) Commission
NewCommissionWithTime returns an initialized validator commission with a specified update time which should be the current block BFT time
func (Commission) Equal ¶
func (c Commission) Equal(c2 Commission) bool
Equal checks if the given Commission object is equal to the receiving Commission object
func (Commission) String ¶
func (c Commission) String() string
String implements the Stringer interface for a Commission
func (Commission) ValidateNewRate ¶
ValidateNewRate performs basic sanity validation checks of a new commission rate If validation fails, an SDK error is returned.
type CommissionRates ¶
type CommissionRates struct { // the commission rate charged to delegators, as a fraction Rate sdk.Dec `json:"rate" yaml:"rate"` // maximum commission rate which validator can ever charge, as a fraction MaxRate sdk.Dec `json:"max_rate" yaml:"max_rate"` // maximum daily increase of the validator commission, as a fraction MaxChangeRate sdk.Dec `json:"max_change_rate" yaml:"max_change_rate"` }
CommissionRates defines the initial commission rates to be used for creating a validator
func NewCommissionRates ¶
func NewCommissionRates(rate, maxRate, maxChangeRate sdk.Dec) CommissionRates
NewCommissionRates returns an initialized validator commission rates
func (CommissionRates) Validate ¶
func (c CommissionRates) Validate() sdk.Error
Validate performs basic sanity validation checks of initial commission parameters If validation fails, an SDK error is returned
type Delegator ¶
type Delegator struct { DelegatorAddress sdk.AccAddress `json:"delegator_address" yaml:"delegator_address"` ValidatorAddresses []sdk.ValAddress `json:"validator_address" yaml:"validator_address"` Tokens sdk.Dec `json:"tokens" yaml:"tokens"` // self-delegated tokens IsProxy bool `json:"is_proxy" yaml:"is_proxy"` TotalDelegatedTokens sdk.Dec `json:"total_delegated_tokens" yaml:"total_delegated_tokens"` // total tokens delegated by other delegators ProxyAddress sdk.AccAddress `json:"proxy_address" yaml:"proxy_address"` }
Delegator is the struct of delegator info
func MustUnMarshalDelegator ¶
MustUnMarshalDelegator must return a delegator entity by unmarshalling
func NewDelegator ¶
func NewDelegator(delAddr sdk.AccAddress) Delegator
NewDelegator creates a new Delegator object
func (*Delegator) BindProxy ¶
func (d *Delegator) BindProxy(proxyAddr sdk.AccAddress)
BindProxy sets relationship between a delegator and proxy
func (Delegator) GetLastAddedShares ¶
GetLastAddedShares gets the last shares added to validators of a delegator for other module
func (Delegator) GetShareAddedValidatorAddresses ¶
func (d Delegator) GetShareAddedValidatorAddresses() []sdk.ValAddress
GetShareAddedValidatorAddresses gets validator address that the delegator added shares to for other module
func (*Delegator) UnbindProxy ¶
func (d *Delegator) UnbindProxy()
UnbindProxy clears the proxy address on a delegator
type Description ¶
type Description struct { Moniker string `json:"moniker" yaml:"moniker"` // name Identity string `json:"identity" yaml:"identity"` // optional identity signature (ex. UPort or Keybase) Website string `json:"website" yaml:"website"` // optional website link Details string `json:"details" yaml:"details"` // optional details }
Description - description fields for a validator
func NewDescription ¶
func NewDescription(moniker, identity, website, details string) Description
NewDescription returns a new Description with the provided values.
func (Description) EnsureLength ¶
func (d Description) EnsureLength() (Description, error)
EnsureLength ensures the length of a validator's description.
func (Description) UpdateDescription ¶
func (d Description) UpdateDescription(d2 Description) (Description, error)
UpdateDescription updates the fields of a given description. An error is returned if the resulting description contains an invalid length.
type GenesisState ¶
type GenesisState struct { Params Params `json:"params" yaml:"params"` LastTotalPower sdk.Int `json:"last_total_power" yaml:"last_total_power"` LastValidatorPowers []LastValidatorPower `json:"last_validator_powers" yaml:"last_validator_powers"` Validators []ValidatorExported `json:"validators" yaml:"validators"` Delegators []Delegator `json:"delegators" yaml:"delegators"` UnbondingDelegations []UndelegationInfo `json:"unbonding_delegations" yaml:"unbonding_delegations"` ProxyDelegatorKeys []ProxyDelegatorKeyExported `json:"proxy_delegator_keys" yaml:"proxy_delegator_keys"` Exported bool `json:"exported" yaml:"exported"` }
GenesisState - all staking state that must be provided at genesis
func DefaultGenesisState ¶
func DefaultGenesisState() GenesisState
DefaultGenesisState gets the default genesis state
func NewGenesisState ¶
func NewGenesisState(params Params, validators Validators, delegators []Delegator) GenesisState
NewGenesisState creates a new object of GenesisState
type LastValidatorPower ¶
type LastValidatorPower struct { Address sdk.ValAddress Power int64 }
LastValidatorPower is needed for validator set update logic
func NewLastValidatorPower ¶
func NewLastValidatorPower(valAddr sdk.ValAddress, power int64) LastValidatorPower
NewLastValidatorPower creates a new instance of LastValidatorPower
type MsgAddShares ¶
type MsgAddShares struct {}
MsgAddShares - struct for adding-shares transaction
func NewMsgAddShares ¶
func NewMsgAddShares(delAddr sdk.AccAddress, valAddrs []sdk.ValAddress) MsgAddShares
NewMsgAddShares creates a msg of adding shares to vals
func (MsgAddShares) GetSignBytes ¶
func (msg MsgAddShares) GetSignBytes() []byte
GetSignBytes returns the message bytes to sign over
func (MsgAddShares) GetSigners ¶
func (msg MsgAddShares) GetSigners() []sdk.AccAddress
func (MsgAddShares) Type ¶
func (MsgAddShares) Type() string
func (MsgAddShares) ValidateBasic ¶
func (msg MsgAddShares) ValidateBasic() error
ValidateBasic gives a quick validity check
type MsgBindProxy ¶
type MsgBindProxy struct { DelAddr sdk.AccAddress `json:"delegator_address" yaml:"delegator_address"` ProxyAddress sdk.AccAddress `json:"proxy_address" yaml:"proxy_address"` }
MsgBindProxy - structure for bind proxy relationship between the delegator and the proxy
func NewMsgBindProxy ¶
func NewMsgBindProxy(delAddr sdk.AccAddress, ProxyDelAddr sdk.AccAddress) MsgBindProxy
NewMsgBindProxy creates a msg of binding proxy
func (MsgBindProxy) GetSignBytes ¶
func (msg MsgBindProxy) GetSignBytes() []byte
GetSignBytes returns the message bytes to sign over
func (MsgBindProxy) GetSigners ¶
func (msg MsgBindProxy) GetSigners() []sdk.AccAddress
func (MsgBindProxy) Type ¶
func (MsgBindProxy) Type() string
func (MsgBindProxy) ValidateBasic ¶
func (msg MsgBindProxy) ValidateBasic() error
ValidateBasic gives a quick validity check
type MsgCreateValidator ¶
type MsgCreateValidator struct { Description Description `json:"description" yaml:"description"` //Commission CommissionRates `json:"commission" yaml:"commission"` MinSelfDelegation sdk.SysCoin `json:"min_self_delegation" yaml:"min_self_delegation"` DelegatorAddress sdk.AccAddress `json:"delegator_address" yaml:"delegator_address"` ValidatorAddress sdk.ValAddress `json:"validator_address" yaml:"validator_address"` PubKey crypto.PubKey `json:"pubkey" yaml:"pubkey"` }
MsgCreateValidator - struct for bonding transactions
func NewMsgCreateValidator ¶
func NewMsgCreateValidator( valAddr sdk.ValAddress, pubKey crypto.PubKey, description Description, minSelfDelegation sdk.SysCoin, ) MsgCreateValidator
NewMsgCreateValidator creates a msg of create-validator Delegator address and validator address are the same
func (MsgCreateValidator) GetSignBytes ¶
func (msg MsgCreateValidator) GetSignBytes() []byte
GetSignBytes returns the message bytes to sign over
func (MsgCreateValidator) GetSigners ¶
func (msg MsgCreateValidator) GetSigners() []sdk.AccAddress
GetSigners returns address(es) that must sign over msg.GetSignBytes()
func (MsgCreateValidator) MarshalJSON ¶
func (msg MsgCreateValidator) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaler interface to provide custom JSON serialization
func (MsgCreateValidator) Type ¶
func (msg MsgCreateValidator) Type() string
func (*MsgCreateValidator) UnmarshalJSON ¶
func (msg *MsgCreateValidator) UnmarshalJSON(bz []byte) error
UnmarshalJSON implements the json.Unmarshaler interface to provide custom JSON deserialization
func (MsgCreateValidator) ValidateBasic ¶
func (msg MsgCreateValidator) ValidateBasic() error
ValidateBasic gives a quick validity check
type MsgDeposit ¶
type MsgDeposit struct { DelegatorAddress sdk.AccAddress `json:"delegator_address" yaml:"delegator_address"` Amount sdk.SysCoin `json:"quantity" yaml:"quantity"` }
MsgDeposit - structure for depositing to the delegator account
func NewMsgDeposit ¶
func NewMsgDeposit(delAddr sdk.AccAddress, amount sdk.SysCoin) MsgDeposit
NewMsgDeposit creates a new instance of MsgDeposit
func (MsgDeposit) GetSignBytes ¶
func (msg MsgDeposit) GetSignBytes() []byte
GetSignBytes returns the message bytes to sign over
func (MsgDeposit) GetSigners ¶
func (msg MsgDeposit) GetSigners() []sdk.AccAddress
func (MsgDeposit) Type ¶
func (msg MsgDeposit) Type() string
func (MsgDeposit) ValidateBasic ¶
func (msg MsgDeposit) ValidateBasic() error
ValidateBasic gives a quick validity check
type MsgDestroyValidator ¶
type MsgDestroyValidator struct {
DelAddr sdk.AccAddress `json:"delegator_address" yaml:"delegator_address"`
}
MsgDestroyValidator - struct for transactions to deregister a validator
func NewMsgDestroyValidator ¶
func NewMsgDestroyValidator(delAddr sdk.AccAddress) MsgDestroyValidator
NewMsgDestroyValidator creates a msg of destroy-validator
func (MsgDestroyValidator) GetSignBytes ¶
func (msg MsgDestroyValidator) GetSignBytes() []byte
GetSignBytes returns the message bytes to sign over
func (MsgDestroyValidator) GetSigners ¶
func (msg MsgDestroyValidator) GetSigners() []sdk.AccAddress
func (MsgDestroyValidator) Type ¶
func (MsgDestroyValidator) Type() string
func (MsgDestroyValidator) ValidateBasic ¶
func (msg MsgDestroyValidator) ValidateBasic() error
ValidateBasic gives a quick validity check
type MsgEditValidator ¶
type MsgEditValidator struct { Description ValidatorAddress sdk.ValAddress `json:"address" yaml:"address"` }
MsgEditValidator - struct for editing a validator
func NewMsgEditValidator ¶
func NewMsgEditValidator(valAddr sdk.ValAddress, description Description) MsgEditValidator
NewMsgEditValidator creates a msg of edit-validator
func (MsgEditValidator) GetSignBytes ¶
func (msg MsgEditValidator) GetSignBytes() []byte
GetSignBytes gets the bytes for the message signer to sign on
func (MsgEditValidator) GetSigners ¶
func (msg MsgEditValidator) GetSigners() []sdk.AccAddress
func (MsgEditValidator) Type ¶
func (msg MsgEditValidator) Type() string
func (MsgEditValidator) ValidateBasic ¶
func (msg MsgEditValidator) ValidateBasic() error
ValidateBasic gives a quick validity check
type MsgRegProxy ¶
type MsgRegProxy struct { ProxyAddress sdk.AccAddress `json:"proxy_address" yaml:"proxy_address"` Reg bool `json:"reg" yaml:"reg"` }
MsgRegProxy - register delegator as proxy or unregister proxy to delegator if Reg == true, action is reg, otherwise action is unreg
func NewMsgRegProxy ¶
func NewMsgRegProxy(proxyAddress sdk.AccAddress, reg bool) MsgRegProxy
NewMsgRegProxy creates a msg of registering proxy
func (MsgRegProxy) GetSignBytes ¶
func (msg MsgRegProxy) GetSignBytes() []byte
GetSignBytes returns the message bytes to sign over
func (MsgRegProxy) GetSigners ¶
func (msg MsgRegProxy) GetSigners() []sdk.AccAddress
func (MsgRegProxy) Type ¶
func (MsgRegProxy) Type() string
func (MsgRegProxy) ValidateBasic ¶
func (msg MsgRegProxy) ValidateBasic() error
ValidateBasic gives a quick validity check
type MsgUnbindProxy ¶
type MsgUnbindProxy struct {
DelAddr sdk.AccAddress `json:"delegator_address" yaml:"delegator_address"`
}
MsgUnbindProxy - structure for unbinding proxy relationship between the delegator and the proxy
func NewMsgUnbindProxy ¶
func NewMsgUnbindProxy(delAddr sdk.AccAddress) MsgUnbindProxy
NewMsgUnbindProxy creates a msg of unbinding proxy
func (MsgUnbindProxy) GetSignBytes ¶
func (msg MsgUnbindProxy) GetSignBytes() []byte
GetSignBytes returns the message bytes to sign over
func (MsgUnbindProxy) GetSigners ¶
func (msg MsgUnbindProxy) GetSigners() []sdk.AccAddress
func (MsgUnbindProxy) Type ¶
func (MsgUnbindProxy) Type() string
func (MsgUnbindProxy) ValidateBasic ¶
func (msg MsgUnbindProxy) ValidateBasic() error
ValidateBasic gives a quick validity check
type MsgWithdraw ¶
type MsgWithdraw struct { DelegatorAddress sdk.AccAddress `json:"delegator_address" yaml:"delegator_address"` Amount sdk.SysCoin `json:"quantity" yaml:"quantity"` }
MsgWithdraw - structure for withdrawing omt and the corresponding shares from all validators
func NewMsgWithdraw ¶
func NewMsgWithdraw(delAddr sdk.AccAddress, amount sdk.SysCoin) MsgWithdraw
NewMsgWithdraw creates a new instance of MsgWithdraw
func (MsgWithdraw) GetSignBytes ¶
func (msg MsgWithdraw) GetSignBytes() []byte
GetSignBytes returns the message bytes to sign over
func (MsgWithdraw) GetSigners ¶
func (msg MsgWithdraw) GetSigners() []sdk.AccAddress
func (MsgWithdraw) Type ¶
func (msg MsgWithdraw) Type() string
func (MsgWithdraw) ValidateBasic ¶
func (msg MsgWithdraw) ValidateBasic() error
ValidateBasic gives a quick validity check
type MultiStakingHooks ¶
type MultiStakingHooks []StakingHooks
MultiStakingHooks combines multiple staking hooks, all hook functions are run in array sequence TODO:need to trim the staking hooks as the omexchain design
func NewMultiStakingHooks ¶
func NewMultiStakingHooks(hooks ...StakingHooks) MultiStakingHooks
NewMultiStakingHooks creates a new object of MultiStakingHooks
func (MultiStakingHooks) AfterValidatorBeginUnbonding ¶
func (h MultiStakingHooks) AfterValidatorBeginUnbonding(ctx sdk.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress)
AfterValidatorBeginUnbonding handles the hooks after the validator began the unbonding
func (MultiStakingHooks) AfterValidatorBonded ¶
func (h MultiStakingHooks) AfterValidatorBonded(ctx sdk.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress)
AfterValidatorBonded handles the hooks after the validator was bonded
func (MultiStakingHooks) AfterValidatorCreated ¶
func (h MultiStakingHooks) AfterValidatorCreated(ctx sdk.Context, valAddr sdk.ValAddress)
AfterValidatorCreated handles the hooks after the validator created
func (MultiStakingHooks) AfterValidatorDestroyed ¶
func (h MultiStakingHooks) AfterValidatorDestroyed(ctx sdk.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress)
AfterValidatorDestroyed handles the hooks after the validator was destroyed by tx
func (MultiStakingHooks) AfterValidatorRemoved ¶
func (h MultiStakingHooks) AfterValidatorRemoved(ctx sdk.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress)
AfterValidatorRemoved handles the hooks after the validator was removed
func (MultiStakingHooks) BeforeValidatorModified ¶
func (h MultiStakingHooks) BeforeValidatorModified(ctx sdk.Context, valAddr sdk.ValAddress)
BeforeValidatorModified handles the hooks before the validator modified
type OVPair ¶
type OVPair struct { OperAddr sdk.ValAddress `json:"operator_address"` ValAddr string `json:"validator_address"` }
OVPair is designed for querying validators by rest
type Params ¶
type Params struct { // time duration of unbonding UnbondingTime time.Duration `json:"unbonding_time" yaml:"unbonding_time"` // note: we need to be a bit careful about potential overflow here, since this is user-determined // maximum number of validators (max uint16 = 65535) MaxValidators uint16 `json:"max_bonded_validators" yaml:"max_bonded_validators"` // epoch for validator update Epoch uint16 `json:"epoch" yaml:"epoch"` // bondable coin denomination BondDenom string `json:"bond_denom" yaml:"bond_denom"` // limited amount of delegate MinDelegation sdk.Dec `json:"min_delegation" yaml:"min_delegation"` // validator's self declared minimum self delegation MinSelfDelegation sdk.Dec `json:"min_self_delegation" yaml:"min_self_delegation"` }
Params defines the high level settings for staking
func NewParams ¶
func NewParams(unbondingTime time.Duration, maxValidators uint16, bondDenom string, epoch uint16, maxValsToAddShares uint16, minDelegation sdk.Dec, minSelfDelegation sdk.Dec) Params
NewParams creates a new Params instance
func (Params) Equal ¶
Equal returns a boolean determining if two Param types are identical TODO: This is slower than comparing struct fields directly
func (*Params) ParamSetPairs ¶
func (p *Params) ParamSetPairs() params.ParamSetPairs
ParamSetPairs is the implements params.ParamSet
type Pool ¶
type Pool struct { // tokens which are not bonded to a validator (unbonded or unbonding) NotBondedTokens sdk.Dec `json:"not_bonded_tokens" yaml:"not_bonded_tokens"` // tokens which are currently bonded to a validator BondedTokens sdk.Dec `json:"bonded_tokens" yaml:"bonded_tokens"` }
Pool - tracking bonded and not-bonded token supply of the bond denomination
type ProxyDelegatorKeyExported ¶
type ProxyDelegatorKeyExported struct { DelAddr sdk.AccAddress `json:"delegator_address" yaml:"delegator_address"` ProxyAddr sdk.AccAddress `json:"proxy_address" yaml:"proxy_address"` }
ProxyDelegatorKeyExported is designed for ProxyDelegatorKey export
func NewProxyDelegatorKeyExported ¶
func NewProxyDelegatorKeyExported(delAddr, proxyAddr sdk.AccAddress) ProxyDelegatorKeyExported
NewProxyDelegatorKeyExported creates a new object of ProxyDelegatorKeyExported
type QueryDelegatorParams ¶
type QueryDelegatorParams struct {
DelegatorAddr sdk.AccAddress
}
QueryDelegatorParams defines the params for the following queries: - 'custom/staking/delegatorDelegations' - 'custom/staking/delegatorUnbondingDelegations' - 'custom/staking/delegatorValidators'
func NewQueryDelegatorParams ¶
func NewQueryDelegatorParams(delegatorAddr sdk.AccAddress) QueryDelegatorParams
NewQueryDelegatorParams creates a new instance of QueryDelegatorParams
type QueryValidatorParams ¶
type QueryValidatorParams struct {
ValidatorAddr sdk.ValAddress
}
QueryValidatorParams defines the params for the following queries: - 'custom/staking/validator' - 'custom/staking/validatorDelegations' - 'custom/staking/validatorUnbondingDelegations' - 'custom/staking/validatorRedelegations'
func NewQueryValidatorParams ¶
func NewQueryValidatorParams(validatorAddr sdk.ValAddress) QueryValidatorParams
NewQueryValidatorParams creates a new instance of QueryValidatorParams
type QueryValidatorsParams ¶
QueryValidatorsParams defines the params for the following queries: - 'custom/staking/validators'
func NewQueryValidatorsParams ¶
func NewQueryValidatorsParams(page, limit int, status string) QueryValidatorsParams
NewQueryValidatorsParams creates a new instance of QueryValidatorsParams
type Shares ¶
Shares is the alias of sdk.Dec to represent the amount of shares for adding shares to validators
type SharesExported ¶
type SharesExported struct {}
SharesExported is designed for types.Shares export
func NewSharesExported ¶
func NewSharesExported(delAddr sdk.AccAddress, valAddr sdk.ValAddress, shares Shares) SharesExported
NewSharesExported creates a new object of SharesExported
type SharesResponse ¶
type SharesResponse struct {}
SharesResponse is the struct for query all the shares on a validator
func NewSharesResponse ¶
func NewSharesResponse(delAddr sdk.AccAddress, shares Shares) SharesResponse
NewSharesResponse creates a new instance of sharesResponse
func (SharesResponse) String ¶
func (sr SharesResponse) String() string
String returns a human readable string representation of SharesResponse
type SharesResponses ¶
type SharesResponses []SharesResponse
SharesResponses is the type alias of SharesResponse slice
func (SharesResponses) String ¶
func (srs SharesResponses) String() (strFormat string)
String returns a human readable string representation of SharesResponses
type StakingHooks ¶
type StakingHooks interface { // Must be called when a validator is created AfterValidatorCreated(ctx sdk.Context, valAddr sdk.ValAddress) // Must be called when a validator's state changes BeforeValidatorModified(ctx sdk.Context, valAddr sdk.ValAddress) // Must be called when a validator is deleted AfterValidatorRemoved(ctx sdk.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress) // Must be called when a validator is bonded AfterValidatorBonded(ctx sdk.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress) // Must be called when a validator begins unbonding AfterValidatorBeginUnbonding(ctx sdk.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress) // required by omexchain // Must be called when a validator is destroyed by tx AfterValidatorDestroyed(ctx sdk.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress) }
StakingHooks event hooks for staking validator object (noalias)
type StandardizedValidator ¶
type StandardizedValidator struct { OperatorAddress sdk.ValAddress `json:"operator_address" yaml:"operator_address"` ConsPubKey crypto.PubKey `json:"consensus_pubkey" yaml:"consensus_pubkey"` Jailed bool `json:"jailed" yaml:"jailed"` Status sdk.BondStatus `json:"status" yaml:"status"` Description Description `json:"description" yaml:"description"` UnbondingHeight int64 `json:"unbonding_height" yaml:"unbonding_height"` UnbondingCompletionTime time.Time `json:"unbonding_time" yaml:"unbonding_time"` MinSelfDelegation sdk.Dec `json:"min_self_delegation" yaml:"min_self_delegation"` }
StandardizedValidator is just a copy of Validator in cosmos sdk The field "DelegatorShares"/"MinSelfDelegation" is treated by descending power 8 to decimal
func (StandardizedValidator) MarshalYAML ¶
func (sv StandardizedValidator) MarshalYAML() (interface{}, error)
MarshalYAML implememts the text format for yaml marshaling
func (StandardizedValidator) String ¶
func (sv StandardizedValidator) String() string
String returns a human readable string representation of a StandardizeValidator
type StandardizedValidators ¶
type StandardizedValidators []StandardizedValidator
StandardizedValidators is the type alias of the StandardizedValidator slice
func (StandardizedValidators) MarshalYAML ¶
func (svs StandardizedValidators) MarshalYAML() (interface{}, error)
MarshalYAML implememts the text format for yaml marshaling
func (StandardizedValidators) String ¶
func (svs StandardizedValidators) String() string
String returns a human readable string representation of StandardizeValidators
type SupplyKeeper ¶
type SupplyKeeper interface { GetSupplyByDenom(ctx sdk.Context, denom string) sdk.Dec GetModuleAddress(name string) sdk.AccAddress GetModuleAccount(ctx sdk.Context, moduleName string) supplyexported.ModuleAccountI // TODO remove with genesis 2-phases refactor https://github.com/cosmos/cosmos-sdk/issues/2862 SetModuleAccount(sdk.Context, supplyexported.ModuleAccountI) SendCoinsFromModuleToModule(ctx sdk.Context, senderPool, recipientPool string, amt sdk.Coins) error UndelegateCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.SysCoins) error DelegateCoinsFromAccountToModule(ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.SysCoins) error BurnCoins(ctx sdk.Context, name string, amt sdk.Coins) error }
SupplyKeeper defines the expected supply Keeper (noalias)
type UndelegationInfo ¶
type UndelegationInfo struct { DelegatorAddress sdk.AccAddress `json:"delegator_address" yaml:"delegator_address"` Quantity sdk.Dec `json:"quantity" yaml:"quantity"` CompletionTime time.Time `json:"completion_time"` }
UndelegationInfo is the struct of the undelegation info
func DefaultUndelegation ¶
func DefaultUndelegation() UndelegationInfo
DefaultUndelegation returns default entity for UndelegationInfo
func MustUnMarshalUndelegationInfo ¶
func MustUnMarshalUndelegationInfo(cdc *codec.Codec, value []byte) UndelegationInfo
MustUnMarshalUndelegationInfo must return the UndelegationInfo object by unmarshaling
func NewUndelegationInfo ¶
func NewUndelegationInfo(delegatorAddr sdk.AccAddress, sharesQuantity Shares, completionTime time.Time) UndelegationInfo
NewUndelegationInfo creates a new delegation object
func UnmarshalUndelegationInfo ¶
func UnmarshalUndelegationInfo(cdc *codec.Codec, value []byte) (undelegationInfo UndelegationInfo, err error)
UnmarshalUndelegationInfo returns the UndelegationInfo object by unmarshaling
func (UndelegationInfo) String ¶
func (ud UndelegationInfo) String() string
String returns a human readable string representation of UndelegationInfo
type Validator ¶
type Validator struct { // address of the validator's operator; bech encoded in JSON OperatorAddress sdk.ValAddress `json:"operator_address" yaml:"operator_address"` // the consensus public key of the validator; bech encoded in JSON ConsPubKey crypto.PubKey `json:"consensus_pubkey" yaml:"consensus_pubkey"` // has the validator been jailed from bonded status? Jailed bool `json:"jailed" yaml:"jailed"` // validator status (bonded/unbonding/unbonded) Status sdk.BondStatus `json:"status" yaml:"status"` // delegated tokens (incl. self-delegation) Tokens sdk.Int `json:"tokens" yaml:"tokens"` DelegatorShares sdk.Dec `json:"delegator_shares" yaml:"delegator_shares"` // description terms for the validator Description Description `json:"description" yaml:"description"` // if unbonding, height at which this validator has begun unbonding UnbondingHeight int64 `json:"unbonding_height" yaml:"unbonding_height"` // if unbonding, min time for the validator to complete unbonding UnbondingCompletionTime time.Time `json:"unbonding_time" yaml:"unbonding_time"` // commission parameters Commission Commission `json:"commission" yaml:"commission"` // validator's self declared minimum self delegation MinSelfDelegation sdk.Dec `json:"min_self_delegation" yaml:"min_self_delegation"` }
Validator defines the total amount of bond shares and their exchange rate to coins. Slashing results in a decrease in the exchange rate, allowing correct calculation of future undelegations without iterating over delegators. When coins are delegated to this validator, the validator is credited with a delegation whose number of bond shares is based on the amount of coins delegated divided by the current exchange rate. Voting power can be calculated as total bonded shares multiplied by exchange rate.
func MustUnmarshalValidator ¶
MustUnmarshalValidator must return the validator entity by unmarshaling
func NewValidator ¶
func NewValidator(operator sdk.ValAddress, pubKey crypto.PubKey, description Description, minSelfDelegation sdk.Dec) Validator
NewValidator initializes a new validator
func UnmarshalValidator ¶
UnmarshalValidator unmarshals a validator from a store value
func (Validator) ABCIValidatorUpdate ¶
func (v Validator) ABCIValidatorUpdate() abci.ValidatorUpdate
ABCIValidatorUpdate returns an abci.ValidatorUpdate from a staking validator type with the full validator power
func (Validator) ABCIValidatorUpdateByShares ¶
func (v Validator) ABCIValidatorUpdateByShares() abci.ValidatorUpdate
ABCIValidatorUpdateByShares returns an abci.ValidatorUpdate from a staking validator type with the full validator power based on shares
func (Validator) ABCIValidatorUpdateZero ¶
func (v Validator) ABCIValidatorUpdateZero() abci.ValidatorUpdate
ABCIValidatorUpdateZero returns an abci.ValidatorUpdate from a staking validator type with zero power used for validator updates.
func (Validator) BondedTokens ¶
BondedTokens gets the bonded tokens which the validator holds
func (Validator) ConsAddress ¶
func (v Validator) ConsAddress() sdk.ConsAddress
ConsAddress returns the TM validator address
func (Validator) ConsensusPower ¶
ConsensusPower gets the consensus-engine power
func (Validator) ConsensusPowerByShares ¶
ConsensusPowerByShares gets the consensus-engine power
func (Validator) Export ¶
func (v Validator) Export() ValidatorExported
Export returns the exported format of validator in genesis export
func (Validator) GetBondedTokens ¶
func (Validator) GetCommission ¶
func (Validator) GetConsAddr ¶
func (v Validator) GetConsAddr() sdk.ConsAddress
func (Validator) GetConsPubKey ¶
func (Validator) GetConsensusPower ¶
func (Validator) GetDelegatorShares ¶
func (Validator) GetMinSelfDelegation ¶
func (Validator) GetMoniker ¶
func (Validator) GetOperator ¶
func (v Validator) GetOperator() sdk.ValAddress
func (Validator) GetStatus ¶
func (v Validator) GetStatus() sdk.BondStatus
func (Validator) IsUnbonded ¶
IsUnbonded checks if the validator status equals Unbonded
func (Validator) IsUnbonding ¶
IsUnbonding checks if the validator status equals Unbonding
func (Validator) MarshalJSON ¶
MarshalJSON marshals the validator to JSON using Bech32
func (Validator) MarshalYAML ¶
MarshalYAML implements the text format for yaml marshaling due to consensus pubkey
func (Validator) PotentialConsensusPowerByShares ¶
PotentialConsensusPowerByShares gets potential consensus-engine power based on shares
func (Validator) SetInitialCommission ¶
func (v Validator) SetInitialCommission(commission Commission) (Validator, error)
SetInitialCommission attempts to set a validator's initial commission. An error is returned if the commission is invalid.
func (Validator) SharesFromTokens ¶
SharesFromTokens returns the shares of a delegation given a bond amount It returns an error if the validator has no tokens No usage found in All Places
func (Validator) SharesFromTokensTruncated ¶
SharesFromTokensTruncated returns the truncated shares of a delegation given a bond amount It returns an error if the validator has no tokens No usage found in All Places
func (Validator) Standardize ¶
func (v Validator) Standardize() StandardizedValidator
Standardize converts inner struct Validator to StandardizedValidator which is used to display
func (Validator) TestEquivalent ¶
TestEquivalent is only for the ut
func (Validator) TokensFromShares ¶
TokensFromShares calculates the token worth of provided shares
func (Validator) TokensFromSharesRoundUp ¶
TokensFromSharesRoundUp returns the token worth of provided shares, rounded up No usage found in All Places
func (Validator) TokensFromSharesTruncated ¶
TokensFromSharesTruncated calculates the token worth of provided shares, truncated
func (*Validator) UnmarshalJSON ¶
UnmarshalJSON unmarshals the validator from JSON using Bech32
func (Validator) UpdateStatus ¶
func (v Validator) UpdateStatus(newStatus sdk.BondStatus) Validator
UpdateStatus updates the location of the shares within a validator to reflect the new status
type ValidatorExported ¶
type ValidatorExported struct { OperatorAddress sdk.ValAddress `json:"operator_address"` ConsPubKey string `json:"consensus_pubkey"` Jailed bool `json:"jailed"` Status sdk.BondStatus `json:"status" yaml:"status"` Description Description `json:"description"` UnbondingHeight int64 `json:"unbonding_height"` UnbondingCompletionTime time.Time `json:"unbonding_time"` MinSelfDelegation sdk.Dec `json:"min_self_delegation"` }
ValidatorExported is designed for Validator export
func (ValidatorExported) ConsAddress ¶
func (ve ValidatorExported) ConsAddress() sdk.ConsAddress
ConsAddress returns the TM validator address of exported validator
func (ValidatorExported) Import ¶
func (ve ValidatorExported) Import() Validator
Import converts validator exported format to inner one by filling the zero-value of Tokens and Commission
func (ValidatorExported) IsBonded ¶
func (ve ValidatorExported) IsBonded() bool
IsBonded checks if the exported validator status equals Bonded
type ValidatorSet ¶
type ValidatorSet interface { // iterate through validators by operator address, execute func for each validator IterateValidators(sdk.Context, func(index int64, validator stakingexported.ValidatorI) (stop bool)) // iterate through bonded validators by operator address, execute func for each validator IterateBondedValidatorsByPower(sdk.Context, func(index int64, validator stakingexported.ValidatorI) (stop bool)) // iterate through the consensus validator set of the last block by operator address, execute func for each validator IterateLastValidators(sdk.Context, func(index int64, validator stakingexported.ValidatorI) (stop bool)) // get a particular validator by operator address Validator(sdk.Context, sdk.ValAddress) stakingexported.ValidatorI // get a particular validator by consensus address ValidatorByConsAddr(sdk.Context, sdk.ConsAddress) stakingexported.ValidatorI // total bonded tokens within the validator set TotalBondedTokens(sdk.Context) sdk.Dec // total staking token supply StakingTokenSupply(sdk.Context) sdk.Dec // slash the validator and delegators of the validator, specifying offence height, offence power, and slash fraction // jail a validator Jail(sdk.Context, sdk.ConsAddress) // unjail a validator Unjail(sdk.Context, sdk.ConsAddress) // MaxValidators returns the maximum amount of bonded validators MaxValidators(sdk.Context) uint16 }
ValidatorSet expected properties for the set of all validators (noalias)
type Validators ¶
type Validators []Validator
Validators is a collection of Validator
func (Validators) Export ¶
func (v Validators) Export() []ValidatorExported
Export returns the exported format of Validators in genesis export
func (Validators) Standardize ¶
func (v Validators) Standardize() StandardizedValidators
Standardize converts inner struct Validators to StandardizedValidators which is used to display
func (Validators) String ¶
func (v Validators) String() (out string)
String returns a human readable string representation of Validators
func (Validators) ToSDKValidators ¶
func (v Validators) ToSDKValidators() (validators []exported.ValidatorI)
ToSDKValidators converts []Validators to []sdk.Validators