cosmos-sdk: github.com/cosmos/cosmos-sdk/x/staking/keeper Index | Files

package keeper

import "github.com/cosmos/cosmos-sdk/x/staking/keeper"

Index

Package Files

alias_functions.go delegation.go grpc_query.go historical_info.go hooks.go invariants.go keeper.go params.go pool.go querier.go query_utils.go slash.go test_common.go val_state_change.go validator.go

func AllInvariants Uses

func AllInvariants(k Keeper) sdk.Invariant

AllInvariants runs all invariants of the staking module.

func DelegationToDelegationResponse Uses

func DelegationToDelegationResponse(ctx sdk.Context, k Keeper, del types.Delegation) (types.DelegationResponse, error)

func DelegationsToDelegationResponses Uses

func DelegationsToDelegationResponses(
    ctx sdk.Context, k Keeper, delegations types.Delegations,
) (types.DelegationResponses, error)

func DelegatorSharesInvariant Uses

func DelegatorSharesInvariant(k Keeper) sdk.Invariant

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 Uses

func ModuleAccountInvariants(k Keeper) sdk.Invariant

ModuleAccountInvariants checks that the bonded and notBonded ModuleAccounts pools reflects the tokens actively bonded and not bonded

func NewQuerier Uses

func NewQuerier(k Keeper, legacyQuerierCdc codec.JSONMarshaler) sdk.Querier

creates a querier for staking REST endpoints

func NonNegativePowerInvariant Uses

func NonNegativePowerInvariant(k Keeper) sdk.Invariant

NonNegativePowerInvariant checks that all stored validators have >= 0 power.

func PositiveDelegationInvariant Uses

func PositiveDelegationInvariant(k Keeper) sdk.Invariant

PositiveDelegationInvariant checks that all stored delegations have > 0 shares.

func RandomValidator Uses

func RandomValidator(r *rand.Rand, keeper Keeper, ctx sdk.Context) (val types.Validator, ok bool)

RandomValidator returns a random validator given access to the keeper and ctx

func RedelegationsToRedelegationResponses Uses

func RedelegationsToRedelegationResponses(
    ctx sdk.Context, k Keeper, redels types.Redelegations,
) (types.RedelegationResponses, error)

func RegisterInvariants Uses

func RegisterInvariants(ir sdk.InvariantRegistry, k Keeper)

RegisterInvariants registers all staking invariants

func TestingUpdateValidator Uses

func TestingUpdateValidator(keeper Keeper, ctx sdk.Context, validator types.Validator, apply bool) types.Validator

update validator for testing

func ValidatorByPowerIndexExists Uses

func ValidatorByPowerIndexExists(ctx sdk.Context, keeper Keeper, power []byte) bool

does a certain by-power index record exist

type Keeper Uses

type Keeper struct {
    // contains filtered or unexported fields
}

keeper of the staking store

func NewKeeper Uses

func NewKeeper(
    cdc codec.BinaryMarshaler, key sdk.StoreKey, ak types.AccountKeeper, bk types.BankKeeper,
    ps paramtypes.Subspace,
) Keeper

NewKeeper creates a new staking Keeper instance

func (Keeper) AddValidatorTokensAndShares Uses

func (k Keeper) AddValidatorTokensAndShares(ctx sdk.Context, validator types.Validator,
    tokensToAdd sdk.Int) (valOut types.Validator, addedShares sdk.Dec)

Update the tokens of an existing validator, update the validators power index key

func (Keeper) AfterDelegationModified Uses

func (k Keeper) AfterDelegationModified(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress)

AfterDelegationModified - call hook if registered

func (Keeper) AfterValidatorBeginUnbonding Uses

func (k Keeper) AfterValidatorBeginUnbonding(ctx sdk.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress)

AfterValidatorBeginUnbonding - call hook if registered

func (Keeper) AfterValidatorBonded Uses

func (k Keeper) AfterValidatorBonded(ctx sdk.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress)

AfterValidatorBonded - call hook if registered

func (Keeper) AfterValidatorCreated Uses

func (k Keeper) AfterValidatorCreated(ctx sdk.Context, valAddr sdk.ValAddress)

AfterValidatorCreated - call hook if registered

func (Keeper) AfterValidatorRemoved Uses

func (k Keeper) AfterValidatorRemoved(ctx sdk.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress)

AfterValidatorRemoved - call hook if registered

