Documentation ¶
Index ¶
- Constants
- Variables
- func GetValidatorCurrentRewardsKey(v sdk.AccAddr) []byte
- func GetValidatorsInfoKey(v []byte) []byte
- func NewQuerier(keeper DistrKeeper) sdk.Querier
- type DistrKeeper
- func (k DistrKeeper) AllocateTokensToValidator(ctx sdk.Context, val staking.Validator, tokens sdk.DecCoin)
- func (k DistrKeeper) DeleteDelegatorStartingInfo(ctx sdk.Context, val sdk.AccAddress, del sdk.AccAddress)
- func (k DistrKeeper) DeleteDelegatorWithdrawAddr(ctx sdk.Context, delAddr, withdrawAddr sdk.AccAddress)
- func (k *DistrKeeper) DeleteProposerCurrentRewards(ctx sdk.Context, val sdk.AccAddr)
- func (k *DistrKeeper) DeleteValidatorAccumulatedCommission(ctx sdk.Context, val sdk.AccAddress)
- func (k *DistrKeeper) DeleteValidatorCurrentRewards(ctx sdk.Context, val sdk.AccAddress)
- func (k DistrKeeper) DeleteValidatorHistoricalReward(ctx sdk.Context, val sdk.AccAddress, period uint64)
- func (k DistrKeeper) DeleteValidatorHistoricalRewards(ctx sdk.Context, val sdk.AccAddress)
- func (k *DistrKeeper) DeleteValidatorOldRewardsRecord(ctx sdk.Context, val sdk.AccAddr)
- func (k *DistrKeeper) DeleteValidatorOutstandingRewards(ctx sdk.Context, val sdk.AccAddress)
- func (k DistrKeeper) DeleteValidatorSlashEvents(ctx sdk.Context, val sdk.AccAddress)
- func (k *DistrKeeper) DeleteValidatorsInfo(ctx sdk.Context, height int64)
- func (k DistrKeeper) FundCommunityPool(ctx sdk.Context, amount sdk.Coin, sender sdk.AccAddress) error
- func (k DistrKeeper) GetBaseProposerReward(ctx sdk.Context) (percent sdk.Dec)
- func (k DistrKeeper) GetBonusProposerReward(ctx sdk.Context) (percent sdk.Dec)
- func (k DistrKeeper) GetCommunityTax(ctx sdk.Context) (percent sdk.Dec)
- func (k DistrKeeper) GetDelegatorStartingInfo(ctx sdk.Context, val sdk.AccAddress, del sdk.AccAddress) (period types.DelegatorStartingInfo)
- func (k DistrKeeper) GetDelegatorWithdrawAddr(ctx sdk.Context, delAddr sdk.AccAddress) sdk.AccAddress
- func (k DistrKeeper) GetDistributionAccount(ctx sdk.Context) exported.ModuleAccountI
- func (k *DistrKeeper) GetFeePool(ctx sdk.Context) (feePool types.FeePool)
- func (k DistrKeeper) GetFeePoolCommunity(ctx sdk.Context) sdk.DecCoin
- func (k DistrKeeper) GetParams(ctx sdk.Context) (params types.Params)
- func (k *DistrKeeper) GetPreFixStore(ctx sdk.Context, prefix string) sdk.KVStore
- func (k *DistrKeeper) GetPreviousProposerAddr(ctx sdk.Context) (proposer sdk.AccAddr)
- func (k *DistrKeeper) GetProposerCurrentRewards(ctx sdk.Context, val sdk.AccAddr, height int64) (rewards sdk.Coin)
- func (k *DistrKeeper) GetValCurrentRewards(ctx sdk.Context, val sdk.AccAddr) (rewards sdk.Coin, err error)
- func (k *DistrKeeper) GetValidatorAccumulatedCommission(ctx sdk.Context, val sdk.AccAddress) (commission types.ValidatorAccumulatedCommission)
- func (k *DistrKeeper) GetValidatorCurrentRewards(ctx sdk.Context, val sdk.AccAddress) (rewards types.ValidatorCurrentRewards)
- func (k DistrKeeper) GetValidatorHistoricalRewards(ctx sdk.Context, val sdk.AccAddress, period uint64) (rewards types.ValidatorHistoricalRewards)
- func (k *DistrKeeper) GetValidatorOutstandingRewards(ctx sdk.Context, val sdk.AccAddress) (rewards types.ValidatorOutstandingRewards)
- func (k DistrKeeper) GetValidatorOutstandingRewardsCoins(ctx sdk.Context, val sdk.AccAddress) sdk.DecCoin
- func (k DistrKeeper) GetValidatorSlashEvent(ctx sdk.Context, val sdk.AccAddress, height, period uint64) (event types.ValidatorSlashEvent, found bool)
- func (k *DistrKeeper) GetValidatorsInfo(ctx sdk.Context, height int64) []byte
- func (k DistrKeeper) GetWithdrawAddrEnabled(ctx sdk.Context) (enabled bool)
- func (k DistrKeeper) HasDelegatorStartingInfo(ctx sdk.Context, val sdk.AccAddress, del sdk.AccAddress) bool
- func (k DistrKeeper) Hooks() Hooks
- func (k DistrKeeper) SetDelegatorStartingInfo(ctx sdk.Context, val, del sdk.AccAddress, period types.DelegatorStartingInfo)
- func (k DistrKeeper) SetDelegatorWithdrawAddr(ctx sdk.Context, delAddr, withdrawAddr sdk.AccAddress)
- func (k *DistrKeeper) SetFeePool(ctx sdk.Context, feePool types.FeePool)
- func (k DistrKeeper) SetParams(ctx sdk.Context, params types.Params)
- func (k *DistrKeeper) SetPreviousProposerAddr(ctx sdk.Context, proposer sdk.AccAddr)
- func (k *DistrKeeper) SetProposerCurrentRewards(ctx sdk.Context, val sdk.AccAddr, rewards sdk.Coin, height int64)
- func (k *DistrKeeper) SetValidatorAccumulatedCommission(ctx sdk.Context, val sdk.AccAddress, ...)
- func (k *DistrKeeper) SetValidatorCurrentRewards(ctx sdk.Context, val sdk.AccAddress, rewards types.ValidatorCurrentRewards)
- func (k DistrKeeper) SetValidatorHistoricalRewards(ctx sdk.Context, val sdk.AccAddress, period uint64, ...)
- func (k *DistrKeeper) SetValidatorOutstandingRewards(ctx sdk.Context, val sdk.AccAddress, rewards types.ValidatorOutstandingRewards)
- func (k DistrKeeper) SetValidatorSlashEvent(ctx sdk.Context, val sdk.AccAddress, height, period uint64, ...)
- func (k *DistrKeeper) SetValidatorsInfo(ctx sdk.Context, bytes []byte, height int64)
- func (k DistrKeeper) SetWithdrawAddr(ctx sdk.Context, delegatorAddr sdk.AccAddress, withdrawAddr sdk.AccAddress) error
- func (k DistrKeeper) WithdrawDelegationRewards(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.AccAddress) (sdk.Coin, error)
- func (k DistrKeeper) WithdrawValidatorCommission(ctx sdk.Context, valAddr sdk.AccAddress) (sdk.Coin, error)
- type Hooks
- func (h Hooks) AfterDelegationModified(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.AccAddress)
- func (h Hooks) AfterValidatorBeginUnbonding(_ sdk.Context, _ sdk.AccAddress, _ sdk.AccAddress)
- func (h Hooks) AfterValidatorBonded(_ sdk.Context, _ sdk.AccAddress, _ sdk.AccAddress)
- func (h Hooks) AfterValidatorCreated(ctx sdk.Context, valAddr sdk.AccAddress)
- func (h Hooks) AfterValidatorRemoved(ctx sdk.Context, _ sdk.AccAddress, valAddr sdk.AccAddress)
- func (h Hooks) BeforeDelegationCreated(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.AccAddress)
- func (h Hooks) BeforeDelegationRemoved(_ sdk.Context, _ sdk.AccAddress, _ sdk.AccAddress)
- func (h Hooks) BeforeDelegationSharesModified(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.AccAddress)
- func (h Hooks) BeforeValidatorModified(_ sdk.Context, _ sdk.AccAddress)
- func (h Hooks) BeforeValidatorSlashed(ctx sdk.Context, valAddr sdk.AccAddress, fraction sdk.Dec)
Constants ¶
const (
QueryRewards = "rewards"
)
Variables ¶
var ( ValidatorCurrentRewardsPrefix = []byte("val") ValidatorsInfoPrefix = []byte("vals") DisrtKey = "distr" )
Functions ¶
func GetValidatorsInfoKey ¶
func NewQuerier ¶
func NewQuerier(keeper DistrKeeper) sdk.Querier
Types ¶
type DistrKeeper ¶
type DistrKeeper struct { SupplyKeeper supply.Keeper FeeCollectorName string AccountKeeper account.AccountKeeper ParamSpace params.Subspace StakingKeeper staking.StakingKeeper // contains filtered or unexported fields }
keeper of the staking store
func NewKeeper ¶
func NewKeeper(cdc *codec.Codec, key sdk.StoreKey, sk supply.Keeper, ak account.AccountKeeper, feeCollector string, paramSpace params.Subspace, stakingKeeper staking.StakingKeeper, cdb dbm.DB) DistrKeeper
create a new keeper
func (DistrKeeper) AllocateTokensToValidator ¶
func (DistrKeeper) DeleteDelegatorStartingInfo ¶
func (k DistrKeeper) DeleteDelegatorStartingInfo(ctx sdk.Context, val sdk.AccAddress, del sdk.AccAddress)
delete the starting info associated with a delegator
func (DistrKeeper) DeleteDelegatorWithdrawAddr ¶
func (k DistrKeeper) DeleteDelegatorWithdrawAddr(ctx sdk.Context, delAddr, withdrawAddr sdk.AccAddress)
delete a delegator withdraw addr
func (*DistrKeeper) DeleteProposerCurrentRewards ¶
func (k *DistrKeeper) DeleteProposerCurrentRewards(ctx sdk.Context, val sdk.AccAddr)
func (*DistrKeeper) DeleteValidatorAccumulatedCommission ¶
func (k *DistrKeeper) DeleteValidatorAccumulatedCommission(ctx sdk.Context, val sdk.AccAddress)
func (*DistrKeeper) DeleteValidatorCurrentRewards ¶
func (k *DistrKeeper) DeleteValidatorCurrentRewards(ctx sdk.Context, val sdk.AccAddress)
delete current rewards for a validator
func (DistrKeeper) DeleteValidatorHistoricalReward ¶
func (k DistrKeeper) DeleteValidatorHistoricalReward(ctx sdk.Context, val sdk.AccAddress, period uint64)
delete a historical reward
func (DistrKeeper) DeleteValidatorHistoricalRewards ¶
func (k DistrKeeper) DeleteValidatorHistoricalRewards(ctx sdk.Context, val sdk.AccAddress)
delete historical rewards for a validator
func (*DistrKeeper) DeleteValidatorOldRewardsRecord ¶
func (k *DistrKeeper) DeleteValidatorOldRewardsRecord(ctx sdk.Context, val sdk.AccAddr)
func (*DistrKeeper) DeleteValidatorOutstandingRewards ¶
func (k *DistrKeeper) DeleteValidatorOutstandingRewards(ctx sdk.Context, val sdk.AccAddress)
func (DistrKeeper) DeleteValidatorSlashEvents ¶
func (k DistrKeeper) DeleteValidatorSlashEvents(ctx sdk.Context, val sdk.AccAddress)
delete slash events for a particular validator
func (*DistrKeeper) DeleteValidatorsInfo ¶
func (k *DistrKeeper) DeleteValidatorsInfo(ctx sdk.Context, height int64)
func (DistrKeeper) FundCommunityPool ¶
func (k DistrKeeper) FundCommunityPool(ctx sdk.Context, amount sdk.Coin, sender sdk.AccAddress) error
FundCommunityPool allows an account to directly fund the community fund pool. The amount is first added to the distribution module account and then directly added to the pool. An error is returned if the amount cannot be sent to the module account.
func (DistrKeeper) GetBaseProposerReward ¶
func (k DistrKeeper) GetBaseProposerReward(ctx sdk.Context) (percent sdk.Dec)
GetBaseProposerReward returns the current distribution base proposer rate.
func (DistrKeeper) GetBonusProposerReward ¶
func (k DistrKeeper) GetBonusProposerReward(ctx sdk.Context) (percent sdk.Dec)
GetBonusProposerReward returns the current distribution bonus proposer reward rate.
func (DistrKeeper) GetCommunityTax ¶
func (k DistrKeeper) GetCommunityTax(ctx sdk.Context) (percent sdk.Dec)
func (DistrKeeper) GetDelegatorStartingInfo ¶
func (k DistrKeeper) GetDelegatorStartingInfo(ctx sdk.Context, val sdk.AccAddress, del sdk.AccAddress) (period types.DelegatorStartingInfo)
get the starting info associated with a delegator
func (DistrKeeper) GetDelegatorWithdrawAddr ¶
func (k DistrKeeper) GetDelegatorWithdrawAddr(ctx sdk.Context, delAddr sdk.AccAddress) sdk.AccAddress
func (DistrKeeper) GetDistributionAccount ¶
func (k DistrKeeper) GetDistributionAccount(ctx sdk.Context) exported.ModuleAccountI
func (*DistrKeeper) GetFeePool ¶
func (k *DistrKeeper) GetFeePool(ctx sdk.Context) (feePool types.FeePool)
func (DistrKeeper) GetFeePoolCommunity ¶
func (k DistrKeeper) GetFeePoolCommunity(ctx sdk.Context) sdk.DecCoin
func (DistrKeeper) GetParams ¶
func (k DistrKeeper) GetParams(ctx sdk.Context) (params types.Params)
func (*DistrKeeper) GetPreFixStore ¶
func (*DistrKeeper) GetPreviousProposerAddr ¶
func (k *DistrKeeper) GetPreviousProposerAddr(ctx sdk.Context) (proposer sdk.AccAddr)
lastProposer
func (*DistrKeeper) GetProposerCurrentRewards ¶
func (*DistrKeeper) GetValCurrentRewards ¶
func (k *DistrKeeper) GetValCurrentRewards(ctx sdk.Context, val sdk.AccAddr) (rewards sdk.Coin, err error)
query
func (*DistrKeeper) GetValidatorAccumulatedCommission ¶
func (k *DistrKeeper) GetValidatorAccumulatedCommission(ctx sdk.Context, val sdk.AccAddress) (commission types.ValidatorAccumulatedCommission)
func (*DistrKeeper) GetValidatorCurrentRewards ¶
func (k *DistrKeeper) GetValidatorCurrentRewards(ctx sdk.Context, val sdk.AccAddress) (rewards types.ValidatorCurrentRewards)
func (DistrKeeper) GetValidatorHistoricalRewards ¶
func (k DistrKeeper) GetValidatorHistoricalRewards(ctx sdk.Context, val sdk.AccAddress, period uint64) (rewards types.ValidatorHistoricalRewards)
get historical rewards for a particular period
func (*DistrKeeper) GetValidatorOutstandingRewards ¶
func (k *DistrKeeper) GetValidatorOutstandingRewards(ctx sdk.Context, val sdk.AccAddress) (rewards types.ValidatorOutstandingRewards)
func (DistrKeeper) GetValidatorOutstandingRewardsCoins ¶
func (k DistrKeeper) GetValidatorOutstandingRewardsCoins(ctx sdk.Context, val sdk.AccAddress) sdk.DecCoin
get outstanding rewards
func (DistrKeeper) GetValidatorSlashEvent ¶
func (k DistrKeeper) GetValidatorSlashEvent(ctx sdk.Context, val sdk.AccAddress, height, period uint64) (event types.ValidatorSlashEvent, found bool)
get slash event for height
func (*DistrKeeper) GetValidatorsInfo ¶
func (k *DistrKeeper) GetValidatorsInfo(ctx sdk.Context, height int64) []byte
func (DistrKeeper) GetWithdrawAddrEnabled ¶
func (k DistrKeeper) GetWithdrawAddrEnabled(ctx sdk.Context) (enabled bool)
GetWithdrawAddrEnabled returns the current distribution withdraw address enabled parameter.
func (DistrKeeper) HasDelegatorStartingInfo ¶
func (k DistrKeeper) HasDelegatorStartingInfo(ctx sdk.Context, val sdk.AccAddress, del sdk.AccAddress) bool
check existence of the starting info associated with a delegator
func (DistrKeeper) SetDelegatorStartingInfo ¶
func (k DistrKeeper) SetDelegatorStartingInfo(ctx sdk.Context, val, del sdk.AccAddress, period types.DelegatorStartingInfo)
func (DistrKeeper) SetDelegatorWithdrawAddr ¶
func (k DistrKeeper) SetDelegatorWithdrawAddr(ctx sdk.Context, delAddr, withdrawAddr sdk.AccAddress)
func (*DistrKeeper) SetFeePool ¶
func (k *DistrKeeper) SetFeePool(ctx sdk.Context, feePool types.FeePool)
func (*DistrKeeper) SetPreviousProposerAddr ¶
func (k *DistrKeeper) SetPreviousProposerAddr(ctx sdk.Context, proposer sdk.AccAddr)
func (*DistrKeeper) SetProposerCurrentRewards ¶
func (k *DistrKeeper) SetProposerCurrentRewards(ctx sdk.Context, val sdk.AccAddr, rewards sdk.Coin, height int64)
proposer
func (*DistrKeeper) SetValidatorAccumulatedCommission ¶
func (k *DistrKeeper) SetValidatorAccumulatedCommission(ctx sdk.Context, val sdk.AccAddress, commission types.ValidatorAccumulatedCommission)
func (*DistrKeeper) SetValidatorCurrentRewards ¶
func (k *DistrKeeper) SetValidatorCurrentRewards(ctx sdk.Context, val sdk.AccAddress, rewards types.ValidatorCurrentRewards)
validator
func (DistrKeeper) SetValidatorHistoricalRewards ¶
func (k DistrKeeper) SetValidatorHistoricalRewards(ctx sdk.Context, val sdk.AccAddress, period uint64, rewards types.ValidatorHistoricalRewards)
set historical rewards for a particular period
func (*DistrKeeper) SetValidatorOutstandingRewards ¶
func (k *DistrKeeper) SetValidatorOutstandingRewards(ctx sdk.Context, val sdk.AccAddress, rewards types.ValidatorOutstandingRewards)
func (DistrKeeper) SetValidatorSlashEvent ¶
func (k DistrKeeper) SetValidatorSlashEvent(ctx sdk.Context, val sdk.AccAddress, height, period uint64, event types.ValidatorSlashEvent)
func (*DistrKeeper) SetValidatorsInfo ¶
func (k *DistrKeeper) SetValidatorsInfo(ctx sdk.Context, bytes []byte, height int64)
validatorsInfo
func (DistrKeeper) SetWithdrawAddr ¶
func (k DistrKeeper) SetWithdrawAddr(ctx sdk.Context, delegatorAddr sdk.AccAddress, withdrawAddr sdk.AccAddress) error
SetWithdrawAddr sets a new address that will receive the rewards upon withdrawal
func (DistrKeeper) WithdrawDelegationRewards ¶
func (k DistrKeeper) WithdrawDelegationRewards(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.AccAddress) (sdk.Coin, error)
withdraw rewards from a delegation
func (DistrKeeper) WithdrawValidatorCommission ¶
func (k DistrKeeper) WithdrawValidatorCommission(ctx sdk.Context, valAddr sdk.AccAddress) (sdk.Coin, error)
withdraw validator commission
type Hooks ¶
type Hooks struct {
// contains filtered or unexported fields
}
func (Hooks) AfterDelegationModified ¶
func (h Hooks) AfterDelegationModified(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.AccAddress)
create new delegation period record
func (Hooks) AfterValidatorBeginUnbonding ¶
func (h Hooks) AfterValidatorBeginUnbonding(_ sdk.Context, _ sdk.AccAddress, _ sdk.AccAddress)
func (Hooks) AfterValidatorBonded ¶
func (h Hooks) AfterValidatorBonded(_ sdk.Context, _ sdk.AccAddress, _ sdk.AccAddress)
func (Hooks) AfterValidatorCreated ¶
func (h Hooks) AfterValidatorCreated(ctx sdk.Context, valAddr sdk.AccAddress)
initialize validator distribution record
func (Hooks) AfterValidatorRemoved ¶
func (h Hooks) AfterValidatorRemoved(ctx sdk.Context, _ sdk.AccAddress, valAddr sdk.AccAddress)
cleanup for after validator is removed
func (Hooks) BeforeDelegationCreated ¶
func (h Hooks) BeforeDelegationCreated(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.AccAddress)
increment period
func (Hooks) BeforeDelegationRemoved ¶
func (h Hooks) BeforeDelegationRemoved(_ sdk.Context, _ sdk.AccAddress, _ sdk.AccAddress)
func (Hooks) BeforeDelegationSharesModified ¶
func (h Hooks) BeforeDelegationSharesModified(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.AccAddress)
withdraw delegation rewards (which also increments period)
func (Hooks) BeforeValidatorModified ¶
func (h Hooks) BeforeValidatorModified(_ sdk.Context, _ sdk.AccAddress)
nolint - unused hooks
func (Hooks) BeforeValidatorSlashed ¶
record the slash event