Documentation ¶
Index ¶
- Constants
- Variables
- func DelegatorAddSharesInvariant(k Keeper) sdk.Invariant
- func MakeTestCodec() *codec.Codec
- func ModuleAccountInvariantsCustom(k Keeper) sdk.Invariant
- func NewPubKey(pk string) (res crypto.PubKey)
- func NewQuerier(k Keeper) sdk.Querier
- func NewTestMsgCreateValidator(address sdk.ValAddress, pubKey crypto.PubKey, msdAmt sdk.Dec) types.MsgCreateValidator
- func NewTestMsgDeposit(delAddr sdk.AccAddress, valAddr sdk.ValAddress, amt sdk.Dec) types.MsgDeposit
- func NonNegativePowerInvariantCustom(k Keeper) sdk.Invariant
- func ParamKeyTable() params.KeyTable
- func PositiveDelegatorInvariant(k Keeper) sdk.Invariant
- func RegisterInvariantsCustom(ir sdk.InvariantRegistry, k Keeper)
- func SimpleCheckValidator(t *testing.T, ctx sdk.Context, stkKeeper Keeper, vaAddr sdk.ValAddress, ...) *types.Validator
- func SimulateWeight(nowTime int64, tokens sdk.Dec) (votes types.Shares, sdkErr sdk.Error)
- func TestAddr(addr string, bech string) sdk.AccAddress
- func ValidatorByPowerIndexExists(ctx sdk.Context, keeper MockStakingKeeper, power []byte) bool
- type Keeper
- func (k Keeper) AddSharesAsMinSelfDelegation(ctx sdk.Context, delAddr sdk.AccAddress, validator *types.Validator, ...) (err sdk.Error)
- func (k Keeper) AddSharesToValidators(ctx sdk.Context, delAddr sdk.AccAddress, vals types.Validators, tokens sdk.Dec) (shares types.Shares, sdkErr sdk.Error)
- func (k Keeper) AfterValidatorBeginUnbonding(ctx sdk.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress)
- func (k Keeper) AfterValidatorBonded(ctx sdk.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress)
- func (k Keeper) AfterValidatorCreated(ctx sdk.Context, valAddr sdk.ValAddress)
- func (k Keeper) AfterValidatorDestroyed(ctx sdk.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress)
- func (k Keeper) AfterValidatorRemoved(ctx sdk.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress)
- func (k Keeper) AppendAbandonedValidatorAddrs(ctx sdk.Context, ConsAddr sdk.ConsAddress)
- func (k Keeper) ApplyAndReturnValidatorSetUpdates(ctx sdk.Context) (updates []abci.ValidatorUpdate)
- func (k Keeper) BeforeValidatorModified(ctx sdk.Context, valAddr sdk.ValAddress)
- func (k Keeper) BondDenom(ctx sdk.Context) (res string)
- func (k Keeper) BondedRatio(ctx sdk.Context) sdk.Dec
- func (k Keeper) ClearProxy(ctx sdk.Context, proxyAddr sdk.AccAddress)
- func (k Keeper) Codespace() sdk.CodespaceType
- func (k Keeper) CompleteUndelegation(ctx sdk.Context, delAddr sdk.AccAddress) (sdk.Dec, sdk.Error)
- func (k Keeper) Delegate(ctx sdk.Context, delAddr sdk.AccAddress, token sdk.DecCoin) sdk.Error
- func (k Keeper) Delegator(ctx sdk.Context, delAddr sdk.AccAddress) exported.DelegatorI
- func (k Keeper) DeleteAbandonedValidatorAddrs(ctx sdk.Context)
- func (k Keeper) DeleteAddrByTimeKey(ctx sdk.Context, timestamp time.Time, delAddr sdk.AccAddress)
- func (k Keeper) DeleteDelegator(ctx sdk.Context, delAddr sdk.AccAddress)
- func (k Keeper) DeleteLastValidatorPower(ctx sdk.Context, operator sdk.ValAddress)
- func (k Keeper) DeleteShares(ctx sdk.Context, valAddr sdk.ValAddress, delAddr sdk.AccAddress)
- func (k Keeper) DeleteUndelegating(ctx sdk.Context, delAddr sdk.AccAddress)
- func (k Keeper) DeleteValidatorByPowerIndex(ctx sdk.Context, validator types.Validator)
- func (k Keeper) DeleteValidatorQueue(ctx sdk.Context, val types.Validator)
- func (k Keeper) DeleteValidatorQueueTimeSlice(ctx sdk.Context, timestamp time.Time)
- func (k Keeper) GetAllValidators(ctx sdk.Context) (validators types.Validators)
- func (k Keeper) GetBondedPool(ctx sdk.Context) (bondedPool exported.ModuleAccountI)
- func (k Keeper) GetDelegator(ctx sdk.Context, delAddr sdk.AccAddress) (delegator types.Delegator, found bool)
- func (k Keeper) GetDelegatorsByProxy(ctx sdk.Context, proxyAddr sdk.AccAddress) (delAddrs []sdk.AccAddress)
- func (k Keeper) GetEpoch(ctx sdk.Context) (epoch uint16)
- func (k Keeper) GetLastTotalPower(ctx sdk.Context) (power sdk.Int)
- func (k Keeper) GetLastValidatorPower(ctx sdk.Context, operator sdk.ValAddress) (power int64)
- func (k Keeper) GetLastValsAddedSharesExisted(ctx sdk.Context, delAddr sdk.AccAddress) (types.Validators, types.Shares)
- func (k Keeper) GetNotBondedPool(ctx sdk.Context) (notBondedPool exported.ModuleAccountI)
- func (k Keeper) GetOperAddrFromValidatorAddr(ctx sdk.Context, va string) (sdk.ValAddress, bool)
- func (k Keeper) GetOperAndValidatorAddr(ctx sdk.Context) types.OVPairs
- func (k Keeper) GetParams(ctx sdk.Context) types.Params
- func (k Keeper) GetShares(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) (types.Shares, bool)
- func (k Keeper) GetTheEndOfLastEpoch(ctx sdk.Context) (height int64)
- func (k Keeper) GetUndelegating(ctx sdk.Context, delAddr sdk.AccAddress) (undelegationInfo types.UndelegationInfo, found bool)
- func (k Keeper) GetValidator(ctx sdk.Context, addr sdk.ValAddress) (validator types.Validator, found bool)
- func (k Keeper) GetValidatorAllShares(ctx sdk.Context, valAddr sdk.ValAddress) types.SharesResponses
- func (k Keeper) GetValidatorByConsAddr(ctx sdk.Context, consAddr sdk.ConsAddress) (validator types.Validator, found bool)
- func (k Keeper) GetValidatorQueueTimeSlice(ctx sdk.Context, timestamp time.Time) (valAddrs []sdk.ValAddress)
- func (k Keeper) GetValidatorsToAddShares(ctx sdk.Context, valAddrs []sdk.ValAddress) (types.Validators, sdk.Error)
- func (k Keeper) InsertValidatorQueue(ctx sdk.Context, val types.Validator)
- func (k Keeper) IsEndOfEpoch(ctx sdk.Context) bool
- func (k Keeper) IsKickedOut(ctx sdk.Context) bool
- func (k Keeper) IsValidator(ctx sdk.Context, addr sdk.AccAddress) bool
- func (k Keeper) IterateBondedValidatorsByPower(ctx sdk.Context, ...)
- func (k Keeper) IterateDelegator(ctx sdk.Context, fn func(index int64, delegator types.Delegator) (stop bool))
- func (k Keeper) IterateKeysBeforeCurrentTime(ctx sdk.Context, currentTime time.Time, ...)
- func (k Keeper) IterateLastValidatorPowers(ctx sdk.Context, ...)
- func (k Keeper) IterateLastValidators(ctx sdk.Context, ...)
- func (k Keeper) IterateProxy(ctx sdk.Context, proxyAddr sdk.AccAddress, isClear bool, ...)
- func (k Keeper) IterateShares(ctx sdk.Context, ...)
- func (k Keeper) IterateUndelegationInfo(ctx sdk.Context, ...)
- func (k Keeper) IterateValidators(ctx sdk.Context, ...)
- func (k Keeper) Jail(ctx sdk.Context, consAddr sdk.ConsAddress)
- func (k Keeper) KickOutAndReturnValidatorSetUpdates(ctx sdk.Context) (updates []abci.ValidatorUpdate)
- func (k Keeper) LastValidatorsIterator(ctx sdk.Context) (iterator sdk.Iterator)
- func (k Keeper) Logger(ctx sdk.Context) log.Logger
- func (k Keeper) MaxValidators(ctx sdk.Context) (res uint16)
- func (k Keeper) ParamsEpoch(ctx sdk.Context) (res uint16)
- func (k Keeper) ParamsMaxValsToAddShares(ctx sdk.Context) (num uint16)
- func (k Keeper) ParamsMinDelegation(ctx sdk.Context) (num sdk.Dec)
- func (k Keeper) ParamsMinSelfDelegation(ctx sdk.Context) (num sdk.Dec)
- func (k Keeper) RemoveValidator(ctx sdk.Context, address sdk.ValAddress)
- func (k Keeper) SetAddrByTimeKeyWithNilValue(ctx sdk.Context, timestamp time.Time, delAddr sdk.AccAddress)
- func (k Keeper) SetDelegator(ctx sdk.Context, delegator types.Delegator)
- func (k Keeper) SetEpoch(ctx sdk.Context, epoch uint16)
- func (k *Keeper) SetHooks(sh types.StakingHooks) *Keeper
- func (k Keeper) SetLastTotalPower(ctx sdk.Context, power sdk.Int)
- func (k Keeper) SetLastValidatorPower(ctx sdk.Context, operator sdk.ValAddress, power int64)
- func (k Keeper) SetNewValidatorByPowerIndex(ctx sdk.Context, validator types.Validator)
- func (k Keeper) SetParams(ctx sdk.Context, params types.Params)
- func (k Keeper) SetProxyBinding(ctx sdk.Context, proxyAddress, delegatorAddress sdk.AccAddress, isRemove bool)
- func (k Keeper) SetShares(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress, ...)
- func (k Keeper) SetTheEndOfLastEpoch(ctx sdk.Context)
- func (k Keeper) SetUndelegating(ctx sdk.Context, undelegationInfo types.UndelegationInfo)
- func (k Keeper) SetValidator(ctx sdk.Context, validator types.Validator)
- func (k Keeper) SetValidatorByConsAddr(ctx sdk.Context, validator types.Validator)
- func (k Keeper) SetValidatorByPowerIndex(ctx sdk.Context, validator types.Validator)
- func (k Keeper) SetValidatorQueueTimeSlice(ctx sdk.Context, timestamp time.Time, keys []sdk.ValAddress)
- func (k Keeper) StakingTokenSupply(ctx sdk.Context) sdk.Dec
- func (k Keeper) TotalBondedTokens(ctx sdk.Context) sdk.Dec
- func (k Keeper) UnbondAllMatureValidatorQueue(ctx sdk.Context)
- func (k Keeper) UnbondingTime(ctx sdk.Context) (res time.Duration)
- func (k Keeper) Unjail(ctx sdk.Context, consAddr sdk.ConsAddress)
- func (k Keeper) UpdateProxy(ctx sdk.Context, delegator types.Delegator, tokens sdk.Dec) (err sdk.Error)
- func (k Keeper) UpdateShares(ctx sdk.Context, delAddr sdk.AccAddress, tokens sdk.Dec) sdk.Error
- func (k Keeper) Validator(ctx sdk.Context, address sdk.ValAddress) exported.ValidatorI
- func (k Keeper) ValidatorByConsAddr(ctx sdk.Context, addr sdk.ConsAddress) exported.ValidatorI
- func (k Keeper) ValidatorQueueIterator(ctx sdk.Context, endTime time.Time) sdk.Iterator
- func (k Keeper) ValidatorsPowerStoreIterator(ctx sdk.Context) (iterator sdk.Iterator)
- func (k Keeper) Withdraw(ctx sdk.Context, delAddr sdk.AccAddress, token sdk.DecCoin) (time.Time, sdk.Error)
- func (k Keeper) WithdrawLastShares(ctx sdk.Context, delAddr sdk.AccAddress, ...)
- func (k Keeper) WithdrawMinSelfDelegation(ctx sdk.Context, delAddr sdk.AccAddress, validator types.Validator) (completionTime time.Time, err sdk.Error)
- type MockStakingKeeper
Constants ¶
const (
DefaultParamspace = types.ModuleName
)
Default parameter namespace
Variables ¶
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 DelegatorAddSharesInvariant ¶
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 ¶
MakeTestCodec creates a codec used only for testing
func ModuleAccountInvariantsCustom ¶
ModuleAccountInvariantsCustom check invariants for module account
func NewQuerier ¶
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 ¶
NonNegativePowerInvariantCustom checks that all stored validators have nonnegative power
func ParamKeyTable ¶
ParamKeyTable returns param table for staking module
func PositiveDelegatorInvariant ¶
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 okexchain
func SimpleCheckValidator ¶
func SimulateWeight ¶
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(cdc *codec.Codec, key, tkey sdk.StoreKey, supplyKeeper types.SupplyKeeper, paramstore params.Subspace, codespace sdk.CodespaceType) Keeper
NewKeeper creates a new staking Keeper instance
func (Keeper) AddSharesAsMinSelfDelegation ¶
func (k Keeper) AddSharesAsMinSelfDelegation(ctx sdk.Context, delAddr sdk.AccAddress, validator *types.Validator, defaultMSDToken sdk.DecCoin) (err sdk.Error)
AddSharesAsMinSelfDelegation adds shares of equal value of default msd (0.001okt) 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 sdk.Error)
AddSharesToValidators adds shares to validators and return the amount of the shares
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) BeforeValidatorModified ¶
func (k Keeper) BeforeValidatorModified(ctx sdk.Context, valAddr sdk.ValAddress)
BeforeValidatorModified - call hook if registered
func (Keeper) BondedRatio ¶
BondedRatio the fraction of the staking tokens which are currently bonded
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() sdk.CodespaceType
Codespace returns the codespace
func (Keeper) CompleteUndelegation ¶
CompleteUndelegation handles the final process when the undelegation is completed
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 ¶
DeleteAbandonedValidatorAddrs deletes the abandoned validator addresses
func (Keeper) DeleteAddrByTimeKey ¶
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) DeleteLastValidatorPower ¶
func (k Keeper) DeleteLastValidatorPower(ctx sdk.Context, operator sdk.ValAddress)
DeleteLastValidatorPower deletes the last validator power
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 ¶
DeleteValidatorByPowerIndex deletes the power index key
func (Keeper) DeleteValidatorQueue ¶
DeleteValidatorQueue deletes a validator address from the validator queue
func (Keeper) DeleteValidatorQueueTimeSlice ¶
DeleteValidatorQueueTimeSlice deletes a specific validator queue timeslice
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) 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) GetLastTotalPower ¶
GetLastTotalPower loads the last total validator power
func (Keeper) GetLastValidatorPower ¶
GetLastValidatorPower loads the last validator power and returns zero if the operator was not a validator last block
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 ¶
GetOperAddrFromValidatorAddr returns the validator address according to the consensus pubkey the validator has to exist
func (Keeper) GetOperAndValidatorAddr ¶
GetOperAndValidatorAddr returns the operator addresses and consensus pubkeys of all the validators
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 ¶
GetTheEndOfLastEpoch returns the deadline of the current epoch
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, sdk.Error)
GetValidatorsToAddShares gets the validators from their validator addresses
func (Keeper) InsertValidatorQueue ¶
InsertValidatorQueue inserts an validator address to the appropriate timeslice in the validator queue
func (Keeper) IsEndOfEpoch ¶
IsEndOfEpoch checks whether an epoch is end
func (Keeper) IsKickedOut ¶
IsKickedOut tells whether there're jailed validators to kick out in an epoch
func (Keeper) IsValidator ¶
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 ¶
LastValidatorsIterator returns an iterator for the consensus validators in the last block
func (Keeper) MaxValidators ¶
MaxValidators returns the param Maximum number of validators
func (Keeper) ParamsEpoch ¶
ParamsEpoch returns epoch from paramstore, only update the KeyEpoch after last epoch ends
func (Keeper) ParamsMaxValsToAddShares ¶
ParamsMaxValsToAddShares returns the param MaxValsToAddShares
func (Keeper) ParamsMinDelegation ¶
ParamsMinDelegation returns the param MinDelegateAmount
func (Keeper) ParamsMinSelfDelegation ¶
ParamsMinSelfDelegation returns the param MinSelfDelegateAmount
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 ¶
SetDelegator sets Delegator info to store
func (*Keeper) SetHooks ¶
func (k *Keeper) SetHooks(sh types.StakingHooks) *Keeper
SetHooks sets the validator hooks
func (Keeper) SetLastTotalPower ¶
SetLastTotalPower sets the last total validator power
func (Keeper) SetLastValidatorPower ¶
SetLastValidatorPower sets the last validator power
func (Keeper) SetNewValidatorByPowerIndex ¶
SetNewValidatorByPowerIndex sets the power index key of a validator
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 ¶
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 ¶
SetValidator sets the main record holding validator details
func (Keeper) SetValidatorByConsAddr ¶
SetValidatorByConsAddr sets the operator address with the key of validator consensus pubkey
func (Keeper) SetValidatorByPowerIndex ¶
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) StakingTokenSupply ¶
StakingTokenSupply staking tokens from the total supply
func (Keeper) TotalBondedTokens ¶
TotalBondedTokens total staking tokens supply which is bonded TODO:No usages found in project files,remove it later
func (Keeper) UnbondAllMatureValidatorQueue ¶
UnbondAllMatureValidatorQueue unbonds all the unbonding validators that have finished their unbonding period
func (Keeper) UnbondingTime ¶
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 sdk.Error)
UpdateProxy updates the shares by the total delegated and self delegated tokens of a proxy
func (Keeper) UpdateShares ¶
UpdateShares withdraws and adds shares continuously on the same validator set with different amount of shares
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 ¶
ValidatorQueueIterator returns all the validator queue timeslices from time 0 until endTime
func (Keeper) ValidatorsPowerStoreIterator ¶
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.DecCoin) (time.Time, sdk.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
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