func (Keeper) ApplyAndReturnValidatorSetUpdates Uses

func (k Keeper) ApplyAndReturnValidatorSetUpdates(ctx sdk.Context) (updates []abci.ValidatorUpdate)

Apply 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 Tendermint.

func (Keeper) BeforeDelegationCreated Uses

func (k Keeper) BeforeDelegationCreated(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress)

BeforeDelegationCreated - call hook if registered

func (Keeper) BeforeDelegationRemoved Uses

func (k Keeper) BeforeDelegationRemoved(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress)

BeforeDelegationRemoved - call hook if registered

func (Keeper) BeforeDelegationSharesModified Uses

func (k Keeper) BeforeDelegationSharesModified(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress)

BeforeDelegationSharesModified - call hook if registered

func (Keeper) BeforeValidatorModified Uses

func (k Keeper) BeforeValidatorModified(ctx sdk.Context, valAddr sdk.ValAddress)

BeforeValidatorModified - call hook if registered

func (Keeper) BeforeValidatorSlashed Uses

func (k Keeper) BeforeValidatorSlashed(ctx sdk.Context, valAddr sdk.ValAddress, fraction sdk.Dec)

BeforeValidatorSlashed - call hook if registered

func (Keeper) BeginRedelegation Uses

func (k Keeper) BeginRedelegation(
    ctx sdk.Context, delAddr sdk.AccAddress, valSrcAddr, valDstAddr sdk.ValAddress, sharesAmount sdk.Dec,
) (completionTime time.Time, err error)

begin unbonding / redelegation; create a redelegation record

func (Keeper) BlockValidatorUpdates Uses

func (k Keeper) BlockValidatorUpdates(ctx sdk.Context) []abci.ValidatorUpdate

Calculate the ValidatorUpdates for the current block Called in each EndBlock

func (Keeper) BondDenom Uses

func (k Keeper) BondDenom(ctx sdk.Context) (res string)

BondDenom - Bondable coin denomination

func (Keeper) BondedRatio Uses

func (k Keeper) BondedRatio(ctx sdk.Context) sdk.Dec

BondedRatio the fraction of the staking tokens which are currently bonded

func (Keeper) CompleteRedelegation Uses

