keeper

package
v0.47.11-ics-lsm Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 21, 2024 License: Apache-2.0 Imports: 33 Imported by: 2,244

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AllInvariants

func AllInvariants(k *Keeper) sdk.Invariant

AllInvariants runs all invariants of the staking module.

func CheckVestedDelegationInVestingAccount

func CheckVestedDelegationInVestingAccount(account vesting.VestingAccount, blockTime time.Time, coin sdk.Coin) bool

CheckVestedDelegationInVestingAccount verifies whether the provided vesting account holds a vested delegation for an equal or greater amount of the specified coin at the given block time.

Note that this function facilitates a specific use-case in the LSM module for tokenizing vested delegations. For more details, see https://github.com/cosmos/gaia/issues/2877.

func DelegationToDelegationResponse added in v0.40.0

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

func DelegationsToDelegationResponses added in v0.40.0

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

func DelegatorSharesInvariant

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

func ModuleAccountInvariants(k *Keeper) sdk.Invariant

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

func NewMsgServerImpl added in v0.40.0

func NewMsgServerImpl(keeper *Keeper) types.MsgServer

NewMsgServerImpl returns an implementation of the bank MsgServer interface for the provided Keeper.

func NonNegativePowerInvariant

func NonNegativePowerInvariant(k *Keeper) sdk.Invariant

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

func PositiveDelegationInvariant

func PositiveDelegationInvariant(k *Keeper) sdk.Invariant

PositiveDelegationInvariant checks that all stored delegations have > 0 shares.

func RedelegationsToRedelegationResponses added in v0.40.0

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

func RegisterInvariants

func RegisterInvariants(ir sdk.InvariantRegistry, k *Keeper)

RegisterInvariants registers all staking invariants

func TestingUpdateValidator

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

update validator for testing

func ValidatorByPowerIndexExists

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

does a certain by-power index record exist

Types

type Keeper

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

Keeper of the x/staking store

func NewKeeper

func NewKeeper(
	cdc codec.BinaryCodec,
	key storetypes.StoreKey,
	ak types.AccountKeeper,
	bk types.BankKeeper,
	authority string,
) *Keeper

NewKeeper creates a new staking Keeper instance

func (Keeper) AddTokenizeShareRecord

func (k Keeper) AddTokenizeShareRecord(ctx sdk.Context, tokenizeShareRecord types.TokenizeShareRecord) error

func (Keeper) AddTokenizeSharesLock

func (k Keeper) AddTokenizeSharesLock(ctx sdk.Context, address sdk.AccAddress)

Adds a lock that prevents tokenizing shares for an account The tokenize share lock store is implemented by keying on the account address and storing a timestamp as the value. The timestamp is empty when the lock is set and gets populated with the unlock completion time once the unlock has started

func (Keeper) AddValidatorTokensAndShares

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

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

func (Keeper) ApplyAndReturnValidatorSetUpdates

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

func (Keeper) BeginRedelegation

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

BeginRedelegation begins unbonding / redelegation and creates a redelegation record.

func (Keeper) BeginUnbondingValidator added in v0.47.0

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

BeginUnbondingValidator performs all the store operations for when a validator begins unbonding

func (Keeper) BlockValidatorUpdates

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

BlockValidatorUpdates calculates the ValidatorUpdates for the current block Called in each EndBlock

func (Keeper) BondDenom

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

BondDenom - Bondable coin denomination

func (Keeper) BondedRatio

func (k Keeper) BondedRatio(ctx sdk.Context) math.LegacyDec

BondedRatio the fraction of the staking tokens which are currently bonded

func (Keeper) CancelTokenizeShareLockExpiration

func (k Keeper) CancelTokenizeShareLockExpiration(ctx sdk.Context, address sdk.AccAddress, completionTime time.Time)

Cancels a pending tokenize share authorization by removing the lock from the queue

func (Keeper) CheckExceedsGlobalLiquidStakingCap

func (k Keeper) CheckExceedsGlobalLiquidStakingCap(ctx sdk.Context, tokens math.Int, sharesAlreadyBonded bool) bool

