Documentation ¶
Overview ¶
nolint
Index ¶
- Constants
- Variables
- func AddressFromLastValidatorPowerKey(key []byte) []byte
- func ErrBadDelegationAddr(codespace sdk.CodespaceType) sdk.Error
- func ErrBadDelegationAmount(codespace sdk.CodespaceType) sdk.Error
- func ErrBadDelegatorAddr(codespace sdk.CodespaceType) sdk.Error
- func ErrBadDenom(codespace sdk.CodespaceType) sdk.Error
- func ErrBadRedelegationAddr(codespace sdk.CodespaceType) sdk.Error
- func ErrBadRedelegationDst(codespace sdk.CodespaceType) sdk.Error
- func ErrBadRemoveValidator(codespace sdk.CodespaceType) sdk.Error
- func ErrBadSharesAmount(codespace sdk.CodespaceType) sdk.Error
- func ErrBadSharesPercent(codespace sdk.CodespaceType) sdk.Error
- func ErrBadValidatorAddr(codespace sdk.CodespaceType) sdk.Error
- func ErrBothShareMsgsGiven(codespace sdk.CodespaceType) sdk.Error
- func ErrCommissionChangeRateGTMaxRate(codespace sdk.CodespaceType) sdk.Error
- func ErrCommissionChangeRateNegative(codespace sdk.CodespaceType) sdk.Error
- func ErrCommissionGTMaxChangeRate(codespace sdk.CodespaceType) sdk.Error
- func ErrCommissionGTMaxRate(codespace sdk.CodespaceType) sdk.Error
- func ErrCommissionHuge(codespace sdk.CodespaceType) sdk.Error
- func ErrCommissionNegative(codespace sdk.CodespaceType) sdk.Error
- func ErrCommissionUpdateTime(codespace sdk.CodespaceType) sdk.Error
- func ErrDelegationValidatorEmpty(codespace sdk.CodespaceType) sdk.Error
- func ErrDelegatorShareExRateInvalid(codespace sdk.CodespaceType) sdk.Error
- func ErrDelegatorShareExceedMaxLever(codespace sdk.CodespaceType) sdk.Error
- func ErrDescriptionLength(codespace sdk.CodespaceType, descriptor string, got, max int) sdk.Error
- func ErrInsufficientShares(codespace sdk.CodespaceType) sdk.Error
- func ErrMaxRedelegationEntries(codespace sdk.CodespaceType) sdk.Error
- func ErrMaxUnbondingDelegationEntries(codespace sdk.CodespaceType) sdk.Error
- func ErrMinSelfDelegationDecreased(codespace sdk.CodespaceType) sdk.Error
- func ErrMinSelfDelegationInvalid(codespace sdk.CodespaceType) sdk.Error
- func ErrMissingSignature(codespace sdk.CodespaceType) sdk.Error
- func ErrNeitherShareMsgsGiven(codespace sdk.CodespaceType) sdk.Error
- func ErrNilDelegatorAddr(codespace sdk.CodespaceType) sdk.Error
- func ErrNilValidatorAddr(codespace sdk.CodespaceType) sdk.Error
- func ErrNoDelegation(codespace sdk.CodespaceType) sdk.Error
- func ErrNoDelegatorForAddress(codespace sdk.CodespaceType) sdk.Error
- func ErrNoRedelegation(codespace sdk.CodespaceType) sdk.Error
- func ErrNoUnbondingDelegation(codespace sdk.CodespaceType) sdk.Error
- func ErrNoValidatorFound(codespace sdk.CodespaceType) sdk.Error
- func ErrNotEnoughDelegationShares(codespace sdk.CodespaceType, shares string) sdk.Error
- func ErrNotMature(codespace sdk.CodespaceType, operation, descriptor string, got, min time.Time) sdk.Error
- func ErrSelfDelegationBelowMinimum(codespace sdk.CodespaceType) sdk.Error
- func ErrSelfRedelegation(codespace sdk.CodespaceType) sdk.Error
- func ErrTransitiveRedelegation(codespace sdk.CodespaceType) sdk.Error
- func ErrValidatorJailed(codespace sdk.CodespaceType) sdk.Error
- func ErrValidatorOwnerExists(codespace sdk.CodespaceType) sdk.Error
- func ErrValidatorPubKeyExists(codespace sdk.CodespaceType) sdk.Error
- func ErrValidatorPubKeyTypeNotSupported(codespace sdk.CodespaceType, keyType string, supportedTypes []string) sdk.Error
- func ErrVerySmallRedelegation(codespace sdk.CodespaceType) sdk.Error
- func GetDelegationKey(delAddr sdk.AccAddress, valAddr sdk.ValAddress) []byte
- func GetDelegationsKey(delAddr sdk.AccAddress) []byte
- func GetLastValidatorPowerKey(operator sdk.ValAddress) []byte
- func GetREDByValDstIndexKey(delAddr sdk.AccAddress, valSrcAddr, valDstAddr sdk.ValAddress) []byte
- func GetREDByValSrcIndexKey(delAddr sdk.AccAddress, valSrcAddr, valDstAddr sdk.ValAddress) []byte
- func GetREDKey(delAddr sdk.AccAddress, valSrcAddr, valDstAddr sdk.ValAddress) []byte
- func GetREDKeyFromValDstIndexKey(indexKey []byte) []byte
- func GetREDKeyFromValSrcIndexKey(indexKey []byte) []byte
- func GetREDsByDelToValDstIndexKey(delAddr sdk.AccAddress, valDstAddr sdk.ValAddress) []byte
- func GetREDsFromValSrcIndexKey(valSrcAddr sdk.ValAddress) []byte
- func GetREDsKey(delAddr sdk.AccAddress) []byte
- func GetREDsToValDstIndexKey(valDstAddr sdk.ValAddress) []byte
- func GetRedelegationTimeKey(timestamp time.Time) []byte
- func GetUBDByValIndexKey(delAddr sdk.AccAddress, valAddr sdk.ValAddress) []byte
- func GetUBDKey(delAddr sdk.AccAddress, valAddr sdk.ValAddress) []byte
- func GetUBDKeyFromValIndexKey(IndexKey []byte) []byte
- func GetUBDsByValIndexKey(valAddr sdk.ValAddress) []byte
- func GetUBDsKey(delAddr sdk.AccAddress) []byte
- func GetUnbondingDelegationTimeKey(timestamp time.Time) []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 MustMarshalDelegation(cdc *codec.Codec, delegation Delegation) []byte
- func MustMarshalRED(cdc *codec.Codec, red Redelegation) []byte
- func MustMarshalUBD(cdc *codec.Codec, ubd UnbondingDelegation) []byte
- func MustMarshalValidator(cdc *codec.Codec, validator Validator) []byte
- func ParseValidatorPowerRankKey(key []byte) (operAddr []byte)
- func RegisterCodec(cdc *codec.Codec)
- type AccountKeeper
- type CodeType
- type Commission
- type CommissionRates
- type DVPair
- type DVVTriplet
- type Delegation
- type DelegationResponse
- type DelegationResponses
- type DelegationSet
- type Delegations
- type Description
- type DistributionKeeper
- type GenesisState
- type LastValidatorPower
- type MsgBeginRedelegate
- 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() sdk.Error
- type MsgDelegate
- type MsgEditValidator
- type MsgUndelegate
- type MultiStakingHooks
- func (h MultiStakingHooks) AfterDelegationModified(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress)
- 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) AfterValidatorRemoved(ctx sdk.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress)
- func (h MultiStakingHooks) BeforeDelegationCreated(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress)
- func (h MultiStakingHooks) BeforeDelegationRemoved(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress)
- func (h MultiStakingHooks) BeforeDelegationSharesModified(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress)
- func (h MultiStakingHooks) BeforeValidatorModified(ctx sdk.Context, valAddr sdk.ValAddress)
- func (h MultiStakingHooks) BeforeValidatorSlashed(ctx sdk.Context, valAddr sdk.ValAddress, fraction sdk.Dec)
- type Params
- type Pool
- type QueryBondsParams
- type QueryDelegatorParams
- type QueryRedelegationParams
- type QueryValidatorParams
- type QueryValidatorsParams
- type Redelegation
- type RedelegationEntry
- type RedelegationEntryResponse
- type RedelegationResponse
- type RedelegationResponses
- type Redelegations
- type StakingHooks
- type SupplyKeeper
- type UnbondingDelegation
- type UnbondingDelegationEntry
- type UnbondingDelegations
- type Validator
- func (v Validator) ABCIValidatorUpdate() abci.ValidatorUpdate
- func (v Validator) ABCIValidatorUpdateZero() abci.ValidatorUpdate
- func (v Validator) AddTokensFromDel(amount sdk.Int, selfDelegation bool) (Validator, sdk.Dec)
- func (v Validator) BondedLever(self_delegation bool, delta sdk.Dec) sdk.Dec
- func (v Validator) BondedTokens() sdk.Int
- func (v Validator) ConsAddress() sdk.ConsAddress
- func (v Validator) ConsensusPower() int64
- 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.Int
- func (v Validator) GetMoniker() string
- func (v Validator) GetOperator() sdk.ValAddress
- func (v Validator) GetSelfDelegation() sdk.Dec
- func (v Validator) GetStatus() sdk.BondStatus
- func (v Validator) GetTokens() sdk.Int
- func (v Validator) InvalidExRate() bool
- 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) PotentialConsensusPower() int64
- func (v Validator) RemoveDelShares(delShares sdk.Dec, selfDelegation bool) (Validator, sdk.Int)
- func (v Validator) RemoveTokens(tokens sdk.Int) Validator
- func (v Validator) SetInitialCommission(commission Commission) (Validator, sdk.Error)
- func (v Validator) SharesFromTokens(amt sdk.Int) (sdk.Dec, sdk.Error)
- func (v Validator) SharesFromTokensTruncated(amt sdk.Int) (sdk.Dec, sdk.Error)
- 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 ValidatorSet
- type Validators
Constants ¶
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 ( // DefaultUnbondingTime reflects three weeks in seconds as the default // unbonding time. // TODO: Justify our choice of default here. DefaultUnbondingTime time.Duration = time.Hour * 24 * 7 * 3 // Default maximum number of bonded validators DefaultMaxValidators uint16 = 100 // Default maximum entries in a UBD/RED pair DefaultMaxEntries uint16 = 7 )
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" QueryDelegatorDelegations = "delegatorDelegations" QueryDelegatorUnbondingDelegations = "delegatorUnbondingDelegations" QueryRedelegations = "redelegations" QueryValidatorDelegations = "validatorDelegations" QueryValidatorRedelegations = "validatorRedelegations" QueryValidatorUnbondingDelegations = "validatorUnbondingDelegations" QueryDelegation = "delegation" QueryUnbondingDelegation = "unbondingDelegation" QueryDelegatorValidators = "delegatorValidators" QueryDelegatorValidator = "delegatorValidator" QueryPool = "pool" QueryParameters = "parameters" )
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]"
constant used in flags to indicate that description field should not be updated
Variables ¶
var ( EventTypeCompleteUnbonding = "complete_unbonding" EventTypeCompleteRedelegation = "complete_redelegation" EventTypeCreateValidator = "create_validator" EventTypeEditValidator = "edit_validator" EventTypeDelegate = "delegate" EventTypeUnbond = "unbond" EventTypeRedelegate = "redelegate" AttributeKeyValidator = "validator" AttributeKeyCommissionRate = "commission_rate" AttributeKeyMinSelfDelegation = "min_self_delegation" AttributeKeySrcValidator = "source_validator" AttributeKeyDstValidator = "destination_validator" AttributeKeyDelegator = "delegator" AttributeKeyCompletionTime = "completion_time" AttributeValueCategory = ModuleName )
Staking module event types
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 DelegationKey = []byte{0x31} // key for a delegation UnbondingDelegationKey = []byte{0x32} // key for an unbonding-delegation UnbondingDelegationByValIndexKey = []byte{0x33} // prefix for each key for an unbonding-delegation, by validator operator RedelegationKey = []byte{0x34} // key for a redelegation RedelegationByValSrcIndexKey = []byte{0x35} // prefix for each key for an redelegation, by source validator operator RedelegationByValDstIndexKey = []byte{0x36} // prefix for each key for an redelegation, by destination validator operator UnbondingQueueKey = []byte{0x41} // prefix for the timestamps in unbonding queue RedelegationQueueKey = []byte{0x42} // prefix for the timestamps in redelegations queue ValidatorQueueKey = []byte{0x43} // prefix for the timestamps in validator queue )
nolint
var ( KeyUnbondingTime = []byte("UnbondingTime") KeyMaxValidators = []byte("MaxValidators") KeyMaxEntries = []byte("KeyMaxEntries") KeyBondDenom = []byte("BondDenom") KeyMaxLever = []byte("MaxLever") )
nolint - Keys for parameter access
var ( // Default maximum lever DefaultMaxLever sdk.Dec = sdk.NewDec(20) )
var ModuleCdc *codec.Codec
generic sealed codec to be used throughout this module
Functions ¶
func AddressFromLastValidatorPowerKey ¶
Get the validator operator address from LastValidatorPowerKey
func ErrBadDelegationAddr ¶
func ErrBadDelegationAddr(codespace sdk.CodespaceType) sdk.Error
func ErrBadDelegationAmount ¶
func ErrBadDelegationAmount(codespace sdk.CodespaceType) sdk.Error
func ErrBadDelegatorAddr ¶
func ErrBadDelegatorAddr(codespace sdk.CodespaceType) sdk.Error
func ErrBadDenom ¶
func ErrBadDenom(codespace sdk.CodespaceType) sdk.Error
func ErrBadRedelegationAddr ¶
func ErrBadRedelegationAddr(codespace sdk.CodespaceType) sdk.Error
func ErrBadRedelegationDst ¶
func ErrBadRedelegationDst(codespace sdk.CodespaceType) sdk.Error
func ErrBadRemoveValidator ¶
func ErrBadRemoveValidator(codespace sdk.CodespaceType) sdk.Error
func ErrBadSharesAmount ¶
func ErrBadSharesAmount(codespace sdk.CodespaceType) sdk.Error
func ErrBadSharesPercent ¶
func ErrBadSharesPercent(codespace sdk.CodespaceType) sdk.Error
func ErrBadValidatorAddr ¶
func ErrBadValidatorAddr(codespace sdk.CodespaceType) sdk.Error
func ErrBothShareMsgsGiven ¶
func ErrBothShareMsgsGiven(codespace sdk.CodespaceType) sdk.Error
func ErrCommissionChangeRateGTMaxRate ¶
func ErrCommissionChangeRateGTMaxRate(codespace sdk.CodespaceType) sdk.Error
func ErrCommissionChangeRateNegative ¶
func ErrCommissionChangeRateNegative(codespace sdk.CodespaceType) sdk.Error
func ErrCommissionGTMaxChangeRate ¶
func ErrCommissionGTMaxChangeRate(codespace sdk.CodespaceType) sdk.Error
func ErrCommissionGTMaxRate ¶
func ErrCommissionGTMaxRate(codespace sdk.CodespaceType) sdk.Error
func ErrCommissionHuge ¶
func ErrCommissionHuge(codespace sdk.CodespaceType) sdk.Error
func ErrCommissionNegative ¶
func ErrCommissionNegative(codespace sdk.CodespaceType) sdk.Error
func ErrCommissionUpdateTime ¶
func ErrCommissionUpdateTime(codespace sdk.CodespaceType) sdk.Error
func ErrDelegationValidatorEmpty ¶
func ErrDelegationValidatorEmpty(codespace sdk.CodespaceType) sdk.Error
func ErrDelegatorShareExRateInvalid ¶
func ErrDelegatorShareExRateInvalid(codespace sdk.CodespaceType) sdk.Error
func ErrDelegatorShareExceedMaxLever ¶
func ErrDelegatorShareExceedMaxLever(codespace sdk.CodespaceType) sdk.Error
func ErrDescriptionLength ¶
func ErrInsufficientShares ¶
func ErrInsufficientShares(codespace sdk.CodespaceType) sdk.Error
func ErrMaxRedelegationEntries ¶
func ErrMaxRedelegationEntries(codespace sdk.CodespaceType) sdk.Error
func ErrMaxUnbondingDelegationEntries ¶
func ErrMaxUnbondingDelegationEntries(codespace sdk.CodespaceType) sdk.Error
func ErrMinSelfDelegationDecreased ¶
func ErrMinSelfDelegationDecreased(codespace sdk.CodespaceType) sdk.Error
func ErrMinSelfDelegationInvalid ¶
func ErrMinSelfDelegationInvalid(codespace sdk.CodespaceType) sdk.Error
func ErrMissingSignature ¶
func ErrMissingSignature(codespace sdk.CodespaceType) sdk.Error
func ErrNeitherShareMsgsGiven ¶
func ErrNeitherShareMsgsGiven(codespace sdk.CodespaceType) sdk.Error
func ErrNilDelegatorAddr ¶
func ErrNilDelegatorAddr(codespace sdk.CodespaceType) sdk.Error
func ErrNilValidatorAddr ¶
func ErrNilValidatorAddr(codespace sdk.CodespaceType) sdk.Error
validator
func ErrNoDelegation ¶
func ErrNoDelegation(codespace sdk.CodespaceType) sdk.Error
func ErrNoDelegatorForAddress ¶
func ErrNoDelegatorForAddress(codespace sdk.CodespaceType) sdk.Error
func ErrNoRedelegation ¶
func ErrNoRedelegation(codespace sdk.CodespaceType) sdk.Error
func ErrNoUnbondingDelegation ¶
func ErrNoUnbondingDelegation(codespace sdk.CodespaceType) sdk.Error
func ErrNoValidatorFound ¶
func ErrNoValidatorFound(codespace sdk.CodespaceType) sdk.Error
func ErrNotEnoughDelegationShares ¶
func ErrNotEnoughDelegationShares(codespace sdk.CodespaceType, shares string) sdk.Error
func ErrNotMature ¶
func ErrSelfDelegationBelowMinimum ¶
func ErrSelfDelegationBelowMinimum(codespace sdk.CodespaceType) sdk.Error
func ErrSelfRedelegation ¶
func ErrSelfRedelegation(codespace sdk.CodespaceType) sdk.Error
func ErrTransitiveRedelegation ¶
func ErrTransitiveRedelegation(codespace sdk.CodespaceType) sdk.Error
func ErrValidatorJailed ¶
func ErrValidatorJailed(codespace sdk.CodespaceType) sdk.Error
func ErrValidatorOwnerExists ¶
func ErrValidatorOwnerExists(codespace sdk.CodespaceType) sdk.Error
func ErrValidatorPubKeyExists ¶
func ErrValidatorPubKeyExists(codespace sdk.CodespaceType) sdk.Error
func ErrVerySmallRedelegation ¶
func ErrVerySmallRedelegation(codespace sdk.CodespaceType) sdk.Error
func GetDelegationKey ¶
func GetDelegationKey(delAddr sdk.AccAddress, valAddr sdk.ValAddress) []byte
gets the key for delegator bond with validator VALUE: staking/Delegation
func GetDelegationsKey ¶
func GetDelegationsKey(delAddr sdk.AccAddress) []byte
gets the prefix for a delegator for all validators
func GetLastValidatorPowerKey ¶
func GetLastValidatorPowerKey(operator sdk.ValAddress) []byte
get the bonded validator index key for an operator address
func GetREDByValDstIndexKey ¶
func GetREDByValDstIndexKey(delAddr sdk.AccAddress, valSrcAddr, valDstAddr sdk.ValAddress) []byte
gets the index-key for a redelegation, stored by destination-validator-index VALUE: none (key rearrangement used)
func GetREDByValSrcIndexKey ¶
func GetREDByValSrcIndexKey(delAddr sdk.AccAddress, valSrcAddr, valDstAddr sdk.ValAddress) []byte
gets the index-key for a redelegation, stored by source-validator-index VALUE: none (key rearrangement used)
func GetREDKey ¶
func GetREDKey(delAddr sdk.AccAddress, valSrcAddr, valDstAddr sdk.ValAddress) []byte
gets the key for a redelegation VALUE: staking/RedelegationKey
func GetREDKeyFromValDstIndexKey ¶
GetREDKeyFromValDstIndexKey rearranges the ValDstIndexKey to get the REDKey
func GetREDKeyFromValSrcIndexKey ¶
GetREDKeyFromValSrcIndexKey rearranges the ValSrcIndexKey to get the REDKey
func GetREDsByDelToValDstIndexKey ¶
func GetREDsByDelToValDstIndexKey(delAddr sdk.AccAddress, valDstAddr sdk.ValAddress) []byte
gets the prefix keyspace for all redelegations redelegating towards a destination validator from a particular delegator
func GetREDsFromValSrcIndexKey ¶
func GetREDsFromValSrcIndexKey(valSrcAddr sdk.ValAddress) []byte
gets the prefix keyspace for all redelegations redelegating away from a source validator
func GetREDsKey ¶
func GetREDsKey(delAddr sdk.AccAddress) []byte
gets the prefix keyspace for redelegations from a delegator
func GetREDsToValDstIndexKey ¶
func GetREDsToValDstIndexKey(valDstAddr sdk.ValAddress) []byte
gets the prefix keyspace for all redelegations redelegating towards a destination validator
func GetRedelegationTimeKey ¶
gets the prefix for all unbonding delegations from a delegator
func GetUBDByValIndexKey ¶
func GetUBDByValIndexKey(delAddr sdk.AccAddress, valAddr sdk.ValAddress) []byte
gets the index-key for an unbonding delegation, stored by validator-index VALUE: none (key rearrangement used)
func GetUBDKey ¶
func GetUBDKey(delAddr sdk.AccAddress, valAddr sdk.ValAddress) []byte
gets the key for an unbonding delegation by delegator and validator addr VALUE: staking/UnbondingDelegation
func GetUBDKeyFromValIndexKey ¶
rearranges the ValIndexKey to get the UBDKey
func GetUBDsByValIndexKey ¶
func GetUBDsByValIndexKey(valAddr sdk.ValAddress) []byte
gets the prefix keyspace for the indexes of unbonding delegations for a validator
func GetUBDsKey ¶
func GetUBDsKey(delAddr sdk.AccAddress) []byte
gets the prefix for all unbonding delegations from a delegator
func GetUnbondingDelegationTimeKey ¶
gets the prefix for all unbonding delegations from a delegator
func GetValidatorByConsAddrKey ¶
func GetValidatorByConsAddrKey(addr sdk.ConsAddress) []byte
gets the key for the validator with pubkey VALUE: validator operator address ([]byte)
func GetValidatorKey ¶
func GetValidatorKey(operatorAddr sdk.ValAddress) []byte
gets the key for the validator with address VALUE: staking/Validator
func GetValidatorQueueTimeKey ¶
gets the prefix for all unbonding delegations from a delegator
func GetValidatorsByPowerIndexKey ¶
get 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 MustMarshalDelegation ¶
func MustMarshalDelegation(cdc *codec.Codec, delegation Delegation) []byte
return the delegation
func MustMarshalRED ¶
func MustMarshalRED(cdc *codec.Codec, red Redelegation) []byte
return the redelegation
func MustMarshalUBD ¶
func MustMarshalUBD(cdc *codec.Codec, ubd UnbondingDelegation) []byte
return the unbonding delegation
func MustMarshalValidator ¶
return the redelegation
func ParseValidatorPowerRankKey ¶
parse the validators operator address from power rank key
Types ¶
type AccountKeeper ¶
type AccountKeeper interface {
IterateAccounts(ctx sdk.Context, process func(authexported.Account) (stop bool))
}
AccountKeeper defines the expected account keeper (noalias)
type CodeType ¶
const ( DefaultCodespace sdk.CodespaceType = ModuleName CodeInvalidValidator CodeType = 101 CodeInvalidDelegation CodeType = 102 CodeInvalidInput CodeType = 103 CodeValidatorJailed CodeType = 104 CodeInvalidAddress CodeType = sdk.CodeInvalidAddress CodeInternal CodeType = sdk.CodeInternal CodeUnknownRequest CodeType = sdk.CodeUnknownRequest )
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
NewCommission 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 { Rate sdk.Dec `json:"rate" yaml:"rate"` // the commission rate charged to delegators, as a fraction MaxRate sdk.Dec `json:"max_rate" yaml:"max_rate"` // maximum commission rate which validator can ever charge, as a fraction MaxChangeRate sdk.Dec `json:"max_change_rate" yaml:"max_change_rate"` // maximum daily increase of the validator commission, as a fraction }
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 DVPair ¶
type DVPair struct { DelegatorAddress sdk.AccAddress ValidatorAddress sdk.ValAddress }
DVPair is struct that just has a delegator-validator pair with no other data. It is intended to be used as a marshalable pointer. For example, a DVPair can be used to construct the key to getting an UnbondingDelegation from state.
type DVVTriplet ¶
type DVVTriplet struct { DelegatorAddress sdk.AccAddress ValidatorSrcAddress sdk.ValAddress ValidatorDstAddress sdk.ValAddress }
DVVTriplet is struct that just has a delegator-validator-validator triplet with no other data. It is intended to be used as a marshalable pointer. For example, a DVVTriplet can be used to construct the key to getting a Redelegation from state.
type Delegation ¶
type Delegation struct { DelegatorAddress sdk.AccAddress `json:"delegator_address" yaml:"delegator_address"` ValidatorAddress sdk.ValAddress `json:"validator_address" yaml:"validator_address"` }
Delegation represents the bond with tokens held by an account. It is owned by one delegator, and is associated with the voting power of one validator.
func MustUnmarshalDelegation ¶
func MustUnmarshalDelegation(cdc *codec.Codec, value []byte) Delegation
return the delegation
func NewDelegation ¶
func NewDelegation(delegatorAddr sdk.AccAddress, validatorAddr sdk.ValAddress, shares sdk.Dec) Delegation
NewDelegation creates a new delegation object
func UnmarshalDelegation ¶
func UnmarshalDelegation(cdc *codec.Codec, value []byte) (delegation Delegation, err error)
return the delegation
func (Delegation) GetDelegatorAddr ¶
func (d Delegation) GetDelegatorAddr() sdk.AccAddress
nolint - for Delegation
func (Delegation) GetShares ¶
func (d Delegation) GetShares() sdk.Dec
func (Delegation) GetValidatorAddr ¶
func (d Delegation) GetValidatorAddr() sdk.ValAddress
func (Delegation) String ¶
func (d Delegation) String() string
String returns a human readable string representation of a Delegation.
type DelegationResponse ¶
type DelegationResponse struct { Delegation Balance sdk.Int `json:"balance" yaml:"balance"` }
DelegationResponse is equivalent to Delegation except that it contains a balance in addition to shares which is more suitable for client responses.
func NewDelegationResp ¶
func NewDelegationResp(d sdk.AccAddress, v sdk.ValAddress, s sdk.Dec, b sdk.Int) DelegationResponse
func (DelegationResponse) MarshalJSON ¶
func (d DelegationResponse) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaler interface. This is so we can achieve a flattened structure while embedding other types.
func (DelegationResponse) String ¶
func (d DelegationResponse) String() string
String implements the Stringer interface for DelegationResponse.
func (*DelegationResponse) UnmarshalJSON ¶
func (d *DelegationResponse) UnmarshalJSON(bz []byte) error
UnmarshalJSON implements the json.Unmarshaler interface. This is so we can achieve a flattened structure while embedding other types.
type DelegationResponses ¶
type DelegationResponses []DelegationResponse
DelegationResponses is a collection of DelegationResp
func (DelegationResponses) String ¶
func (d DelegationResponses) String() (out string)
String implements the Stringer interface for DelegationResponses.
type DelegationSet ¶
type DelegationSet interface { GetValidatorSet() ValidatorSet // validator set for which delegation set is based upon // iterate through all delegations from one delegator by validator-AccAddress, // execute func for each validator IterateDelegations(ctx sdk.Context, delegator sdk.AccAddress, fn func(index int64, delegation stakingexported.DelegationI) (stop bool)) }
DelegationSet expected properties for the set of all delegations for a particular (noalias)
type Delegations ¶
type Delegations []Delegation
Delegations is a collection of delegations
func (Delegations) String ¶
func (d Delegations) String() (out string)
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, sdk.Error)
EnsureLength ensures the length of a validator's description.
func (Description) UpdateDescription ¶
func (d Description) UpdateDescription(d2 Description) (Description, sdk.Error)
UpdateDescription updates the fields of a given description. An error is returned if the resulting description contains an invalid length.
type DistributionKeeper ¶
type DistributionKeeper interface { GetFeePoolCommunityCoins(ctx sdk.Context) sdk.DecCoins GetValidatorOutstandingRewardsCoins(ctx sdk.Context, val sdk.ValAddress) sdk.DecCoins }
DistributionKeeper expected distribution keeper (noalias)
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 Validators `json:"validators" yaml:"validators"` Delegations Delegations `json:"delegations" yaml:"delegations"` UnbondingDelegations []UnbondingDelegation `json:"unbonding_delegations" yaml:"unbonding_delegations"` Redelegations []Redelegation `json:"redelegations" yaml:"redelegations"` Exported bool `json:"exported" yaml:"exported"` }
GenesisState - all staking state that must be provided at genesis
func DefaultGenesisState ¶
func DefaultGenesisState() GenesisState
get raw genesis raw message for testing
func NewGenesisState ¶
func NewGenesisState(params Params, validators []Validator, delegations []Delegation) GenesisState
type LastValidatorPower ¶
type LastValidatorPower struct { Address sdk.ValAddress Power int64 }
Last validator power, needed for validator set update logic
type MsgBeginRedelegate ¶
type MsgBeginRedelegate struct { DelegatorAddress sdk.AccAddress `json:"delegator_address" yaml:"delegator_address"` ValidatorSrcAddress sdk.ValAddress `json:"validator_src_address" yaml:"validator_src_address"` ValidatorDstAddress sdk.ValAddress `json:"validator_dst_address" yaml:"validator_dst_address"` Amount sdk.Coin `json:"amount" yaml:"amount"` }
MsgDelegate - struct for bonding transactions
func NewMsgBeginRedelegate ¶
func NewMsgBeginRedelegate(delAddr sdk.AccAddress, valSrcAddr, valDstAddr sdk.ValAddress, amount sdk.Coin) MsgBeginRedelegate
func (MsgBeginRedelegate) GetSignBytes ¶
func (msg MsgBeginRedelegate) GetSignBytes() []byte
get the bytes for the message signer to sign on
func (MsgBeginRedelegate) GetSigners ¶
func (msg MsgBeginRedelegate) GetSigners() []sdk.AccAddress
func (MsgBeginRedelegate) Type ¶
func (msg MsgBeginRedelegate) Type() string
func (MsgBeginRedelegate) ValidateBasic ¶
func (msg MsgBeginRedelegate) ValidateBasic() sdk.Error
quick validity check
type MsgCreateValidator ¶
type MsgCreateValidator struct { Description Description `json:"description" yaml:"description"` Commission CommissionRates `json:"commission" yaml:"commission"` MinSelfDelegation sdk.Int `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"` Value sdk.Coin `json:"value" yaml:"value"` }
MsgCreateValidator - struct for bonding transactions
func NewMsgCreateValidator ¶
func NewMsgCreateValidator( valAddr sdk.ValAddress, pubKey crypto.PubKey, selfDelegation sdk.Coin, description Description, commission CommissionRates, minSelfDelegation sdk.Int, ) MsgCreateValidator
Default way to 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
Return 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 of the MsgCreateValidator type.
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 of the MsgCreateValidator type.
func (MsgCreateValidator) ValidateBasic ¶
func (msg MsgCreateValidator) ValidateBasic() sdk.Error
quick validity check
type MsgDelegate ¶
type MsgDelegate struct { DelegatorAddress sdk.AccAddress `json:"delegator_address" yaml:"delegator_address"` ValidatorAddress sdk.ValAddress `json:"validator_address" yaml:"validator_address"` Amount sdk.Coin `json:"amount" yaml:"amount"` }
MsgDelegate - struct for bonding transactions
func NewMsgDelegate ¶
func NewMsgDelegate(delAddr sdk.AccAddress, valAddr sdk.ValAddress, amount sdk.Coin) MsgDelegate
func (MsgDelegate) GetSignBytes ¶
func (msg MsgDelegate) GetSignBytes() []byte
get the bytes for the message signer to sign on
func (MsgDelegate) GetSigners ¶
func (msg MsgDelegate) GetSigners() []sdk.AccAddress
func (MsgDelegate) Type ¶
func (msg MsgDelegate) Type() string
func (MsgDelegate) ValidateBasic ¶
func (msg MsgDelegate) ValidateBasic() sdk.Error
quick validity check
type MsgEditValidator ¶
type MsgEditValidator struct { Description ValidatorAddress sdk.ValAddress `json:"address" yaml:"address"` // We pass a reference to the new commission rate and min self delegation as it's not mandatory to // update. If not updated, the deserialized rate will be zero with no way to // distinguish if an update was intended. // // REF: #2373 CommissionRate *sdk.Dec `json:"commission_rate" yaml:"commission_rate"` MinSelfDelegation *sdk.Int `json:"min_self_delegation" yaml:"min_self_delegation"` }
MsgEditValidator - struct for editing a validator
func NewMsgEditValidator ¶
func NewMsgEditValidator(valAddr sdk.ValAddress, description Description, newRate *sdk.Dec, newMinSelfDelegation *sdk.Int) MsgEditValidator
func (MsgEditValidator) GetSignBytes ¶
func (msg MsgEditValidator) GetSignBytes() []byte
get 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() sdk.Error
quick validity check
type MsgUndelegate ¶
type MsgUndelegate struct { DelegatorAddress sdk.AccAddress `json:"delegator_address" yaml:"delegator_address"` ValidatorAddress sdk.ValAddress `json:"validator_address" yaml:"validator_address"` Amount sdk.Coin `json:"amount" yaml:"amount"` }
MsgUndelegate - struct for unbonding transactions
func NewMsgUndelegate ¶
func NewMsgUndelegate(delAddr sdk.AccAddress, valAddr sdk.ValAddress, amount sdk.Coin) MsgUndelegate
func (MsgUndelegate) GetSignBytes ¶
func (msg MsgUndelegate) GetSignBytes() []byte
get the bytes for the message signer to sign on
func (MsgUndelegate) GetSigners ¶
func (msg MsgUndelegate) GetSigners() []sdk.AccAddress
func (MsgUndelegate) Type ¶
func (msg MsgUndelegate) Type() string
func (MsgUndelegate) ValidateBasic ¶
func (msg MsgUndelegate) ValidateBasic() sdk.Error
quick validity check
type MultiStakingHooks ¶
type MultiStakingHooks []StakingHooks
combine multiple staking hooks, all hook functions are run in array sequence
func NewMultiStakingHooks ¶
func NewMultiStakingHooks(hooks ...StakingHooks) MultiStakingHooks
func (MultiStakingHooks) AfterDelegationModified ¶
func (h MultiStakingHooks) AfterDelegationModified(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress)
func (MultiStakingHooks) AfterValidatorBeginUnbonding ¶
func (h MultiStakingHooks) AfterValidatorBeginUnbonding(ctx sdk.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress)
func (MultiStakingHooks) AfterValidatorBonded ¶
func (h MultiStakingHooks) AfterValidatorBonded(ctx sdk.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress)
func (MultiStakingHooks) AfterValidatorCreated ¶
func (h MultiStakingHooks) AfterValidatorCreated(ctx sdk.Context, valAddr sdk.ValAddress)
nolint
func (MultiStakingHooks) AfterValidatorRemoved ¶
func (h MultiStakingHooks) AfterValidatorRemoved(ctx sdk.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress)
func (MultiStakingHooks) BeforeDelegationCreated ¶
func (h MultiStakingHooks) BeforeDelegationCreated(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress)
func (MultiStakingHooks) BeforeDelegationRemoved ¶
func (h MultiStakingHooks) BeforeDelegationRemoved(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress)
func (MultiStakingHooks) BeforeDelegationSharesModified ¶
func (h MultiStakingHooks) BeforeDelegationSharesModified(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress)
func (MultiStakingHooks) BeforeValidatorModified ¶
func (h MultiStakingHooks) BeforeValidatorModified(ctx sdk.Context, valAddr sdk.ValAddress)
func (MultiStakingHooks) BeforeValidatorSlashed ¶
func (h MultiStakingHooks) BeforeValidatorSlashed(ctx sdk.Context, valAddr sdk.ValAddress, fraction sdk.Dec)
type Params ¶
type Params struct { UnbondingTime time.Duration `json:"unbonding_time" yaml:"unbonding_time"` // time duration of unbonding MaxValidators uint16 `json:"max_validators" yaml:"max_validators"` // maximum number of validators (max uint16 = 65535) MaxEntries uint16 `json:"max_entries" yaml:"max_entries"` // max entries for either unbonding delegation or redelegation (per pair/trio) // note: we need to be a bit careful about potential overflow here, since this is user-determined BondDenom string `json:"bond_denom" yaml:"bond_denom"` // bondable coin denomination MaxLever sdk.Dec `json:"max_lever" yaml:"max_lever"` // max lever: total user delegate / self delegate < max_lever }
Params defines the high level settings for staking
func MustUnmarshalParams ¶
unmarshal the current staking params value from store key or panic
func NewParams ¶
func NewParams(unbondingTime time.Duration, maxValidators, maxEntries uint16, bondDenom string, maxLeverRate sdk.Dec) Params
NewParams creates a new Params instance
func UnmarshalParams ¶
unmarshal the current staking params value from store key
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
Implements params.ParamSet
type Pool ¶
type Pool struct { NotBondedTokens sdk.Int `json:"not_bonded_tokens" yaml:"not_bonded_tokens"` // tokens which are not bonded to a validator (unbonded or unbonding) BondedTokens sdk.Int `json:"bonded_tokens" yaml:"bonded_tokens"` // tokens which are currently bonded to a validator }
Pool - tracking bonded and not-bonded token supply of the bond denomination
type QueryBondsParams ¶
type QueryBondsParams struct { DelegatorAddr sdk.AccAddress ValidatorAddr sdk.ValAddress }
defines the params for the following queries: - 'custom/staking/delegation' - 'custom/staking/unbondingDelegation' - 'custom/staking/delegatorValidator'
func NewQueryBondsParams ¶
func NewQueryBondsParams(delegatorAddr sdk.AccAddress, validatorAddr sdk.ValAddress) QueryBondsParams
type QueryDelegatorParams ¶
type QueryDelegatorParams struct {
DelegatorAddr sdk.AccAddress
}
defines the params for the following queries: - 'custom/staking/delegatorDelegations' - 'custom/staking/delegatorUnbondingDelegations' - 'custom/staking/delegatorRedelegations' - 'custom/staking/delegatorValidators'
func NewQueryDelegatorParams ¶
func NewQueryDelegatorParams(delegatorAddr sdk.AccAddress) QueryDelegatorParams
type QueryRedelegationParams ¶
type QueryRedelegationParams struct { DelegatorAddr sdk.AccAddress SrcValidatorAddr sdk.ValAddress DstValidatorAddr sdk.ValAddress }
defines the params for the following queries: - 'custom/staking/redelegation'
func NewQueryRedelegationParams ¶
func NewQueryRedelegationParams(delegatorAddr sdk.AccAddress, srcValidatorAddr, dstValidatorAddr sdk.ValAddress) QueryRedelegationParams
type QueryValidatorParams ¶
type QueryValidatorParams struct {
ValidatorAddr sdk.ValAddress
}
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
type QueryValidatorsParams ¶
QueryValidatorsParams defines the params for the following queries: - 'custom/staking/validators'
func NewQueryValidatorsParams ¶
func NewQueryValidatorsParams(page, limit int, status string) QueryValidatorsParams
type Redelegation ¶
type Redelegation struct { DelegatorAddress sdk.AccAddress `json:"delegator_address" yaml:"delegator_address"` // delegator ValidatorSrcAddress sdk.ValAddress `json:"validator_src_address" yaml:"validator_src_address"` // validator redelegation source operator addr ValidatorDstAddress sdk.ValAddress `json:"validator_dst_address" yaml:"validator_dst_address"` // validator redelegation destination operator addr Entries []RedelegationEntry `json:"entries" yaml:"entries"` // redelegation entries }
Redelegation contains the list of a particular delegator's redelegating bonds from a particular source validator to a particular destination validator
func MustUnmarshalRED ¶
func MustUnmarshalRED(cdc *codec.Codec, value []byte) Redelegation
unmarshal a redelegation from a store value
func NewRedelegation ¶
func NewRedelegation(delegatorAddr sdk.AccAddress, validatorSrcAddr, validatorDstAddr sdk.ValAddress, creationHeight int64, minTime time.Time, balance sdk.Int, sharesDst sdk.Dec) Redelegation
NewRedelegation - create a new redelegation object
func UnmarshalRED ¶
func UnmarshalRED(cdc *codec.Codec, value []byte) (red Redelegation, err error)
unmarshal a redelegation from a store value
func (*Redelegation) AddEntry ¶
func (d *Redelegation) AddEntry(creationHeight int64, minTime time.Time, balance sdk.Int, sharesDst sdk.Dec)
AddEntry - append entry to the unbonding delegation
func (Redelegation) Equal ¶
func (d Redelegation) Equal(d2 Redelegation) bool
nolint inefficient but only used in tests
func (*Redelegation) RemoveEntry ¶
func (d *Redelegation) RemoveEntry(i int64)
RemoveEntry - remove entry at index i to the unbonding delegation
func (Redelegation) String ¶
func (d Redelegation) String() string
String returns a human readable string representation of a Redelegation.
type RedelegationEntry ¶
type RedelegationEntry struct { CreationHeight int64 `json:"creation_height" yaml:"creation_height"` // height at which the redelegation took place CompletionTime time.Time `json:"completion_time" yaml:"completion_time"` // time at which the redelegation will complete InitialBalance sdk.Int `json:"initial_balance" yaml:"initial_balance"` // initial balance when redelegation started }
RedelegationEntry - entry to a Redelegation
func NewRedelegationEntry ¶
func NewRedelegationEntry(creationHeight int64, completionTime time.Time, balance sdk.Int, sharesDst sdk.Dec) RedelegationEntry
NewRedelegation - create a new redelegation object
type RedelegationEntryResponse ¶
type RedelegationEntryResponse struct { RedelegationEntry Balance sdk.Int `json:"balance"` }
RedelegationEntryResponse is equivalent to a RedelegationEntry except that it contains a balance in addition to shares which is more suitable for client responses.
type RedelegationResponse ¶
type RedelegationResponse struct { Redelegation Entries []RedelegationEntryResponse `json:"entries" yaml:"entries"` // nolint: structtag }
RedelegationResponse is equivalent to a Redelegation except that its entries contain a balance in addition to shares which is more suitable for client responses.
func NewRedelegationResponse ¶
func NewRedelegationResponse(d sdk.AccAddress, vSrc, vDst sdk.ValAddress, entries []RedelegationEntryResponse) RedelegationResponse
func (RedelegationResponse) MarshalJSON ¶
func (r RedelegationResponse) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaler interface. This is so we can achieve a flattened structure while embedding other types.
func (RedelegationResponse) String ¶
func (r RedelegationResponse) String() string
String implements the Stringer interface for RedelegationResp.
func (*RedelegationResponse) UnmarshalJSON ¶
func (r *RedelegationResponse) UnmarshalJSON(bz []byte) error
UnmarshalJSON implements the json.Unmarshaler interface. This is so we can achieve a flattened structure while embedding other types.
type RedelegationResponses ¶
type RedelegationResponses []RedelegationResponse
RedelegationResponses are a collection of RedelegationResp
func (RedelegationResponses) String ¶
func (r RedelegationResponses) String() (out string)
type Redelegations ¶
type Redelegations []Redelegation
Redelegations are a collection of Redelegation
func (Redelegations) String ¶
func (d Redelegations) String() (out string)
type StakingHooks ¶
type StakingHooks interface { AfterValidatorCreated(ctx sdk.Context, valAddr sdk.ValAddress) // Must be called when a validator is created BeforeValidatorModified(ctx sdk.Context, valAddr sdk.ValAddress) // Must be called when a validator's state changes AfterValidatorRemoved(ctx sdk.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress) // Must be called when a validator is deleted AfterValidatorBonded(ctx sdk.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress) // Must be called when a validator is bonded AfterValidatorBeginUnbonding(ctx sdk.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress) // Must be called when a validator begins unbonding BeforeDelegationCreated(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) // Must be called when a delegation is created BeforeDelegationRemoved(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) // Must be called when a delegation is removed AfterDelegationModified(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) BeforeValidatorSlashed(ctx sdk.Context, valAddr sdk.ValAddress, fraction sdk.Dec) }
StakingHooks event hooks for staking validator object (noalias)
type SupplyKeeper ¶
type SupplyKeeper interface { GetSupply(ctx sdk.Context) supplyexported.SupplyI 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) sdk.Error UndelegateCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) sdk.Error DelegateCoinsFromAccountToModule(ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) sdk.Error BurnCoins(ctx sdk.Context, name string, amt sdk.Coins) sdk.Error }
SupplyKeeper defines the expected supply Keeper (noalias)
type UnbondingDelegation ¶
type UnbondingDelegation struct { DelegatorAddress sdk.AccAddress `json:"delegator_address" yaml:"delegator_address"` // delegator ValidatorAddress sdk.ValAddress `json:"validator_address" yaml:"validator_address"` // validator unbonding from operator addr Entries []UnbondingDelegationEntry `json:"entries" yaml:"entries"` // unbonding delegation entries }
UnbondingDelegation stores all of a single delegator's unbonding bonds for a single validator in an time-ordered list
func MustUnmarshalUBD ¶
func MustUnmarshalUBD(cdc *codec.Codec, value []byte) UnbondingDelegation
unmarshal a unbonding delegation from a store value
func NewUnbondingDelegation ¶
func NewUnbondingDelegation(delegatorAddr sdk.AccAddress, validatorAddr sdk.ValAddress, creationHeight int64, minTime time.Time, balance sdk.Int) UnbondingDelegation
NewUnbondingDelegation - create a new unbonding delegation object
func UnmarshalUBD ¶
func UnmarshalUBD(cdc *codec.Codec, value []byte) (ubd UnbondingDelegation, err error)
unmarshal a unbonding delegation from a store value
func (UnbondingDelegation) Equal ¶
func (d UnbondingDelegation) Equal(d2 UnbondingDelegation) bool
nolint inefficient but only used in testing
func (*UnbondingDelegation) RemoveEntry ¶
func (d *UnbondingDelegation) RemoveEntry(i int64)
RemoveEntry - remove entry at index i to the unbonding delegation
func (UnbondingDelegation) String ¶
func (d UnbondingDelegation) String() string
String returns a human readable string representation of an UnbondingDelegation.
type UnbondingDelegationEntry ¶
type UnbondingDelegationEntry struct { CreationHeight int64 `json:"creation_height" yaml:"creation_height"` // height which the unbonding took place CompletionTime time.Time `json:"completion_time" yaml:"completion_time"` // time at which the unbonding delegation will complete InitialBalance sdk.Int `json:"initial_balance" yaml:"initial_balance"` // nchs initially scheduled to receive at completion Balance sdk.Int `json:"balance" yaml:"balance"` // nchs to receive at completion }
UnbondingDelegationEntry - entry to an UnbondingDelegation
func NewUnbondingDelegationEntry ¶
func NewUnbondingDelegationEntry(creationHeight int64, completionTime time.Time, balance sdk.Int) UnbondingDelegationEntry
NewUnbondingDelegation - create a new unbonding delegation object
type UnbondingDelegations ¶
type UnbondingDelegations []UnbondingDelegation
UnbondingDelegations is a collection of UnbondingDelegation
func (UnbondingDelegations) String ¶
func (ubds UnbondingDelegations) String() (out string)
type Validator ¶
type Validator struct { OperatorAddress sdk.ValAddress `json:"operator_address" yaml:"operator_address"` // address of the validator's operator; bech encoded in JSON ConsPubKey crypto.PubKey `json:"consensus_pubkey" yaml:"consensus_pubkey"` // the consensus public key of the validator; bech encoded in JSON Jailed bool `json:"jailed" yaml:"jailed"` // has the validator been jailed from bonded status? Status sdk.BondStatus `json:"status" yaml:"status"` // validator status (bonded/unbonding/unbonded) Tokens sdk.Int `json:"tokens" yaml:"tokens"` // delegated tokens (incl. self-delegation) Description Description `json:"description" yaml:"description"` // description terms for the validator UnbondingHeight int64 `json:"unbonding_height" yaml:"unbonding_height"` // if unbonding, height at which this validator has begun unbonding UnbondingCompletionTime time.Time `json:"unbonding_time" yaml:"unbonding_time"` // if unbonding, min time for the validator to complete unbonding Commission Commission `json:"commission" yaml:"commission"` // commission parameters MinSelfDelegation sdk.Int `json:"min_self_delegation" yaml:"min_self_delegation"` // validator's self declared minimum self delegation SelfDelegation sdk.Dec `json:"self_delegation" yaml:"self_delegation"` // validator's 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 ¶
unmarshal a redelegation from a store value
func NewValidator ¶
func NewValidator(operator sdk.ValAddress, pubKey crypto.PubKey, description Description) Validator
NewValidator - initialize a new validator
func UnmarshalValidator ¶
unmarshal a redelegation 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) 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) AddTokensFromDel ¶
AddTokensFromDel adds tokens to a validator
func (Validator) BondedLever ¶
get current delegation lever
func (Validator) BondedTokens ¶
get the bonded tokens which the validator holds
func (Validator) ConsAddress ¶
func (v Validator) ConsAddress() sdk.ConsAddress
return the TM validator address
func (Validator) ConsensusPower ¶
get the consensus-engine power a reduction of 10^6 from validator tokens is applied
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) GetSelfDelegation ¶
func (Validator) GetStatus ¶
func (v Validator) GetStatus() sdk.BondStatus
func (Validator) InvalidExRate ¶
In some situations, the exchange rate becomes invalid, e.g. if Validator loses all tokens due to slashing. In this case, make all future delegations invalid.
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 ¶
custom marshal yaml function due to consensus pubkey
func (Validator) PotentialConsensusPower ¶
potential consensus-engine power
func (Validator) RemoveDelShares ¶
RemoveDelShares removes delegator shares from a validator. NOTE: because token fractions are left in the validator,
the exchange rate of future shares of this validator can increase.
func (Validator) RemoveTokens ¶
RemoveTokens removes tokens from a validator
func (Validator) SetInitialCommission ¶
func (v Validator) SetInitialCommission(commission Commission) (Validator, sdk.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.
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.
func (Validator) TestEquivalent ¶
only the vitals
func (Validator) TokensFromShares ¶
calculate the token worth of provided shares
func (Validator) TokensFromSharesRoundUp ¶
TokensFromSharesRoundUp returns the token worth of provided shares, rounded up.
func (Validator) TokensFromSharesTruncated ¶
calculate 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 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)) Validator(sdk.Context, sdk.ValAddress) stakingexported.ValidatorI // get a particular validator by operator address ValidatorByConsAddr(sdk.Context, sdk.ConsAddress) stakingexported.ValidatorI // get a particular validator by consensus address TotalBondedTokens(sdk.Context) sdk.Int // total bonded tokens within the validator set StakingTokenSupply(sdk.Context) sdk.Int // total staking token supply // slash the validator and delegators of the validator, specifying offence height, offence power, and slash fraction Slash(sdk.Context, sdk.ConsAddress, int64, int64, sdk.Dec) Jail(sdk.Context, sdk.ConsAddress) // jail a validator Unjail(sdk.Context, sdk.ConsAddress) // unjail a validator // Delegation allows for getting a particular delegation for a given validator // and delegator outside the scope of the staking module. Delegation(sdk.Context, sdk.AccAddress, sdk.ValAddress) stakingexported.DelegationI // 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) String ¶
func (v Validators) String() (out string)
func (Validators) ToSDKValidators ¶
func (v Validators) ToSDKValidators() (validators []exported.ValidatorI)
ToSDKValidators - convenience function convert []Validators to []sdk.Validators