Documentation ¶
Index ¶
- Constants
- Variables
- func DelegationToDelegationResponse(ctx sdk.Context, k Keeper, del stakingtypes.Delegation) (stakingtypes.DelegationResponse, error)
- func DelegationsToDelegationResponses(ctx sdk.Context, k Keeper, delegations stakingtypes.Delegations) (stakingtypes.DelegationResponses, error)
- 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 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 error)
- func (k Keeper) AddSharesToValidators(ctx sdk.Context, delAddr sdk.AccAddress, vals types.Validators, tokens sdk.Dec) (shares types.Shares, sdkErr error)
- func (k Keeper) AfterDelegationModified(ctx sdk.Context, delAddr sdk.AccAddress, valAddrs []sdk.ValAddress)
- 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) BeforeDelegationCreated(ctx sdk.Context, delAddr sdk.AccAddress, valAddrs []sdk.ValAddress)
- func (k Keeper) BeforeDelegationRemoved(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress)
- func (k Keeper) BeforeDelegationSharesModified(ctx sdk.Context, delAddr sdk.AccAddress, valAddrs []sdk.ValAddress)
- func (k Keeper) BeforeValidatorModified(ctx sdk.Context, valAddr sdk.ValAddress)
- func (k Keeper) BondDenom(_ sdk.Context) string
- func (k Keeper) BondedRatio(ctx sdk.Context) sdk.Dec
- func (k Keeper) CheckEnabled(ctx sdk.Context) bool
- func (k Keeper) ClearProxy(ctx sdk.Context, proxyAddr sdk.AccAddress)
- func (k Keeper) Codespace() string
- func (k Keeper) CompleteUndelegation(ctx sdk.Context, delAddr sdk.AccAddress) (sdk.Dec, error)
- func (k Keeper) Delegate(ctx sdk.Context, delAddr sdk.AccAddress, token sdk.SysCoin) error
- func (k Keeper) Delegation(ctx sdk.Context, delAddr sdk.AccAddress, address2 sdk.ValAddress) exported.DelegatorI
- func (k Keeper) Delegator(ctx sdk.Context, delAddr sdk.AccAddress) exported.DelegatorI
- func (k Keeper) DelegatorDelegations(ctx sdk.Context, req *outtypes.QueryDelegatorDelegationsRequest) (*outtypes.QueryDelegatorDelegationsResponse, error)
- 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) DeleteHistoricalInfo(ctx sdk.Context, height int64)
- 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) GetAllDelegatorDelegations(ctx sdk.Context, delegator sdk.AccAddress) []types.Delegation
- 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) GetDelegatorUnbondingDelegations(ctx sdk.Context, delAddr sdk.AccAddress, page *query.PageRequest) (types.UnbondingDelegations, *query.PageResponse, error)
- 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) GetHistoricalInfo(ctx sdk.Context, height int64) (types.HistoricalInfo, bool)
- 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) GetLastValidators(ctx sdk.Context) (validators []outtypes.Validator)
- 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) GetUnbondingDelegation(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) (ubd types.UnbondingDelegation, found bool)
- 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, error)
- func (k Keeper) HistoricalEntries(ctx sdk.Context) (res uint32)
- 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) SetHistoricalInfo(ctx sdk.Context, height int64, hi outtypes.HistoricalInfo)
- 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) Slash(ctx sdk.Context, consAddr sdk.ConsAddress, infractionHeight int64, power int64, ...)
- func (k Keeper) StakingTokenSupply(ctx sdk.Context) sdk.Dec
- func (k Keeper) TotalBondedTokens(ctx sdk.Context) sdk.Dec
- func (k Keeper) TrackHistoricalInfo(ctx sdk.Context)
- 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 error)
- func (k Keeper) UpdateShares(ctx sdk.Context, delAddr sdk.AccAddress, tokens sdk.Dec) error
- func (k Keeper) UpdateValidatorCommission(ctx sdk.Context, validator types.Validator, newRate sdk.Dec) (types.Commission, 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.SysCoin) (time.Time, 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 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 DelegationToDelegationResponse ¶ added in v1.3.0
func DelegationToDelegationResponse(ctx sdk.Context, k Keeper, del stakingtypes.Delegation) (stakingtypes.DelegationResponse, error)
func DelegationsToDelegationResponses ¶ added in v1.3.0
func DelegationsToDelegationResponses( ctx sdk.Context, k Keeper, delegations stakingtypes.Delegations, ) (stakingtypes.DelegationResponses, error)
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(cdcMarshl *codec.CodecProxy, key sdk.StoreKey, supplyKeeper types.SupplyKeeper, paramstore params.Subspace) Keeper
NewKeeper creates a new staking Keeper instance
func NewKeeperWithNoParam ¶ added in v1.3.0
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.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 error)
AddSharesToValidators adds shares to validators and return the amount of the shares
func (Keeper) AfterDelegationModified ¶ added in v1.6.3
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 ¶ added in v1.6.3
func (k Keeper) BeforeDelegationCreated(ctx sdk.Context, delAddr sdk.AccAddress, valAddrs []sdk.ValAddress)
BeforeDelegationCreated - call hook if registered
func (Keeper) BeforeDelegationRemoved ¶ added in v1.6.3
func (k Keeper) BeforeDelegationRemoved(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress)
BeforeDelegationRemoved - call hook if registered
func (Keeper) BeforeDelegationSharesModified ¶ added in v1.6.3
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) BondedRatio ¶
BondedRatio the fraction of the staking tokens which are currently bonded
func (Keeper) CheckEnabled ¶ added in v1.6.3
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) CompleteUndelegation ¶
CompleteUndelegation handles the final process when the undelegation is completed
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) DelegatorDelegations ¶ added in v1.3.0
func (k Keeper) DelegatorDelegations(ctx sdk.Context, req *outtypes.QueryDelegatorDelegationsRequest) (*outtypes.QueryDelegatorDelegationsResponse, error)
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) DeleteHistoricalInfo ¶ added in v1.3.0
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) 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) GetAllDelegatorDelegations ¶ added in v1.3.0
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 ¶ added in v1.3.0
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) GetHistoricalInfo ¶ added in v1.3.0
GetHistoricalInfo gets the historical info at a given height
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) GetLastValidators ¶ added in v1.3.0
get the group of the bonded validators
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) GetUnbondingDelegation ¶ added in v1.3.0
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 ¶ added in v1.3.0
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) SetHistoricalInfo ¶ added in v1.3.0
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 ¶
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) TrackHistoricalInfo ¶ added in v1.3.0
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 ¶
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) UpdateValidatorCommission ¶ added in v1.6.3
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 ¶
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.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
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
Source Files ¶
- alias_functions.go
- delegation.go
- delegator.go
- hooks.go
- hooks_distr_proposal.go
- invariants.go
- keeper.go
- keeper_distr_proposal.go
- keeper_ibc.go
- keeper_ibc_adapter.go
- min_self_delegation.go
- params.go
- pool.go
- proxy.go
- querier.go
- shares.go
- slash.go
- test_common.go
- test_common_distr_proposal.go
- val_state.go
- val_state_change.go
- validator.go
- validator_distr_proposal.go
- weight.go