CheckExceedsGlobalLiquidStakingCap checks if a liquid delegation would cause the global liquid staking cap to be exceeded A liquid delegation is defined as either tokenized shares, or a delegation from an ICA Account The total stake is determined by the balance of the bonded pool If the delegation's shares are already bonded (e.g. in the event of a tokenized share) the tokens are already included in the bonded pool If the delegation's shares are not bonded (e.g. normal delegation), we need to add the tokens to the current bonded pool balance to get the total staked

func (Keeper) CheckExceedsValidatorBondCap

func (k Keeper) CheckExceedsValidatorBondCap(ctx sdk.Context, validator types.Validator, shares sdk.Dec) bool

CheckExceedsValidatorBondCap checks if a liquid delegation to a validator would cause the liquid shares to exceed the validator bond factor A liquid delegation is defined as either tokenized shares, or a delegation from an ICA Account Returns true if the cap is exceeded

func (Keeper) CheckExceedsValidatorLiquidStakingCap

func (k Keeper) CheckExceedsValidatorLiquidStakingCap(ctx sdk.Context, validator types.Validator, shares sdk.Dec, sharesAlreadyBonded bool) bool

CheckExceedsValidatorLiquidStakingCap checks if a liquid delegation could cause the total liquid shares to exceed the liquid staking cap A liquid delegation is defined as either tokenized shares, or a delegation from an ICA Account If the liquid delegation's shares are already bonded (e.g. in the event of a tokenized share) the tokens are already included in the validator's delegator shares If the liquid delegation's shares are not bonded (e.g. normal delegation), we need to add the shares to the current validator's delegator shares to get the total shares Returns true if the cap is exceeded

func (Keeper) CompleteRedelegation

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

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) DecreaseTotalLiquidStakedTokens

func (k Keeper) DecreaseTotalLiquidStakedTokens(ctx sdk.Context, amount math.Int) error

DecreaseTotalLiquidStakedTokens decrements the total liquid staked tokens

func (Keeper) DecreaseValidatorLiquidShares

func (k Keeper) DecreaseValidatorLiquidShares(ctx sdk.Context, valAddress sdk.ValAddress, shares sdk.Dec) (types.Validator, error)

DecreaseValidatorLiquidShares decrements the liquid shares on a validator

func (Keeper) Delegate

func (k Keeper) Delegate(
	ctx sdk.Context, delAddr sdk.AccAddress, bondAmt math.Int, tokenSrc types.BondStatus,
	validator types.Validator, subtractAccount bool,
) (newShares sdk.Dec, 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 sdk.Context, addrDel sdk.AccAddress, addrVal sdk.ValAddress) types.DelegationI

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

func (Keeper) DelegatorIsLiquidStaker

func (k Keeper) DelegatorIsLiquidStaker(delegatorAddress sdk.AccAddress) bool

Checks if an account associated with a given delegation is related to liquid staking

This is determined by checking if the account has a 32-length address which will identify the following scenarios:

  • An account has tokenized their shares, and thus the delegation is owned by the tokenize share record module account
  • A liquid staking provider is delegating through an ICA account

Both ICA accounts and tokenize share record module accounts have 32-length addresses NOTE: This will have to be refactored before adapting it to chains beyond gaia as other chains may have 32-length addresses that are not related to the above scenarios

func (Keeper) DeleteHistoricalInfo

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

DeleteHistoricalInfo deletes the historical info at a given height

func (Keeper) DeleteLastValidatorPower

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

Delete the last validator power.

func (Keeper) DeleteTokenizeShareRecord

func (k Keeper) DeleteTokenizeShareRecord(ctx sdk.Context, recordID uint64) error

func (Keeper) DeleteUnbondingIndex added in v0.47.0

func (k Keeper) DeleteUnbondingIndex(ctx sdk.Context, id uint64)

DeleteUnbondingIndex removes a mapping from UnbondingId to unbonding operation

func (Keeper) DeleteValidatorByPowerIndex

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

validator index

func (Keeper) DeleteValidatorQueue

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

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

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

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 sdk.Context, currTime time.Time) (matureUnbonds []types.DVPair)

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

func (Keeper) ExportGenesis added in v0.46.0

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

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

GetAllDelegations returns all delegations used during genesis dump.

