Documentation ¶
Index ¶
- func AllInvariants(k *Keeper) sdk.Invariant
- func DelegatorSharesInvariant(k *Keeper) sdk.Invariant
- func ModuleAccountInvariants(k *Keeper) sdk.Invariant
- func NewMsgServerImpl(keeper *Keeper) types.MsgServer
- func NonNegativePowerInvariant(k *Keeper) sdk.Invariant
- func PositiveDelegationInvariant(k *Keeper) sdk.Invariant
- func RegisterInvariants(ir sdk.InvariantRegistry, k *Keeper)
- func TestingUpdateValidator(keeper *Keeper, ctx sdk.Context, validator types.Validator, apply bool) types.Validator
- func ValidatorByPowerIndexExists(ctx context.Context, keeper *Keeper, power []byte) bool
- type Keeper
- func (k Keeper) AddValidatorTokensAndShares(ctx context.Context, validator types.Validator, tokensToAdd math.Int) (valOut types.Validator, addedShares math.LegacyDec, err error)
- func (k Keeper) ApplyAndReturnValidatorSetUpdates(ctx context.Context) (updates []abci.ValidatorUpdate, err error)
- func (k *Keeper) BeginBlocker(ctx context.Context) error
- func (k Keeper) BeginRedelegation(ctx context.Context, delAddr sdk.AccAddress, ...) (completionTime time.Time, err error)
- func (k Keeper) BeginUnbondingValidator(ctx context.Context, validator types.Validator) (types.Validator, error)
- func (k Keeper) BlockValidatorUpdates(ctx context.Context) ([]abci.ValidatorUpdate, error)
- func (k Keeper) BondDenom(ctx context.Context) (string, error)
- func (k Keeper) BondedRatio(ctx context.Context) (math.LegacyDec, error)
- func (k Keeper) CompleteRedelegation(ctx context.Context, delAddr sdk.AccAddress, ...) (sdk.Coins, error)
- func (k Keeper) CompleteUnbonding(ctx context.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) (sdk.Coins, error)
- func (k Keeper) ConsensusAddressCodec() addresscodec.Codec
- func (k Keeper) Delegate(ctx context.Context, delAddr sdk.AccAddress, bondAmt math.Int, ...) (newShares math.LegacyDec, err error)
- func (k Keeper) Delegation(ctx context.Context, addrDel sdk.AccAddress, addrVal sdk.ValAddress) (types.DelegationI, error)
- func (k Keeper) DeleteHistoricalInfo(ctx context.Context, height int64) error
- func (k Keeper) DeleteLastValidatorPower(ctx context.Context, operator sdk.ValAddress) error
- func (k Keeper) DeleteUnbondingIndex(ctx context.Context, id uint64) error
- func (k Keeper) DeleteValidatorByPowerIndex(ctx context.Context, validator types.Validator) error
- func (k Keeper) DeleteValidatorQueue(ctx context.Context, val types.Validator) error
- func (k Keeper) DeleteValidatorQueueTimeSlice(ctx context.Context, endTime time.Time, endHeight int64) error
- func (k Keeper) DequeueAllMatureRedelegationQueue(ctx context.Context, currTime time.Time) (matureRedelegations []types.DVVTriplet, err error)
- func (k Keeper) DequeueAllMatureUBDQueue(ctx context.Context, currTime time.Time) (matureUnbonds []types.DVPair, err error)
- func (k *Keeper) EndBlocker(ctx context.Context) ([]abci.ValidatorUpdate, error)
- func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState
- func (k Keeper) GetAllDelegations(ctx context.Context) (delegations []types.Delegation, err error)
- func (k Keeper) GetAllDelegatorDelegations(ctx context.Context, delegator sdk.AccAddress) ([]types.Delegation, error)
- func (k Keeper) GetAllHistoricalInfo(ctx context.Context) ([]types.HistoricalInfo, error)
- func (k Keeper) GetAllRedelegations(ctx context.Context, delegator sdk.AccAddress, ...) ([]types.Redelegation, error)
- func (k Keeper) GetAllSDKDelegations(ctx context.Context) (delegations []types.Delegation, err error)
- func (k Keeper) GetAllUnbondingDelegations(ctx context.Context, delegator sdk.AccAddress) ([]types.UnbondingDelegation, error)
- func (k Keeper) GetAllValidators(ctx context.Context) (validators []types.Validator, err error)
- func (k Keeper) GetAuthority() string
- func (k Keeper) GetBondedPool(ctx context.Context) (bondedPool sdk.ModuleAccountI)
- func (k Keeper) GetBondedValidatorsByPower(ctx context.Context) ([]types.Validator, error)
- func (k Keeper) GetDelegation(ctx context.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) (types.Delegation, error)
- func (k Keeper) GetDelegatorBonded(ctx context.Context, delegator sdk.AccAddress) (math.Int, error)
- func (k Keeper) GetDelegatorDelegations(ctx context.Context, delegator sdk.AccAddress, maxRetrieve uint16) (delegations []types.Delegation, err error)
- func (k Keeper) GetDelegatorUnbonding(ctx context.Context, delegator sdk.AccAddress) (math.Int, error)
- func (k Keeper) GetDelegatorValidator(ctx context.Context, delegatorAddr sdk.AccAddress, ...) (validator types.Validator, err error)
- func (k Keeper) GetDelegatorValidators(ctx context.Context, delegatorAddr sdk.AccAddress, maxRetrieve uint32) (types.Validators, error)
- func (k Keeper) GetHistoricalInfo(ctx context.Context, height int64) (types.HistoricalInfo, error)
- func (k Keeper) GetLastTotalPower(ctx context.Context) (math.Int, error)
- func (k Keeper) GetLastValidatorPower(ctx context.Context, operator sdk.ValAddress) (power int64, err error)
- func (k Keeper) GetLastValidators(ctx context.Context) (validators []types.Validator, err error)
- func (k Keeper) GetNotBondedPool(ctx context.Context) (notBondedPool sdk.ModuleAccountI)
- func (k Keeper) GetParams(ctx context.Context) (params types.Params, err error)
- func (k Keeper) GetPubKeyByConsAddr(ctx context.Context, addr sdk.ConsAddress) (cmtprotocrypto.PublicKey, error)
- func (k Keeper) GetRedelegation(ctx context.Context, delAddr sdk.AccAddress, ...) (red types.Redelegation, err error)
- func (k Keeper) GetRedelegationByUnbondingID(ctx context.Context, id uint64) (red types.Redelegation, err error)
- func (k Keeper) GetRedelegationQueueTimeSlice(ctx context.Context, timestamp time.Time) (dvvTriplets []types.DVVTriplet, err error)
- func (k Keeper) GetRedelegations(ctx context.Context, delegator sdk.AccAddress, maxRetrieve uint16) (redelegations []types.Redelegation, err error)
- func (k Keeper) GetRedelegationsFromSrcValidator(ctx context.Context, valAddr sdk.ValAddress) (reds []types.Redelegation, err error)
- func (k Keeper) GetUBDQueueTimeSlice(ctx context.Context, timestamp time.Time) (dvPairs []types.DVPair, err error)
- func (k Keeper) GetUnbondingDelegation(ctx context.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) (ubd types.UnbondingDelegation, err error)
- func (k Keeper) GetUnbondingDelegationByUnbondingID(ctx context.Context, id uint64) (ubd types.UnbondingDelegation, err error)
- func (k Keeper) GetUnbondingDelegations(ctx context.Context, delegator sdk.AccAddress, maxRetrieve uint16) (unbondingDelegations []types.UnbondingDelegation, err error)
- func (k Keeper) GetUnbondingDelegationsFromValidator(ctx context.Context, valAddr sdk.ValAddress) (ubds []types.UnbondingDelegation, err error)
- func (k Keeper) GetUnbondingType(ctx context.Context, id uint64) (unbondingType types.UnbondingType, err error)
- func (k Keeper) GetUnbondingValidators(ctx context.Context, endTime time.Time, endHeight int64) ([]string, error)
- func (k Keeper) GetValidator(ctx context.Context, addr sdk.ValAddress) (validator types.Validator, err error)
- func (k Keeper) GetValidatorByConsAddr(ctx context.Context, consAddr sdk.ConsAddress) (validator types.Validator, err error)
- func (k Keeper) GetValidatorByUnbondingID(ctx context.Context, id uint64) (val types.Validator, err error)
- func (k Keeper) GetValidatorDelegations(ctx context.Context, valAddr sdk.ValAddress) (delegations []types.Delegation, err error)
- func (k Keeper) GetValidatorSet() types.ValidatorSet
- func (k Keeper) GetValidatorUpdates(ctx context.Context) ([]abci.ValidatorUpdate, error)
- func (k Keeper) GetValidators(ctx context.Context, maxRetrieve uint32) (validators []types.Validator, err error)
- func (k Keeper) HasMaxRedelegationEntries(ctx context.Context, delegatorAddr sdk.AccAddress, ...) (bool, error)
- func (k Keeper) HasMaxUnbondingDelegationEntries(ctx context.Context, delegatorAddr sdk.AccAddress, ...) (bool, error)
- func (k Keeper) HasReceivingRedelegation(ctx context.Context, delAddr sdk.AccAddress, valDstAddr sdk.ValAddress) (bool, error)
- func (k Keeper) HistoricalEntries(ctx context.Context) (uint32, error)
- func (k *Keeper) Hooks() types.StakingHooks
- func (k Keeper) IncrementUnbondingID(ctx context.Context) (unbondingID uint64, err error)
- func (k Keeper) InitGenesis(ctx context.Context, data *types.GenesisState) (res []abci.ValidatorUpdate)
- func (k Keeper) InsertRedelegationQueue(ctx context.Context, red types.Redelegation, completionTime time.Time) error
- func (k Keeper) InsertUBDQueue(ctx context.Context, ubd types.UnbondingDelegation, completionTime time.Time) error
- func (k Keeper) InsertUnbondingValidatorQueue(ctx context.Context, val types.Validator) error
- func (k Keeper) IsValidatorJailed(ctx context.Context, addr sdk.ConsAddress) (bool, error)
- func (k Keeper) IterateAllDelegations(ctx context.Context, cb func(delegation types.Delegation) (stop bool)) error
- func (k Keeper) IterateBondedValidatorsByPower(ctx context.Context, ...) error
- func (k Keeper) IterateDelegations(ctx context.Context, delAddr sdk.AccAddress, ...) error
- func (k Keeper) IterateDelegatorDelegations(ctx context.Context, delegator sdk.AccAddress, ...) error
- func (k Keeper) IterateDelegatorRedelegations(ctx context.Context, delegator sdk.AccAddress, ...) error
- func (k Keeper) IterateDelegatorUnbondingDelegations(ctx context.Context, delegator sdk.AccAddress, ...) error
- func (k Keeper) IterateHistoricalInfo(ctx context.Context, cb func(types.HistoricalInfo) bool) error
- func (k Keeper) IterateLastValidatorPowers(ctx context.Context, ...) error
- func (k Keeper) IterateLastValidators(ctx context.Context, ...) error
- func (k Keeper) IterateRedelegations(ctx context.Context, fn func(index int64, red types.Redelegation) (stop bool)) error
- func (k Keeper) IterateUnbondingDelegations(ctx context.Context, ...) error
- func (k Keeper) IterateValidators(ctx context.Context, ...) error
- func (k Keeper) Jail(ctx context.Context, consAddr sdk.ConsAddress) error
- func (k Keeper) LastValidatorsIterator(ctx context.Context) (corestore.Iterator, error)
- func (k Keeper) Logger(ctx context.Context) log.Logger
- func (k Keeper) MaxEntries(ctx context.Context) (uint32, error)
- func (k Keeper) MaxValidators(ctx context.Context) (uint32, error)
- func (k Keeper) MinCommissionRate(ctx context.Context) (math.LegacyDec, error)
- func (k Keeper) PowerReduction(ctx context.Context) math.Int
- func (k Keeper) PutUnbondingOnHold(ctx context.Context, id uint64) error
- func (k Keeper) RedelegationQueueIterator(ctx context.Context, endTime time.Time) (storetypes.Iterator, error)
- func (k Keeper) RemoveDelegation(ctx context.Context, delegation types.Delegation) error
- func (k Keeper) RemoveRedelegation(ctx context.Context, red types.Redelegation) error
- func (k Keeper) RemoveUnbondingDelegation(ctx context.Context, ubd types.UnbondingDelegation) error
- func (k Keeper) RemoveValidator(ctx context.Context, address sdk.ValAddress) error
- func (k Keeper) RemoveValidatorTokens(ctx context.Context, validator types.Validator, tokensToRemove math.Int) (types.Validator, error)
- func (k Keeper) RemoveValidatorTokensAndShares(ctx context.Context, validator types.Validator, sharesToRemove math.LegacyDec) (valOut types.Validator, removedTokens math.Int, err error)
- func (k Keeper) SetDelegation(ctx context.Context, delegation types.Delegation) error
- func (k Keeper) SetHistoricalInfo(ctx context.Context, height int64, hi *types.HistoricalInfo) error
- func (k *Keeper) SetHooks(sh types.StakingHooks)
- func (k Keeper) SetLastTotalPower(ctx context.Context, power math.Int) error
- func (k Keeper) SetLastValidatorPower(ctx context.Context, operator sdk.ValAddress, power int64) error
- func (k Keeper) SetNewValidatorByPowerIndex(ctx context.Context, validator types.Validator) error
- func (k Keeper) SetParams(ctx context.Context, params types.Params) error
- func (k Keeper) SetRedelegation(ctx context.Context, red types.Redelegation) error
- func (k Keeper) SetRedelegationByUnbondingID(ctx context.Context, red types.Redelegation, id uint64) error
- func (k Keeper) SetRedelegationEntry(ctx context.Context, delegatorAddr sdk.AccAddress, ...) (types.Redelegation, error)
- func (k Keeper) SetRedelegationQueueTimeSlice(ctx context.Context, timestamp time.Time, keys []types.DVVTriplet) error
- func (k Keeper) SetUBDQueueTimeSlice(ctx context.Context, timestamp time.Time, keys []types.DVPair) error
- func (k Keeper) SetUnbondingDelegation(ctx context.Context, ubd types.UnbondingDelegation) error
- func (k Keeper) SetUnbondingDelegationByUnbondingID(ctx context.Context, ubd types.UnbondingDelegation, id uint64) error
- func (k Keeper) SetUnbondingDelegationEntry(ctx context.Context, delegatorAddr sdk.AccAddress, ...) (types.UnbondingDelegation, error)
- func (k Keeper) SetUnbondingType(ctx context.Context, id uint64, unbondingType types.UnbondingType) error
- func (k Keeper) SetUnbondingValidatorsQueue(ctx context.Context, endTime time.Time, endHeight int64, addrs []string) error
- func (k Keeper) SetValidator(ctx context.Context, validator types.Validator) error
- func (k Keeper) SetValidatorByConsAddr(ctx context.Context, validator types.Validator) error
- func (k Keeper) SetValidatorByPowerIndex(ctx context.Context, validator types.Validator) error
- func (k Keeper) SetValidatorByUnbondingID(ctx context.Context, val types.Validator, id uint64) error
- func (k Keeper) SetValidatorUpdates(ctx context.Context, valUpdates []abci.ValidatorUpdate) error
- func (k Keeper) Slash(ctx context.Context, consAddr sdk.ConsAddress, infractionHeight, power int64, ...) (math.Int, error)
- func (k Keeper) SlashRedelegation(ctx context.Context, srcValidator types.Validator, ...) (totalSlashAmount math.Int, err error)
- func (k Keeper) SlashUnbondingDelegation(ctx context.Context, unbondingDelegation types.UnbondingDelegation, ...) (totalSlashAmount math.Int, err error)
- func (k Keeper) SlashWithInfractionReason(ctx context.Context, consAddr sdk.ConsAddress, infractionHeight, power int64, ...) (math.Int, error)
- func (k Keeper) StakingTokenSupply(ctx context.Context) (math.Int, error)
- func (k Keeper) TokensFromConsensusPower(ctx context.Context, power int64) math.Int
- func (k Keeper) TokensToConsensusPower(ctx context.Context, tokens math.Int) int64
- func (k Keeper) TotalBondedTokens(ctx context.Context) (math.Int, error)
- func (k Keeper) TrackHistoricalInfo(ctx context.Context) error
- func (k Keeper) UBDQueueIterator(ctx context.Context, endTime time.Time) (corestore.Iterator, error)
- func (k Keeper) Unbond(ctx context.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress, ...) (amount math.Int, err error)
- func (k Keeper) UnbondAllMatureValidators(ctx context.Context) error
- func (k Keeper) UnbondingCanComplete(ctx context.Context, id uint64) error
- func (k Keeper) UnbondingTime(ctx context.Context) (time.Duration, error)
- func (k Keeper) UnbondingToUnbonded(ctx context.Context, validator types.Validator) (types.Validator, error)
- func (k Keeper) Undelegate(ctx context.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress, ...) (time.Time, math.Int, error)
- func (k Keeper) Unjail(ctx context.Context, consAddr sdk.ConsAddress) error
- func (k Keeper) UpdateValidatorCommission(ctx context.Context, validator types.Validator, newRate math.LegacyDec) (types.Commission, error)
- func (k Keeper) ValidateUnbondAmount(ctx context.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress, ...) (shares math.LegacyDec, err error)
- func (k Keeper) Validator(ctx context.Context, address sdk.ValAddress) (types.ValidatorI, error)
- func (k Keeper) ValidatorAddressCodec() addresscodec.Codec
- func (k Keeper) ValidatorByConsAddr(ctx context.Context, addr sdk.ConsAddress) (types.ValidatorI, error)
- func (k Keeper) ValidatorQueueIterator(ctx context.Context, endTime time.Time, endHeight int64) (corestore.Iterator, error)
- func (k Keeper) ValidatorsPowerStoreIterator(ctx context.Context) (corestore.Iterator, error)
- type Migrator
- type Querier
- func (k Querier) Delegation(ctx context.Context, req *types.QueryDelegationRequest) (*types.QueryDelegationResponse, error)
- func (k Querier) DelegatorDelegations(ctx context.Context, req *types.QueryDelegatorDelegationsRequest) (*types.QueryDelegatorDelegationsResponse, error)
- func (k Querier) DelegatorUnbondingDelegations(ctx context.Context, req *types.QueryDelegatorUnbondingDelegationsRequest) (*types.QueryDelegatorUnbondingDelegationsResponse, error)
- func (k Querier) DelegatorValidator(ctx context.Context, req *types.QueryDelegatorValidatorRequest) (*types.QueryDelegatorValidatorResponse, error)
- func (k Querier) DelegatorValidators(ctx context.Context, req *types.QueryDelegatorValidatorsRequest) (*types.QueryDelegatorValidatorsResponse, error)
- func (k Querier) HistoricalInfo(ctx context.Context, req *types.QueryHistoricalInfoRequest) (*types.QueryHistoricalInfoResponse, error)
- func (k Querier) Params(ctx context.Context, _ *types.QueryParamsRequest) (*types.QueryParamsResponse, error)
- func (k Querier) Pool(ctx context.Context, _ *types.QueryPoolRequest) (*types.QueryPoolResponse, error)
- func (k Querier) Redelegations(ctx context.Context, req *types.QueryRedelegationsRequest) (*types.QueryRedelegationsResponse, error)
- func (k Querier) UnbondingDelegation(ctx context.Context, req *types.QueryUnbondingDelegationRequest) (*types.QueryUnbondingDelegationResponse, error)
- func (k Querier) Validator(ctx context.Context, req *types.QueryValidatorRequest) (*types.QueryValidatorResponse, error)
- func (k Querier) ValidatorDelegations(ctx context.Context, req *types.QueryValidatorDelegationsRequest) (*types.QueryValidatorDelegationsResponse, error)
- func (k Querier) ValidatorUnbondingDelegations(ctx context.Context, req *types.QueryValidatorUnbondingDelegationsRequest) (*types.QueryValidatorUnbondingDelegationsResponse, error)
- func (k Querier) Validators(ctx context.Context, req *types.QueryValidatorsRequest) (*types.QueryValidatorsResponse, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AllInvariants ¶
AllInvariants runs all invariants of the staking module.
func DelegatorSharesInvariant ¶
DelegatorSharesInvariant checks whether all the delegator shares which persist in the delegator object add up to the correct total delegator shares amount stored in each validator.
func ModuleAccountInvariants ¶
ModuleAccountInvariants checks that the bonded and notBonded ModuleAccounts pools reflects the tokens actively bonded and not bonded
func NewMsgServerImpl ¶
NewMsgServerImpl returns an implementation of the staking MsgServer interface for the provided Keeper.
func NonNegativePowerInvariant ¶
NonNegativePowerInvariant checks that all stored validators have >= 0 power.
func PositiveDelegationInvariant ¶
PositiveDelegationInvariant checks that all stored delegations have > 0 shares.
func RegisterInvariants ¶
func RegisterInvariants(ir sdk.InvariantRegistry, k *Keeper)
RegisterInvariants registers all staking invariants
Types ¶
type Keeper ¶
type Keeper struct {
// contains filtered or unexported fields
}
Keeper of the x/staking store
func NewKeeper ¶
func NewKeeper( cdc codec.BinaryCodec, storeService storetypes.KVStoreService, ak types.AccountKeeper, bk types.BankKeeper, authority string, validatorAddressCodec addresscodec.Codec, consensusAddressCodec addresscodec.Codec, ) *Keeper
NewKeeper creates a new staking Keeper instance
func (Keeper) AddValidatorTokensAndShares ¶
func (k Keeper) AddValidatorTokensAndShares(ctx context.Context, validator types.Validator, tokensToAdd math.Int, ) (valOut types.Validator, addedShares math.LegacyDec, err error)
AddValidatorTokensAndShares updates the tokens of an existing validator, updates the validators power index key
func (Keeper) ApplyAndReturnValidatorSetUpdates ¶
func (k Keeper) ApplyAndReturnValidatorSetUpdates(ctx context.Context) (updates []abci.ValidatorUpdate, err error)
ApplyAndReturnValidatorSetUpdates applies and return accumulated updates to the bonded validator set. Also, * Updates the active valset as keyed by LastValidatorPowerKey. * Updates the total power as keyed by LastTotalPowerKey. * Updates validator status' according to updated powers. * Updates the fee pool bonded vs not-bonded tokens. * Updates relevant indices. It gets called once after genesis, another time maybe after genesis transactions, then once at every EndBlock.
CONTRACT: Only validators with non-zero power or zero-power that were bonded at the previous block height or were removed from the validator set entirely are returned to CometBFT.
func (*Keeper) BeginBlocker ¶
BeginBlocker will persist the current header and validator set as a historical entry and prune the oldest entry based on the HistoricalEntries parameter
func (Keeper) BeginRedelegation ¶
func (k Keeper) BeginRedelegation( ctx context.Context, delAddr sdk.AccAddress, valSrcAddr, valDstAddr sdk.ValAddress, sharesAmount math.LegacyDec, ) (completionTime time.Time, err error)
BeginRedelegation begins unbonding / redelegation and creates a redelegation record.
func (Keeper) BeginUnbondingValidator ¶
func (k Keeper) BeginUnbondingValidator(ctx context.Context, validator types.Validator) (types.Validator, error)
BeginUnbondingValidator performs all the store operations for when a validator begins unbonding
func (Keeper) BlockValidatorUpdates ¶
BlockValidatorUpdates calculates the ValidatorUpdates for the current block Called in each EndBlock
func (Keeper) BondedRatio ¶
BondedRatio the fraction of the staking tokens which are currently bonded
func (Keeper) CompleteRedelegation ¶
func (k Keeper) CompleteRedelegation( ctx context.Context, delAddr sdk.AccAddress, valSrcAddr, valDstAddr sdk.ValAddress, ) (sdk.Coins, error)
CompleteRedelegation completes the redelegations of all mature entries in the retrieved redelegation object and returns the total redelegation (initial) balance or an error upon failure.
func (Keeper) CompleteUnbonding ¶
func (k Keeper) CompleteUnbonding(ctx context.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) (sdk.Coins, error)
CompleteUnbonding completes the unbonding of all mature entries in the retrieved unbonding delegation object and returns the total unbonding balance or an error upon failure.
func (Keeper) ConsensusAddressCodec ¶
func (k Keeper) ConsensusAddressCodec() addresscodec.Codec
ConsensusAddressCodec returns the app consensus address codec.
func (Keeper) Delegate ¶
func (k Keeper) Delegate( ctx context.Context, delAddr sdk.AccAddress, bondAmt math.Int, tokenSrc types.BondStatus, validator types.Validator, subtractAccount bool, ) (newShares math.LegacyDec, err error)
Delegate performs a delegation, set/update everything necessary within the store. tokenSrc indicates the bond status of the incoming funds.
func (Keeper) Delegation ¶
func (k Keeper) Delegation(ctx context.Context, addrDel sdk.AccAddress, addrVal sdk.ValAddress) (types.DelegationI, error)
Delegation gets the delegation interface for a particular set of delegator and validator addresses
func (Keeper) DeleteHistoricalInfo ¶
DeleteHistoricalInfo deletes the historical info at a given height
func (Keeper) DeleteLastValidatorPower ¶
DeleteLastValidatorPower deletes the last validator power.
func (Keeper) DeleteUnbondingIndex ¶
DeleteUnbondingIndex removes a mapping from UnbondingId to unbonding operation
func (Keeper) DeleteValidatorByPowerIndex ¶
DeleteValidatorByPowerIndex deletes a record by power index
func (Keeper) DeleteValidatorQueue ¶
DeleteValidatorQueue removes a validator by address from the unbonding queue indexed by a given height and time.
func (Keeper) DeleteValidatorQueueTimeSlice ¶
func (k Keeper) DeleteValidatorQueueTimeSlice(ctx context.Context, endTime time.Time, endHeight int64) error
DeleteValidatorQueueTimeSlice deletes all entries in the queue indexed by a given height and time.
func (Keeper) DequeueAllMatureRedelegationQueue ¶
func (k Keeper) DequeueAllMatureRedelegationQueue(ctx context.Context, currTime time.Time) (matureRedelegations []types.DVVTriplet, err error)
DequeueAllMatureRedelegationQueue returns a concatenated list of all the timeslices inclusively previous to currTime, and deletes the timeslices from the queue.
func (Keeper) DequeueAllMatureUBDQueue ¶
func (k Keeper) DequeueAllMatureUBDQueue(ctx context.Context, currTime time.Time) (matureUnbonds []types.DVPair, err error)
DequeueAllMatureUBDQueue returns a concatenated list of all the timeslices inclusively previous to currTime, and deletes the timeslices from the queue.
func (*Keeper) EndBlocker ¶
EndBlocker called at every block, update validator set
func (Keeper) ExportGenesis ¶
func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState
ExportGenesis returns a GenesisState for a given context and keeper. The GenesisState will contain the pool, params, validators, and bonds found in the keeper.
func (Keeper) GetAllDelegations ¶
GetAllDelegations returns all delegations used during genesis dump.
func (Keeper) GetAllDelegatorDelegations ¶
func (k Keeper) GetAllDelegatorDelegations(ctx context.Context, delegator sdk.AccAddress) ([]types.Delegation, error)
GetAllDelegatorDelegations returns all delegations of a delegator
func (Keeper) GetAllHistoricalInfo ¶
GetAllHistoricalInfo returns all stored HistoricalInfo objects.
func (Keeper) GetAllRedelegations ¶
func (k Keeper) GetAllRedelegations( ctx context.Context, delegator sdk.AccAddress, srcValAddress, dstValAddress sdk.ValAddress, ) ([]types.Redelegation, error)
GetAllRedelegations returns all redelegations of a delegator
func (Keeper) GetAllSDKDelegations ¶
func (k Keeper) GetAllSDKDelegations(ctx context.Context) (delegations []types.Delegation, err error)
GetAllSDKDelegations returns all delegations used during genesis dump TODO: remove this func, change all usage for iterate functionality
func (Keeper) GetAllUnbondingDelegations ¶
func (k Keeper) GetAllUnbondingDelegations(ctx context.Context, delegator sdk.AccAddress) ([]types.UnbondingDelegation, error)
GetAllUnbondingDelegations returns all unbonding-delegations of a delegator
func (Keeper) GetAllValidators ¶
GetAllValidators gets the set of all validators with no limits, used during genesis dump
func (Keeper) GetAuthority ¶
GetAuthority returns the x/staking module's authority.
func (Keeper) GetBondedPool ¶
func (k Keeper) GetBondedPool(ctx context.Context) (bondedPool sdk.ModuleAccountI)
GetBondedPool returns the bonded tokens pool's module account
func (Keeper) GetBondedValidatorsByPower ¶
GetBondedValidatorsByPower gets the current group of bonded validators sorted by power-rank
func (Keeper) GetDelegation ¶
func (k Keeper) GetDelegation(ctx context.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) (types.Delegation, error)
GetDelegation returns a specific delegation.
func (Keeper) GetDelegatorBonded ¶
GetDelegatorBonded returs the total amount a delegator has bonded.
func (Keeper) GetDelegatorDelegations ¶
func (k Keeper) GetDelegatorDelegations(ctx context.Context, delegator sdk.AccAddress, maxRetrieve uint16) (delegations []types.Delegation, err error)
GetDelegatorDelegations returns a given amount of all the delegations from a delegator.
func (Keeper) GetDelegatorUnbonding ¶
func (k Keeper) GetDelegatorUnbonding(ctx context.Context, delegator sdk.AccAddress) (math.Int, error)
GetDelegatorUnbonding returns the total amount a delegator has unbonding.
func (Keeper) GetDelegatorValidator ¶
func (k Keeper) GetDelegatorValidator( ctx context.Context, delegatorAddr sdk.AccAddress, validatorAddr sdk.ValAddress, ) (validator types.Validator, err error)
GetDelegatorValidator returns a validator that a delegator is bonded to
func (Keeper) GetDelegatorValidators ¶
func (k Keeper) GetDelegatorValidators( ctx context.Context, delegatorAddr sdk.AccAddress, maxRetrieve uint32, ) (types.Validators, error)
GetDelegatorValidators returns all validators that a delegator is bonded to. If maxRetrieve is supplied, the respective amount will be returned.
func (Keeper) GetHistoricalInfo ¶
GetHistoricalInfo gets the historical info at a given height
func (Keeper) GetLastTotalPower ¶
GetLastTotalPower loads the last total validator power.
func (Keeper) GetLastValidatorPower ¶
func (k Keeper) GetLastValidatorPower(ctx context.Context, operator sdk.ValAddress) (power int64, err error)
GetLastValidatorPower loads the last validator power. Returns zero if the operator was not a validator last block.
func (Keeper) GetLastValidators ¶
GetLastValidators gets the group of the bonded validators
func (Keeper) GetNotBondedPool ¶
func (k Keeper) GetNotBondedPool(ctx context.Context) (notBondedPool sdk.ModuleAccountI)
GetNotBondedPool returns the not bonded tokens pool's module account
func (Keeper) GetPubKeyByConsAddr ¶
func (k Keeper) GetPubKeyByConsAddr(ctx context.Context, addr sdk.ConsAddress) (cmtprotocrypto.PublicKey, error)
GetPubKeyByConsAddr returns the consensus public key by consensus address.
func (Keeper) GetRedelegation ¶
func (k Keeper) GetRedelegation(ctx context.Context, delAddr sdk.AccAddress, valSrcAddr, valDstAddr sdk.ValAddress) (red types.Redelegation, err error)
GetRedelegation returns a redelegation.
func (Keeper) GetRedelegationByUnbondingID ¶
func (k Keeper) GetRedelegationByUnbondingID(ctx context.Context, id uint64) (red types.Redelegation, err error)
GetRedelegationByUnbondingID returns a unbonding delegation that has an unbonding delegation entry with a certain ID
func (Keeper) GetRedelegationQueueTimeSlice ¶
func (k Keeper) GetRedelegationQueueTimeSlice(ctx context.Context, timestamp time.Time) (dvvTriplets []types.DVVTriplet, err error)
GetRedelegationQueueTimeSlice gets a specific redelegation queue timeslice. A timeslice is a slice of DVVTriplets corresponding to redelegations that expire at a certain time.
func (Keeper) GetRedelegations ¶
func (k Keeper) GetRedelegations(ctx context.Context, delegator sdk.AccAddress, maxRetrieve uint16) (redelegations []types.Redelegation, err error)
GetRedelegations returns a given amount of all the delegator redelegations.
func (Keeper) GetRedelegationsFromSrcValidator ¶
func (k Keeper) GetRedelegationsFromSrcValidator(ctx context.Context, valAddr sdk.ValAddress) (reds []types.Redelegation, err error)
GetRedelegationsFromSrcValidator returns all redelegations from a particular validator.
func (Keeper) GetUBDQueueTimeSlice ¶
func (k Keeper) GetUBDQueueTimeSlice(ctx context.Context, timestamp time.Time) (dvPairs []types.DVPair, err error)
GetUBDQueueTimeSlice gets a specific unbonding queue timeslice. A timeslice is a slice of DVPairs corresponding to unbonding delegations that expire at a certain time.
func (Keeper) GetUnbondingDelegation ¶
func (k Keeper) GetUnbondingDelegation(ctx context.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) (ubd types.UnbondingDelegation, err error)
GetUnbondingDelegation returns a unbonding delegation.
func (Keeper) GetUnbondingDelegationByUnbondingID ¶
func (k Keeper) GetUnbondingDelegationByUnbondingID(ctx context.Context, id uint64) (ubd types.UnbondingDelegation, err error)
GetUnbondingDelegationByUnbondingID returns a unbonding delegation that has an unbonding delegation entry with a certain ID
func (Keeper) GetUnbondingDelegations ¶
func (k Keeper) GetUnbondingDelegations(ctx context.Context, delegator sdk.AccAddress, maxRetrieve uint16) (unbondingDelegations []types.UnbondingDelegation, err error)
GetUnbondingDelegations returns a given amount of all the delegator unbonding-delegations.
func (Keeper) GetUnbondingDelegationsFromValidator ¶
func (k Keeper) GetUnbondingDelegationsFromValidator(ctx context.Context, valAddr sdk.ValAddress) (ubds []types.UnbondingDelegation, err error)
GetUnbondingDelegationsFromValidator returns all unbonding delegations from a particular validator.
func (Keeper) GetUnbondingType ¶
func (k Keeper) GetUnbondingType(ctx context.Context, id uint64) (unbondingType types.UnbondingType, err error)
GetUnbondingType returns the enum type of unbonding which is any of {UnbondingDelegation | Redelegation | ValidatorUnbonding}
func (Keeper) GetUnbondingValidators ¶
func (k Keeper) GetUnbondingValidators(ctx context.Context, endTime time.Time, endHeight int64) ([]string, error)
GetUnbondingValidators returns a slice of mature validator addresses that complete their unbonding at a given time and height.
func (Keeper) GetValidator ¶
func (k Keeper) GetValidator(ctx context.Context, addr sdk.ValAddress) (validator types.Validator, err error)
GetValidator gets a single validator
func (Keeper) GetValidatorByConsAddr ¶
func (k Keeper) GetValidatorByConsAddr(ctx context.Context, consAddr sdk.ConsAddress) (validator types.Validator, err error)
GetValidatorByConsAddr gets a single validator by consensus address
func (Keeper) GetValidatorByUnbondingID ¶
func (k Keeper) GetValidatorByUnbondingID(ctx context.Context, id uint64) (val types.Validator, err error)
GetValidatorByUnbondingID returns the validator that is unbonding with a certain unbonding op ID
func (Keeper) GetValidatorDelegations ¶
func (k Keeper) GetValidatorDelegations(ctx context.Context, valAddr sdk.ValAddress) (delegations []types.Delegation, err error)
GetValidatorDelegations returns all delegations to a specific validator. Useful for querier.
func (Keeper) GetValidatorSet ¶
func (k Keeper) GetValidatorSet() types.ValidatorSet
GetValidatorSet returns self as it is both a validatorset and delegationset
func (Keeper) GetValidatorUpdates ¶
GetValidatorUpdates returns the ABCI validator power updates within the current block.
func (Keeper) GetValidators ¶
func (k Keeper) GetValidators(ctx context.Context, maxRetrieve uint32) (validators []types.Validator, err error)
GetValidators returns a given amount of all the validators
func (Keeper) HasMaxRedelegationEntries ¶
func (k Keeper) HasMaxRedelegationEntries(ctx context.Context, delegatorAddr sdk.AccAddress, validatorSrcAddr, validatorDstAddr sdk.ValAddress) (bool, error)
HasMaxRedelegationEntries checks if the redelegation entries reached maximum limit.
func (Keeper) HasMaxUnbondingDelegationEntries ¶
func (k Keeper) HasMaxUnbondingDelegationEntries(ctx context.Context, delegatorAddr sdk.AccAddress, validatorAddr sdk.ValAddress) (bool, error)
HasMaxUnbondingDelegationEntries checks if unbonding delegation has maximum number of entries.
func (Keeper) HasReceivingRedelegation ¶
func (k Keeper) HasReceivingRedelegation(ctx context.Context, delAddr sdk.AccAddress, valDstAddr sdk.ValAddress) (bool, error)
HasReceivingRedelegation checks if validator is receiving a redelegation.
func (Keeper) HistoricalEntries ¶
HistoricalEntries = number of historical info entries to persist in store
func (*Keeper) Hooks ¶
func (k *Keeper) Hooks() types.StakingHooks
Hooks gets the hooks for staking *Keeper {
func (Keeper) IncrementUnbondingID ¶
IncrementUnbondingID increments and returns a unique ID for an unbonding operation
func (Keeper) InitGenesis ¶
func (k Keeper) InitGenesis(ctx context.Context, data *types.GenesisState) (res []abci.ValidatorUpdate)
InitGenesis sets the pool and parameters for the provided keeper. For each validator in data, it sets that validator in the keeper along with manually setting the indexes. In addition, it also sets any delegations found in data. Finally, it updates the bonded validators. Returns final validator set after applying all declaration and delegations
func (Keeper) InsertRedelegationQueue ¶
func (k Keeper) InsertRedelegationQueue(ctx context.Context, red types.Redelegation, completionTime time.Time) error
InsertRedelegationQueue insert an redelegation delegation to the appropriate timeslice in the redelegation queue.
func (Keeper) InsertUBDQueue ¶
func (k Keeper) InsertUBDQueue(ctx context.Context, ubd types.UnbondingDelegation, completionTime time.Time) error
InsertUBDQueue inserts an unbonding delegation to the appropriate timeslice in the unbonding queue.
func (Keeper) InsertUnbondingValidatorQueue ¶
InsertUnbondingValidatorQueue inserts a given unbonding validator address into the unbonding validator queue for a given height and time.
func (Keeper) IsValidatorJailed ¶
IsValidatorJailed checks and returns boolean of a validator status jailed or not.
func (Keeper) IterateAllDelegations ¶
func (k Keeper) IterateAllDelegations(ctx context.Context, cb func(delegation types.Delegation) (stop bool)) error
IterateAllDelegations iterates through all of the delegations.
func (Keeper) IterateBondedValidatorsByPower ¶
func (k Keeper) IterateBondedValidatorsByPower(ctx context.Context, fn func(index int64, validator types.ValidatorI) (stop bool)) error
IterateBondedValidatorsByPower iterates through the bonded validator set and perform the provided function
func (Keeper) IterateDelegations ¶
func (k Keeper) IterateDelegations(ctx context.Context, delAddr sdk.AccAddress, fn func(index int64, del types.DelegationI) (stop bool), ) error
IterateDelegations iterates through all of the delegations from a delegator
func (Keeper) IterateDelegatorDelegations ¶
func (k Keeper) IterateDelegatorDelegations(ctx context.Context, delegator sdk.AccAddress, cb func(delegation types.Delegation) (stop bool)) error
IterateDelegatorDelegations iterates through one delegator's delegations.
func (Keeper) IterateDelegatorRedelegations ¶
func (k Keeper) IterateDelegatorRedelegations(ctx context.Context, delegator sdk.AccAddress, cb func(red types.Redelegation) (stop bool)) error
IterateDelegatorRedelegations iterates through one delegator's redelegations.
func (Keeper) IterateDelegatorUnbondingDelegations ¶
func (k Keeper) IterateDelegatorUnbondingDelegations(ctx context.Context, delegator sdk.AccAddress, cb func(ubd types.UnbondingDelegation) (stop bool)) error
IterateDelegatorUnbondingDelegations iterates through a delegator's unbonding delegations.
func (Keeper) IterateHistoricalInfo ¶
func (k Keeper) IterateHistoricalInfo(ctx context.Context, cb func(types.HistoricalInfo) bool) error
IterateHistoricalInfo provides an iterator over all stored HistoricalInfo objects. For each HistoricalInfo object, cb will be called. If the cb returns true, the iterator will break and close.
func (Keeper) IterateLastValidatorPowers ¶
func (k Keeper) IterateLastValidatorPowers(ctx context.Context, handler func(operator sdk.ValAddress, power int64) (stop bool)) error
IterateLastValidatorPowers iterates over last validator powers.
func (Keeper) IterateLastValidators ¶
func (k Keeper) IterateLastValidators(ctx context.Context, fn func(index int64, validator types.ValidatorI) (stop bool)) error
IterateLastValidators iterates through the active validator set and perform the provided function
func (Keeper) IterateRedelegations ¶
func (k Keeper) IterateRedelegations(ctx context.Context, fn func(index int64, red types.Redelegation) (stop bool)) error
IterateRedelegations iterates through all redelegations.
func (Keeper) IterateUnbondingDelegations ¶
func (k Keeper) IterateUnbondingDelegations(ctx context.Context, fn func(index int64, ubd types.UnbondingDelegation) (stop bool)) error
IterateUnbondingDelegations iterates through all of the unbonding delegations.
func (Keeper) IterateValidators ¶
func (k Keeper) IterateValidators(ctx context.Context, fn func(index int64, validator types.ValidatorI) (stop bool)) error
IterateValidators iterates through the validator set and perform the provided function
func (Keeper) LastValidatorsIterator ¶
lastValidatorsIterator returns an iterator for the consensus validators in the last block
func (Keeper) MaxEntries ¶
MaxEntries - Maximum number of simultaneous unbonding delegations or redelegations (per pair/trio)
func (Keeper) MaxValidators ¶
MaxValidators - Maximum number of validators
func (Keeper) MinCommissionRate ¶
MinCommissionRate - Minimum validator commission rate
func (Keeper) PowerReduction ¶
PowerReduction - is the amount of staking tokens required for 1 unit of consensus-engine power. Currently, this returns a global variable that the app developer can tweak. TODO: we might turn this into an on-chain param: https://github.com/cosmos/cosmos-sdk/issues/8365
func (Keeper) PutUnbondingOnHold ¶
PutUnbondingOnHold allows an external module to stop an unbonding operation, such as an unbonding delegation, a redelegation, or a validator unbonding. In order for the unbonding operation with `id` to eventually complete, every call to PutUnbondingOnHold(id) must be matched by a call to UnbondingCanComplete(id).
func (Keeper) RedelegationQueueIterator ¶
func (k Keeper) RedelegationQueueIterator(ctx context.Context, endTime time.Time) (storetypes.Iterator, error)
RedelegationQueueIterator returns all the redelegation queue timeslices from time 0 until endTime.
func (Keeper) RemoveDelegation ¶
RemoveDelegation removes a delegation
func (Keeper) RemoveRedelegation ¶
RemoveRedelegation removes a redelegation object and associated index.
func (Keeper) RemoveUnbondingDelegation ¶
RemoveUnbondingDelegation removes the unbonding delegation object and associated index.
func (Keeper) RemoveValidator ¶
RemoveValidator removes the validator record and associated indexes except for the bonded validator index which is only handled in ApplyAndReturnTendermintUpdates
func (Keeper) RemoveValidatorTokens ¶
func (k Keeper) RemoveValidatorTokens(ctx context.Context, validator types.Validator, tokensToRemove math.Int, ) (types.Validator, error)
RemoveValidatorTokens updates the tokens of an existing validator, updates the validators power index key
func (Keeper) RemoveValidatorTokensAndShares ¶
func (k Keeper) RemoveValidatorTokensAndShares(ctx context.Context, validator types.Validator, sharesToRemove math.LegacyDec, ) (valOut types.Validator, removedTokens math.Int, err error)
RemoveValidatorTokensAndShares updates the tokens of an existing validator, updates the validators power index key
func (Keeper) SetDelegation ¶
SetDelegation sets a delegation.
func (Keeper) SetHistoricalInfo ¶
func (k Keeper) SetHistoricalInfo(ctx context.Context, height int64, hi *types.HistoricalInfo) error
SetHistoricalInfo sets the historical info at a given height
func (*Keeper) SetHooks ¶
func (k *Keeper) SetHooks(sh types.StakingHooks)
SetHooks sets the validator hooks. In contrast to other receivers, this method must take a pointer due to nature of the hooks interface and SDK start up sequence.
func (Keeper) SetLastTotalPower ¶
SetLastTotalPower sets the last total validator power.
func (Keeper) SetLastValidatorPower ¶
func (k Keeper) SetLastValidatorPower(ctx context.Context, operator sdk.ValAddress, power int64) error
SetLastValidatorPower sets the last validator power.
func (Keeper) SetNewValidatorByPowerIndex ¶
SetNewValidatorByPowerIndex adds new entry by power index
func (Keeper) SetParams ¶
SetParams sets the x/staking module parameters. CONTRACT: This method performs no validation of the parameters.
func (Keeper) SetRedelegation ¶
SetRedelegation sets a redelegation and associated index.
func (Keeper) SetRedelegationByUnbondingID ¶
func (k Keeper) SetRedelegationByUnbondingID(ctx context.Context, red types.Redelegation, id uint64) error
SetRedelegationByUnbondingID sets an index to look up an Redelegation by the unbondingID of an RedelegationEntry that it contains Note, it does not set the redelegation itself, use SetRedelegation(ctx, red) for that
func (Keeper) SetRedelegationEntry ¶
func (k Keeper) SetRedelegationEntry(ctx context.Context, delegatorAddr sdk.AccAddress, validatorSrcAddr, validatorDstAddr sdk.ValAddress, creationHeight int64, minTime time.Time, balance math.Int, sharesSrc, sharesDst math.LegacyDec, ) (types.Redelegation, error)
SetRedelegationEntry adds an entry to the unbonding delegation at the given addresses. It creates the unbonding delegation if it does not exist.
func (Keeper) SetRedelegationQueueTimeSlice ¶
func (k Keeper) SetRedelegationQueueTimeSlice(ctx context.Context, timestamp time.Time, keys []types.DVVTriplet) error
SetRedelegationQueueTimeSlice sets a specific redelegation queue timeslice.
func (Keeper) SetUBDQueueTimeSlice ¶
func (k Keeper) SetUBDQueueTimeSlice(ctx context.Context, timestamp time.Time, keys []types.DVPair) error
SetUBDQueueTimeSlice sets a specific unbonding queue timeslice.
func (Keeper) SetUnbondingDelegation ¶
SetUnbondingDelegation sets the unbonding delegation and associated index.
func (Keeper) SetUnbondingDelegationByUnbondingID ¶
func (k Keeper) SetUnbondingDelegationByUnbondingID(ctx context.Context, ubd types.UnbondingDelegation, id uint64) error
SetUnbondingDelegationByUnbondingID sets an index to look up an UnbondingDelegation by the unbondingID of an UnbondingDelegationEntry that it contains Note, it does not set the unbonding delegation itself, use SetUnbondingDelegation(ctx, ubd) for that
func (Keeper) SetUnbondingDelegationEntry ¶
func (k Keeper) SetUnbondingDelegationEntry( ctx context.Context, delegatorAddr sdk.AccAddress, validatorAddr sdk.ValAddress, creationHeight int64, minTime time.Time, balance math.Int, ) (types.UnbondingDelegation, error)
SetUnbondingDelegationEntry adds an entry to the unbonding delegation at the given addresses. It creates the unbonding delegation if it does not exist.
func (Keeper) SetUnbondingType ¶
func (k Keeper) SetUnbondingType(ctx context.Context, id uint64, unbondingType types.UnbondingType) error
SetUnbondingType sets the enum type of unbonding which is any of {UnbondingDelegation | Redelegation | ValidatorUnbonding}
func (Keeper) SetUnbondingValidatorsQueue ¶
func (k Keeper) SetUnbondingValidatorsQueue(ctx context.Context, endTime time.Time, endHeight int64, addrs []string) error
SetUnbondingValidatorsQueue sets a given slice of validator addresses into the unbonding validator queue by a given height and time.
func (Keeper) SetValidator ¶
SetValidator sets the main record holding validator details
func (Keeper) SetValidatorByConsAddr ¶
SetValidatorByConsAddr sets a validator by conesensus address
func (Keeper) SetValidatorByPowerIndex ¶
SetValidatorByPowerIndex sets a validator by power index
func (Keeper) SetValidatorByUnbondingID ¶
func (k Keeper) SetValidatorByUnbondingID(ctx context.Context, val types.Validator, id uint64) error
SetValidatorByUnbondingID sets an index to look up a Validator by the unbondingID corresponding to its current unbonding Note, it does not set the validator itself, use SetValidator(ctx, val) for that
func (Keeper) SetValidatorUpdates ¶
SetValidatorUpdates sets the ABCI validator power updates for the current block.
func (Keeper) Slash ¶
func (k Keeper) Slash(ctx context.Context, consAddr sdk.ConsAddress, infractionHeight, power int64, slashFactor math.LegacyDec) (math.Int, error)
Slash a validator for an infraction committed at a known height Find the contributing stake at that height and burn the specified slashFactor of it, updating unbonding delegations & redelegations appropriately
CONTRACT:
slashFactor is non-negative
CONTRACT:
Infraction was committed equal to or less than an unbonding period in the past, so all unbonding delegations and redelegations from that height are stored
CONTRACT:
Slash will not slash unbonded validators (for the above reason)
CONTRACT:
Infraction was committed at the current height or at a past height, but not at a height in the future
func (Keeper) SlashRedelegation ¶
func (k Keeper) SlashRedelegation(ctx context.Context, srcValidator types.Validator, redelegation types.Redelegation, infractionHeight int64, slashFactor math.LegacyDec, ) (totalSlashAmount math.Int, err error)
slash a redelegation and update the pool return the amount that would have been slashed assuming the unbonding delegation had enough stake to slash (the amount actually slashed may be less if there's insufficient stake remaining) NOTE this is only slashing for prior infractions from the source validator
func (Keeper) SlashUnbondingDelegation ¶
func (k Keeper) SlashUnbondingDelegation(ctx context.Context, unbondingDelegation types.UnbondingDelegation, infractionHeight int64, slashFactor math.LegacyDec, ) (totalSlashAmount math.Int, err error)
slash an unbonding delegation and update the pool return the amount that would have been slashed assuming the unbonding delegation had enough stake to slash (the amount actually slashed may be less if there's insufficient stake remaining)
func (Keeper) SlashWithInfractionReason ¶
func (k Keeper) SlashWithInfractionReason(ctx context.Context, consAddr sdk.ConsAddress, infractionHeight, power int64, slashFactor math.LegacyDec, _ types.Infraction) (math.Int, error)
SlashWithInfractionReason implementation doesn't require the infraction (types.Infraction) to work but is required by Interchain Security.
func (Keeper) StakingTokenSupply ¶
StakingTokenSupply staking tokens from the total supply
func (Keeper) TokensFromConsensusPower ¶
TokensFromConsensusPower converts input power to tokens
func (Keeper) TokensToConsensusPower ¶
TokensToConsensusPower converts input tokens to potential consensus-engine power
func (Keeper) TotalBondedTokens ¶
TotalBondedTokens total staking tokens supply which is bonded
func (Keeper) TrackHistoricalInfo ¶
TrackHistoricalInfo saves the latest historical-info and deletes the oldest heights that are below pruning height
func (Keeper) UBDQueueIterator ¶
func (k Keeper) UBDQueueIterator(ctx context.Context, endTime time.Time) (corestore.Iterator, error)
UBDQueueIterator returns all the unbonding queue timeslices from time 0 until endTime.
func (Keeper) Unbond ¶
func (k Keeper) Unbond( ctx context.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress, shares math.LegacyDec, ) (amount math.Int, err error)
Unbond unbonds a particular delegation and perform associated store operations.
func (Keeper) UnbondAllMatureValidators ¶
UnbondAllMatureValidators unbonds all the mature unbonding validators that have finished their unbonding period.
func (Keeper) UnbondingCanComplete ¶
UnbondingCanComplete allows a stopped unbonding operation, such as an unbonding delegation, a redelegation, or a validator unbonding to complete. In order for the unbonding operation with `id` to eventually complete, every call to PutUnbondingOnHold(id) must be matched by a call to UnbondingCanComplete(id).
func (Keeper) UnbondingTime ¶
UnbondingTime - The time duration for unbonding
func (Keeper) UnbondingToUnbonded ¶
func (k Keeper) UnbondingToUnbonded(ctx context.Context, validator types.Validator) (types.Validator, error)
UnbondingToUnbonded switches a validator from unbonding state to unbonded state
func (Keeper) Undelegate ¶
func (k Keeper) Undelegate( ctx context.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress, sharesAmount math.LegacyDec, ) (time.Time, math.Int, error)
Undelegate unbonds an amount of delegator shares from a given validator. It will verify that the unbonding entries between the delegator and validator are not exceeded and unbond the staked tokens (based on shares) by creating an unbonding object and inserting it into the unbonding queue which will be processed during the staking EndBlocker.
func (Keeper) UpdateValidatorCommission ¶
func (k Keeper) UpdateValidatorCommission(ctx context.Context, validator types.Validator, newRate math.LegacyDec, ) (types.Commission, error)
UpdateValidatorCommission attempts to update a validator's commission rate. An error is returned if the new commission rate is invalid.
func (Keeper) ValidateUnbondAmount ¶
func (k Keeper) ValidateUnbondAmount( ctx context.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress, amt math.Int, ) (shares math.LegacyDec, err error)
ValidateUnbondAmount validates that a given unbond or redelegation amount is valid based on upon the converted shares. If the amount is valid, the total amount of respective shares is returned, otherwise an error is returned.
func (Keeper) Validator ¶
func (k Keeper) Validator(ctx context.Context, address sdk.ValAddress) (types.ValidatorI, error)
Validator gets the Validator interface for a particular address
func (Keeper) ValidatorAddressCodec ¶
func (k Keeper) ValidatorAddressCodec() addresscodec.Codec
ValidatorAddressCodec returns the app validator address codec.
func (Keeper) ValidatorByConsAddr ¶
func (k Keeper) ValidatorByConsAddr(ctx context.Context, addr sdk.ConsAddress) (types.ValidatorI, error)
ValidatorByConsAddr gets the validator interface for a particular pubkey
func (Keeper) ValidatorQueueIterator ¶
func (k Keeper) ValidatorQueueIterator(ctx context.Context, endTime time.Time, endHeight int64) (corestore.Iterator, error)
ValidatorQueueIterator returns an interator ranging over validators that are unbonding whose unbonding completion occurs at the given height and time.
type Migrator ¶
type Migrator struct {
// contains filtered or unexported fields
}
Migrator is a struct for handling in-place store migrations.
func NewMigrator ¶
NewMigrator returns a new Migrator instance.
func (Migrator) Migrate1to2 ¶
Migrate1to2 migrates from version 1 to 2.
func (Migrator) Migrate2to3 ¶
Migrate2to3 migrates x/staking state from consensus version 2 to 3.
func (Migrator) Migrate3to4 ¶
Migrate3to4 migrates x/staking state from consensus version 3 to 4.
type Querier ¶
type Querier struct {
*Keeper
}
Querier is used as Keeper will have duplicate methods if used directly, and gRPC names take precedence over keeper
func NewQuerier ¶
func (Querier) Delegation ¶
func (k Querier) Delegation(ctx context.Context, req *types.QueryDelegationRequest) (*types.QueryDelegationResponse, error)
Delegation queries delegate info for given validator delegator pair
func (Querier) DelegatorDelegations ¶
func (k Querier) DelegatorDelegations(ctx context.Context, req *types.QueryDelegatorDelegationsRequest) (*types.QueryDelegatorDelegationsResponse, error)
DelegatorDelegations queries all delegations of a given delegator address
func (Querier) DelegatorUnbondingDelegations ¶
func (k Querier) DelegatorUnbondingDelegations(ctx context.Context, req *types.QueryDelegatorUnbondingDelegationsRequest) (*types.QueryDelegatorUnbondingDelegationsResponse, error)
DelegatorUnbondingDelegations queries all unbonding delegations of a given delegator address
func (Querier) DelegatorValidator ¶
func (k Querier) DelegatorValidator(ctx context.Context, req *types.QueryDelegatorValidatorRequest) (*types.QueryDelegatorValidatorResponse, error)
DelegatorValidator queries validator info for given delegator validator pair
func (Querier) DelegatorValidators ¶
func (k Querier) DelegatorValidators(ctx context.Context, req *types.QueryDelegatorValidatorsRequest) (*types.QueryDelegatorValidatorsResponse, error)
DelegatorValidators queries all validators info for given delegator address
func (Querier) HistoricalInfo ¶
func (k Querier) HistoricalInfo(ctx context.Context, req *types.QueryHistoricalInfoRequest) (*types.QueryHistoricalInfoResponse, error)
HistoricalInfo queries the historical info for given height
func (Querier) Params ¶
func (k Querier) Params(ctx context.Context, _ *types.QueryParamsRequest) (*types.QueryParamsResponse, error)
Params queries the staking parameters
func (Querier) Pool ¶
func (k Querier) Pool(ctx context.Context, _ *types.QueryPoolRequest) (*types.QueryPoolResponse, error)
Pool queries the pool info
func (Querier) Redelegations ¶
func (k Querier) Redelegations(ctx context.Context, req *types.QueryRedelegationsRequest) (*types.QueryRedelegationsResponse, error)
Redelegations queries redelegations of given address
func (Querier) UnbondingDelegation ¶
func (k Querier) UnbondingDelegation(ctx context.Context, req *types.QueryUnbondingDelegationRequest) (*types.QueryUnbondingDelegationResponse, error)
UnbondingDelegation queries unbonding info for given validator delegator pair
func (Querier) Validator ¶
func (k Querier) Validator(ctx context.Context, req *types.QueryValidatorRequest) (*types.QueryValidatorResponse, error)
Validator queries validator info for given validator address
func (Querier) ValidatorDelegations ¶
func (k Querier) ValidatorDelegations(ctx context.Context, req *types.QueryValidatorDelegationsRequest) (*types.QueryValidatorDelegationsResponse, error)
ValidatorDelegations queries delegate info for given validator
func (Querier) ValidatorUnbondingDelegations ¶
func (k Querier) ValidatorUnbondingDelegations(ctx context.Context, req *types.QueryValidatorUnbondingDelegationsRequest) (*types.QueryValidatorUnbondingDelegationsResponse, error)
ValidatorUnbondingDelegations queries unbonding delegations of a validator
func (Querier) Validators ¶
func (k Querier) Validators(ctx context.Context, req *types.QueryValidatorsRequest) (*types.QueryValidatorsResponse, error)
Validators queries all validators that match the given status