func (k Keeper) CompleteRedelegation(
    ctx sdk.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 Uses

func (k Keeper) CompleteUnbonding(ctx sdk.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) Delegate Uses

func (k Keeper) Delegate(
    ctx sdk.Context, delAddr sdk.AccAddress, bondAmt sdk.Int, tokenSrc sdk.BondStatus,
    validator types.Validator, subtractAccount bool,
) (newShares sdk.Dec, err error)

Perform a delegation, set/update everything necessary within the store. tokenSrc indicates the bond status of the incoming funds.

func (Keeper) Delegation Uses

func (k Keeper) Delegation(ctx sdk.Context, addrDel sdk.AccAddress, addrVal sdk.ValAddress) exported.DelegationI

Delegation get the delegation interface for a particular set of delegator and validator addresses

func (Keeper) DeleteHistoricalInfo Uses

func (k Keeper) DeleteHistoricalInfo(ctx sdk.Context, height int64)

DeleteHistoricalInfo deletes the historical info at a given height

func (Keeper) DeleteLastValidatorPower Uses

func (k Keeper) DeleteLastValidatorPower(ctx sdk.Context, operator sdk.ValAddress)

Delete the last validator power.

func (Keeper) DeleteValidatorByPowerIndex Uses

func (k Keeper) DeleteValidatorByPowerIndex(ctx sdk.Context, validator types.Validator)

validator index

func (Keeper) DeleteValidatorQueue Uses

func (k Keeper) DeleteValidatorQueue(ctx sdk.Context, val types.Validator)

DeleteValidatorQueue removes a validator by address from the unbonding queue indexed by a given height and time.

func (Keeper) DeleteValidatorQueueTimeSlice Uses

func (k Keeper) DeleteValidatorQueueTimeSlice(ctx sdk.Context, endTime time.Time, endHeight int64)

DeleteValidatorQueueTimeSlice deletes all entries in the queue indexed by a given height and time.

func (Keeper) DequeueAllMatureRedelegationQueue Uses

func (k Keeper) DequeueAllMatureRedelegationQueue(ctx sdk.Context, currTime time.Time) (matureRedelegations []types.DVVTriplet)

Returns a concatenated list of all the timeslices inclusively previous to currTime, and deletes the timeslices from the queue

func (Keeper) DequeueAllMatureUBDQueue Uses

func (k Keeper) DequeueAllMatureUBDQueue(ctx sdk.Context, currTime time.Time) (matureUnbonds []types.DVPair)

Returns a concatenated list of all the timeslices inclusively previous to currTime, and deletes the timeslices from the queue

func (Keeper) GetAllDelegations Uses

func (k Keeper) GetAllDelegations(ctx sdk.Context) (delegations []types.Delegation)

GetAllDelegations returns all delegations used during genesis dump

func (Keeper) GetAllDelegatorDelegations Uses

func (k Keeper) GetAllDelegatorDelegations(ctx sdk.Context, delegator sdk.AccAddress) []types.Delegation

return all delegations for a delegator

func (Keeper) GetAllHistoricalInfo Uses

func (k Keeper) GetAllHistoricalInfo(ctx sdk.Context) []types.HistoricalInfo

GetAllHistoricalInfo returns all stored HistoricalInfo objects.

func (Keeper) GetAllRedelegations Uses

func (k Keeper) GetAllRedelegations(
    ctx sdk.Context, delegator sdk.AccAddress, srcValAddress, dstValAddress sdk.ValAddress,
) []types.Redelegation

return all redelegations for a delegator

func (Keeper) GetAllSDKDelegations Uses

func (k Keeper) GetAllSDKDelegations(ctx sdk.Context) (delegations []types.Delegation)

return all delegations used during genesis dump TODO: remove this func, change all usage for iterate functionality

func (Keeper) GetAllUnbondingDelegations Uses

func (k Keeper) GetAllUnbondingDelegations(ctx sdk.Context, delegator sdk.AccAddress) []types.UnbondingDelegation

return all unbonding-delegations for a delegator

func (Keeper) GetAllValidators Uses

func (k Keeper) GetAllValidators(ctx sdk.Context) (validators []types.Validator)

get the set of all validators with no limits, used during genesis dump

func (Keeper) GetBondedPool Uses

func (k Keeper) GetBondedPool(ctx sdk.Context) (bondedPool authtypes.ModuleAccountI)

GetBondedPool returns the bonded tokens pool's module account

func (Keeper) GetBondedValidatorsByPower Uses

func (k Keeper) GetBondedValidatorsByPower(ctx sdk.Context) []types.Validator

get the current group of bonded validators sorted by power-rank

func (Keeper) GetDelegation Uses

func (k Keeper) GetDelegation(ctx sdk.Context,
    delAddr sdk.AccAddress, valAddr sdk.ValAddress) (delegation types.Delegation, found bool)

return a specific delegation

func (Keeper) GetDelegatorDelegations Uses

func (k Keeper) GetDelegatorDelegations(ctx sdk.Context, delegator sdk.AccAddress,
    maxRetrieve uint16) (delegations []types.Delegation)

return a given amount of all the delegations from a delegator

func (Keeper) GetDelegatorValidator Uses

func (k Keeper) GetDelegatorValidator(
    ctx sdk.Context, delegatorAddr sdk.AccAddress, validatorAddr sdk.ValAddress,
) (validator types.Validator, err error)

return a validator that a delegator is bonded to

func (Keeper) GetDelegatorValidators Uses

func (k Keeper) GetDelegatorValidators(
    ctx sdk.Context, delegatorAddr sdk.AccAddress, maxRetrieve uint32,
) []types.Validator

Return all validators that a delegator is bonded to. If maxRetrieve is supplied, the respective amount will be returned.

func (Keeper) GetHistoricalInfo Uses

func (k Keeper) GetHistoricalInfo(ctx sdk.Context, height int64) (types.HistoricalInfo, bool)

GetHistoricalInfo gets the historical info at a given height

func (Keeper) GetLastTotalPower Uses

func (k Keeper) GetLastTotalPower(ctx sdk.Context) sdk.Int

Load the last total validator power.

func (Keeper) GetLastValidatorPower Uses

func (k Keeper) GetLastValidatorPower(ctx sdk.Context, operator sdk.ValAddress) (power int64)

Load the last validator power. Returns zero if the operator was not a validator last block.

func (Keeper) GetLastValidators Uses

func (k Keeper) GetLastValidators(ctx sdk.Context) (validators []types.Validator)

get the group of the bonded validators

func (Keeper) GetNotBondedPool Uses

func (k Keeper) GetNotBondedPool(ctx sdk.Context) (notBondedPool authtypes.ModuleAccountI)

GetNotBondedPool returns the not bonded tokens pool's module account

func (Keeper) GetParams Uses

func (k Keeper) GetParams(ctx sdk.Context) types.Params

Get all parameteras as types.Params

func (Keeper) GetRedelegation Uses

func (k Keeper) GetRedelegation(ctx sdk.Context,
    delAddr sdk.AccAddress, valSrcAddr, valDstAddr sdk.ValAddress) (red types.Redelegation, found bool)

return a redelegation

func (Keeper) GetRedelegationQueueTimeSlice Uses

func (k Keeper) GetRedelegationQueueTimeSlice(ctx sdk.Context, timestamp time.Time) (dvvTriplets []types.DVVTriplet)

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 Uses

func (k Keeper) GetRedelegations(ctx sdk.Context, delegator sdk.AccAddress,
    maxRetrieve uint16) (redelegations []types.Redelegation)

return a given amount of all the delegator redelegations

func (Keeper) GetRedelegationsFromSrcValidator Uses

func (k Keeper) GetRedelegationsFromSrcValidator(ctx sdk.Context, valAddr sdk.ValAddress) (reds []types.Redelegation)

return all redelegations from a particular validator

func (Keeper) GetUBDQueueTimeSlice Uses

func (k Keeper) GetUBDQueueTimeSlice(ctx sdk.Context, timestamp time.Time) (dvPairs []types.DVPair)

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 Uses

func (k Keeper) GetUnbondingDelegation(
    ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress,
) (ubd types.UnbondingDelegation, found bool)

return a unbonding delegation

func (Keeper) GetUnbondingDelegations Uses

func (k Keeper) GetUnbondingDelegations(ctx sdk.Context, delegator sdk.AccAddress,
    maxRetrieve uint16) (unbondingDelegations []types.UnbondingDelegation)

return a given amount of all the delegator unbonding-delegations

func (Keeper) GetUnbondingDelegationsFromValidator Uses

func (k Keeper) GetUnbondingDelegationsFromValidator(ctx sdk.Context, valAddr sdk.ValAddress) (ubds []types.UnbondingDelegation)

return all unbonding delegations from a particular validator

func (Keeper) GetUnbondingValidators Uses

func (k Keeper) GetUnbondingValidators(ctx sdk.Context, endTime time.Time, endHeight int64) []sdk.ValAddress

GetUnbondingValidators returns a slice of mature validator addresses that complete their unbonding at a given time and height.

func (Keeper) GetValidator Uses

func (k Keeper) GetValidator(ctx sdk.Context, addr sdk.ValAddress) (validator types.Validator, found bool)

get a single validator

func (Keeper) GetValidatorByConsAddr Uses

func (k Keeper) GetValidatorByConsAddr(ctx sdk.Context, consAddr sdk.ConsAddress) (validator types.Validator, found bool)

get a single validator by consensus address

func (Keeper) GetValidatorDelegations Uses

func (k Keeper) GetValidatorDelegations(ctx sdk.Context, valAddr sdk.ValAddress) (delegations []types.Delegation)

return all delegations to a specific validator. Useful for querier.

func (Keeper) GetValidatorSet Uses

func (k Keeper) GetValidatorSet() types.ValidatorSet

Returns self as it is both a validatorset and delegationset

func (Keeper) GetValidators Uses

func (k Keeper) GetValidators(ctx sdk.Context, maxRetrieve uint32) (validators []types.Validator)

return a given amount of all the validators

func (Keeper) HasMaxRedelegationEntries Uses

func (k Keeper) HasMaxRedelegationEntries(ctx sdk.Context,
    delegatorAddr sdk.AccAddress, validatorSrcAddr,
    validatorDstAddr sdk.ValAddress) bool

HasMaxRedelegationEntries - redelegation has maximum number of entries

func (Keeper) HasMaxUnbondingDelegationEntries Uses

func (k Keeper) HasMaxUnbondingDelegationEntries(ctx sdk.Context,
    delegatorAddr sdk.AccAddress, validatorAddr sdk.ValAddress) bool

HasMaxUnbondingDelegationEntries - check if unbonding delegation has maximum number of entries

func (Keeper) HasReceivingRedelegation Uses

func (k Keeper) HasReceivingRedelegation(ctx sdk.Context,
    delAddr sdk.AccAddress, valDstAddr sdk.ValAddress) bool

check if validator is receiving a redelegation

func (Keeper) HistoricalEntries Uses

func (k Keeper) HistoricalEntries(ctx sdk.Context) (res uint32)

HistoricalEntries = number of historical info entries to persist in store

func (Keeper) InsertRedelegationQueue Uses

func (k Keeper) InsertRedelegationQueue(ctx sdk.Context, red types.Redelegation,
    completionTime time.Time)

Insert an redelegation delegation to the appropriate timeslice in the redelegation queue

func (Keeper) InsertUBDQueue Uses

func (k Keeper) InsertUBDQueue(ctx sdk.Context, ubd types.UnbondingDelegation,
    completionTime time.Time)

Insert an unbonding delegation to the appropriate timeslice in the unbonding queue

func (Keeper) InsertUnbondingValidatorQueue Uses

func (k Keeper) InsertUnbondingValidatorQueue(ctx sdk.Context, val types.Validator)

InsertUnbondingValidatorQueue inserts a given unbonding validator address into the unbonding validator queue for a given height and time.

func (Keeper) IterateAllDelegations Uses

func (k Keeper) IterateAllDelegations(ctx sdk.Context, cb func(delegation types.Delegation) (stop bool))

IterateAllDelegations iterate through all of the delegations

func (Keeper) IterateBondedValidatorsByPower Uses

func (k Keeper) IterateBondedValidatorsByPower(ctx sdk.Context, fn func(index int64, validator exported.ValidatorI) (stop bool))

iterate through the bonded validator set and perform the provided function

func (Keeper) IterateDelegations Uses

func (k Keeper) IterateDelegations(ctx sdk.Context, delAddr sdk.AccAddress,
    fn func(index int64, del exported.DelegationI) (stop bool))

iterate through all of the delegations from a delegator

func (Keeper) IterateHistoricalInfo Uses

func (k Keeper) IterateHistoricalInfo(ctx sdk.Context, cb func(types.HistoricalInfo) bool)

IterateHistoricalInfo provides an interator over all stored HistoricalInfo

objects. For each HistoricalInfo object, cb will be called. If the cb returns

true, the iterator will close and stop.

func (Keeper) IterateLastValidatorPowers Uses

func (k Keeper) IterateLastValidatorPowers(ctx sdk.Context, handler func(operator sdk.ValAddress, power int64) (stop bool))

Iterate over last validator powers.

func (Keeper) IterateLastValidators Uses

func (k Keeper) IterateLastValidators(ctx sdk.Context, fn func(index int64, validator exported.ValidatorI) (stop bool))

iterate through the active validator set and perform the provided function

func (Keeper) IterateRedelegations Uses

func (k Keeper) IterateRedelegations(ctx sdk.Context, fn func(index int64, red types.Redelegation) (stop bool))

iterate through all redelegations

func (Keeper) IterateUnbondingDelegations Uses

func (k Keeper) IterateUnbondingDelegations(ctx sdk.Context, fn func(index int64, ubd types.UnbondingDelegation) (stop bool))

iterate through all of the unbonding delegations

func (Keeper) IterateValidators Uses

func (k Keeper) IterateValidators(ctx sdk.Context, fn func(index int64, validator exported.ValidatorI) (stop bool))

iterate through the validator set and perform the provided function

func (Keeper) Jail Uses

func (k Keeper) Jail(ctx sdk.Context, consAddr sdk.ConsAddress)

jail a validator

func (Keeper) LastValidatorsIterator Uses

func (k Keeper) LastValidatorsIterator(ctx sdk.Context) (iterator sdk.Iterator)

returns an iterator for the consensus validators in the last block

func (Keeper) Logger Uses

func (k Keeper) Logger(ctx sdk.Context) log.Logger

Logger returns a module-specific logger.

func (Keeper) MaxEntries Uses

func (k Keeper) MaxEntries(ctx sdk.Context) (res uint32)

MaxEntries - Maximum number of simultaneous unbonding delegations or redelegations (per pair/trio)

func (Keeper) MaxValidators Uses

func (k Keeper) MaxValidators(ctx sdk.Context) (res uint32)

MaxValidators - Maximum number of validators

func (Keeper) RedelegationQueueIterator Uses

func (k Keeper) RedelegationQueueIterator(ctx sdk.Context, endTime time.Time) sdk.Iterator

Returns all the redelegation queue timeslices from time 0 until endTime

func (Keeper) RemoveDelegation Uses

func (k Keeper) RemoveDelegation(ctx sdk.Context, delegation types.Delegation)

remove a delegation

func (Keeper) RemoveRedelegation Uses

func (k Keeper) RemoveRedelegation(ctx sdk.Context, red types.Redelegation)

remove a redelegation object and associated index

func (Keeper) RemoveUnbondingDelegation Uses

func (k Keeper) RemoveUnbondingDelegation(ctx sdk.Context, ubd types.UnbondingDelegation)

remove the unbonding delegation object and associated index

func (Keeper) RemoveValidator Uses

func (k Keeper) RemoveValidator(ctx sdk.Context, address sdk.ValAddress)

remove the validator record and associated indexes except for the bonded validator index which is only handled in ApplyAndReturnTendermintUpdates

func (Keeper) RemoveValidatorTokens Uses

func (k Keeper) RemoveValidatorTokens(ctx sdk.Context,
    validator types.Validator, tokensToRemove sdk.Int) types.Validator

Update the tokens of an existing validator, update the validators power index key

func (Keeper) RemoveValidatorTokensAndShares Uses

func (k Keeper) RemoveValidatorTokensAndShares(ctx sdk.Context, validator types.Validator,
    sharesToRemove sdk.Dec) (valOut types.Validator, removedTokens sdk.Int)

Update the tokens of an existing validator, update the validators power index key

func (Keeper) SetDelegation Uses

func (k Keeper) SetDelegation(ctx sdk.Context, delegation types.Delegation)

set a delegation

func (Keeper) SetHistoricalInfo Uses

func (k Keeper) SetHistoricalInfo(ctx sdk.Context, height int64, hi types.HistoricalInfo)

SetHistoricalInfo sets the historical info at a given height

func (*Keeper) SetHooks Uses

func (k *Keeper) SetHooks(sh types.StakingHooks) *Keeper

Set the validator hooks

func (Keeper) SetLastTotalPower Uses

func (k Keeper) SetLastTotalPower(ctx sdk.Context, power sdk.Int)

Set the last total validator power.

func (Keeper) SetLastValidatorPower Uses

func (k Keeper) SetLastValidatorPower(ctx sdk.Context, operator sdk.ValAddress, power int64)

Set the last validator power.

func (Keeper) SetNewValidatorByPowerIndex Uses

func (k Keeper) SetNewValidatorByPowerIndex(ctx sdk.Context, validator types.Validator)

validator index

func (Keeper) SetParams Uses

func (k Keeper) SetParams(ctx sdk.Context, params types.Params)

set the params

func (Keeper) SetRedelegation Uses

func (k Keeper) SetRedelegation(ctx sdk.Context, red types.Redelegation)

set a redelegation and associated index

func (Keeper) SetRedelegationEntry Uses

func (k Keeper) SetRedelegationEntry(ctx sdk.Context,
    delegatorAddr sdk.AccAddress, validatorSrcAddr,
    validatorDstAddr sdk.ValAddress, creationHeight int64,
    minTime time.Time, balance sdk.Int,
    sharesSrc, sharesDst sdk.Dec) types.Redelegation

SetUnbondingDelegationEntry adds an entry to the unbonding delegation at the given addresses. It creates the unbonding delegation if it does not exist

func (Keeper) SetRedelegationQueueTimeSlice Uses

func (k Keeper) SetRedelegationQueueTimeSlice(ctx sdk.Context, timestamp time.Time, keys []types.DVVTriplet)

Sets a specific redelegation queue timeslice.

func (Keeper) SetUBDQueueTimeSlice Uses

func (k Keeper) SetUBDQueueTimeSlice(ctx sdk.Context, timestamp time.Time, keys []types.DVPair)

Sets a specific unbonding queue timeslice.

func (Keeper) SetUnbondingDelegation Uses

func (k Keeper) SetUnbondingDelegation(ctx sdk.Context, ubd types.UnbondingDelegation)

set the unbonding delegation and associated index

func (Keeper) SetUnbondingDelegationEntry Uses

func (k Keeper) SetUnbondingDelegationEntry(
    ctx sdk.Context, delegatorAddr sdk.AccAddress, validatorAddr sdk.ValAddress,
    creationHeight int64, minTime time.Time, balance sdk.Int,
) types.UnbondingDelegation

SetUnbondingDelegationEntry adds an entry to the unbonding delegation at the given addresses. It creates the unbonding delegation if it does not exist

func (Keeper) SetUnbondingValidatorsQueue Uses

func (k Keeper) SetUnbondingValidatorsQueue(ctx sdk.Context, endTime time.Time, endHeight int64, addrs []sdk.ValAddress)

SetUnbondingValidatorsQueue sets a given slice of validator addresses into the unbonding validator queue by a given height and time.

func (Keeper) SetValidator Uses

func (k Keeper) SetValidator(ctx sdk.Context, validator types.Validator)

set the main record holding validator details

func (Keeper) SetValidatorByConsAddr Uses

func (k Keeper) SetValidatorByConsAddr(ctx sdk.Context, validator types.Validator)

validator index

func (Keeper) SetValidatorByPowerIndex Uses

func (k Keeper) SetValidatorByPowerIndex(ctx sdk.Context, validator types.Validator)

validator index

func (Keeper) Slash Uses

func (k Keeper) Slash(ctx sdk.Context, consAddr sdk.ConsAddress, infractionHeight int64, power int64, slashFactor sdk.Dec)

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,
not at a height in the future

func (Keeper) SlashRedelegation Uses

func (k Keeper) SlashRedelegation(ctx sdk.Context, srcValidator types.Validator, redelegation types.Redelegation,
    infractionHeight int64, slashFactor sdk.Dec) (totalSlashAmount sdk.Int)

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 Uses

func (k Keeper) SlashUnbondingDelegation(ctx sdk.Context, unbondingDelegation types.UnbondingDelegation,
    infractionHeight int64, slashFactor sdk.Dec) (totalSlashAmount sdk.Int)

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) StakingTokenSupply Uses