func (Keeper) GetAllDelegatorDelegations

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

return all delegations for a delegator

func (Keeper) GetAllHistoricalInfo

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

GetAllHistoricalInfo returns all stored HistoricalInfo objects.

func (Keeper) GetAllRedelegations

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

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) GetAllTokenizeShareRecords

func (k Keeper) GetAllTokenizeShareRecords(ctx sdk.Context) (tokenizeShareRecords []types.TokenizeShareRecord)

func (Keeper) GetAllTokenizeSharesLocks

func (k Keeper) GetAllTokenizeSharesLocks(ctx sdk.Context) (tokenizeShareLocks []types.TokenizeShareLock)

Returns all tokenize share locks

func (Keeper) GetAllUnbondingDelegations

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

return all unbonding-delegations for a delegator

func (Keeper) GetAllValidators

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) GetAuthority added in v0.47.0

func (k Keeper) GetAuthority() string

GetAuthority returns the x/staking module's authority.

func (Keeper) GetBondedPool

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

GetBondedPool returns the bonded tokens pool's module account

func (Keeper) GetBondedValidatorsByPower

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

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

func (Keeper) GetDelegation

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

GetDelegation returns a specific delegation.

func (Keeper) GetDelegatorBonded added in v0.45.4

func (k Keeper) GetDelegatorBonded(ctx sdk.Context, delegator sdk.AccAddress) math.Int

GetDelegatorBonded returs the total amount a delegator has bonded.

func (Keeper) GetDelegatorDelegations

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

GetDelegatorDelegations returns a given amount of all the delegations from a delegator.

func (Keeper) GetDelegatorUnbonding added in v0.45.4

func (k Keeper) GetDelegatorUnbonding(ctx sdk.Context, delegator sdk.AccAddress) math.Int

GetDelegatorUnbonding returns the total amount a delegator has unbonding.

func (Keeper) GetDelegatorValidator

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

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

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

func (Keeper) GetHistoricalInfo

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

GetHistoricalInfo gets the historical info at a given height

func (Keeper) GetLastTokenizeShareRecordID

func (k Keeper) GetLastTokenizeShareRecordID(ctx sdk.Context) uint64

func (Keeper) GetLastTotalPower

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

GetLastTotalPower Load the last total validator power.

func (Keeper) GetLastValidatorPower

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

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

get the group of the bonded validators

func (Keeper) GetNotBondedPool

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

GetNotBondedPool returns the not bonded tokens pool's module account

func (Keeper) GetParams

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

GetParams sets the x/staking module parameters.

func (Keeper) GetPendingTokenizeShareAuthorizations

func (k Keeper) GetPendingTokenizeShareAuthorizations(ctx sdk.Context, completionTime time.Time) types.PendingTokenizeShareAuthorizations

Returns a list of addresses pending tokenize share unlocking at the same time

func (Keeper) GetRedelegation

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

GetRedelegation returns a redelegation.

func (Keeper) GetRedelegationByUnbondingID added in v0.47.0

func (k Keeper) GetRedelegationByUnbondingID(ctx sdk.Context, id uint64) (red types.Redelegation, found bool)

GetRedelegationByUnbondingID returns a unbonding delegation that has an unbonding delegation entry with a certain ID

func (Keeper) GetRedelegationQueueTimeSlice

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

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 sdk.Context, delegator sdk.AccAddress, maxRetrieve uint16) (redelegations []types.Redelegation)

GetRedelegations returns a given amount of all the delegator redelegations.

func (Keeper) GetRedelegationsFromSrcValidator

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

GetRedelegationsFromSrcValidator returns all redelegations from a particular validator.

func (Keeper) GetTokenizeShareRecord

func (k Keeper) GetTokenizeShareRecord(ctx sdk.Context, id uint64) (tokenizeShareRecord types.TokenizeShareRecord, err error)

func (Keeper) GetTokenizeShareRecordByDenom

func (k Keeper) GetTokenizeShareRecordByDenom(ctx sdk.Context, denom string) (types.TokenizeShareRecord, error)

func (Keeper) GetTokenizeShareRecordsByOwner

