Documentation ¶
Overview ¶
nolint
Index ¶
- Constants
- Variables
- func AddressFromKey(key []byte) []byte
- func ErrBadDelegationAmount(codespace sdk.CodespaceType) sdk.Error
- func ErrBadDenom(codespace sdk.CodespaceType) sdk.Error
- func ErrBadSendAmount(codespace sdk.CodespaceType) sdk.Error
- func ErrBadValidatorAddr(codespace sdk.CodespaceType) sdk.Error
- func ErrCantHandleEvidence(codespace sdk.CodespaceType) sdk.Error
- func ErrMinimumStake(codespace sdk.CodespaceType) sdk.Error
- func ErrMinimumUnstake(codespace sdk.CodespaceType) sdk.Error
- func ErrMissingSelfDelegation(codespace sdk.CodespaceType) sdk.Error
- func ErrNilValidatorAddr(codespace sdk.CodespaceType) sdk.Error
- func ErrNoSigningInfoFound(codespace sdk.CodespaceType, address sdk.Address) sdk.Error
- func ErrNoValidatorForAddress(codespace sdk.CodespaceType) sdk.Error
- func ErrNoValidatorFound(codespace sdk.CodespaceType) sdk.Error
- func ErrNotEnoughCoins(codespace sdk.CodespaceType) sdk.Error
- func ErrSelfDelegationTooLowToUnjail(codespace sdk.CodespaceType) sdk.Error
- func ErrValidatorJailed(codespace sdk.CodespaceType) sdk.Error
- func ErrValidatorNotJailed(codespace sdk.CodespaceType) sdk.Error
- func ErrValidatorPubKeyExists(codespace sdk.CodespaceType) sdk.Error
- func ErrValidatorPubKeyTypeNotSupported(codespace sdk.CodespaceType, keyType string, supportedTypes []string) sdk.Error
- func ErrValidatorStatus(codespace sdk.CodespaceType) sdk.Error
- func ErrValidatorTombstoned(codespace sdk.CodespaceType) sdk.Error
- func GetAddrPubkeyRelationKey(address []byte) []byte
- func GetValMissedBlockKey(v sdk.Address, i int64) []byte
- func GetValMissedBlockPrefixKey(v sdk.Address) []byte
- func GetValidatorSigningInfoAddress(key []byte) (v sdk.Address)
- func GetValidatorSigningInfoKey(v sdk.Address) []byte
- func KeyForUnstakingValidators(unstakingTime time.Time) []byte
- func KeyForValByAllVals(addr sdk.Address) []byte
- func KeyForValidatorAward(address sdk.Address) []byte
- func KeyForValidatorBurn(address sdk.Address) []byte
- func KeyForValidatorInStakingSet(validator Validator) []byte
- func KeyForValidatorPrevStateStateByPower(address sdk.Address) []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 GenesisState
- type MissedBlock
- type MsgBeginUnstake
- type MsgSend
- type MsgStake
- type MsgUnjail
- type MultiPOSHooks
- func (h MultiPOSHooks) AfterValidatorBeginUnstaked(ctx sdk.Ctx, valAddr sdk.Address)
- func (h MultiPOSHooks) AfterValidatorBeginUnstaking(ctx sdk.Ctx, valAddr sdk.Address)
- func (h MultiPOSHooks) AfterValidatorRegistered(ctx sdk.Ctx, valAddr sdk.Address)
- func (h MultiPOSHooks) AfterValidatorRemoved(ctx sdk.Ctx, valAddr sdk.Address)
- func (h MultiPOSHooks) AfterValidatorSlashed(ctx sdk.Ctx, valAddr sdk.Address, fraction sdk.Dec)
- func (h MultiPOSHooks) AfterValidatorStaked(ctx sdk.Ctx, valAddr sdk.Address)
- func (h MultiPOSHooks) BeforeValidatorBeginUnstaked(ctx sdk.Ctx, valAddr sdk.Address)
- func (h MultiPOSHooks) BeforeValidatorBeginUnstaking(ctx sdk.Ctx, valAddr sdk.Address)
- func (h MultiPOSHooks) BeforeValidatorRegistered(ctx sdk.Ctx, valAddr sdk.Address)
- func (h MultiPOSHooks) BeforeValidatorRemoved(ctx sdk.Ctx, valAddr sdk.Address)
- func (h MultiPOSHooks) BeforeValidatorSlashed(ctx sdk.Ctx, valAddr sdk.Address, fraction sdk.Dec)
- func (h MultiPOSHooks) BeforeValidatorStaked(ctx sdk.Ctx, valAddr sdk.Address)
- type POSHooks
- type Params
- type Pool
- type PrevStatePowerMapping
- type QueryAccountBalanceParams
- type QuerySigningInfoParams
- type QuerySigningInfosParams
- type QueryStakedValidatorsParams
- type QueryUnstakedValidatorsParams
- type QueryUnstakingValidatorsParams
- type QueryValidatorParams
- type QueryValidatorsParams
- type StakingPool
- type SupplyKeeper
- type Validator
- func (v Validator) ABCIValidatorUpdate() abci.ValidatorUpdate
- func (v Validator) ABCIValidatorUpdateZero() abci.ValidatorUpdate
- func (v Validator) AddStakedTokens(tokens sdk.Int) Validator
- func (v Validator) ConsensusPower() int64
- func (v Validator) Equals(v2 Validator) bool
- func (v Validator) GetAddress() sdk.Address
- func (v Validator) GetConsensusPower() int64
- func (v Validator) GetPublicKey() crypto.PublicKey
- func (v Validator) GetStatus() sdk.StakeStatus
- func (v Validator) GetTokens() sdk.Int
- func (v Validator) IsJailed() bool
- func (v Validator) IsStaked() bool
- func (v Validator) IsUnstaked() bool
- func (v Validator) IsUnstaking() bool
- func (v Validator) MarshalJSON() ([]byte, error)
- func (v Validator) PotentialConsensusPower() int64
- func (v Validator) RemoveStakedTokens(tokens sdk.Int) Validator
- func (v Validator) String() string
- func (v *Validator) UnmarshalJSON(data []byte) error
- func (v Validator) UpdateStatus(newStatus sdk.StakeStatus) Validator
- type ValidatorSet
- type ValidatorSigningInfo
- type Validators
Constants ¶
const ( EventTypeCompleteUnstaking = "complete_unstaking" EventTypeCreateValidator = "create_validator" EventTypeStake = "upokt" EventTypeBeginUnstake = "begin_unstake" EventTypeUnstake = "unstake" EventTypeProposerReward = "proposer_reward" EventTypeSlash = "slash" EventTypeLiveness = "liveness" AttributeKeyAddress = "address" AttributeKeyHeight = "height" AttributeKeyPower = "power" AttributeKeyReason = "reason" AttributeKeyJailed = "jailed" AttributeKeyMissedBlocks = "missed_blocks" AttributeValueDoubleSign = "double_sign" AttributeValueMissingSignature = "missing_signature" AttributeKeyValidator = "validator" AttributeValueCategory = ModuleName )
pos module event types
const ( ModuleName = "pos" StoreKey = ModuleName // StoreKey is the string store representation QuerierRoute = ModuleName // QuerierRoute is the querier route for the staking module RouterKey = ModuleName // RouterKey is the msg router key for the staking module )
const ( DefaultUnstakingTime = time.Hour * 24 * 7 * 3 DefaultMaxValidators uint64 = 100000 DefaultMinStake int64 = 1000000 DefaultBaseProposerAwardPercentage = 90 DefaultMaxEvidenceAge = 60 * 2 * time.Second DefaultSignedBlocksWindow = int64(100) DefaultDowntimeJailDuration = 60 * 10 * time.Second )
POS params default values
const ( QueryValidators = "validators" QueryValidator = "validator" QueryUnstakingValidators = "unstaking_validators" QueryStakedValidators = "staked_validators" QueryUnstakedValidators = "unstaked_validators" QueryStakedPool = "stakedPool" QueryUnstakedPool = "unstakedPool" QueryParameters = "parameters" QuerySigningInfo = "signingInfo" QuerySigningInfos = "signingInfos" QueryAccountBalance = "account_balance" )
query endpoints supported by the staking Querier
const (
StakedPoolName = "staked_tokens_pool"
)
names used as root for pool module accounts: - StakingPool -> "staked_tokens_pool"
Variables ¶
var ( ProposerKey = []byte{0x01} // key for the proposer address used for rewards ValidatorSigningInfoKey = []byte{0x11} // Prefix for signing info used in slashing ValidatorMissedBlockBitArrayKey = []byte{0x12} // Prefix for missed block bit array used in slashing AddrPubkeyRelationKey = []byte{0x13} // Prefix for address-pubkey relation used in slashing AllValidatorsKey = []byte{0x21} // prefix for each key to a validator StakedValidatorsKey = []byte{0x23} // prefix for each key to a staked validator index, sorted by power PrevStateValidatorsPowerKey = []byte{0x31} // prefix for the key to the validators of the prevState state PrevStateTotalPowerKey = []byte{0x32} // prefix for the total power of the prevState state UnstakingValidatorsKey = []byte{0x41} // prefix for unstaking validator UnstakedValidatorsKey = []byte{0x42} // prefix for unstaked validators // todo remove AwardValidatorKey = []byte{0x51} // prefix for awarding validators BurnValidatorKey = []byte{0x52} // prefix for awarding validators )
nolint
var ( KeyUnstakingTime = []byte("UnstakingTime") KeyMaxValidators = []byte("MaxValidators") KeyStakeDenom = []byte("StakeDenom") KeyStakeMinimum = []byte("StakeMinimum") KeyProposerRewardPercentage = []byte("ProposerRewardPercentage") KeyMaxEvidenceAge = []byte("MaxEvidenceAge") KeySignedBlocksWindow = []byte("SignedBlocksWindow") KeyMinSignedPerWindow = []byte("MinSignedPerWindow") KeyDowntimeJailDuration = []byte("DowntimeJailDuration") KeySlashFractionDoubleSign = []byte("SlashFractionDoubleSign") KeySlashFractionDowntime = []byte("SlashFractionDowntime") DoubleSignJailEndTime = time.Unix(253402300799, 0) // forever DefaultMinSignedPerWindow = sdk.NewDecWithPrec(5, 1) DefaultSlashFractionDoubleSign = sdk.NewDec(1).Quo(sdk.NewDec(20)) DefaultSlashFractionDowntime = sdk.NewDec(1).Quo(sdk.NewDec(100)) )
nolint - PublicKeys for parameter access
var ModuleCdc *codec.Codec // generic sealed codec to be used throughout this module
Functions ¶
func AddressFromKey ¶
Removes the prefix bytes from a key to expose true address
func ErrBadDelegationAmount ¶
func ErrBadDelegationAmount(codespace sdk.CodespaceType) sdk.Error
func ErrBadDenom ¶
func ErrBadDenom(codespace sdk.CodespaceType) sdk.Error
func ErrBadSendAmount ¶
func ErrBadSendAmount(codespace sdk.CodespaceType) sdk.Error
func ErrBadValidatorAddr ¶
func ErrBadValidatorAddr(codespace sdk.CodespaceType) sdk.Error
func ErrCantHandleEvidence ¶
func ErrCantHandleEvidence(codespace sdk.CodespaceType) sdk.Error
func ErrMinimumStake ¶
func ErrMinimumStake(codespace sdk.CodespaceType) sdk.Error
func ErrMinimumUnstake ¶
func ErrMinimumUnstake(codespace sdk.CodespaceType) sdk.Error
func ErrMissingSelfDelegation ¶
func ErrMissingSelfDelegation(codespace sdk.CodespaceType) sdk.Error
func ErrNilValidatorAddr ¶
func ErrNilValidatorAddr(codespace sdk.CodespaceType) sdk.Error
func ErrNoSigningInfoFound ¶
func ErrNoValidatorForAddress ¶
func ErrNoValidatorForAddress(codespace sdk.CodespaceType) sdk.Error
func ErrNoValidatorFound ¶
func ErrNoValidatorFound(codespace sdk.CodespaceType) sdk.Error
func ErrNotEnoughCoins ¶
func ErrNotEnoughCoins(codespace sdk.CodespaceType) sdk.Error
func ErrSelfDelegationTooLowToUnjail ¶
func ErrSelfDelegationTooLowToUnjail(codespace sdk.CodespaceType) sdk.Error
func ErrValidatorJailed ¶
func ErrValidatorJailed(codespace sdk.CodespaceType) sdk.Error
func ErrValidatorNotJailed ¶
func ErrValidatorNotJailed(codespace sdk.CodespaceType) sdk.Error
func ErrValidatorPubKeyExists ¶
func ErrValidatorPubKeyExists(codespace sdk.CodespaceType) sdk.Error
func ErrValidatorStatus ¶
func ErrValidatorStatus(codespace sdk.CodespaceType) sdk.Error
func ErrValidatorTombstoned ¶
func ErrValidatorTombstoned(codespace sdk.CodespaceType) sdk.Error
func GetAddrPubkeyRelationKey ¶
generates pubkey relation key used to get the pubkey from the address
func GetValMissedBlockKey ¶
generates the key for missing val who missed block through consensus addr
func GetValMissedBlockPrefixKey ¶
generates the prefix key for missing val who missed block through consensus addr
func GetValidatorSigningInfoAddress ¶
extract the address from a validator signing info key
func GetValidatorSigningInfoKey ¶
generates the key for validator signing information by consensus addr
func KeyForUnstakingValidators ¶
generates the key for unstaking validators by the unstakingtime
func KeyForValByAllVals ¶
generates the key for the validator with address
func KeyForValidatorAward ¶
generates the award key for a validator in the current state
func KeyForValidatorBurn ¶
func KeyForValidatorInStakingSet ¶
generates the key for a validator in the staking set
func KeyForValidatorPrevStateStateByPower ¶
generates the key for a validator in the prevState state
func MustMarshalValidator ¶
MUST return the amino encoded version of this validator
func ParseValidatorPowerRankKey ¶
parse the validators address from power rank key
Types ¶
type AccountKeeper ¶
type AccountKeeper interface {
IterateAccounts(ctx sdk.Ctx, 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 CodeValidatorNotJailed CodeType = 105 CodeMissingSelfDelegation CodeType = 106 CodeMissingSigningInfo CodeType = 108 CodeBadSend CodeType = 109 CodeInvalidStatus CodeType = 110 CodeMinimumStake CodeType = 111 CodeNotEnoughCoins CodeType = 112 CodeValidatorTombstoned CodeType = 113 CodeCantHandleEvidence CodeType = 114 CodeMinimumUnstake CodeType = 115 )
type GenesisState ¶
type GenesisState struct { Params Params `json:"params" yaml:"params"` PrevStateTotalPower sdk.Int `json:"prevState_total_power" yaml:"prevState_total_power"` PrevStateValidatorPowers []PrevStatePowerMapping `json:"prevState_validator_powers" yaml:"prevState_validator_powers"` Validators Validators `json:"validators" yaml:"validators"` Exported bool `json:"exported" yaml:"exported"` SigningInfos map[string]ValidatorSigningInfo `json:"signing_infos" yaml:"signing_infos"` MissedBlocks map[string][]MissedBlock `json:"missed_blocks" yaml:"missed_blocks"` PreviousProposer sdk.Address `json:"previous_proposer" yaml:"previous_proposer"` }
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, previousProposer sdk.Address, signingInfos map[string]ValidatorSigningInfo, missedBlocks map[string][]MissedBlock) GenesisState
type MissedBlock ¶
type MissedBlock struct { Index int64 `json:"index" yaml:"index"` Missed bool `json:"missed" yaml:"missed"` }
MissedBlock
type MsgBeginUnstake ¶
type MsgBeginUnstake struct {
Address sdk.Address `json:"validator_address" yaml:"validator_address"`
}
---------------------------------------------------------------------------------------------------------------------- MsgBeginUnstake - struct for unstaking transaciton
func (MsgBeginUnstake) GetSignBytes ¶
func (msg MsgBeginUnstake) GetSignBytes() []byte
func (MsgBeginUnstake) GetSigners ¶
func (msg MsgBeginUnstake) GetSigners() []sdk.Address
func (MsgBeginUnstake) Type ¶
func (msg MsgBeginUnstake) Type() string
func (MsgBeginUnstake) ValidateBasic ¶
func (msg MsgBeginUnstake) ValidateBasic() sdk.Error
type MsgSend ¶
---------------------------------------------------------------------------------------------------------------------- MsgChangeParam structure for sending coins
func (MsgSend) GetSignBytes ¶
func (MsgSend) GetSigners ¶
func (MsgSend) ValidateBasic ¶
type MsgStake ¶
type MsgStake struct { PubKey crypto.PublicKey `json:"pubkey" yaml:"pubkey"` Value sdk.Int `json:"value" yaml:"value"` }
---------------------------------------------------------------------------------------------------------------------- MsgStake - struct for staking transactions
func (MsgStake) GetSignBytes ¶
GetSignBytes returns the message bytes to sign over.
func (MsgStake) GetSigners ¶
Return address(es) that must sign over msg.GetSignBytes()
type MsgUnjail ¶
type MsgUnjail struct {
ValidatorAddr sdk.Address `json:"address" yaml:"address"` // address of the validator operator
}
---------------------------------------------------------------------------------------------------------------------- MsgUnjail - struct for unjailing jailed validator
func (MsgUnjail) GetSignBytes ¶
func (MsgUnjail) GetSigners ¶
func (MsgUnjail) ValidateBasic ¶
type MultiPOSHooks ¶
type MultiPOSHooks []POSHooks
func (MultiPOSHooks) AfterValidatorBeginUnstaked ¶
func (h MultiPOSHooks) AfterValidatorBeginUnstaked(ctx sdk.Ctx, valAddr sdk.Address)
func (MultiPOSHooks) AfterValidatorBeginUnstaking ¶
func (h MultiPOSHooks) AfterValidatorBeginUnstaking(ctx sdk.Ctx, valAddr sdk.Address)
func (MultiPOSHooks) AfterValidatorRegistered ¶
func (h MultiPOSHooks) AfterValidatorRegistered(ctx sdk.Ctx, valAddr sdk.Address)
nolint
func (MultiPOSHooks) AfterValidatorRemoved ¶
func (h MultiPOSHooks) AfterValidatorRemoved(ctx sdk.Ctx, valAddr sdk.Address)
func (MultiPOSHooks) AfterValidatorSlashed ¶
func (MultiPOSHooks) AfterValidatorStaked ¶
func (h MultiPOSHooks) AfterValidatorStaked(ctx sdk.Ctx, valAddr sdk.Address)
func (MultiPOSHooks) BeforeValidatorBeginUnstaked ¶
func (h MultiPOSHooks) BeforeValidatorBeginUnstaked(ctx sdk.Ctx, valAddr sdk.Address)
func (MultiPOSHooks) BeforeValidatorBeginUnstaking ¶
func (h MultiPOSHooks) BeforeValidatorBeginUnstaking(ctx sdk.Ctx, valAddr sdk.Address)
func (MultiPOSHooks) BeforeValidatorRegistered ¶
func (h MultiPOSHooks) BeforeValidatorRegistered(ctx sdk.Ctx, valAddr sdk.Address)
func (MultiPOSHooks) BeforeValidatorRemoved ¶
func (h MultiPOSHooks) BeforeValidatorRemoved(ctx sdk.Ctx, valAddr sdk.Address)
func (MultiPOSHooks) BeforeValidatorSlashed ¶
func (MultiPOSHooks) BeforeValidatorStaked ¶
func (h MultiPOSHooks) BeforeValidatorStaked(ctx sdk.Ctx, valAddr sdk.Address)
type POSHooks ¶
type POSHooks interface { BeforeValidatorRegistered(ctx sdk.Ctx, valAddr sdk.Address) AfterValidatorRegistered(ctx sdk.Ctx, valAddr sdk.Address) BeforeValidatorRemoved(ctx sdk.Ctx, valAddr sdk.Address) AfterValidatorRemoved(ctx sdk.Ctx, valAddr sdk.Address) BeforeValidatorStaked(ctx sdk.Ctx, valAddr sdk.Address) AfterValidatorStaked(ctx sdk.Ctx, valAddr sdk.Address) BeforeValidatorBeginUnstaking(ctx sdk.Ctx, valAddr sdk.Address) AfterValidatorBeginUnstaking(ctx sdk.Ctx, valAddr sdk.Address) BeforeValidatorUnstaked(ctx sdk.Ctx, valAddr sdk.Address) AfterValidatorUnstaked(ctx sdk.Ctx, valAddr sdk.Address) BeforeValidatorSlashed(ctx sdk.Ctx, valAddr sdk.Address, fraction sdk.Dec) AfterValidatorSlashed(ctx sdk.Ctx, valAddr sdk.Address, fraction sdk.Dec) }
POSHooks event hooks for staking validator object (noalias)
type Params ¶
type Params struct { UnstakingTime time.Duration `json:"unstaking_time" yaml:"unstaking_time"` // duration of unstaking MaxValidators uint64 `json:"max_validators" yaml:"max_validators"` // maximum number of validators StakeDenom string `json:"stake_denom" yaml:"stake_denom"` // stakeable coin denomination StakeMinimum int64 `json:"stake_minimum" yaml:"stake_minimum"` // minimum amount needed to stake ProposerRewardPercentage int8 `json:"base_proposer_award" yaml:"base_proposer_award"` // minimum award for the proposer // slashing params MaxEvidenceAge time.Duration `json:"max_evidence_age" yaml:"max_evidence_age"` SignedBlocksWindow int64 `json:"signed_blocks_window" yaml:"signed_blocks_window"` MinSignedPerWindow sdk.Dec `json:"min_signed_per_window" yaml:"min_signed_per_window"` DowntimeJailDuration time.Duration `json:"downtime_jail_duration" yaml:"downtime_jail_duration"` SlashFractionDoubleSign sdk.Dec `json:"slash_fraction_double_sign" yaml:"slash_fraction_double_sign"` SlashFractionDowntime sdk.Dec `json:"slash_fraction_downtime" yaml:"slash_fraction_downtime"` }
Params defines the high level settings for pos module
func MustUnmarshalParams ¶
unmarshal the current pos params value from store key or panic
func UnmarshalParams ¶
unmarshal the current pos params value from store key
func (*Params) ParamSetPairs ¶
func (p *Params) ParamSetPairs() sdk.ParamSetPairs
Implements params.ParamSet
type PrevStatePowerMapping ¶
PrevState validator power, needed for validator set update logic
type QuerySigningInfoParams ¶
QuerySigningInfoParams defines the params for the following queries: - 'custom/slashing/signingInfo'
func NewQuerySigningInfoParams ¶
func NewQuerySigningInfoParams(address sdk.Address) QuerySigningInfoParams
type QuerySigningInfosParams ¶
type QuerySigningInfosParams struct {
Page, Limit int
}
QuerySigningInfosParams defines the params for the following queries: - 'custom/slashing/signingInfos'
func NewQuerySigningInfosParams ¶
func NewQuerySigningInfosParams(page, limit int) QuerySigningInfosParams
type QueryStakedValidatorsParams ¶
type QueryStakedValidatorsParams struct {
Page, Limit int
}
func NewQueryStakedValidatorsParams ¶
func NewQueryStakedValidatorsParams(page, limit int) QueryStakedValidatorsParams
type QueryUnstakedValidatorsParams ¶
type QueryUnstakedValidatorsParams struct {
Page, Limit int
}
func NewQueryUnstakedValidatorsParams ¶
func NewQueryUnstakedValidatorsParams(page, limit int) QueryUnstakedValidatorsParams
type QueryUnstakingValidatorsParams ¶
type QueryUnstakingValidatorsParams struct {
Page, Limit int
}
func NewQueryUnstakingValidatorsParams ¶
func NewQueryUnstakingValidatorsParams(page, limit int) QueryUnstakingValidatorsParams
type QueryValidatorParams ¶
func NewQueryValidatorParams ¶
func NewQueryValidatorParams(validatorAddr sdk.Address) QueryValidatorParams
type QueryValidatorsParams ¶
type QueryValidatorsParams struct {
Page, Limit int
}
func NewQueryValidatorsParams ¶
func NewQueryValidatorsParams(page, limit int) QueryValidatorsParams
type StakingPool ¶
type StakingPool Pool
Tokens - tracking staked token supply
func (StakingPool) String ¶
func (bp StakingPool) String() string
String returns a human readable string representation of a pool.
type SupplyKeeper ¶
type SupplyKeeper interface { // get total supply of tokens GetSupply(ctx sdk.Ctx) supplyexported.SupplyI // get the address of a module account GetModuleAddress(name string) sdk.Address // get the module account structure GetModuleAccount(ctx sdk.Ctx, moduleName string) supplyexported.ModuleAccountI // set module account structure SetModuleAccount(sdk.Ctx, supplyexported.ModuleAccountI) // send coins to/from module accounts SendCoinsFromModuleToModule(ctx sdk.Ctx, senderModule, recipientModule string, amt sdk.Coins) sdk.Error // send coins from module to validator SendCoinsFromModuleToAccount(ctx sdk.Ctx, senderModule string, recipientAddr sdk.Address, amt sdk.Coins) sdk.Error // send coins from validator to module SendCoinsFromAccountToModule(ctx sdk.Ctx, senderAddr sdk.Address, recipientModule string, amt sdk.Coins) sdk.Error // mint coins MintCoins(ctx sdk.Ctx, moduleName string, amt sdk.Coins) sdk.Error // burn coins BurnCoins(ctx sdk.Ctx, name string, amt sdk.Coins) sdk.Error }
SupplyKeeper defines the expected supply Keeper (noalias)
type Validator ¶
type Validator struct { Address sdk.Address `json:"address" yaml:"address"` // address of the validator; PublicKey crypto.PublicKey `json:"public_key" yaml:"public_key"` // the consensus public key of the validator; Jailed bool `json:"jailed" yaml:"jailed"` // has the validator been jailed from staked status? Status sdk.StakeStatus `json:"status" yaml:"status"` // validator status (staked/unstaking/unstaked) StakedTokens sdk.Int `json:"tokens" yaml:"tokens"` // tokens staked in the network UnstakingCompletionTime time.Time `json:"unstaking_time" yaml:"unstaking_time"` // if unstaking, min time for the validator to complete unstaking }
func MustUnmarshalValidator ¶
MUST decode the validator from the bytes
func NewValidator ¶
NewValidator - initialize a new validator
func UnmarshalValidator ¶
unmarshal the validator
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) AddStakedTokens ¶
AddStakedTokens tokens to staked field for a validator
func (Validator) ConsensusPower ¶
get the consensus-engine power a reduction of 10^6 from validator tokens is applied
func (Validator) GetAddress ¶
func (Validator) GetConsensusPower ¶
func (Validator) GetPublicKey ¶
func (Validator) GetStatus ¶
func (v Validator) GetStatus() sdk.StakeStatus
func (Validator) IsUnstaked ¶
func (Validator) IsUnstaking ¶
func (Validator) MarshalJSON ¶
MarshalJSON marshals the validator to JSON using Hex
func (Validator) PotentialConsensusPower ¶
potential consensus-engine power
func (Validator) RemoveStakedTokens ¶
RemoveStakedTokens removes tokens from a validator
func (*Validator) UnmarshalJSON ¶
UnmarshalJSON unmarshals the validator from JSON using Hex
func (Validator) UpdateStatus ¶
func (v Validator) UpdateStatus(newStatus sdk.StakeStatus) Validator
UpdateStatus updates the staking status
type ValidatorSet ¶
type ValidatorSet interface { // iterate through validators by address, execute func for each validator IterateAndExecuteOverVals(sdk.Ctx, func(index int64, validator posexported.ValidatorI) (stop bool)) // iterate through staked validators by address, execute func for each validator IterateAndExecuteOverStakedVals(sdk.Ctx, func(index int64, validator posexported.ValidatorI) (stop bool)) // iterate through the validator set of the prevState block by address, execute func for each validator IterateAndExecuteOverPrevStateVals(sdk.Ctx, func(index int64, validator posexported.ValidatorI) (stop bool)) // get a particular validator by address Validator(sdk.Ctx, sdk.Address) posexported.ValidatorI // total staked tokens within the validator set TotalTokens(sdk.Ctx) sdk.Int // jail a validator JailValidator(sdk.Ctx, sdk.Address) // unjail a validator UnjailValidator(sdk.Ctx, sdk.Address) // MaxValidators returns the maximum amount of staked validators MaxValidators(sdk.Ctx) uint64 }
ValidatorSet expected properties for the set of all validators (noalias) todo this is here so other modules can conform to this interface
type ValidatorSigningInfo ¶
type ValidatorSigningInfo struct { Address sdk.Address `json:"address" yaml:"address"` // validator consensus address StartHeight int64 `json:"start_height" yaml:"start_height"` // height at which validator was first a candidate OR was unjailed IndexOffset int64 `json:"index_offset" yaml:"index_offset"` // index offset into signed block bit array JailedUntil time.Time `json:"jailed_until" yaml:"jailed_until"` // timestamp validator cannot be unjailed until Tombstoned bool `json:"tombstoned" yaml:"tombstoned"` // whether or not a validator has been tombstoned (killed out of validator set) MissedBlocksCounter int64 `json:"missed_blocks_counter" yaml:"missed_blocks_counter"` // missed blocks counter (to avoid scanning the array every time) }
Signing info for a validator
func (ValidatorSigningInfo) String ¶
func (i ValidatorSigningInfo) String() string
Return human readable signing info
type Validators ¶
type Validators []Validator
Validators is a collection of Validator
func (Validators) String ¶
func (v Validators) String() (out string)