Documentation ¶
Index ¶
- Constants
- Variables
- func GetDelegationDistInfoKey(delAddr sdk.AccAddress, valAddr sdk.ValAddress) []byte
- func GetDelegationDistInfosKey(delAddr sdk.AccAddress) []byte
- func GetDelegatorWithdrawAddrKey(delAddr sdk.AccAddress) []byte
- func GetDelegatorWithdrawInfoAddress(key []byte) (delAddr sdk.AccAddress)
- func GetValidatorDistInfoKey(operatorAddr sdk.ValAddress) []byte
- func NewQuerier(k Keeper) sdk.Querier
- func ParamTypeTable() params.TypeTable
- type CommunityTax
- type DelegationsReward
- type Hooks
- func (h Hooks) OnDelegationCreated(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress)
- func (h Hooks) OnDelegationRemoved(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress)
- func (h Hooks) OnDelegationSharesModified(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress)
- func (h Hooks) OnValidatorBeginUnbonding(ctx sdk.Context, _ sdk.ConsAddress, valAddr sdk.ValAddress)
- func (h Hooks) OnValidatorBonded(ctx sdk.Context, _ sdk.ConsAddress, valAddr sdk.ValAddress)
- func (h Hooks) OnValidatorCreated(ctx sdk.Context, valAddr sdk.ValAddress)
- func (h Hooks) OnValidatorModified(ctx sdk.Context, valAddr sdk.ValAddress)
- func (h Hooks) OnValidatorPowerDidChange(ctx sdk.Context, _ sdk.ConsAddress, valAddr sdk.ValAddress)
- func (h Hooks) OnValidatorRemoved(ctx sdk.Context, _ sdk.ConsAddress, valAddr sdk.ValAddress)
- type Keeper
- func (k Keeper) AllocateFeeTax(ctx sdk.Context, destAddr sdk.AccAddress, percent sdk.Dec, burn bool)
- func (k Keeper) AllocateTokens(ctx sdk.Context, percentVotes sdk.Dec, proposer sdk.ConsAddress)
- func (k Keeper) CurrentDelegationReward(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) (sdk.Coins, sdk.Error)
- func (k Keeper) CurrentDelegationRewardsAll(ctx sdk.Context, delAddr sdk.AccAddress) types.DecCoins
- func (k Keeper) CurrentValidatorRewardsAll(ctx sdk.Context, operatorAddr sdk.ValAddress) (sdk.Coins, sdk.Error)
- func (k Keeper) GetAllDelegationDistInfos(ctx sdk.Context) (ddis []types.DelegationDistInfo)
- func (k Keeper) GetAllDelegatorWithdrawInfos(ctx sdk.Context) (dwis []types.DelegatorWithdrawInfo)
- func (k Keeper) GetAllValidatorDistInfos(ctx sdk.Context) (vdis []types.ValidatorDistInfo)
- func (k Keeper) GetBaseProposerReward(ctx sdk.Context) sdk.Dec
- func (k Keeper) GetBonusProposerReward(ctx sdk.Context) sdk.Dec
- func (k Keeper) GetCommunityTax(ctx sdk.Context) sdk.Dec
- func (k Keeper) GetDelegationDistInfo(ctx sdk.Context, delAddr sdk.AccAddress, valOperatorAddr sdk.ValAddress) (ddi types.DelegationDistInfo)
- func (k Keeper) GetDelegatorWithdrawAddr(ctx sdk.Context, delAddr sdk.AccAddress) sdk.AccAddress
- func (k Keeper) GetFeePool(ctx sdk.Context) (feePool types.FeePool)
- func (k Keeper) GetFeePoolValAccum(ctx sdk.Context) sdk.Dec
- func (k Keeper) GetParams(ctx sdk.Context) (res types.Params)
- func (k Keeper) GetPreviousProposerConsAddr(ctx sdk.Context) (consAddr sdk.ConsAddress)
- func (k Keeper) GetValidatorAccum(ctx sdk.Context, operatorAddr sdk.ValAddress) (sdk.Dec, sdk.Error)
- func (k Keeper) GetValidatorDistInfo(ctx sdk.Context, operatorAddr sdk.ValAddress) (vdi types.ValidatorDistInfo)
- func (k Keeper) GetWithdrawContext(ctx sdk.Context, valOperatorAddr sdk.ValAddress) types.WithdrawContext
- func (k Keeper) HasDelegationDistInfo(ctx sdk.Context, delAddr sdk.AccAddress, valOperatorAddr sdk.ValAddress) (has bool)
- func (k Keeper) HasValidatorDistInfo(ctx sdk.Context, operatorAddr sdk.ValAddress) (exists bool)
- func (k Keeper) Hooks() Hooks
- func (k Keeper) IterateDelegationDistInfos(ctx sdk.Context, ...)
- func (k Keeper) IterateDelegatorDistInfos(ctx sdk.Context, delegator sdk.AccAddress, ...)
- func (k Keeper) IterateValidatorDistInfos(ctx sdk.Context, ...)
- func (k Keeper) RemoveDelegationDistInfo(ctx sdk.Context, delAddr sdk.AccAddress, valOperatorAddr sdk.ValAddress)
- func (k Keeper) RemoveDelegationDistInfos(ctx sdk.Context)
- func (k Keeper) RemoveDelegatorWithdrawAddr(ctx sdk.Context, delAddr, withdrawAddr sdk.AccAddress)
- func (k Keeper) RemoveValidatorDistInfo(ctx sdk.Context, valAddr sdk.ValAddress)
- func (k Keeper) SetDelegationDistInfo(ctx sdk.Context, ddi types.DelegationDistInfo)
- func (k Keeper) SetDelegatorWithdrawAddr(ctx sdk.Context, delAddr, withdrawAddr sdk.AccAddress)
- func (k Keeper) SetFeePool(ctx sdk.Context, feePool types.FeePool)
- func (k Keeper) SetGenesisFeePool(ctx sdk.Context, feePool types.FeePool)
- func (k Keeper) SetParams(ctx sdk.Context, params types.Params)
- func (k Keeper) SetPreviousProposerConsAddr(ctx sdk.Context, consAddr sdk.ConsAddress)
- func (k Keeper) SetValidatorDistInfo(ctx sdk.Context, vdi types.ValidatorDistInfo)
- func (k Keeper) WithdrawDelegationReward(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) (types.DecCoins, sdk.Error)
- func (k Keeper) WithdrawDelegationRewardsAll(ctx sdk.Context, delAddr sdk.AccAddress) (types.DecCoins, sdk.Tags)
- func (k Keeper) WithdrawToDelegator(ctx sdk.Context, feePool types.FeePool, delAddr sdk.AccAddress, ...)
- func (k Keeper) WithdrawValidatorRewardsAll(ctx sdk.Context, operatorAddr sdk.ValAddress) (types.DecCoins, sdk.Tags, sdk.Error)
- type Metrics
- type QueryDelegationDistInfoParams
- type QueryDelegatorParams
- type QueryRewardsParams
- type QueryValidatorDistInfoParams
- type Rewards
Constants ¶
const ( QueryWithdrawAddr = "withdraw_addr" QueryDelegationDistInfo = "delegation_dist_info" QueryAllDelegationDistInfo = "all_delegation_dist_info" QueryValidatorDistInfo = "validator_dist_info" QueryRewards = "rewards" QueryCommunityTax = "community_tax" )
nolint
const (
// default paramspace for params keeper
DefaultParamspace = "distr"
)
const MetricsSubsystem = "module_distribution"
Variables ¶
var ( FeePoolKey = []byte{0x00} // key for global distribution state ValidatorDistInfoKey = []byte{0x01} // prefix for each key to a validator distribution DelegationDistInfoKey = []byte{0x02} // prefix for each key to a delegation distribution DelegatorWithdrawInfoKey = []byte{0x03} // prefix for each key to a delegator withdraw info ProposerKey = []byte{0x04} // key for storing the proposer operator address // params store ParamStoreKeyCommunityTax = []byte("communitytax") ParamStoreKeyBaseProposerReward = []byte("baseproposerreward") ParamStoreKeyBonusProposerReward = []byte("bonusproposerreward") )
keys/key-prefixes
Functions ¶
func GetDelegationDistInfoKey ¶
func GetDelegationDistInfoKey(delAddr sdk.AccAddress, valAddr sdk.ValAddress) []byte
gets the key for delegator distribution for a validator VALUE: distribution/types.DelegationDistInfo
func GetDelegationDistInfosKey ¶
func GetDelegationDistInfosKey(delAddr sdk.AccAddress) []byte
gets the prefix for a delegator's distributions across all validators
func GetDelegatorWithdrawAddrKey ¶
func GetDelegatorWithdrawAddrKey(delAddr sdk.AccAddress) []byte
gets the prefix for a delegator's withdraw info
func GetDelegatorWithdrawInfoAddress ¶
func GetDelegatorWithdrawInfoAddress(key []byte) (delAddr sdk.AccAddress)
gets an address from a delegator's withdraw info key
func GetValidatorDistInfoKey ¶
func GetValidatorDistInfoKey(operatorAddr sdk.ValAddress) []byte
gets the key for the validator distribution info from address VALUE: distribution/types.ValidatorDistInfo
func NewQuerier ¶ added in v0.14.0
Types ¶
type CommunityTax ¶ added in v0.14.0
func (CommunityTax) String ¶ added in v0.14.0
func (ct CommunityTax) String() string
type DelegationsReward ¶ added in v0.14.0
type DelegationsReward struct { Validator sdk.ValAddress `json:"validator"` Reward sdk.Coins `json:"reward"` }
func (DelegationsReward) String ¶ added in v0.14.0
func (dr DelegationsReward) String() string
type Hooks ¶
type Hooks struct {
// contains filtered or unexported fields
}
Wrapper struct
func (Hooks) OnDelegationCreated ¶
func (h Hooks) OnDelegationCreated(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress)
func (Hooks) OnDelegationRemoved ¶
func (h Hooks) OnDelegationRemoved(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress)
func (Hooks) OnDelegationSharesModified ¶
func (h Hooks) OnDelegationSharesModified(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress)
func (Hooks) OnValidatorBeginUnbonding ¶
func (h Hooks) OnValidatorBeginUnbonding(ctx sdk.Context, _ sdk.ConsAddress, valAddr sdk.ValAddress)
func (Hooks) OnValidatorBonded ¶
func (h Hooks) OnValidatorBonded(ctx sdk.Context, _ sdk.ConsAddress, valAddr sdk.ValAddress)
func (Hooks) OnValidatorCreated ¶
func (h Hooks) OnValidatorCreated(ctx sdk.Context, valAddr sdk.ValAddress)
nolint
func (Hooks) OnValidatorModified ¶
func (h Hooks) OnValidatorModified(ctx sdk.Context, valAddr sdk.ValAddress)
func (Hooks) OnValidatorPowerDidChange ¶
func (h Hooks) OnValidatorPowerDidChange(ctx sdk.Context, _ sdk.ConsAddress, valAddr sdk.ValAddress)
func (Hooks) OnValidatorRemoved ¶
func (h Hooks) OnValidatorRemoved(ctx sdk.Context, _ sdk.ConsAddress, valAddr sdk.ValAddress)
type Keeper ¶
type Keeper struct {
// contains filtered or unexported fields
}
keeper of the stake store
func (Keeper) AllocateFeeTax ¶ added in v0.9.0
func (k Keeper) AllocateFeeTax(ctx sdk.Context, destAddr sdk.AccAddress, percent sdk.Dec, burn bool)
Allocate fee tax from the community fee pool, burn or send to trustee account
func (Keeper) AllocateTokens ¶
Allocate fees handles distribution of the collected fees
func (Keeper) CurrentDelegationReward ¶
func (k Keeper) CurrentDelegationReward(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) (sdk.Coins, sdk.Error)
current rewards for a single delegation
func (Keeper) CurrentDelegationRewardsAll ¶
get all rewards for all delegations of a delegator
func (Keeper) CurrentValidatorRewardsAll ¶
func (k Keeper) CurrentValidatorRewardsAll(ctx sdk.Context, operatorAddr sdk.ValAddress) (sdk.Coins, sdk.Error)
get all the validator rewards including the commission
func (Keeper) GetAllDelegationDistInfos ¶
func (k Keeper) GetAllDelegationDistInfos(ctx sdk.Context) (ddis []types.DelegationDistInfo)
Get the set of all delegator-distribution-info's with no limits, used during genesis dump
func (Keeper) GetAllDelegatorWithdrawInfos ¶
func (k Keeper) GetAllDelegatorWithdrawInfos(ctx sdk.Context) (dwis []types.DelegatorWithdrawInfo)
Get the set of all delegator-withdraw addresses with no limits, used during genesis dump
func (Keeper) GetAllValidatorDistInfos ¶
func (k Keeper) GetAllValidatorDistInfos(ctx sdk.Context) (vdis []types.ValidatorDistInfo)
Get the set of all validator-distribution-info's with no limits, used during genesis dump
func (Keeper) GetBaseProposerReward ¶
Returns the current BaseProposerReward rate from the global param store nolint: errcheck
func (Keeper) GetBonusProposerReward ¶
Returns the current BaseProposerReward rate from the global param store nolint: errcheck
func (Keeper) GetDelegationDistInfo ¶
func (k Keeper) GetDelegationDistInfo(ctx sdk.Context, delAddr sdk.AccAddress, valOperatorAddr sdk.ValAddress) (ddi types.DelegationDistInfo)
get the delegator distribution info
func (Keeper) GetDelegatorWithdrawAddr ¶
func (k Keeper) GetDelegatorWithdrawAddr(ctx sdk.Context, delAddr sdk.AccAddress) sdk.AccAddress
get the delegator withdraw address, return the delegator address if not set
func (Keeper) GetFeePool ¶
get the global fee pool distribution info
func (Keeper) GetFeePoolValAccum ¶
get the total validator accum for the ctx height in the fee pool
func (Keeper) GetPreviousProposerConsAddr ¶
func (k Keeper) GetPreviousProposerConsAddr(ctx sdk.Context) (consAddr sdk.ConsAddress)
set the proposer public key for this block
func (Keeper) GetValidatorAccum ¶
func (k Keeper) GetValidatorAccum(ctx sdk.Context, operatorAddr sdk.ValAddress) (sdk.Dec, sdk.Error)
Get the calculated accum of a validator at the current block without affecting the state.
func (Keeper) GetValidatorDistInfo ¶
func (k Keeper) GetValidatorDistInfo(ctx sdk.Context, operatorAddr sdk.ValAddress) (vdi types.ValidatorDistInfo)
get the validator distribution info
func (Keeper) GetWithdrawContext ¶
func (k Keeper) GetWithdrawContext(ctx sdk.Context, valOperatorAddr sdk.ValAddress) types.WithdrawContext
get context required for withdraw operations
func (Keeper) HasDelegationDistInfo ¶
func (k Keeper) HasDelegationDistInfo(ctx sdk.Context, delAddr sdk.AccAddress, valOperatorAddr sdk.ValAddress) (has bool)
check whether a delegator distribution info exists
func (Keeper) HasValidatorDistInfo ¶
check whether a validator has distribution info
func (Keeper) IterateDelegationDistInfos ¶ added in v0.9.0
func (k Keeper) IterateDelegationDistInfos(ctx sdk.Context, fn func(index int64, distInfo types.DelegationDistInfo) (stop bool))
iterate over all the validator distribution infos
func (Keeper) IterateDelegatorDistInfos ¶ added in v0.14.0
func (k Keeper) IterateDelegatorDistInfos(ctx sdk.Context, delegator sdk.AccAddress, fn func(index int64, distInfo types.DelegationDistInfo) (stop bool))
iterate over all the validator distribution infos of one delegator
func (Keeper) IterateValidatorDistInfos ¶
func (k Keeper) IterateValidatorDistInfos(ctx sdk.Context, fn func(index int64, distInfo types.ValidatorDistInfo) (stop bool))
iterate over all the validator distribution infos (inefficient, just used to check invariants)
func (Keeper) RemoveDelegationDistInfo ¶
func (k Keeper) RemoveDelegationDistInfo(ctx sdk.Context, delAddr sdk.AccAddress, valOperatorAddr sdk.ValAddress)
remove a delegator distribution info
func (Keeper) RemoveDelegationDistInfos ¶ added in v0.9.0
remove all delegation distribution infos
func (Keeper) RemoveDelegatorWithdrawAddr ¶
func (k Keeper) RemoveDelegatorWithdrawAddr(ctx sdk.Context, delAddr, withdrawAddr sdk.AccAddress)
remove a delegator withdraw info
func (Keeper) RemoveValidatorDistInfo ¶
func (k Keeper) RemoveValidatorDistInfo(ctx sdk.Context, valAddr sdk.ValAddress)
remove a validator distribution info
func (Keeper) SetDelegationDistInfo ¶
func (k Keeper) SetDelegationDistInfo(ctx sdk.Context, ddi types.DelegationDistInfo)
set the delegator distribution info
func (Keeper) SetDelegatorWithdrawAddr ¶
func (k Keeper) SetDelegatorWithdrawAddr(ctx sdk.Context, delAddr, withdrawAddr sdk.AccAddress)
set the delegator withdraw address
func (Keeper) SetFeePool ¶
set the global fee pool distribution info
func (Keeper) SetGenesisFeePool ¶ added in v0.10.0
set the global fee pool distribution info
func (Keeper) SetPreviousProposerConsAddr ¶
func (k Keeper) SetPreviousProposerConsAddr(ctx sdk.Context, consAddr sdk.ConsAddress)
get the proposer public key for this block
func (Keeper) SetValidatorDistInfo ¶
func (k Keeper) SetValidatorDistInfo(ctx sdk.Context, vdi types.ValidatorDistInfo)
set the validator distribution info
func (Keeper) WithdrawDelegationReward ¶
func (k Keeper) WithdrawDelegationReward(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) (types.DecCoins, sdk.Error)
withdraw all rewards for a single delegation NOTE: This gets called "onDelegationSharesModified", meaning any changes to bonded coins
func (Keeper) WithdrawDelegationRewardsAll ¶
func (k Keeper) WithdrawDelegationRewardsAll(ctx sdk.Context, delAddr sdk.AccAddress) (types.DecCoins, sdk.Tags)
return all rewards for all delegations of a delegator
type Metrics ¶ added in v0.12.0
func NopMetrics ¶ added in v0.12.0
func NopMetrics() *Metrics
func PrometheusMetrics ¶ added in v0.12.0
func PrometheusMetrics(config *cfg.InstrumentationConfig) *Metrics
PrometheusMetrics returns Metrics build using Prometheus client library.
type QueryDelegationDistInfoParams ¶ added in v0.14.0
type QueryDelegationDistInfoParams struct { DelegatorAddress sdk.AccAddress `json:"delegator_address"` ValidatorAddress sdk.ValAddress `json:"validator_address"` }
params for query 'custom/distr/delegation_dist_info'
func NewQueryDelegationDistInfoParams ¶ added in v0.14.0
func NewQueryDelegationDistInfoParams(delegatorAddr sdk.AccAddress, validatorAddr sdk.ValAddress) QueryDelegationDistInfoParams
creates a new instance of QueryDelegationDistInfoParams
type QueryDelegatorParams ¶ added in v0.14.0
type QueryDelegatorParams struct {
DelegatorAddress sdk.AccAddress `json:"delegator_address"`
}
params for query 'custom/distr/delegation_dist_info', 'custom/distr/all_delegation_dist_info' and 'withdraw_addr'
func NewQueryDelegatorParams ¶ added in v0.14.0
func NewQueryDelegatorParams(delegatorAddr sdk.AccAddress) QueryDelegatorParams
type QueryRewardsParams ¶ added in v0.14.0
type QueryRewardsParams struct {
Address sdk.AccAddress `json:"address"`
}
params for query 'custom/distr/rewards'
func NewQueryRewardsParams ¶ added in v0.14.0
func NewQueryRewardsParams(address sdk.AccAddress) QueryRewardsParams
creates a new instance of QueryRewardsParams
type QueryValidatorDistInfoParams ¶ added in v0.14.0
type QueryValidatorDistInfoParams struct {
ValidatorAddress sdk.ValAddress `json:"validator_address"`
}
params for query 'custom/distr/validator_dist_info'
func NewQueryValidatorDistInfoParams ¶ added in v0.14.0
func NewQueryValidatorDistInfoParams(validatorAddr sdk.ValAddress) QueryValidatorDistInfoParams
creates a new instance of QueryValidatorDistInfoParams