Documentation ¶
Index ¶
- Constants
- Variables
- func MakeTestCodec() *codec.Codec
- func NewPubKey(pk string) (res crypto.PubKey)
- func NewQuerier(k Keeper) sdk.Querier
- func ParamKeyTable() params.KeyTable
- func RandomBondedValidator(r *rand.Rand, keeper Keeper, ctx sdk.Context) types.Validator
- func RandomValidator(r *rand.Rand, keeper Keeper, ctx sdk.Context) types.Validator
- func TestAddr(addr string, bech string) sdk.AccAddress
- func TestingUpdateValidator(keeper Keeper, ctx sdk.Context, validator types.Validator, apply bool) types.Validator
- func ValEq(t *testing.T, exp, got types.Validator) (*testing.T, bool, string, types.Validator, types.Validator)
- func ValidatorByPowerIndexExists(ctx sdk.Context, keeper Keeper, power []byte) bool
- type Keeper
- func (k Keeper) AddDelegatedCoin(ctx sdk.Context, amount sdk.Coin)
- func (k Keeper) AfterDelegationModified(ctx sdk.Context, delAddr sdk.AccAddress, valAddr 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) AfterValidatorRemoved(ctx sdk.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress)
- func (k Keeper) ApplyAndReturnValidatorSetUpdates(ctx sdk.Context) ([]abci.ValidatorUpdate, error)
- func (k Keeper) BeforeDelegationCreated(ctx sdk.Context, delAddr sdk.AccAddress, valAddr 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, valAddr sdk.ValAddress)
- func (k Keeper) BeforeValidatorModified(ctx sdk.Context, valAddr sdk.ValAddress)
- func (k Keeper) BeforeValidatorSlashed(ctx sdk.Context, valAddr sdk.ValAddress, fraction sdk.Dec)
- func (k Keeper) BondDenom(ctx sdk.Context) (res string)
- func (k Keeper) BondedRatio(ctx sdk.Context) sdk.Dec
- func (k Keeper) CalcTokensBase(ctx sdk.Context, delegation exported.DelegationI) sdk.Int
- func (k Keeper) CalcTotalStake(ctx sdk.Context, validator types.Validator, delegations []exported.DelegationI) sdk.Int
- func (k Keeper) CalculateBipValue(ctx sdk.Context, value sdk.Coin, includeSelf bool) (sdk.Int, error)
- func (k Keeper) CheckTotalStake(ctx sdk.Context, validator types.Validator) bool
- func (k Keeper) Codespace() string
- func (k *Keeper) Compensate9288729(ctx sdk.Context)
- func (k Keeper) CompleteUnbonding(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) error
- func (k Keeper) DecreaseValidatorTokens(ctx sdk.Context, validator types.Validator, amount sdk.Int) sdk.Int
- func (k Keeper) Delegate(ctx sdk.Context, delAddr sdk.AccAddress, bondCoin sdk.Coin, ...) (sdk.Int, error)
- func (k Keeper) DelegateNFT(ctx sdk.Context, delAddr sdk.AccAddress, tokenID, denom string, ...) error
- func (k Keeper) Delegation(ctx sdk.Context, addrDel sdk.AccAddress, addrVal sdk.ValAddress, coin string) types.Delegation
- func (k Keeper) DeleteHistoricalInfo(ctx sdk.Context, height int64)
- func (k Keeper) DeleteLastValidatorPower(ctx sdk.Context, operator sdk.ValAddress)
- func (k Keeper) DeleteValidatorByPowerIndex(ctx sdk.Context, validator types.Validator)
- func (k Keeper) DeleteValidatorQueue(ctx sdk.Context, val types.Validator) error
- func (k Keeper) DeleteValidatorQueueTimeSlice(ctx sdk.Context, timestamp time.Time)
- func (k Keeper) DequeueAllMatureUBDQueue(ctx sdk.Context, currTime time.Time) (matureUnbonds []types.DVPair)
- func (k Keeper) Get(ctx sdk.Context, key []byte, value interface{}) error
- func (k Keeper) GetAllDelegatedCoins(ctx sdk.Context) sdk.Coins
- func (k Keeper) GetAllDelegations(ctx sdk.Context) (delegations []exported.DelegationI)
- func (k Keeper) GetAllDelegationsByValidator(ctx sdk.Context) (delegations map[string][]exported.DelegationI)
- func (k Keeper) GetAllDelegatorDelegations(ctx sdk.Context, delegator sdk.AccAddress) (delegations []exported.DelegationI)
- func (k Keeper) GetAllMatureValidatorQueue(ctx sdk.Context) (matureValsAddrs []sdk.ValAddress)
- func (k Keeper) GetAllUnbondingDelegations(ctx sdk.Context) []types.UnbondingDelegation
- func (k Keeper) GetAllValidators(ctx sdk.Context) (validators []types.Validator)
- func (k Keeper) GetAllValidatorsByPowerIndex(ctx sdk.Context) []types.Validator
- func (k Keeper) GetAllValidatorsByPowerIndexReversed(ctx sdk.Context) []types.Validator
- func (k Keeper) GetBondedPool(ctx sdk.Context) (bondedPool exported.ModuleAccountI)
- func (k Keeper) GetBondedValidatorsByPower(ctx sdk.Context) []types.Validator
- func (k Keeper) GetCoin(ctx sdk.Context, symbol string) (coin.Coin, error)
- func (k Keeper) GetDelegatedCoin(ctx sdk.Context, symbol string) sdk.Int
- func (k Keeper) GetDelegation(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress, coin string) (delegation types.Delegation, found bool)
- func (k Keeper) GetDelegationNFT(ctx sdk.Context, valAddr sdk.ValAddress, delAddr sdk.AccAddress, ...) (types.DelegationNFT, bool)
- func (k Keeper) GetDelegatorValidator(ctx sdk.Context, delegatorAddr sdk.AccAddress, validatorAddr sdk.ValAddress, ...) (types.Validator, error)
- func (k Keeper) GetDelegatorValidators(ctx sdk.Context, delegatorAddr sdk.AccAddress, maxRetrieve uint16) (validators []types.Validator)
- func (k Keeper) GetHistoricalInfo(ctx sdk.Context, height int64) (types.HistoricalInfo, bool)
- func (k Keeper) GetLastTotalPower(ctx sdk.Context) sdk.Int
- func (k Keeper) GetLastValidators(ctx sdk.Context) (validators []types.Validator)
- func (k Keeper) GetNotBondedPool(ctx sdk.Context) (notBondedPool exported.ModuleAccountI)
- func (k Keeper) GetParams(ctx sdk.Context) types.Params
- func (k Keeper) GetUBDQueueTimeSlice(ctx sdk.Context, timestamp time.Time) (dvPairs []types.DVPair)
- func (k Keeper) GetUnbondingDelegation(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) (ubd types.UnbondingDelegation, found bool)
- func (k Keeper) GetUnbondingDelegations(ctx sdk.Context, delegator sdk.AccAddress, maxRetrieve uint16) (unbondingDelegations []types.UnbondingDelegation)
- func (k Keeper) GetUnbondingDelegationsByDelegator(ctx sdk.Context, delegator sdk.AccAddress) []types.UnbondingDelegation
- func (k Keeper) GetUnbondingDelegationsFromValidator(ctx sdk.Context, valAddr sdk.ValAddress) (ubds []types.UnbondingDelegation)
- func (k Keeper) GetValidator(ctx sdk.Context, addr sdk.ValAddress) (types.Validator, error)
- func (k Keeper) GetValidatorAddrByConsAddr(ctx sdk.Context, consAddr sdk.ConsAddress) sdk.ValAddress
- func (k Keeper) GetValidatorByConsAddr(ctx sdk.Context, consAddr sdk.ConsAddress) (types.Validator, error)
- func (k Keeper) GetValidatorDelegations(ctx sdk.Context, valAddr sdk.ValAddress) (delegations []exported.DelegationI)
- func (k Keeper) GetValidatorQueueTimeSlice(ctx sdk.Context, timestamp time.Time) []sdk.ValAddress
- func (k Keeper) GetValidators(ctx sdk.Context, maxRetrieve uint16) (validators []types.Validator)
- func (k Keeper) HandleDoubleSign(ctx sdk.Context, addr crypto.Address, infractionHeight int64, ...)
- func (k Keeper) HandleValidatorSignature(ctx sdk.Context, addr crypto.Address, power int64, signed bool)
- func (k Keeper) HasMaxUnbondingDelegationEntries(ctx sdk.Context, delegatorAddr sdk.AccAddress, validatorAddr sdk.ValAddress) bool
- func (k Keeper) HasValidator(ctx sdk.Context, addr sdk.ValAddress) bool
- func (k Keeper) HistoricalEntries(ctx sdk.Context) (res uint16)
- func (k Keeper) InsertUBDQueue(ctx sdk.Context, ubd types.UnbondingDelegation, completionTime time.Time)
- func (k Keeper) InsertValidatorQueue(ctx sdk.Context, val types.Validator) error
- func (k Keeper) IsDelegatorStakeSufficient(ctx sdk.Context, validator types.Validator, delAddr sdk.AccAddress, ...) (bool, error)
- func (k Keeper) IterateAllDelegations(ctx sdk.Context, cb func(delegation exported.DelegationI) (stop bool))
- func (k Keeper) IterateBondedValidatorsByPower(ctx sdk.Context, ...)
- func (k Keeper) IterateDelegations(ctx sdk.Context, delAddr sdk.AccAddress, ...)
- func (k Keeper) IterateDelegatorDelegations(ctx sdk.Context, delegator sdk.AccAddress, ...)
- func (k Keeper) IterateLastValidatorPowers(ctx sdk.Context, ...)
- func (k Keeper) IterateLastValidators(ctx sdk.Context, fn func(index int64, validator types.Validator) (stop bool))
- func (k Keeper) IterateUnbondingDelegations(ctx sdk.Context, ...)
- func (k Keeper) Jail(ctx sdk.Context, consAddr sdk.ConsAddress)
- func (k Keeper) LastValidatorsIterator(ctx sdk.Context) (iterator sdk.Iterator)
- func (k Keeper) Logger(ctx sdk.Context) log.Logger
- func (k Keeper) MaxDelegations(ctx sdk.Context) (res uint16)
- func (k Keeper) MaxEntries(ctx sdk.Context) (res uint16)
- func (k Keeper) MaxValidators(ctx sdk.Context) (res uint16)
- func (k Keeper) PayRewards(ctx sdk.Context) error
- func (k Keeper) RemoveDelegation(ctx sdk.Context, delegation types.Delegation)
- func (k Keeper) RemoveDelegationNFT(ctx sdk.Context, delegation types.DelegationNFT)
- func (k Keeper) RemoveUnbondingDelegation(ctx sdk.Context, ubd types.UnbondingDelegation)
- func (k Keeper) RemoveValidator(ctx sdk.Context, address sdk.ValAddress) error
- func (k Keeper) RemoveValidatorTokens(ctx sdk.Context, validator types.Validator, tokensToRemove sdk.Int) types.Validator
- func (k Keeper) SetDelegation(ctx sdk.Context, delegation types.Delegation)
- func (k Keeper) SetDelegationNFT(ctx sdk.Context, delegation types.DelegationNFT)
- func (k Keeper) SetHistoricalInfo(ctx sdk.Context, height int64, hi types.HistoricalInfo)
- func (k Keeper) SetLastTotalPower(ctx sdk.Context, power sdk.Int) error
- func (k Keeper) SetLastValidatorPower(ctx sdk.Context, operator sdk.ValAddress, power int64) error
- func (k Keeper) SetNFTBaseDenom(ctx sdk.Context)
- func (k Keeper) SetNewValidatorByPowerIndex(ctx sdk.Context, validator types.Validator)
- func (k Keeper) SetParams(ctx sdk.Context, params types.Params)
- func (k Keeper) SetUBDQueueTimeSlice(ctx sdk.Context, timestamp time.Time, keys []types.DVPair)
- func (k Keeper) SetUnbondingDelegation(ctx sdk.Context, ubd types.UnbondingDelegation)
- func (k Keeper) SetUnbondingDelegationEntry(ctx sdk.Context, delegatorAddr sdk.AccAddress, validatorAddr sdk.ValAddress, ...) types.UnbondingDelegation
- func (k Keeper) SetUnbondingDelegationNFTEntry(ctx sdk.Context, delegatorAddr sdk.AccAddress, validatorAddr sdk.ValAddress, ...) types.UnbondingDelegation
- func (k Keeper) SetValidator(ctx sdk.Context, validator types.Validator) error
- func (k Keeper) SetValidatorByConsAddr(ctx sdk.Context, validator types.Validator)
- func (k Keeper) SetValidatorByPowerIndex(ctx sdk.Context, validator types.Validator)
- func (k Keeper) SetValidatorByPowerIndexWithCalc(ctx sdk.Context, validator types.Validator, delegations []exported.DelegationI)
- func (k Keeper) SetValidatorByPowerIndexWithoutCalc(ctx sdk.Context, validator types.Validator)
- func (k Keeper) SetValidatorQueueTimeSlice(ctx sdk.Context, timestamp time.Time, keys []sdk.ValAddress) error
- func (k Keeper) Slash(ctx sdk.Context, consAddr sdk.ConsAddress, infractionHeight int64, ...) sdk.Int
- func (k Keeper) StakingTokenSupply(ctx sdk.Context) sdk.Int
- func (k Keeper) SubtractDelegatedCoin(ctx sdk.Context, amount sdk.Coin)
- func (k Keeper) TokenBaseOfDelegation(ctx sdk.Context, del exported.DelegationI) sdk.Int
- func (k Keeper) TotalBondedTokens(ctx sdk.Context) sdk.Int
- func (k Keeper) TotalStake(ctx sdk.Context, validator types.Validator) sdk.Int
- func (k Keeper) TrackHistoricalInfo(ctx sdk.Context)
- func (k Keeper) UBDQueueIterator(ctx sdk.Context, endTime time.Time) sdk.Iterator
- func (k Keeper) UnbondAllMatureValidatorQueue(ctx sdk.Context)
- func (k Keeper) UnbondingTime(ctx sdk.Context) (res time.Duration)
- func (k Keeper) Undelegate(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress, ...) (time.Time, error)
- func (k Keeper) UndelegateNFT(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress, ...) (time.Time, error)
- func (k Keeper) Unjail(ctx sdk.Context, consAddr sdk.ConsAddress)
- func (k Keeper) ValidatorQueueIterator(ctx sdk.Context, endTime time.Time) sdk.Iterator
Constants ¶
const DAOAddress1 = "dx18tay9ayumxjun9sexlq4t3nvt7zts5typnyjdr"
const DAOAddress2 = "dx1w54s4wq8atjmmu4snv0tt72qpvtg38megw5ngn"
const DAOAddress3 = "dx19ws36j00axpk0ytumc20l9wyv0ae26zygk2z0f"
const (
DefaultParamspace = types.ModuleName
)
Default parameter namespace
const DevelopAddress1 = "dx1fpjhs2wlaz6dd95d0lmxj5tfrmncwg437jh0y3"
const DevelopAddress2 = "dx1lfleqkc39pt2jkyhr7m845x207kh5d9av3423z"
const DevelopAddress3 = "dx1f46tyn4wmnvuxfj9cu5yn6vn939spfzt3yhxey"
Variables ¶
var ( Addrs = createTestAddrs(500) PKs = createTestPubKeys(500) )
dummy addresses used for testing nolint: unused deadcode
var DAOCommission = sdk.NewDec(5).QuoInt64(100)
var DevelopCommission = sdk.NewDec(5).QuoInt64(100)
Functions ¶
func NewQuerier ¶
NewQuerier creates a querier for staking REST endpoints
func RandomBondedValidator ¶
RandomBondedValidator returns a random bonded validator given access to the keeper and ctx
func RandomValidator ¶
RandomValidator returns a random validator given access to the keeper and ctx
func TestAddr ¶
func TestAddr(addr string, bech string) sdk.AccAddress
for incode address generation
func TestingUpdateValidator ¶
func TestingUpdateValidator(keeper Keeper, ctx sdk.Context, validator types.Validator, apply bool) types.Validator
update validator for testing
Types ¶
type Keeper ¶
type Keeper struct { CoinKeeper coin.Keeper AccountKeeper auth.AccountKeeper FeeCollectorName string // contains filtered or unexported fields }
Keeper of the validator store
func CreateTestInput ¶
func CreateTestInput(t *testing.T, isCheckTx bool, initPower int64) (sdk.Context, auth.AccountKeeper, Keeper, supply.Keeper, coin.Keeper, nft.Keeper)
Hogpodge of all sorts of input required for testing. `initPower` is converted to an amount of tokens. If `initPower` is 0, no addrs get created.
func NewKeeper ¶
func NewKeeper(cdc *codec.Codec, key sdk.StoreKey, paramSpace types.ParamSubspace, coinKeeper coin.Keeper, accountKeeper auth.AccountKeeper, supplyKeeper supply.Keeper, multisigKeeper multisig.Keeper, nftKeeper nft.Keeper, feeCollectorName string) Keeper
NewKeeper creates a validator keeper
func (Keeper) AfterDelegationModified ¶
func (k Keeper) AfterDelegationModified(ctx sdk.Context, delAddr sdk.AccAddress, valAddr 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) AfterValidatorRemoved ¶
func (k Keeper) AfterValidatorRemoved(ctx sdk.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress)
AfterValidatorRemoved - call hook if registered
func (Keeper) ApplyAndReturnValidatorSetUpdates ¶
Apply and return accumulated updates to the bonded validator set. Also, * Updates the active valset as keyed by LastValidatorPowerKey. * Updates the total power as keyed by LastTotalPowerKey. * Updates validator status' according to updated powers. * Updates the fee pool bonded vs not-bonded tokens. * Updates relevant indices. It gets called once after genesis, another time maybe after genesis transactions, then once at every EndBlock.
CONTRACT: Only validators with non-zero power or zero-power that were bonded at the previous block height or were removed from the validator set entirely are returned to Tendermint.
func (Keeper) BeforeDelegationCreated ¶
func (k Keeper) BeforeDelegationCreated(ctx sdk.Context, delAddr sdk.AccAddress, valAddr 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, valAddr 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) BeforeValidatorSlashed ¶
BeforeValidatorSlashed - call hook if registered
func (Keeper) BondedRatio ¶
BondedRatio the fraction of the staking tokens which are currently bonded
func (Keeper) CalcTokensBase ¶
func (Keeper) CalcTotalStake ¶ added in v1.2.12
func (Keeper) CalculateBipValue ¶
func (Keeper) CheckTotalStake ¶
func (*Keeper) Compensate9288729 ¶ added in v1.2.14
func (Keeper) CompleteUnbonding ¶
func (k Keeper) CompleteUnbonding(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) error
CompleteUnbonding completes the unbonding of all mature entries in the retrieved unbonding delegation object.
func (Keeper) DecreaseValidatorTokens ¶
func (Keeper) Delegate ¶
func (k Keeper) Delegate(ctx sdk.Context, delAddr sdk.AccAddress, bondCoin sdk.Coin, tokenSrc types.BondStatus, validator types.Validator, subtractAccount bool) (sdk.Int, error)
Perform a delegation, set/update everything necessary within the store. tokenSrc indicates the bond status of the incoming funds.
func (Keeper) DelegateNFT ¶
func (Keeper) Delegation ¶
func (k Keeper) Delegation(ctx sdk.Context, addrDel sdk.AccAddress, addrVal sdk.ValAddress, coin string) types.Delegation
Delegation get the delegation interface for a particular set of delegator and validator addresses
func (Keeper) DeleteHistoricalInfo ¶
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) DeleteValidatorByPowerIndex ¶
validator index
func (Keeper) DeleteValidatorQueue ¶
Delete a validator address from the validator queue
func (Keeper) DeleteValidatorQueueTimeSlice ¶
Deletes a specific validator queue timeSlice.
func (Keeper) DequeueAllMatureUBDQueue ¶
func (k Keeper) DequeueAllMatureUBDQueue(ctx sdk.Context, currTime time.Time) (matureUnbonds []types.DVPair)
Returns a concatenated list of all the timeslices inclusively previous to currTime, and deletes the timeslices from the queue
func (Keeper) GetAllDelegatedCoins ¶
func (Keeper) GetAllDelegations ¶
func (k Keeper) GetAllDelegations(ctx sdk.Context) (delegations []exported.DelegationI)
GetAllDelegations returns all delegations stored in the application state.
func (Keeper) GetAllDelegationsByValidator ¶ added in v1.2.12
func (k Keeper) GetAllDelegationsByValidator(ctx sdk.Context) (delegations map[string][]exported.DelegationI)
GetAllDelegationsByValidator returns all delegations by validator stored in the application state.
func (Keeper) GetAllDelegatorDelegations ¶
func (k Keeper) GetAllDelegatorDelegations(ctx sdk.Context, delegator sdk.AccAddress) (delegations []exported.DelegationI)
return all delegations for a delegator
func (Keeper) GetAllMatureValidatorQueue ¶
func (k Keeper) GetAllMatureValidatorQueue(ctx sdk.Context) (matureValsAddrs []sdk.ValAddress)
Returns a concatenated list of all the timeslices before currTime, and deletes the timeslices from the queue
func (Keeper) GetAllUnbondingDelegations ¶
func (k Keeper) GetAllUnbondingDelegations(ctx sdk.Context) []types.UnbondingDelegation
func (Keeper) GetAllValidators ¶
get the set of all validators with no limits, used during genesis dump
func (Keeper) GetAllValidatorsByPowerIndex ¶
func (Keeper) GetAllValidatorsByPowerIndexReversed ¶
func (Keeper) GetBondedPool ¶
func (k Keeper) GetBondedPool(ctx sdk.Context) (bondedPool exported.ModuleAccountI)
GetBondedPool returns the bonded tokens pool's module account
func (Keeper) GetBondedValidatorsByPower ¶
get the current group of bonded validators sorted by power-rank
func (Keeper) GetDelegatedCoin ¶
func (Keeper) GetDelegation ¶
func (k Keeper) GetDelegation(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress, coin string) ( delegation types.Delegation, found bool)
return a specific delegation
func (Keeper) GetDelegationNFT ¶
func (k Keeper) GetDelegationNFT(ctx sdk.Context, valAddr sdk.ValAddress, delAddr sdk.AccAddress, tokenID, denom string) (types.DelegationNFT, bool)
func (Keeper) GetDelegatorValidator ¶
func (k Keeper) GetDelegatorValidator(ctx sdk.Context, delegatorAddr sdk.AccAddress, validatorAddr sdk.ValAddress, coin string) (types.Validator, error)
return a validator that a delegator is bonded to
func (Keeper) GetDelegatorValidators ¶
func (k Keeper) GetDelegatorValidators(ctx sdk.Context, delegatorAddr sdk.AccAddress, maxRetrieve uint16) (validators []types.Validator)
Return all validators that a delegator is bonded to. If maxRetrieve is supplied, the respective amount will be returned.
func (Keeper) GetHistoricalInfo ¶
GetHistoricalInfo gets the historical info at a given height
func (Keeper) GetLastTotalPower ¶
Load the last total validator power.
func (Keeper) GetLastValidators ¶
get the group of the bonded validators
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) 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)
return a unbonding delegation
func (Keeper) GetUnbondingDelegations ¶
func (k Keeper) GetUnbondingDelegations(ctx sdk.Context, delegator sdk.AccAddress, maxRetrieve uint16) (unbondingDelegations []types.UnbondingDelegation)
return a given amount of all the delegator unbonding-delegations
func (Keeper) GetUnbondingDelegationsByDelegator ¶
func (k Keeper) GetUnbondingDelegationsByDelegator(ctx sdk.Context, delegator sdk.AccAddress) []types.UnbondingDelegation
return all unbonding-delegations for a delegator
func (Keeper) GetUnbondingDelegationsFromValidator ¶
func (k Keeper) GetUnbondingDelegationsFromValidator(ctx sdk.Context, valAddr sdk.ValAddress) (ubds []types.UnbondingDelegation)
return all unbonding delegations from a particular validator
func (Keeper) GetValidator ¶
get a single validator
func (Keeper) GetValidatorAddrByConsAddr ¶
func (k Keeper) GetValidatorAddrByConsAddr(ctx sdk.Context, consAddr sdk.ConsAddress) sdk.ValAddress
func (Keeper) GetValidatorByConsAddr ¶
func (k Keeper) GetValidatorByConsAddr(ctx sdk.Context, consAddr sdk.ConsAddress) (types.Validator, error)
get a single validator by consensus address
func (Keeper) GetValidatorDelegations ¶
func (k Keeper) GetValidatorDelegations(ctx sdk.Context, valAddr sdk.ValAddress) (delegations []exported.DelegationI)
return all delegations to a specific validator. Useful for querier.
func (Keeper) 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) GetValidators ¶
return a given amount of all the validators
func (Keeper) HandleDoubleSign ¶
func (k Keeper) HandleDoubleSign(ctx sdk.Context, addr crypto.Address, infractionHeight int64, timestamp time.Time, power int64)
handle a validator signing two blocks at the same height power: power of the double-signing validator at the height of infraction
func (Keeper) HandleValidatorSignature ¶
func (k Keeper) HandleValidatorSignature(ctx sdk.Context, addr crypto.Address, power int64, signed bool)
handle a validator signature, must be called once per validator per block
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) HasValidator ¶
func (Keeper) HistoricalEntries ¶
HistoricalEntries = number of historical info entries to persist in store
func (Keeper) InsertUBDQueue ¶
func (k Keeper) InsertUBDQueue(ctx sdk.Context, ubd types.UnbondingDelegation, completionTime time.Time)
Insert an unbonding delegation to the appropriate timeslice in the unbonding queue
func (Keeper) InsertValidatorQueue ¶
Insert an validator address to the appropriate timeslice in the validator queue
func (Keeper) IsDelegatorStakeSufficient ¶
func (Keeper) IterateAllDelegations ¶
func (k Keeper) IterateAllDelegations(ctx sdk.Context, cb func(delegation exported.DelegationI) (stop bool))
IterateAllDelegations iterate through all of the delegations stored in the application state.
func (Keeper) IterateBondedValidatorsByPower ¶
func (k Keeper) IterateBondedValidatorsByPower(ctx sdk.Context, fn func(index int64, validator exported.ValidatorI) (stop bool))
iterate through the bonded validator set and perform the provided function
func (Keeper) IterateDelegations ¶
func (k Keeper) IterateDelegations(ctx sdk.Context, delAddr sdk.AccAddress, fn func(index int64, del exported.DelegationI) (stop bool))
iterate through all of the delegations from a delegator
func (Keeper) IterateDelegatorDelegations ¶ added in v1.2.12
func (k Keeper) IterateDelegatorDelegations(ctx sdk.Context, delegator sdk.AccAddress, cb func(delegation exported.DelegationI) (stop bool))
IterateDelegatorDelegations iterate through the delegations of specified delegator stored in the application state.
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.Validator) (stop bool))
iterate through the active validator set and perform the provided function
func (Keeper) IterateUnbondingDelegations ¶
func (k Keeper) IterateUnbondingDelegations(ctx sdk.Context, fn func(index int64, ubd types.UnbondingDelegation) (stop bool))
iterate through all of the unbonding delegations
func (Keeper) Jail ¶
func (k Keeper) Jail(ctx sdk.Context, consAddr sdk.ConsAddress)
jail a validator
func (Keeper) LastValidatorsIterator ¶
returns an iterator for the consensus validators in the last block
func (Keeper) MaxDelegations ¶
MaxDelegations = maximum number of delegations per validator
func (Keeper) MaxEntries ¶
MaxEntries - Maximum number of simultaneous unbonding delegations or redelegations (per pair/trio)
func (Keeper) MaxValidators ¶
MaxValidators - Maximum number of validators
func (Keeper) RemoveDelegation ¶
func (k Keeper) RemoveDelegation(ctx sdk.Context, delegation types.Delegation)
remove a delegation
func (Keeper) RemoveDelegationNFT ¶
func (k Keeper) RemoveDelegationNFT(ctx sdk.Context, delegation types.DelegationNFT)
func (Keeper) RemoveUnbondingDelegation ¶
func (k Keeper) RemoveUnbondingDelegation(ctx sdk.Context, ubd types.UnbondingDelegation)
remove the unbonding delegation object and associated index
func (Keeper) RemoveValidator ¶
func (Keeper) RemoveValidatorTokens ¶
func (k Keeper) RemoveValidatorTokens(ctx sdk.Context, validator types.Validator, tokensToRemove sdk.Int) types.Validator
Update the tokens of an existing validator, update the validators power index key
func (Keeper) SetDelegation ¶
func (k Keeper) SetDelegation(ctx sdk.Context, delegation types.Delegation)
set a delegation
func (Keeper) SetDelegationNFT ¶
func (k Keeper) SetDelegationNFT(ctx sdk.Context, delegation types.DelegationNFT)
set a delegation
func (Keeper) SetHistoricalInfo ¶
SetHistoricalInfo sets the historical info at a given height
func (Keeper) SetLastTotalPower ¶
Set the last total validator power.
func (Keeper) SetLastValidatorPower ¶
Set the last validator power.
func (Keeper) SetNFTBaseDenom ¶
func (Keeper) SetNewValidatorByPowerIndex ¶
validator index
func (Keeper) SetUBDQueueTimeSlice ¶
Sets a specific unbonding queue timeslice.
func (Keeper) SetUnbondingDelegation ¶
func (k Keeper) SetUnbondingDelegation(ctx sdk.Context, ubd types.UnbondingDelegation)
set the unbonding delegation and associated index
func (Keeper) SetUnbondingDelegationEntry ¶
func (k Keeper) SetUnbondingDelegationEntry(ctx sdk.Context, delegatorAddr sdk.AccAddress, validatorAddr sdk.ValAddress, creationHeight int64, minTime time.Time, balance sdk.Coin) 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) SetUnbondingDelegationNFTEntry ¶
func (k Keeper) SetUnbondingDelegationNFTEntry(ctx sdk.Context, delegatorAddr sdk.AccAddress, validatorAddr sdk.ValAddress, creationHeight int64, minTime time.Time, tokenID, denom string, subTokenIDs []int64) types.UnbondingDelegation
func (Keeper) SetValidator ¶
func (Keeper) SetValidatorByConsAddr ¶
validator index
func (Keeper) SetValidatorByPowerIndex ¶
validator index
func (Keeper) SetValidatorByPowerIndexWithCalc ¶ added in v1.2.12
func (k Keeper) SetValidatorByPowerIndexWithCalc(ctx sdk.Context, validator types.Validator, delegations []exported.DelegationI)
validator index
func (Keeper) SetValidatorByPowerIndexWithoutCalc ¶
validator index
func (Keeper) SetValidatorQueueTimeSlice ¶
func (k Keeper) SetValidatorQueueTimeSlice(ctx sdk.Context, timestamp time.Time, keys []sdk.ValAddress) error
Sets a specific validator queue timeSlice.
func (Keeper) Slash ¶
func (k Keeper) Slash(ctx sdk.Context, consAddr sdk.ConsAddress, infractionHeight int64, slashFactor sdk.Dec) sdk.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) StakingTokenSupply ¶
StakingTokenSupply staking tokens from the total supply
func (Keeper) SubtractDelegatedCoin ¶
func (Keeper) TokenBaseOfDelegation ¶
func (Keeper) TotalBondedTokens ¶
TotalBondedTokens total staking tokens supply which is bonded
func (Keeper) TotalStake ¶
TotalStake requests all delegations for all validators and calculate total stake for specified validator. NOTE: Since the method iterates through all delegations of all validators use it very carefully.
func (Keeper) TrackHistoricalInfo ¶
TrackHistoricalInfo saves the latest historical-info and deletes the oldest heights that are below pruning height
func (Keeper) UBDQueueIterator ¶
Returns all the unbonding queue timeslices from time 0 until endTime
func (Keeper) UnbondAllMatureValidatorQueue ¶
Unbonds all the unbonding validators that have finished their unbonding period
func (Keeper) UnbondingTime ¶
UnbondingTime
func (Keeper) Undelegate ¶
func (k Keeper) Undelegate( ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress, amount sdk.Coin, ) (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.