func (k Keeper) StakingTokenSupply(ctx sdk.Context) sdk.Int

StakingTokenSupply staking tokens from the total supply

func (Keeper) TotalBondedTokens Uses

func (k Keeper) TotalBondedTokens(ctx sdk.Context) sdk.Int

TotalBondedTokens total staking tokens supply which is bonded

func (Keeper) TrackHistoricalInfo Uses

func (k Keeper) TrackHistoricalInfo(ctx sdk.Context)

TrackHistoricalInfo saves the latest historical-info and deletes the oldest heights that are below pruning height

func (Keeper) UBDQueueIterator Uses

func (k Keeper) UBDQueueIterator(ctx sdk.Context, endTime time.Time) sdk.Iterator

Returns all the unbonding queue timeslices from time 0 until endTime

func (Keeper) Unbond Uses

func (k Keeper) Unbond(
    ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress, shares sdk.Dec,
) (amount sdk.Int, err error)

unbond a particular delegation and perform associated store operations

func (Keeper) UnbondAllMatureValidators Uses

func (k Keeper) UnbondAllMatureValidators(ctx sdk.Context)

UnbondAllMatureValidators unbonds all the mature unbonding validators that have finished their unbonding period.

func (Keeper) UnbondingTime Uses

func (k Keeper) UnbondingTime(ctx sdk.Context) (res time.Duration)