func (k Keeper) GetTokenizeShareRecordsByOwner(ctx sdk.Context, owner sdk.AccAddress) (tokenizeShareRecords []types.TokenizeShareRecord)

func (Keeper) GetTokenizeSharesLock

func (k Keeper) GetTokenizeSharesLock(ctx sdk.Context, address sdk.AccAddress) (status types.TokenizeShareLockStatus, unlockTime time.Time)

Checks if there is currently a tokenize share lock for a given account Returns the status indicating whether the account is locked, unlocked, or as a lock expiring. If the lock is expiring, the expiration time is returned

func (Keeper) GetTotalLiquidStakedTokens

func (k Keeper) GetTotalLiquidStakedTokens(ctx sdk.Context) math.Int

GetTotalLiquidStakedTokens returns the total outstanding tokens owned by a liquid staking provider Returns zero if the total liquid stake amount has not been initialized

func (Keeper) GetUBDQueueTimeSlice

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

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 sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) (ubd types.UnbondingDelegation, found bool)

GetUnbondingDelegation returns a unbonding delegation.

func (Keeper) GetUnbondingDelegationByUnbondingID added in v0.47.0

func (k Keeper) GetUnbondingDelegationByUnbondingID(ctx sdk.Context, id uint64) (ubd types.UnbondingDelegation, found bool)

GetUnbondingDelegationByUnbondingID returns a unbonding delegation that has an unbonding delegation entry with a certain ID

func (Keeper) GetUnbondingDelegations

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

GetUnbondingDelegations returns a given amount of all the delegator unbonding-delegations.

func (Keeper) GetUnbondingDelegationsFromValidator

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

GetUnbondingDelegationsFromValidator returns all unbonding delegations from a particular validator.

func (Keeper) GetUnbondingType added in v0.47.0

func (k Keeper) GetUnbondingType(ctx sdk.Context, id uint64) (unbondingType types.UnbondingType, found bool)

func (Keeper) GetUnbondingValidators added in v0.40.0

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

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 sdk.Context, addr sdk.ValAddress) (validator types.Validator, found bool)

get a single validator

func (Keeper) GetValidatorByConsAddr

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

get a single validator by consensus address

func (Keeper) GetValidatorByUnbondingID added in v0.47.0

func (k Keeper) GetValidatorByUnbondingID(ctx sdk.Context, id uint64) (val types.Validator, found bool)

GetValidatorByUnbondingID returns the validator that is unbonding with a certain unbonding op ID

func (Keeper) GetValidatorDelegations

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

GetValidatorDelegations returns all delegations to a specific validator. Useful for querier.

func (Keeper) GetValidatorSet

func (k Keeper) GetValidatorSet() types.ValidatorSet

Returns self as it is both a validatorset and delegationset

func (Keeper) GetValidatorUpdates added in v0.47.0

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

GetValidatorUpdates returns the ABCI validator power updates within the current block.

func (Keeper) GetValidators

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

return a given amount of all the validators

func (Keeper) GlobalLiquidStakingCap

func (k Keeper) GlobalLiquidStakingCap(ctx sdk.Context) (res sdk.Dec)

Global liquid staking cap across all liquid staking providers

func (Keeper) HasMaxRedelegationEntries

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

HasMaxRedelegationEntries checks if redelegation has maximum number of entries.

func (Keeper) HasMaxUnbondingDelegationEntries

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

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

HasReceivingRedelegation checks if validator is receiving a redelegation.

func (Keeper) HistoricalEntries

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

HistoricalEntries = number of historical info entries to persist in store

func (*Keeper) Hooks added in v0.47.0

func (k *Keeper) Hooks() types.StakingHooks

