Documentation ¶
Index ¶
- Constants
- Variables
- func GetDelegationKey(delAddr sdk.AccAddress, valAddr sdk.AccAddress) []byte
- func GetDelegationsKey(delAddr sdk.AccAddress) []byte
- func GetLastValidatorPowerKey(operator sdk.AccAddress) []byte
- func GetREDByValDstIndexKey(delAddr sdk.AccAddress, valSrcAddr, valDstAddr sdk.AccAddress) []byte
- func GetREDByValSrcIndexKey(delAddr sdk.AccAddress, valSrcAddr, valDstAddr sdk.AccAddress) []byte
- func GetREDKey(delAddr sdk.AccAddress, valSrcAddr, valDstAddr sdk.AccAddress) []byte
- func GetREDKeyFromValDstIndexKey(IndexKey []byte) []byte
- func GetREDKeyFromValSrcIndexKey(IndexKey []byte) []byte
- func GetREDsByDelToValDstIndexKey(delAddr sdk.AccAddress, valDstAddr sdk.AccAddress) []byte
- func GetREDsFromValSrcIndexKey(valSrcAddr sdk.AccAddress) []byte
- func GetREDsKey(delAddr sdk.AccAddress) []byte
- func GetREDsToValDstIndexKey(valDstAddr sdk.AccAddress) []byte
- func GetTdmAddressKey(tdmAddress []byte) []byte
- func GetUBDByValIndexKey(delAddr sdk.AccAddress, valAddr sdk.AccAddress) []byte
- func GetUBDKey(delAddr sdk.AccAddress, valAddr sdk.AccAddress) []byte
- func GetUBDsByValIndexKey(valAddr sdk.AccAddress) []byte
- func GetUBDsKey(delAddr sdk.AccAddress) []byte
- func GetValidatorByConsAddrKey(addr sdk.AccAddress) []byte
- func GetValidatorDistKey(operatorAddr sdk.AccAddress) []byte
- func GetValidatorKey(operatorAddr sdk.AccAddress) []byte
- func GetValidatorsByPowerIndexKey(validator posTypes.Validator, pool posTypes.Pool) []byte
- type Keeper
- func (k Keeper) AddValidatorTokensAndShares(ctx sdk.Context, validator posTypes.Validator, tokensToAdd types.Dec) (valOut posTypes.Validator, addedShares types.Dec)
- func (k Keeper) BeginRedelegation(ctx sdk.Context, delAddr sdk.AccAddress, valSrcAddr, valDstAddr sdk.AccAddress, ...) sdk.Error
- func (k Keeper) BeginUnbonding(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.AccAddress, ...) sdk.Error
- func (k Keeper) Codespace() sdk.CodespaceType
- func (k Keeper) CompleteRedelegation(ctx sdk.Context, delAddr sdk.AccAddress, valSrcAddr, valDstAddr sdk.AccAddress) sdk.Error
- func (k Keeper) CompleteUnbonding(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.AccAddress) sdk.Error
- func (k Keeper) Delegate(ctx sdk.Context, delAddr sdk.AccAddress, bondAmt types.Coin, ...) (newShares types.Dec, err sdk.Error)
- func (k Keeper) DeleteLastValidatorPower(ctx sdk.Context, operator sdk.AccAddress)
- func (k Keeper) DeleteValidatorByPowerIndex(ctx sdk.Context, validator posTypes.Validator, pool posTypes.Pool)
- func (k Keeper) GetAllDelegations(ctx sdk.Context) (delegations []posTypes.Delegation)
- func (k Keeper) GetDelegation(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.AccAddress) (delegation posTypes.Delegation, found bool)
- func (k Keeper) GetIntraTxCounter(ctx sdk.Context) int16
- func (k Keeper) GetParams(ctx sdk.Context) (params posTypes.Params)
- func (k Keeper) GetPool(ctx sdk.Context) (pool posTypes.Pool)
- func (k Keeper) GetRedelegation(ctx sdk.Context, delAddr sdk.AccAddress, valSrcAddr, valDstAddr sdk.AccAddress) (red posTypes.Redelegation, found bool)
- func (k Keeper) GetRedelegations(ctx sdk.Context, delegator sdk.AccAddress, maxRetrieve uint16) (redelegations []posTypes.Redelegation)
- func (k Keeper) GetUnbondingDelegation(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.AccAddress) (ubd posTypes.UnbondingDelegation, found bool)
- func (k Keeper) GetUnbondingDelegations(ctx sdk.Context, delegator sdk.AccAddress, maxRetrieve uint16) (unbondingDelegations []posTypes.UnbondingDelegation)
- func (k Keeper) GetValidator(ctx sdk.Context, addr sdk.AccAddress) (validator posTypes.Validator, found bool)
- func (k Keeper) GetValidatorByTDMAddress(ctx sdk.Context, tdmAddress []byte) (validator posTypes.Validator, found bool)
- func (k Keeper) GetValidatorDistInfo(ctx sdk.Context, addr sdk.AccAddress) (vdi posTypes.ValidatorDistInfo, found bool)
- func (k Keeper) GetValidatorSetUpdates(ctx sdk.Context) []abci.ValidatorUpdate
- func (k Keeper) GetValidators(ctx sdk.Context, maxRetrieve uint16) (validators []posTypes.Validator)
- func (k Keeper) HasReceivingRedelegation(ctx sdk.Context, delAddr sdk.AccAddress, valDstAddr sdk.AccAddress) bool
- func (k Keeper) InitIntraTxCounter(ctx sdk.Context)
- func (k Keeper) RemoveDelegation(ctx sdk.Context, delegation posTypes.Delegation)
- func (k Keeper) RemoveRedelegation(ctx sdk.Context, red posTypes.Redelegation)
- func (k Keeper) RemoveUnbondingDelegation(ctx sdk.Context, ubd posTypes.UnbondingDelegation)
- func (k Keeper) RemoveValidator(ctx sdk.Context, address sdk.AccAddress)
- func (k Keeper) RemoveValidatorTokensAndShares(ctx sdk.Context, validator posTypes.Validator, sharesToRemove types.Dec) (valOut posTypes.Validator, removedTokens types.Dec)
- func (k Keeper) SetAddressByTDMAddress(ctx sdk.Context, tdmAddress []byte, address sdk.AccAddress)
- func (k Keeper) SetDelegation(ctx sdk.Context, delegation posTypes.Delegation)
- func (k Keeper) SetIntraTxCounter(ctx sdk.Context, counter int16)
- func (k Keeper) SetLastTotalPower(ctx sdk.Context, power sdk.Int)
- func (k Keeper) SetLastValidatorPower(ctx sdk.Context, operator sdk.AccAddress, power sdk.Int)
- func (k Keeper) SetNewValidatorByPowerIndex(ctx sdk.Context, validator posTypes.Validator)
- func (k Keeper) SetParams(ctx sdk.Context, params posTypes.Params)
- func (k Keeper) SetPool(ctx sdk.Context, pool posTypes.Pool)
- func (k Keeper) SetRedelegation(ctx sdk.Context, red posTypes.Redelegation)
- func (k Keeper) SetUnbondingDelegation(ctx sdk.Context, ubd posTypes.UnbondingDelegation)
- func (k Keeper) SetValidator(ctx sdk.Context, validator posTypes.Validator)
- func (k Keeper) SetValidatorByPowerIndex(ctx sdk.Context, validator posTypes.Validator, pool posTypes.Pool)
- func (k Keeper) SetValidatorDistInfo(ctx sdk.Context, vdi posTypes.ValidatorDistInfo)
- func (k Keeper) UpdateBlockReward(ctx sdk.Context, validatorAddr sdk.AccAddress, commissionRate types.Dec, ...) (posTypes.ValidatorDistInfo, sdk.Error)
- func (k Keeper) UpdateDelAccum(ctx sdk.Context, validatorAddr sdk.AccAddress, currentHeight int64) (posTypes.ValidatorDistInfo, sdk.Error)
- func (k Keeper) WithdrawDelReward(ctx sdk.Context, validatorAddr sdk.AccAddress, delegatorAddr sdk.AccAddress) (posTypes.ValidatorDistInfo, types.Coin, sdk.Error)
Constants ¶
const MaxCacheLength = 500
Variables ¶
var ( // Keys for store prefixes ParamKey = []byte{0x00} // key for parameters relating to staking PoolKey = []byte{0x01} // key for the staking pools ValidatorsKey = []byte{0x02} // prefix for each key to a validator ValidatorsByConsAddrKey = []byte{0x03} // prefix for each key to a validator index, by pubkey ValidatorsBondedIndexKey = []byte{0x04} // prefix for each key to a validator index, for bonded validators ValidatorsByPowerIndexKey = []byte{0x05} // prefix for each key to a validator index, sorted by power IntraTxCounterKey = []byte{0x06} // key for intra-block tx index DelegationKey = []byte{0x07} // key for a delegation UnbondingDelegationKey = []byte{0x08} // key for an unbonding-delegation UnbondingDelegationByValIndexKey = []byte{0x09} // prefix for each key for an unbonding-delegation, by validator operator RedelegationKey = []byte{0x0A} // key for a redelegation RedelegationByValSrcIndexKey = []byte{0x0B} // prefix for each key for an redelegation, by source validator operator RedelegationByValDstIndexKey = []byte{0x0C} // prefix for each key for an redelegation, by destination validator operator ValidatorDistKey = []byte{0x0D} // prefix for each key for validator distribution information ValidatorsTDMAddrKey = []byte{0x0E} // prefix for mapping from TDM address to Shareledger address // Last* values are const during a block. LastValidatorPowerKey = []byte{0x11} // prefix for each key to a validator index, for bonded validators LastTotalPowerKey = []byte{0x12} // prefix for the total power )
nolint
Functions ¶
func GetDelegationKey ¶
func GetDelegationKey(delAddr sdk.AccAddress, valAddr sdk.AccAddress) []byte
gets the key for delegator bond with validator VALUE: stake/types.Delegation
func GetDelegationsKey ¶
func GetDelegationsKey(delAddr sdk.AccAddress) []byte
gets the prefix for a delegator for all validators
func GetLastValidatorPowerKey ¶
func GetLastValidatorPowerKey(operator sdk.AccAddress) []byte
get the bonded validator index key for an operator address
func GetREDByValDstIndexKey ¶
func GetREDByValDstIndexKey(delAddr sdk.AccAddress, valSrcAddr, valDstAddr sdk.AccAddress) []byte
gets the index-key for a redelegation, stored by destination-validator-index VALUE: none (key rearrangement used)
func GetREDByValSrcIndexKey ¶
func GetREDByValSrcIndexKey(delAddr sdk.AccAddress, valSrcAddr, valDstAddr sdk.AccAddress) []byte
gets the index-key for a redelegation, stored by source-validator-index VALUE: none (key rearrangement used)
func GetREDKey ¶
func GetREDKey(delAddr sdk.AccAddress, valSrcAddr, valDstAddr sdk.AccAddress) []byte
gets the key for a redelegation VALUE: stake/types.RedelegationKey
func GetREDKeyFromValDstIndexKey ¶
rearranges the ValDstIndexKey to get the REDKey
func GetREDKeyFromValSrcIndexKey ¶
rearranges the ValSrcIndexKey to get the REDKey
func GetREDsByDelToValDstIndexKey ¶
func GetREDsByDelToValDstIndexKey(delAddr sdk.AccAddress, valDstAddr sdk.AccAddress) []byte
gets the prefix keyspace for all redelegations redelegating towards a destination validator from a particular delegator
func GetREDsFromValSrcIndexKey ¶
func GetREDsFromValSrcIndexKey(valSrcAddr sdk.AccAddress) []byte
gets the prefix keyspace for all redelegations redelegating away from a source validator
func GetREDsKey ¶
func GetREDsKey(delAddr sdk.AccAddress) []byte
gets the prefix keyspace for redelegations from a delegator
func GetREDsToValDstIndexKey ¶
func GetREDsToValDstIndexKey(valDstAddr sdk.AccAddress) []byte
gets the prefix keyspace for all redelegations redelegating towards a destination validator
func GetTdmAddressKey ¶ added in v0.2.1
func GetUBDByValIndexKey ¶
func GetUBDByValIndexKey(delAddr sdk.AccAddress, valAddr sdk.AccAddress) []byte
gets the index-key for an unbonding delegation, stored by validator-index VALUE: none (key rearrangement used)
func GetUBDKey ¶
func GetUBDKey(delAddr sdk.AccAddress, valAddr sdk.AccAddress) []byte
gets the key for an unbonding delegation by delegator and validator addr VALUE: stake/types.UnbondingDelegation
func GetUBDsByValIndexKey ¶
func GetUBDsByValIndexKey(valAddr sdk.AccAddress) []byte
gets the prefix keyspace for the indexes of unbonding delegations for a validator
func GetUBDsKey ¶
func GetUBDsKey(delAddr sdk.AccAddress) []byte
gets the prefix for all unbonding delegations from a delegator
func GetValidatorByConsAddrKey ¶
func GetValidatorByConsAddrKey(addr sdk.AccAddress) []byte
gets the key for the validator with pubkey VALUE: validator operator address ([]byte)
func GetValidatorDistKey ¶
func GetValidatorDistKey(operatorAddr sdk.AccAddress) []byte
func GetValidatorKey ¶
func GetValidatorKey(operatorAddr sdk.AccAddress) []byte
gets the key for the validator with address VALUE: stake/types.Validator
func GetValidatorsByPowerIndexKey ¶
get the validator by power index. Power index is the key used in the power-store, and represents the relative power ranking of the validator. VALUE: validator operator address ([]byte)
Types ¶
type Keeper ¶
type Keeper struct {
// contains filtered or unexported fields
}
func (Keeper) AddValidatorTokensAndShares ¶
func (k Keeper) AddValidatorTokensAndShares(ctx sdk.Context, validator posTypes.Validator, tokensToAdd types.Dec) (valOut posTypes.Validator, addedShares types.Dec)
Update the tokens of an existing validator, update the validators power index key
func (Keeper) BeginRedelegation ¶
func (Keeper) BeginUnbonding ¶
func (Keeper) CompleteRedelegation ¶
func (k Keeper) CompleteRedelegation(ctx sdk.Context, delAddr sdk.AccAddress, valSrcAddr, valDstAddr sdk.AccAddress) sdk.Error
complete unbonding an ongoing redelegation
func (Keeper) CompleteUnbonding ¶
func (k Keeper) CompleteUnbonding(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.AccAddress) sdk.Error
complete unbonding an unbonding record
func (Keeper) Delegate ¶
func (k Keeper) Delegate(ctx sdk.Context, delAddr sdk.AccAddress, bondAmt types.Coin, validator posTypes.Validator, subtractAccount bool) (newShares types.Dec, err sdk.Error)
Perform a delegation, set/update everything necessary within the store.
func (Keeper) DeleteLastValidatorPower ¶
func (k Keeper) DeleteLastValidatorPower(ctx sdk.Context, operator sdk.AccAddress)
Delete the last validator power.
func (Keeper) DeleteValidatorByPowerIndex ¶
func (k Keeper) DeleteValidatorByPowerIndex(ctx sdk.Context, validator posTypes.Validator, pool posTypes.Pool)
validator index
func (Keeper) GetAllDelegations ¶
func (k Keeper) GetAllDelegations(ctx sdk.Context) (delegations []posTypes.Delegation)
return all delegations during POS withdrawlReward
func (Keeper) GetDelegation ¶
func (k Keeper) GetDelegation(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.AccAddress) ( delegation posTypes.Delegation, found bool)
return a specific delegation
func (Keeper) GetIntraTxCounter ¶
get the current in-block validator operation counter
func (Keeper) GetRedelegation ¶
func (k Keeper) GetRedelegation(ctx sdk.Context, delAddr sdk.AccAddress, valSrcAddr, valDstAddr sdk.AccAddress) (red posTypes.Redelegation, found bool)
return a redelegation
func (Keeper) GetRedelegations ¶
func (k Keeper) GetRedelegations(ctx sdk.Context, delegator sdk.AccAddress, maxRetrieve uint16) (redelegations []posTypes.Redelegation)
return a given amount of all the delegator redelegations
func (Keeper) GetUnbondingDelegation ¶
func (k Keeper) GetUnbondingDelegation(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.AccAddress) (ubd posTypes.UnbondingDelegation, found bool)
return a unbonding delegation
func (Keeper) GetUnbondingDelegations ¶
func (k Keeper) GetUnbondingDelegations(ctx sdk.Context, delegator sdk.AccAddress, maxRetrieve uint16) (unbondingDelegations []posTypes.UnbondingDelegation)
return a given amount of all the delegator unbonding-delegations
func (Keeper) GetValidator ¶
func (k Keeper) GetValidator(ctx sdk.Context, addr sdk.AccAddress) (validator posTypes.Validator, found bool)
get a single validator
func (Keeper) GetValidatorByTDMAddress ¶ added in v0.2.1
func (k Keeper) GetValidatorByTDMAddress( ctx sdk.Context, tdmAddress []byte, ) ( validator posTypes.Validator, found bool, )
GetValidatorByTDMAddress - get validator by Tendermint Address
func (Keeper) GetValidatorDistInfo ¶
func (k Keeper) GetValidatorDistInfo( ctx sdk.Context, addr sdk.AccAddress, ) ( vdi posTypes.ValidatorDistInfo, found bool, )
func (Keeper) GetValidatorSetUpdates ¶
func (k Keeper) GetValidatorSetUpdates(ctx sdk.Context) []abci.ValidatorUpdate
func (Keeper) GetValidators ¶
func (k Keeper) GetValidators(ctx sdk.Context, maxRetrieve uint16) (validators []posTypes.Validator)
return a given amount of all the validators
func (Keeper) HasReceivingRedelegation ¶
func (k Keeper) HasReceivingRedelegation(ctx sdk.Context, delAddr sdk.AccAddress, valDstAddr sdk.AccAddress) bool
check if validator is receiving a redelegation
func (Keeper) InitIntraTxCounter ¶
get the current in-block validator operation counter
func (Keeper) RemoveDelegation ¶
func (k Keeper) RemoveDelegation(ctx sdk.Context, delegation posTypes.Delegation)
remove a delegation from store
func (Keeper) RemoveRedelegation ¶
func (k Keeper) RemoveRedelegation(ctx sdk.Context, red posTypes.Redelegation)
remove a redelegation object and associated index
func (Keeper) RemoveUnbondingDelegation ¶
func (k Keeper) RemoveUnbondingDelegation(ctx sdk.Context, ubd posTypes.UnbondingDelegation)
remove the unbonding delegation object and associated index
func (Keeper) RemoveValidator ¶
func (k Keeper) RemoveValidator(ctx sdk.Context, address sdk.AccAddress)
remove the validator record and associated indexes
func (Keeper) RemoveValidatorTokensAndShares ¶
func (k Keeper) RemoveValidatorTokensAndShares(ctx sdk.Context, validator posTypes.Validator, sharesToRemove types.Dec) (valOut posTypes.Validator, removedTokens types.Dec)
Update the tokens of an existing validator, update the validators power index key
func (Keeper) SetAddressByTDMAddress ¶ added in v0.2.1
func (k Keeper) SetAddressByTDMAddress( ctx sdk.Context, tdmAddress []byte, address sdk.AccAddress, )
SetAddressByTDMAddress - set ShareledgerAddress by TDMAddress to later retrieve during POS processing
func (Keeper) SetDelegation ¶
func (k Keeper) SetDelegation(ctx sdk.Context, delegation posTypes.Delegation)
set the delegation
func (Keeper) SetIntraTxCounter ¶
set the current in-block validator operation counter
func (Keeper) SetLastTotalPower ¶
Set the last total validator power.
func (Keeper) SetLastValidatorPower ¶
Set the last validator power.
func (Keeper) SetNewValidatorByPowerIndex ¶
validator index
func (Keeper) SetRedelegation ¶
func (k Keeper) SetRedelegation(ctx sdk.Context, red posTypes.Redelegation)
set a redelegation and associated index
func (Keeper) SetUnbondingDelegation ¶
func (k Keeper) SetUnbondingDelegation(ctx sdk.Context, ubd posTypes.UnbondingDelegation)
set the unbonding delegation and associated index
func (Keeper) SetValidator ¶
set the main record holding validator details
func (Keeper) SetValidatorByPowerIndex ¶
func (k Keeper) SetValidatorByPowerIndex(ctx sdk.Context, validator posTypes.Validator, pool posTypes.Pool)
validator index
func (Keeper) SetValidatorDistInfo ¶
func (k Keeper) SetValidatorDistInfo( ctx sdk.Context, vdi posTypes.ValidatorDistInfo, )
func (Keeper) UpdateBlockReward ¶
func (k Keeper) UpdateBlockReward( ctx sdk.Context, validatorAddr sdk.AccAddress, commissionRate types.Dec, rewardPerBlock types.Coin, ) ( posTypes.ValidatorDistInfo, sdk.Error, )
UpdateBlockReward is called everytime this validator is selected as forger
func (Keeper) UpdateDelAccum ¶
func (k Keeper) UpdateDelAccum( ctx sdk.Context, validatorAddr sdk.AccAddress, currentHeight int64, ) ( posTypes.ValidatorDistInfo, sdk.Error, )
UpdateDelAccum - Update Delegation Accum of a certain delegator is called everytime reward delegation settlement
func (Keeper) WithdrawDelReward ¶
func (k Keeper) WithdrawDelReward( ctx sdk.Context, validatorAddr sdk.AccAddress, delegatorAddr sdk.AccAddress, ) (posTypes.ValidatorDistInfo, types.Coin, sdk.Error)