keeper

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2023 License: Apache-2.0 Imports: 37 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultParamspace = types.ModuleName
)

Default parameter namespace

Variables

View Source
var (
	Addrs = createTestAddrs(500)
	PKs   = createTestPubKeys(500)

	SufficientInitBalance = int64(10000)
	InitMsd2000           = sdk.NewDec(2000)
	TestChainID           = "stkchainid"
)

dummy addresses used for testing nolint: unused deadcode

Functions

func DelegationsToDelegationResponses

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

func DelegatorAddSharesInvariant

func DelegatorAddSharesInvariant(k Keeper) sdk.Invariant

DelegatorAddSharesInvariant checks whether all the shares which persist in the store add up to the correct total shares amount stored on each existing validator

func MakeTestCodec

func MakeTestCodec() *codec.Codec

MakeTestCodec creates a codec used only for testing

func ModuleAccountInvariantsCustom

func ModuleAccountInvariantsCustom(k Keeper) sdk.Invariant

ModuleAccountInvariantsCustom check invariants for module account

func NewPubKey

func NewPubKey(pk string) (res crypto.PubKey)

func NewQuerier

func NewQuerier(k Keeper) sdk.Querier

NewQuerier creates a querier for staking REST endpoints

func NewTestMsgCreateValidator

func NewTestMsgCreateValidator(address sdk.ValAddress, pubKey crypto.PubKey, msdAmt sdk.Dec) types.MsgCreateValidator

func NewTestMsgDeposit

func NewTestMsgDeposit(delAddr sdk.AccAddress, valAddr sdk.ValAddress, amt sdk.Dec) types.MsgDeposit

func NonNegativePowerInvariantCustom

func NonNegativePowerInvariantCustom(k Keeper) sdk.Invariant

NonNegativePowerInvariantCustom checks that all stored validators have nonnegative power

func ParamKeyTable

func ParamKeyTable() params.KeyTable

ParamKeyTable returns param table for staking module

func PositiveDelegatorInvariant

func PositiveDelegatorInvariant(k Keeper) sdk.Invariant

PositiveDelegatorInvariant checks that all tokens delegated by delegator are greater than 0

func RegisterInvariantsCustom

func RegisterInvariantsCustom(ir sdk.InvariantRegistry, k Keeper)

RegisterInvariantsCustom registers all staking invariants for okbchain

func SimpleCheckValidator

func SimpleCheckValidator(t *testing.T, ctx sdk.Context, stkKeeper Keeper, vaAddr sdk.ValAddress,
	expMsd sdk.Dec, expStatus sdk.BondStatus, expDlgShares sdk.Dec, expJailed bool) *types.Validator

func SimulateWeight

func SimulateWeight(tokens sdk.Dec) types.Shares

func TestAddr

func TestAddr(addr string, bech string) sdk.AccAddress

TestAddr is designed for incode address generation

func ValidatorByPowerIndexExists

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

ValidatorByPowerIndexExists checks whether a certain by-power index record exist

Types

type Keeper

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

Keeper is the keeper struct of the staking store

func NewKeeper

func NewKeeper(cdcMarshl *codec.CodecProxy, key sdk.StoreKey, supplyKeeper types.SupplyKeeper,
	paramstore params.Subspace) Keeper

NewKeeper creates a new staking Keeper instance

func NewKeeperWithNoParam

func NewKeeperWithNoParam(cdcMarshl *codec.CodecProxy, key sdk.StoreKey, supplyKeeper types.SupplyKeeper,
	paramstore params.Subspace) Keeper

func (Keeper) AddSharesAsMinSelfDelegation

func (k Keeper) AddSharesAsMinSelfDelegation(ctx sdk.Context, delAddr sdk.AccAddress, validator *types.Validator,
	defaultMSDToken sdk.SysCoin) (err error)

AddSharesAsMinSelfDelegation adds shares of equal value of default msd (0.001okB) to validator itself during the creation

func (Keeper) AddSharesToValidators

func (k Keeper) AddSharesToValidators(ctx sdk.Context, delAddr sdk.AccAddress, vals types.Validators, tokens sdk.Dec) (
	shares types.Shares, sdkErr error)