Hooks gets the hooks for staking *Keeper {

func (Keeper) IncreaseValidatorBondShares

func (k Keeper) IncreaseValidatorBondShares(ctx sdk.Context, valAddress sdk.ValAddress, shares sdk.Dec) error

Increase validator bond shares increments the validator's self bond in the event that the delegation amount on a validator bond delegation is increased

func (Keeper) IncrementUnbondingID added in v0.47.0

func (k Keeper) IncrementUnbondingID(ctx sdk.Context) (unbondingID uint64)

IncrementUnbondingID increments and returns a unique ID for an unbonding operation

func (Keeper) InitGenesis added in v0.46.0

func (k Keeper) InitGenesis(ctx sdk.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 sdk.Context, red types.Redelegation, completionTime time.Time)

InsertRedelegationQueue insert an redelegation delegation to the appropriate timeslice in the redelegation queue.

func (Keeper) InsertUBDQueue

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

InsertUBDQueue inserts an unbonding delegation to the appropriate timeslice in the unbonding queue.

func (Keeper) InsertUnbondingValidatorQueue added in v0.40.0

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) IsValidatorJailed added in v0.47.0

func (k Keeper) IsValidatorJailed(ctx sdk.Context, addr sdk.ConsAddress) bool

func (Keeper) IterateAllDelegations

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

IterateAllDelegations iterates through all of the delegations.

func (Keeper) IterateBondedValidatorsByPower

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

iterate through the bonded validator set and perform the provided function

func (Keeper) IterateDelegations

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

iterate through all of the delegations from a delegator

func (Keeper) IterateDelegatorDelegations added in v0.45.4

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

IterateDelegatorDelegations iterates through one delegator's delegations.

func (Keeper) IterateDelegatorRedelegations added in v0.45.4

func (k Keeper) IterateDelegatorRedelegations(ctx sdk.Context, delegator sdk.AccAddress, cb func(red types.Redelegation) (stop bool))

IterateDelegatorRedelegations iterates through one delegator's redelegations.

func (Keeper) IterateDelegatorUnbondingDelegations added in v0.45.4

func (k Keeper) IterateDelegatorUnbondingDelegations(ctx sdk.Context, delegator sdk.AccAddress, cb func(ubd types.UnbondingDelegation) (stop bool))

IterateDelegatorUnbondingDelegations iterates through a delegator's unbonding delegations.

func (Keeper) IterateHistoricalInfo

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

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

Iterate over last validator powers.

func (Keeper) IterateLastValidators

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

iterate through the active validator set and perform the provided function

func (Keeper) IterateRedelegations

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

IterateRedelegations iterates through all redelegations.

func (Keeper) IterateUnbondingDelegations

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

IterateUnbondingDelegations iterates through all of the unbonding delegations.

func (Keeper) IterateValidators

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

iterate through the validator set and perform the provided function

func (Keeper) Jail

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

jail a validator

func (Keeper) LastValidatorsIterator

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

returns an iterator for the consensus validators in the last block

func (Keeper) Logger

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

Logger returns a module-specific logger.

func (Keeper) MaxEntries

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

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

func (Keeper) MaxValidators

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

MaxValidators - Maximum number of validators

func (Keeper) MinCommissionRate added in v0.46.0

func (k Keeper) MinCommissionRate(ctx sdk.Context) math.LegacyDec

MinCommissionRate - Minimum validator commission rate

func (Keeper) PowerReduction added in v0.43.0

func (k Keeper) PowerReduction(ctx sdk.Context) math.Int

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 added in v0.47.0

func (k Keeper) PutUnbondingOnHold(ctx sdk.Context, id uint64) error

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) QueueTokenizeSharesAuthorization

func (k Keeper) QueueTokenizeSharesAuthorization(ctx sdk.Context, address sdk.AccAddress) time.Time

Inserts the address into a queue where it will sit for 1 unbonding period before the tokenize share lock is removed Returns the completion time

func (Keeper) RedelegationQueueIterator

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

RedelegationQueueIterator returns all the redelegation queue timeslices from time 0 until endTime.

func (Keeper) RefreshTotalLiquidStaked

func (k Keeper) RefreshTotalLiquidStaked(ctx sdk.Context) error

Calculates and sets the global liquid staked tokens and liquid shares by validator The totals are determined by looping each delegation record and summing the stake if the delegator has a 32-length address. Checking for a 32-length address will capture ICA accounts, as well as tokenized delegations which are owned by module accounts under the hood This function must be called in the upgrade handler which onboards LSM

func (Keeper) RemoveDelegation

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

RemoveDelegation removes a delegation

func (Keeper) RemoveExpiredTokenizeShareLocks