UnbondingTime

func (Keeper) UnbondingToUnbonded Uses

func (k Keeper) UnbondingToUnbonded(ctx sdk.Context, validator types.Validator) types.Validator

switches a validator from unbonding state to unbonded state

func (Keeper) Undelegate Uses

func (k Keeper) Undelegate(
    ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress, sharesAmount sdk.Dec,
) (time.Time, 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) Unjail Uses

func (k Keeper) Unjail(ctx sdk.Context, consAddr sdk.ConsAddress)

unjail a validator

func (Keeper) UpdateValidatorCommission Uses

func (k Keeper) UpdateValidatorCommission(ctx sdk.Context,
    validator types.Validator, newRate sdk.Dec) (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 Uses

func (k Keeper) ValidateUnbondAmount(
    ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress, amt sdk.Int,
) (shares sdk.Dec, err error)

ValidateUnbondAmount validates that a given unbond or redelegation amount is valied 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 Uses

func (k Keeper) Validator(ctx sdk.Context, address sdk.ValAddress) exported.ValidatorI

Validator gets the Validator interface for a particular address

func (Keeper) ValidatorByConsAddr Uses

func (k Keeper) ValidatorByConsAddr(ctx sdk.Context, addr sdk.ConsAddress) exported.ValidatorI

ValidatorByConsAddr gets the validator interface for a particular pubkey

func (Keeper) ValidatorQueueIterator Uses

func (k Keeper) ValidatorQueueIterator(ctx sdk.Context, endTime time.Time, endHeight int64) sdk.Iterator

ValidatorQueueIterator returns an interator ranging over validators that are unbonding whose unbonding completion occurs at the given height and time.

func (Keeper) ValidatorsPowerStoreIterator Uses

func (k Keeper) ValidatorsPowerStoreIterator(ctx sdk.Context) sdk.Iterator

returns an iterator for the current validator power store

type Querier Uses

type Querier struct {
    Keeper
}

Querier is used as Keeper will have duplicate methods if used directly, and gRPC names take precedence over keeper

func (Querier) Delegation Uses

func (k Querier) Delegation(c context.Context, req *types.QueryDelegationRequest) (*types.QueryDelegationResponse, error)

Delegation queries delegate info for given validator delegator pair

func (Querier) DelegatorDelegations Uses

func (k Querier) DelegatorDelegations(c context.Context, req *types.QueryDelegatorDelegationsRequest) (*types.QueryDelegatorDelegationsResponse, error)

DelegatorDelegations queries all delegations of a give delegator address

func (Querier) DelegatorUnbondingDelegations Uses

func (k Querier) DelegatorUnbondingDelegations(c context.Context, req *types.QueryDelegatorUnbondingDelegationsRequest) (*types.QueryDelegatorUnbondingDelegationsResponse, error)

DelegatorUnbondingDelegations queries all unbonding delegations of a give delegator address

func (Querier) DelegatorValidator Uses

func (k Querier) DelegatorValidator(c context.Context, req *types.QueryDelegatorValidatorRequest) (*types.QueryDelegatorValidatorResponse, error)

DelegatorValidator queries validator info for given delegator validator pair

func (Querier) DelegatorValidators Uses

func (k Querier) DelegatorValidators(c context.Context, req *types.QueryDelegatorValidatorsRequest) (*types.QueryDelegatorValidatorsResponse, error)

func (Querier) HistoricalInfo Uses

func (k Querier) HistoricalInfo(c context.Context, req *types.QueryHistoricalInfoRequest) (*types.QueryHistoricalInfoResponse, error)

HistoricalInfo queries the historical info for given height

func (Querier) Params Uses

func (k Querier) Params(c context.Context, _ *types.QueryParamsRequest) (*types.QueryParamsResponse, error)

Params queries the staking parameters

func (Querier) Pool Uses

func (k Querier) Pool(c context.Context, _ *types.QueryPoolRequest) (*types.QueryPoolResponse, error)

Pool queries the pool info

func (Querier) Redelegations Uses

func (k Querier) Redelegations(c context.Context, req *types.QueryRedelegationsRequest) (*types.QueryRedelegationsResponse, error)

func (Querier) UnbondingDelegation Uses

func (k Querier) UnbondingDelegation(c context.Context, req *types.QueryUnbondingDelegationRequest) (*types.QueryUnbondingDelegationResponse, error)

UnbondingDelegation queries unbonding info for give validator delegator pair

func (Querier) Validator Uses

func (k Querier) Validator(c context.Context, req *types.QueryValidatorRequest) (*types.QueryValidatorResponse, error)

Validator queries validator info for given validator addr

func (Querier) ValidatorDelegations Uses

func (k Querier) ValidatorDelegations(c context.Context, req *types.QueryValidatorDelegationsRequest) (*types.QueryValidatorDelegationsResponse, error)

ValidatorDelegations queries delegate info for given validator

func (Querier) ValidatorUnbondingDelegations Uses

func (k Querier) ValidatorUnbondingDelegations(c context.Context, req *types.QueryValidatorUnbondingDelegationsRequest) (*types.QueryValidatorUnbondingDelegationsResponse, error)

ValidatorUnbondingDelegations queries unbonding delegations of a validator

func (Querier) Validators Uses

func (k Querier) Validators(c context.Context, req *types.QueryValidatorsRequest) (*types.QueryValidatorsResponse, error)

Validators queries all validators that match the given status

Package keeper imports 24 packages (graph) and is imported by 7 packages. Updated 2020-08-01. Refresh now. Tools for package owners.