AddSharesToValidators adds shares to validators and return the amount of the shares

func (Keeper) AfterDelegationModified

func (k Keeper) AfterDelegationModified(ctx sdk.Context, delAddr sdk.AccAddress, valAddrs []sdk.ValAddress)

AfterDelegationModified - call hook if registered

func (Keeper) AfterValidatorBeginUnbonding

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

AfterValidatorBeginUnbonding - call hook if registered

func (Keeper) AfterValidatorBonded

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

AfterValidatorBonded - call hook if registered

func (Keeper) AfterValidatorCreated

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

AfterValidatorCreated - call hook if registered

func (Keeper) AfterValidatorDestroyed

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

AfterValidatorDestroyed - call hook if registered

func (Keeper) AfterValidatorRemoved

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

AfterValidatorRemoved - call hook if registered

func (Keeper) AppendAbandonedValidatorAddrs

func (k Keeper) AppendAbandonedValidatorAddrs(ctx sdk.Context, ConsAddr sdk.ConsAddress)

AppendAbandonedValidatorAddrs appends validator addresses to kick out

func (Keeper) ApplyAndReturnValidatorSetUpdates

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

ApplyAndReturnValidatorSetUpdates applies and returns 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

func (k Keeper) BeforeDelegationCreated(ctx sdk.Context, delAddr sdk.AccAddress, valAddrs []sdk.ValAddress)

BeforeDelegationCreated - call hook if registered

func (Keeper) BeforeDelegationRemoved

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

BeforeDelegationRemoved - call hook if registered

func (Keeper) BeforeDelegationSharesModified

func (k Keeper) BeforeDelegationSharesModified(ctx sdk.Context, delAddr sdk.AccAddress, valAddrs []sdk.ValAddress)

BeforeDelegationSharesModified - call hook if registered

func (Keeper) BeforeValidatorModified

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

BeforeValidatorModified - call hook if registered

func (Keeper) BondDenom

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

BondDenom returns the default the denomination of staking token

func (Keeper) BondedRatio

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

BondedRatio the fraction of the staking tokens which are currently bonded

func (Keeper) CheckEnabled

func (k Keeper) CheckEnabled(ctx sdk.Context) bool

CheckEnabled - check modules enabled

func (Keeper) ClearProxy

func (k Keeper) ClearProxy(ctx sdk.Context, proxyAddr sdk.AccAddress)

ClearProxy clears the ProxyAddress on the delegator who has bound

func (Keeper) Codespace

func (k Keeper) Codespace() string

Codespace returns the codespace

func (Keeper) CompleteUndelegation

func (k Keeper) CompleteUndelegation(ctx sdk.Context, delAddr sdk.AccAddress) (sdk.Dec, error)

CompleteUndelegation handles the final process when the undelegation is completed

func (Keeper) Delegate

func (k Keeper) Delegate(ctx sdk.Context, delAddr sdk.AccAddress, token sdk.SysCoin) error

Delegate handles the process of delegating

func (Keeper) Delegation

func (k Keeper) Delegation(ctx sdk.Context, delAddr sdk.AccAddress, address2 sdk.ValAddress) exported.DelegatorI

func (Keeper) Delegator

func (k Keeper) Delegator(ctx sdk.Context, delAddr sdk.AccAddress) exported.DelegatorI

Delegator gets the DelegatorI interface for other module

func (Keeper) DeleteAbandonedValidatorAddrs

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

DeleteAbandonedValidatorAddrs deletes the abandoned validator addresses

func (Keeper) DeleteAddrByTimeKey

func (k Keeper) DeleteAddrByTimeKey(ctx sdk.Context, timestamp time.Time, delAddr sdk.AccAddress)

DeleteAddrByTimeKey deletes the time+delAddr key from store

func (Keeper) DeleteDelegator

func (k Keeper) DeleteDelegator(ctx sdk.Context, delAddr sdk.AccAddress)

DeleteDelegator deletes Delegator info from store

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)

DeleteLastValidatorPower deletes the last validator power

func (Keeper) DeleteProposeValidators

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

DeleteProposeValidators deletes proposed validators to db

func (Keeper) DeleteShares

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