func (k Keeper) RemoveExpiredTokenizeShareLocks(ctx sdk.Context, blockTime time.Time) (unlockedAddresses []string)

Unlocks all queued tokenize share authorizations that have matured (i.e. have waited the full unbonding period)

func (Keeper) RemoveRedelegation

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

RemoveRedelegation removes a redelegation object and associated index.

func (Keeper) RemoveTokenizeSharesLock

func (k Keeper) RemoveTokenizeSharesLock(ctx sdk.Context, address sdk.AccAddress)

Removes the tokenize share lock for an account to enable tokenizing shares

func (Keeper) RemoveUnbondingDelegation

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

RemoveUnbondingDelegation removes the unbonding delegation object and associated index.

func (Keeper) RemoveValidator

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 TODO, this function panics, and it's not good.

func (Keeper) RemoveValidatorTokens

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

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

func (Keeper) RemoveValidatorTokensAndShares

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

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

func (Keeper) SafelyDecreaseValidatorBond

func (k Keeper) SafelyDecreaseValidatorBond(ctx sdk.Context, valAddress sdk.ValAddress, shares sdk.Dec) error

SafelyDecreaseValidatorBond decrements the validator's self bond so long as it will not cause the current delegations to exceed the threshold set by validator bond factor

func (Keeper) SafelyIncreaseTotalLiquidStakedTokens

func (k Keeper) SafelyIncreaseTotalLiquidStakedTokens(ctx sdk.Context, amount math.Int, sharesAlreadyBonded bool) error

SafelyIncreaseTotalLiquidStakedTokens increments the total liquid staked tokens if the global cap is not surpassed by this delegation

The percentage of liquid staked tokens must be less than the GlobalLiquidStakingCap: (TotalLiquidStakedTokens / TotalStakedTokens) <= GlobalLiquidStakingCap

func (Keeper) SafelyIncreaseValidatorLiquidShares

func (k Keeper) SafelyIncreaseValidatorLiquidShares(ctx sdk.Context, valAddress sdk.ValAddress, shares sdk.Dec, sharesAlreadyBonded bool) (types.Validator, error)

SafelyIncreaseValidatorLiquidShares increments the liquid shares on a validator, if: the validator bond factor and validator liquid staking cap will not be exceeded by this delegation

The percentage of validator liquid shares must be less than the ValidatorLiquidStakingCap, and the total liquid staked shares cannot exceed the validator bond cap

  1. (TotalLiquidStakedTokens / TotalStakedTokens) <= ValidatorLiquidStakingCap
  2. LiquidShares <= (ValidatorBondShares * ValidatorBondFactor)

func (Keeper) SetDelegation

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

SetDelegation sets a delegation.

func (Keeper) SetHistoricalInfo

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

SetHistoricalInfo sets the historical info at a given height

func (*Keeper) SetHooks

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

SetHooks Set 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) SetLastTokenizeShareRecordID

func (k Keeper) SetLastTokenizeShareRecordID(ctx sdk.Context, id uint64)

func (Keeper) SetLastTotalPower

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

SetLastTotalPower Set the last total validator power.

func (Keeper) SetLastValidatorPower

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

Set the last validator power.

func (Keeper) SetNewValidatorByPowerIndex

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

validator index

func (Keeper) SetParams

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

SetParams sets the x/staking module parameters.

func (Keeper) SetPendingTokenizeShareAuthorizations

func (k Keeper) SetPendingTokenizeShareAuthorizations(ctx sdk.Context, completionTime time.Time, authorizations types.PendingTokenizeShareAuthorizations)

Stores a list of addresses pending tokenize share unlocking at the same time

func (Keeper) SetRedelegation

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

SetRedelegation set a redelegation and associated index.

func (Keeper) SetRedelegationByUnbondingID added in v0.47.0

func (k Keeper) SetRedelegationByUnbondingID(ctx sdk.Context, red types.Redelegation, id uint64)

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 sdk.Context,
	delegatorAddr sdk.AccAddress, validatorSrcAddr,
	validatorDstAddr sdk.ValAddress, creationHeight int64,
	minTime time.Time, balance math.Int,
	sharesSrc, sharesDst sdk.Dec,
) types.Redelegation

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 sdk.Context, timestamp time.Time, keys []types.DVVTriplet)

SetRedelegationQueueTimeSlice sets a specific redelegation queue timeslice.

func (Keeper) SetTokenizeSharesUnlockTime

func (k Keeper) SetTokenizeSharesUnlockTime(ctx sdk.Context, address sdk.AccAddress, completionTime time.Time)

Updates the timestamp associated with a lock to the time at which the lock expires

func (Keeper) SetTotalLiquidStakedTokens

func (k Keeper) SetTotalLiquidStakedTokens(ctx sdk.Context, tokens math.Int)

SetTotalLiquidStakedTokens stores the total outstanding tokens owned by a liquid staking provider

func (Keeper) SetUBDQueueTimeSlice

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

SetUBDQueueTimeSlice sets a specific unbonding queue timeslice.

func (Keeper) SetUnbondingDelegation

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

SetUnbondingDelegation sets the unbonding delegation and associated index.

func (Keeper) SetUnbondingDelegationByUnbondingID added in v0.47.0

func (k Keeper) SetUnbondingDelegationByUnbondingID(ctx sdk.Context, ubd types.UnbondingDelegation, id uint64)

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 sdk.Context, delegatorAddr sdk.AccAddress, validatorAddr sdk.ValAddress,
	creationHeight int64, minTime time.Time, balance math.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) SetUnbondingType added in v0.47.0

func (k Keeper) SetUnbondingType(ctx sdk.Context, id uint64, unbondingType types.UnbondingType)

func (Keeper) SetUnbondingValidatorsQueue added in v0.40.0

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

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

func (Keeper) SetValidator

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

set the main record holding validator details

func (Keeper) SetValidatorByConsAddr

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

validator index

func (Keeper) SetValidatorByPowerIndex

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

validator index

func (Keeper) SetValidatorByUnbondingID added in v0.47.0

func (k Keeper) SetValidatorByUnbondingID(ctx sdk.Context, val types.Validator, id uint64)

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 added in v0.47.0

func (k Keeper) SetValidatorUpdates(ctx sdk.Context, valUpdates []abci.ValidatorUpdate)

SetValidatorUpdates sets the ABCI validator power updates for the current block.

func (Keeper) Slash

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

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