DeleteShares deletes shares entire from store

func (Keeper) DeleteUndelegating

func (k Keeper) DeleteUndelegating(ctx sdk.Context, delAddr sdk.AccAddress)

DeleteUndelegating deletes UndelegationInfo from store

func (Keeper) DeleteValidatorByPowerIndex

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

DeleteValidatorByPowerIndex deletes the power index key

func (Keeper) DeleteValidatorQueue

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

DeleteValidatorQueue deletes a validator address from the validator queue

func (Keeper) DeleteValidatorQueueTimeSlice

func (k Keeper) DeleteValidatorQueueTimeSlice(ctx sdk.Context, timestamp time.Time)

DeleteValidatorQueueTimeSlice deletes a specific validator queue timeslice

func (Keeper) DepositMinSelfDelegation

func (k Keeper) DepositMinSelfDelegation(ctx sdk.Context, delAddr sdk.AccAddress, validator *types.Validator,
	defaultMSDToken sdk.SysCoin) (err error)

func (Keeper) GetAllDelegatorDelegations

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

func (Keeper) GetAllValidators

func (k Keeper) GetAllValidators(ctx sdk.Context) (validators types.Validators)

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

func (Keeper) GetBondedPool

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

GetBondedPool returns the bonded tokens pool's module account

func (Keeper) GetDelegator

func (k Keeper) GetDelegator(ctx sdk.Context, delAddr sdk.AccAddress) (delegator types.Delegator, found bool)

GetDelegator gets Delegator entity from store

func (Keeper) GetDelegatorUnbondingDelegations

func (k Keeper) GetDelegatorUnbondingDelegations(ctx sdk.Context,
	delAddr sdk.AccAddress, page *query.PageRequest) (types.UnbondingDelegations, *query.PageResponse, error)

func (Keeper) GetDelegatorsByProxy

func (k Keeper) GetDelegatorsByProxy(ctx sdk.Context, proxyAddr sdk.AccAddress) (delAddrs []sdk.AccAddress)

GetDelegatorsByProxy returns all delegator addresses binding a proxy and it's useful for querier

func (Keeper) GetEpoch

func (k Keeper) GetEpoch(ctx sdk.Context) (epoch uint16)

GetEpoch returns the epoch for validators updates

func (Keeper) GetHistoricalInfo

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

GetHistoricalInfo gets the historical info at a given height

func (Keeper) GetLastTotalPower

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

GetLastTotalPower loads the last total validator power

func (Keeper) GetLastValidatorPower

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

GetLastValidatorPower loads the last validator power and returns zero if the operator was not a validator last block

func (Keeper) GetLastValidators

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

get the group of the bonded validators

func (Keeper) GetLastValidatorsByAddr

func (k Keeper) GetLastValidatorsByAddr(ctx sdk.Context) validatorsByAddr

get the last validator set

func (Keeper) GetLastValsAddedSharesExisted

func (k Keeper) GetLastValsAddedSharesExisted(ctx sdk.Context, delAddr sdk.AccAddress) (types.Validators, types.Shares)

GetLastValsAddedSharesExisted gets last validators that the delegator added shares to last time

func (Keeper) GetNotBondedPool

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

GetNotBondedPool returns the not bonded tokens pool's module account

func (Keeper) GetOperAddrFromValidatorAddr

func (k Keeper) GetOperAddrFromValidatorAddr(ctx sdk.Context, va string) (sdk.ValAddress, bool)

GetOperAddrFromValidatorAddr returns the validator address according to the consensus pubkey the validator has to exist

func (Keeper) GetOperAndValidatorAddr

func (k Keeper) GetOperAndValidatorAddr(ctx sdk.Context) types.OVPairs

GetOperAndValidatorAddr returns the operator addresses and consensus pubkeys of all the validators

func (Keeper) GetParams

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

GetParams gets all params as types.Params

func (Keeper) GetProposeValidators

func (k Keeper) GetProposeValidators(ctx sdk.Context) map[[sdk.AddrLen]byte]bool

GetProposeValidators gets proposed validators from db

func (Keeper) GetShares

func (k Keeper) GetShares(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) (types.Shares, bool)

GetShares gets the shares entity

func (Keeper) GetTheEndOfLastEpoch

func (k Keeper) GetTheEndOfLastEpoch(ctx sdk.Context) (height int64)

GetTheEndOfLastEpoch returns the deadline of the current epoch

func (Keeper) GetUnbondingDelegation

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

func (Keeper) GetUndelegating

func (k Keeper) GetUndelegating(ctx sdk.Context, delAddr sdk.AccAddress) (undelegationInfo types.UndelegationInfo,
	found bool)

GetUndelegating gets UndelegationInfo entity from store

func (Keeper) GetValidator

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

GetValidator gets a single validator

func (Keeper) GetValidatorAllShares

func (k Keeper) GetValidatorAllShares(ctx sdk.Context, valAddr sdk.ValAddress) types.SharesResponses

GetValidatorAllShares returns all shares added to a specific validator and it's useful for querier

func (Keeper) GetValidatorByConsAddr

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

GetValidatorByConsAddr gets a single validator by consensus address

func (Keeper) GetValidatorQueueTimeSlice

func (k Keeper) GetValidatorQueueTimeSlice(ctx sdk.Context, timestamp time.Time) (valAddrs []sdk.ValAddress)

GetValidatorQueueTimeSlice gets a specific validator queue timeslice A timeslice is a slice of ValAddresses corresponding to unbonding validators that expire at a certain time

func (Keeper) GetValidatorsToAddShares

func (k Keeper) GetValidatorsToAddShares(ctx sdk.Context, valAddrs []sdk.ValAddress) (types.Validators, error)

GetValidatorsToAddShares gets the validators from their validator addresses

func (Keeper) HistoricalEntries

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

func (Keeper) InsertValidatorQueue

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

InsertValidatorQueue inserts an validator address to the appropriate timeslice in the validator queue

func (Keeper) IsEndOfEpoch

func (k Keeper) IsEndOfEpoch(ctx sdk.Context) bool

IsEndOfEpoch checks whether an epoch is end

func (Keeper) IsKickedOut

func (k Keeper) IsKickedOut(ctx sdk.Context) bool

IsKickedOut tells whether there're jailed validators to kick out in an epoch

func (Keeper) IsValidator

func (k Keeper) IsValidator(ctx sdk.Context, addr sdk.AccAddress) bool

IsValidator tells whether a validator is in bonded status

func (Keeper) IterateBondedValidatorsByPower

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

IterateBondedValidatorsByPower iterates through the bonded validator set and performs the provided function

func (Keeper) IterateDelegator

func (k Keeper) IterateDelegator(ctx sdk.Context, fn func(index int64, delegator types.Delegator) (stop bool))

IterateDelegator iterates through all of the delegators info from the store

func (Keeper) IterateKeysBeforeCurrentTime

func (k Keeper) IterateKeysBeforeCurrentTime(ctx sdk.Context, currentTime time.Time,
	fn func(index int64, key []byte) (stop bool))

IterateKeysBeforeCurrentTime iterates for all keys of (time+delAddr) from time 0 until the current Blockheader time

func (Keeper) IterateLastValidatorPowers

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

IterateLastValidatorPowers iterates over last validator powers

func (Keeper) IterateLastValidators

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

IterateLastValidators iterates through the active validator set and performs the provided function

func (Keeper) IterateProxy

func (k Keeper) IterateProxy(ctx sdk.Context, proxyAddr sdk.AccAddress, isClear bool,
	fn func(index int64, delAddr, proxyAddr sdk.AccAddress) (stop bool))

IterateProxy iterates all the info between delegator and its proxy

func (Keeper) IterateShares

func (k Keeper) IterateShares(ctx sdk.Context, fn func(index int64, delAddr sdk.AccAddress, valAddr sdk.ValAddress,
	shares types.Shares) (stop bool))

IterateShares iterates through all of the shares from store

func (Keeper) IterateUndelegationInfo

func (k Keeper) IterateUndelegationInfo(ctx sdk.Context,
	fn func(index int64, undelegationInfo types.UndelegationInfo) (stop bool))

IterateUndelegationInfo iterates through all of the undelegation info

func (Keeper) IterateValidators

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

IterateValidators iterates through the validator set and performs the provided function

func (Keeper) Jail

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

Jail sents a validator to jail

func (Keeper) KickOutAndReturnValidatorSetUpdates

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

KickOutAndReturnValidatorSetUpdates shows the main logic when a validator is kicked out of validator-set in an epoch

func (Keeper) LastValidatorsIterator

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

LastValidatorsIterator 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) MaxValidators

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

MaxValidators returns the param Maximum number of validators

func (Keeper) ParamsConsensusType

func (k Keeper) ParamsConsensusType(ctx sdk.Context) (consensusType common.ConsensusType)

ParamsConsensusType returns the param ConsensusType

func (Keeper) ParamsEnableDposOp

func (k Keeper) ParamsEnableDposOp(ctx sdk.Context) (enableDposOp bool)

ParamsEnableDposOp returns the param EnableDposOp

func (Keeper) ParamsEpoch

func (k Keeper) ParamsEpoch(ctx sdk.Context) (res uint16)

ParamsEpoch returns epoch from paramstore, only update the KeyEpoch after last epoch ends

func (Keeper) ParamsMaxValsToAddShares

func (k Keeper) ParamsMaxValsToAddShares(ctx sdk.Context) (num uint16)

ParamsMaxValsToAddShares returns the param MaxValsToAddShares

func (Keeper) ParamsMinDelegation

func (k Keeper) ParamsMinDelegation(ctx sdk.Context) (num sdk.Dec)

ParamsMinDelegation returns the param MinDelegateAmount

func (Keeper) ParamsMinSelfDelegation

func (k Keeper) ParamsMinSelfDelegation(ctx sdk.Context) (num sdk.Dec)

ParamsMinSelfDelegation returns the param MinSelfDelegateAmount

func (Keeper) PoAApplyAndReturnValidatorSetUpdates

func (k Keeper) PoAApplyAndReturnValidatorSetUpdates(ctx sdk.Context, proposeValidators map[[sdk.AddrLen]byte]bool) (updates []abci.ValidatorUpdate)

func (Keeper) RemoveValidator

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

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

func (Keeper) SetAddrByTimeKeyWithNilValue

func (k Keeper) SetAddrByTimeKeyWithNilValue(ctx sdk.Context, timestamp time.Time, delAddr sdk.AccAddress)

SetAddrByTimeKeyWithNilValue sets the time+delAddr key into store with an empty value

func (Keeper) SetDelegator

func (k Keeper) SetDelegator(ctx sdk.Context, delegator types.Delegator)

SetDelegator sets Delegator info to store

func (Keeper) SetEpoch

func (k Keeper) SetEpoch(ctx sdk.Context, epoch uint16)

SetEpoch set epoch into keystore

func (Keeper) SetHistoricalInfo

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

SetHistoricalInfo sets the historical info at a given height

func (*Keeper) SetHooks

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

SetHooks sets the validator hooks

func (Keeper) SetLastTotalPower

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

SetLastTotalPower sets the last total validator power

func (Keeper) SetLastValidatorPower

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

SetLastValidatorPower sets the last validator power

func (Keeper) SetNewValidatorByPowerIndex

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

SetNewValidatorByPowerIndex sets the power index key of a validator

func (Keeper) SetParams

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

SetParams sets the params

func (Keeper) SetProposeValidator

func (k Keeper) SetProposeValidator(ctx sdk.Context, operator sdk.ValAddress, isAdd bool)

SetProposeValidator sets proposed validators to db

func (Keeper) SetProxyBinding

func (k Keeper) SetProxyBinding(ctx sdk.Context, proxyAddress, delegatorAddress sdk.AccAddress, isRemove bool)

SetProxyBinding sets or deletes the key of proxy relationship

func (Keeper) SetShares

func (k Keeper) SetShares(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress, shares types.Shares)

SetShares sets the shares that added to validators to store

func (Keeper) SetTheEndOfLastEpoch

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

SetTheEndOfLastEpoch sets the deadline of the current epoch

func (Keeper) SetUndelegating

func (k Keeper) SetUndelegating(ctx sdk.Context, undelegationInfo types.UndelegationInfo)

SetUndelegating sets UndelegationInfo entity to store

func (Keeper) SetValidator

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

SetValidator sets the main record holding validator details

func (Keeper) SetValidatorByConsAddr

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

SetValidatorByConsAddr sets the operator address with the key of validator consensus pubkey

func (Keeper) SetValidatorByPowerIndex

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

SetValidatorByPowerIndex sets the power index key of an unjailed validator

func (Keeper) SetValidatorQueueTimeSlice

func (k Keeper) SetValidatorQueueTimeSlice(ctx sdk.Context, timestamp time.Time, keys []sdk.ValAddress)

SetValidatorQueueTimeSlice sets a specific validator queue timeslice

func (Keeper) Slash

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

func (Keeper) StakingTokenSupply

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

StakingTokenSupply staking tokens from the total supply

func (Keeper) TotalBondedTokens

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

TotalBondedTokens total staking tokens supply which is bonded TODO:No usages found in project files,remove it later

func (Keeper) TrackHistoricalInfo

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

func (Keeper) UnbondAllMatureValidatorQueue

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

UnbondAllMatureValidatorQueue unbonds all the unbonding validators that have finished their unbonding period

func (Keeper) UnbondingTime

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

UnbondingTime returns the param UnbondingTime

func (Keeper) Unjail

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

Unjail discharges a validator by unjailing

func (Keeper) UpdateProxy

func (k Keeper) UpdateProxy(ctx sdk.Context, delegator types.Delegator, tokens sdk.Dec) (err error)

UpdateProxy updates the shares by the total delegated and self delegated tokens of a proxy

func (Keeper) UpdateShares

func (k Keeper) UpdateShares(ctx sdk.Context, delAddr sdk.AccAddress, tokens sdk.Dec) error

UpdateShares withdraws and adds shares continuously on the same validator set with different amount of shares

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

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

Validator gets the Validator interface for a particular address

func (Keeper) ValidatorByConsAddr

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

ValidatorByConsAddr gets the validator interface for a particular pubkey

func (Keeper) ValidatorQueueIterator

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

ValidatorQueueIterator returns all the validator queue timeslices from time 0 until endTime

func (Keeper) ValidatorsPowerStoreIterator

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

ValidatorsPowerStoreIterator returns an iterator for the current validator power store

func (Keeper) Withdraw

func (k Keeper) Withdraw(ctx sdk.Context, delAddr sdk.AccAddress, token sdk.SysCoin) (time.Time, error)

Withdraw handles the process of withdrawing token from deposit account

func (Keeper) WithdrawLastShares

func (k Keeper) WithdrawLastShares(ctx sdk.Context, delAddr sdk.AccAddress, lastValsAddedSharesTo types.Validators,
	lastShares types.Shares)

WithdrawLastShares withdraws the shares last time from the validators

func (Keeper) WithdrawMinSelfDelegation

func (k Keeper) WithdrawMinSelfDelegation(ctx sdk.Context, delAddr sdk.AccAddress, validator types.Validator,
) (completionTime time.Time, err error)

WithdrawMinSelfDelegation withdraws the msd from validator

type MockStakingKeeper

type MockStakingKeeper struct {
	Keeper
	StoreKey     sdk.StoreKey
	TkeyStoreKey sdk.StoreKey
	SupplyKeeper supply.Keeper
	MountedStore store.MultiStore
	AccKeeper    auth.AccountKeeper
}

func CreateTestInput

func CreateTestInput(t *testing.T, isCheckTx bool, initBalance int64) (sdk.Context, auth.AccountKeeper, MockStakingKeeper)

CreateTestInput returns all sorts of input required for testing initBalance is converted to an amount of tokens.

func NewMockStakingKeeper

func NewMockStakingKeeper(k Keeper, keyStoreKey, tkeyStoreKey sdk.StoreKey, sKeeper supply.Keeper,
	ms store.MultiStore, accKeeper auth.AccountKeeper) MockStakingKeeper

type Querier

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

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

func NewGrpcQuerier

func NewGrpcQuerier(k Keeper) *Querier

func (*Querier) Params

func (*Querier) Pool

func (Querier) Validators

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