func (k Keeper) SlashRedelegation(ctx sdk.Context, srcValidator types.Validator, redelegation types.Redelegation,
	infractionHeight int64, slashFactor sdk.Dec,
) (totalSlashAmount math.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

func (k Keeper) SlashUnbondingDelegation(ctx sdk.Context, unbondingDelegation types.UnbondingDelegation,
	infractionHeight int64, slashFactor sdk.Dec,
) (totalSlashAmount math.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) SlashWithInfractionReason added in v0.47.0

func (k Keeper) SlashWithInfractionReason(ctx sdk.Context, consAddr sdk.ConsAddress, infractionHeight int64, power int64, slashFactor sdk.Dec, _ types.Infraction) math.Int

SlashWithInfractionReason implementation doesn't require the infraction (types.Infraction) to work but is required by Interchain Security.

func (Keeper) StakingTokenSupply

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

StakingTokenSupply staking tokens from the total supply

func (Keeper) TokensFromConsensusPower added in v0.43.0

func (k Keeper) TokensFromConsensusPower(ctx sdk.Context, power int64) math.Int

TokensFromConsensusPower - convert input power to tokens

func (Keeper) TokensToConsensusPower added in v0.43.0

func (k Keeper) TokensToConsensusPower(ctx sdk.Context, tokens math.Int) int64

TokensToConsensusPower - convert input tokens to potential consensus-engine power

func (Keeper) TotalBondedTokens

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

TotalBondedTokens total staking tokens supply which is bonded

func (Keeper) TrackHistoricalInfo

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

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

UBDQueueIterator returns all the unbonding queue timeslices from time 0 until endTime.

func (Keeper) Unbond

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

Unbond unbonds a particular delegation and perform associated store operations.

func (Keeper) UnbondAllMatureValidators added in v0.40.0

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

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

func (Keeper) UnbondingCanComplete added in v0.47.0

func (k Keeper) UnbondingCanComplete(ctx sdk.Context, id uint64) error

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

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

UnbondingTime - The time duration for unbonding

func (Keeper) UnbondingToUnbonded

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

UnbondingToUnbonded switches a validator from unbonding state to unbonded state

func (Keeper) Undelegate

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

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

unjail a validator

func (Keeper) UpdateValidatorCommission

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

func (k Keeper) ValidateUnbondAmount(
	ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress, amt math.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

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

Validator gets the Validator interface for a particular address

func (Keeper) ValidatorBondFactor

func (k Keeper) ValidatorBondFactor(ctx sdk.Context) (res sdk.Dec)

Validator bond factor for all validators

func (Keeper) ValidatorByConsAddr

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

ValidatorByConsAddr gets the validator interface for a particular pubkey

func (Keeper) ValidatorLiquidStakingCap

func (k Keeper) ValidatorLiquidStakingCap(ctx sdk.Context) (res sdk.Dec)

Liquid staking cap for each validator

func (Keeper) ValidatorQueueIterator

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

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

returns an iterator for the current validator power store

type Migrator added in v0.43.0

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

Migrator is a struct for handling in-place store migrations.

func NewMigrator added in v0.43.0

func NewMigrator(keeper *Keeper, legacySubspace exported.Subspace) Migrator

NewMigrator returns a new Migrator.

func (Migrator) Migrate1to2 added in v0.43.0

func (m Migrator) Migrate1to2(ctx sdk.Context) error

Migrate1to2 migrates from version 1 to 2.

func (Migrator) Migrate2to3 added in v0.46.0

func (m Migrator) Migrate2to3(ctx sdk.Context) error

Migrate2to3 migrates x/staking state from consensus version 2 to 3.

func (Migrator) Migrate3to4 added in v0.47.0

func (m Migrator) Migrate3to4(ctx sdk.Context) error

Migrate3to4 migrates x/staking state from consensus version 3 to 4.

type Querier added in v0.40.0

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) AllTokenizeShareRecords

Query for all tokenize share records

func (Querier) Delegation added in v0.40.0

Delegation queries delegate info for given validator delegator pair

func (Querier) DelegatorDelegations added in v0.40.0

DelegatorDelegations queries all delegations of a give delegator address

func (Querier) DelegatorUnbondingDelegations added in v0.40.0

DelegatorUnbondingDelegations queries all unbonding delegations of a given delegator address

func (Querier) DelegatorValidator added in v0.40.0

DelegatorValidator queries validator info for given delegator validator pair

func (Querier) DelegatorValidators added in v0.40.0

DelegatorValidators queries all validators info for given delegator address

func (Querier) HistoricalInfo added in v0.40.0

HistoricalInfo queries the historical info for given height

func (Querier) LastTokenizeShareRecordId

Query for last tokenize share record id

func (Querier) Params added in v0.40.0

Params queries the staking parameters

func (Querier) Pool added in v0.40.0

Pool queries the pool info

func (Querier) Redelegations added in v0.40.0

Redelegations queries redelegations of given address

func (Querier) TokenizeShareLockInfo

Query status of an account's tokenize share lock

func (Querier) TokenizeShareRecordByDenom

Query for individual tokenize share record information by share denom

func (Querier) TokenizeShareRecordById

Query for individual tokenize share record information by share by id

func (Querier) TokenizeShareRecordsOwned

Query tokenize share records by address

func (Querier) TotalLiquidStaked

Query for total tokenized staked tokens Liquid staked tokens are either tokenized delegations or delegations owned by a module account

func (Querier) TotalTokenizeSharedAssets

Query for total tokenized staked assets

func (Querier) UnbondingDelegation added in v0.40.0

UnbondingDelegation queries unbonding info for give validator delegator pair

func (Querier) Validator added in v0.40.0

Validator queries validator info for given validator address

func (Querier) ValidatorDelegations added in v0.40.0

ValidatorDelegations queries delegate info for given validator

func (Querier) ValidatorUnbondingDelegations added in v0.40.0

ValidatorUnbondingDelegations queries unbonding delegations of a validator

func (Querier) Validators added in v0.40.0

Validators queries all validators that match the given status

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL