Documentation
¶
Index ¶
- func AllInvariants(k Keeper) sdk.Invariant
- func CanWithdrawInvariant(k Keeper) sdk.Invariant
- func HandleCommunityPoolSpendProposal(ctx sdk.Context, k Keeper, p types.CommunityPoolSpendProposal) error
- func ModuleAccountInvariant(k Keeper) sdk.Invariant
- func NewQuerier(k Keeper) sdk.Querier
- func NonNegativeOutstandingInvariant(k Keeper) sdk.Invariant
- func ReferenceCountInvariant(k Keeper) sdk.Invariant
- func RegisterInvariants(ir sdk.InvariantRegistry, k Keeper)
- type AccountID
- type Hooks
- func (h Hooks) AfterDelegationModified(ctx sdk.Context, delId chainType.AccountID, valId chainType.AccountID)
- func (h Hooks) AfterValidatorBeginUnbonding(_ sdk.Context, _ sdk.ConsAddress, _ chainType.AccountID)
- func (h Hooks) AfterValidatorBonded(_ sdk.Context, _ sdk.ConsAddress, _ chainType.AccountID)
- func (h Hooks) AfterValidatorCreated(ctx sdk.Context, valId chainType.AccountID)
- func (h Hooks) AfterValidatorRemoved(ctx sdk.Context, _ sdk.ConsAddress, valId chainType.AccountID)
- func (h Hooks) BeforeDelegationCreated(ctx sdk.Context, _ chainType.AccountID, valId chainType.AccountID)
- func (h Hooks) BeforeDelegationRemoved(_ sdk.Context, _ chainType.AccountID, _ chainType.AccountID)
- func (h Hooks) BeforeDelegationSharesModified(ctx sdk.Context, delAddr chainType.AccountID, valAId chainType.AccountID)
- func (h Hooks) BeforeValidatorModified(_ sdk.Context, _ chainType.AccountID)
- func (h Hooks) BeforeValidatorSlashed(ctx sdk.Context, valId chainType.AccountID, fraction sdk.Dec)
- type Keeper
- func (k Keeper) AllocateTokens(ctx sdk.Context, sumPreviousPrecommitPower, totalPreviousPower int64, ...)
- func (k Keeper) AllocateTokensToValidator(ctx sdk.Context, val types.StakingExportedValidatorI, tokens sdk.DecCoins)
- func (k Keeper) CalculateDelegationRewards(ctx sdk.Context, val types.ValidatorI, del types.DelegationI, ...) (rewards sdk.DecCoins)
- func (k Keeper) CanDistribution(ctx sdk.Context) (bool, time.Time)
- func (k Keeper) DeleteAllValidatorHistoricalRewards(ctx sdk.Context)
- func (k Keeper) DeleteAllValidatorSlashEvents(ctx sdk.Context)
- func (k Keeper) DeleteDelegatorStartingInfo(ctx sdk.Context, val AccountID, del AccountID)
- func (k Keeper) DeleteDelegatorWithdrawAddr(ctx sdk.Context, delId, withdrawId AccountID)
- func (k Keeper) DeleteValidatorAccumulatedCommission(ctx sdk.Context, val AccountID)
- func (k Keeper) DeleteValidatorCurrentRewards(ctx sdk.Context, val AccountID)
- func (k Keeper) DeleteValidatorHistoricalReward(ctx sdk.Context, val AccountID, period uint64)
- func (k Keeper) DeleteValidatorHistoricalRewards(ctx sdk.Context, val AccountID)
- func (k Keeper) DeleteValidatorOutstandingRewards(ctx sdk.Context, val AccountID)
- func (k Keeper) DeleteValidatorSlashEvents(ctx sdk.Context, val AccountID)
- func (k Keeper) DistributeFromFeePool(ctx sdk.Context, amount sdk.Coins, receiveId chainType.AccountID) error
- func (k Keeper) FundCommunityPool(ctx sdk.Context, amount sdk.Coins, sender chainType.AccountID) error
- func (k Keeper) GetBaseProposerReward(ctx sdk.Context) (percent sdk.Dec)
- func (k Keeper) GetBonusProposerReward(ctx sdk.Context) (percent sdk.Dec)
- func (k Keeper) GetCommunityTax(ctx sdk.Context) (percent sdk.Dec)
- func (k Keeper) GetDelegatorStartingInfo(ctx sdk.Context, val AccountID, del AccountID) (period types.DelegatorStartingInfo)
- func (k Keeper) GetDelegatorWithdrawAddr(ctx sdk.Context, delAddr AccountID) AccountID
- func (k Keeper) GetDistributionAccount(ctx sdk.Context) supplyexported.ModuleAccountI
- func (k Keeper) GetFeePool(ctx sdk.Context) (feePool types.FeePool)
- func (k Keeper) GetFeePoolCommunityCoins(ctx sdk.Context) sdk.DecCoins
- func (k Keeper) GetParams(ctx sdk.Context) (params types.Params)
- func (k Keeper) GetPreviousProposerConsAddr(ctx sdk.Context) sdk.ConsAddress
- func (k Keeper) GetStartNotDistributionTimePoint(ctx sdk.Context)
- func (k Keeper) GetTotalRewards(ctx sdk.Context) (totalRewards sdk.DecCoins)
- func (k Keeper) GetValidatorAccumulatedCommission(ctx sdk.Context, val AccountID) (commission types.ValidatorAccumulatedCommission)
- func (k Keeper) GetValidatorCurrentRewards(ctx sdk.Context, val AccountID) (rewards types.ValidatorCurrentRewards)
- func (k Keeper) GetValidatorHistoricalReferenceCount(ctx sdk.Context) (count uint64)
- func (k Keeper) GetValidatorHistoricalRewards(ctx sdk.Context, val AccountID, period uint64) (rewards types.ValidatorHistoricalRewards)
- func (k Keeper) GetValidatorOutstandingRewards(ctx sdk.Context, val AccountID) (rewards types.ValidatorOutstandingRewards)
- func (k Keeper) GetValidatorOutstandingRewardsCoins(ctx sdk.Context, val AccountID) sdk.DecCoins
- func (k Keeper) GetValidatorSlashEvent(ctx sdk.Context, val AccountID, height, period uint64) (event types.ValidatorSlashEvent, found bool)
- func (k Keeper) GetWithdrawAddrEnabled(ctx sdk.Context) (enabled bool)
- func (k Keeper) HasDelegatorStartingInfo(ctx sdk.Context, val AccountID, del AccountID) bool
- func (k Keeper) Hooks() Hooks
- func (k Keeper) IncrementValidatorPeriod(ctx sdk.Context, val types.StakingExportedValidatorI) uint64
- func (k Keeper) IterateDelegatorStartingInfos(ctx sdk.Context, ...)
- func (k Keeper) IterateDelegatorWithdrawAddId(ctx sdk.Context, handler func(del AccountID, addr AccountID) (stop bool))
- func (k Keeper) IterateValidatorAccumulatedCommissions(ctx sdk.Context, ...)
- func (k Keeper) IterateValidatorCurrentRewards(ctx sdk.Context, ...)
- func (k Keeper) IterateValidatorHistoricalRewards(ctx sdk.Context, ...)
- func (k Keeper) IterateValidatorOutstandingRewards(ctx sdk.Context, ...)
- func (k Keeper) IterateValidatorSlashEvents(ctx sdk.Context, ...)
- func (k Keeper) IterateValidatorSlashEventsBetween(ctx sdk.Context, val AccountID, startingHeight uint64, endingHeight uint64, ...)
- func (k Keeper) Logger(ctx sdk.Context) log.Logger
- func (k Keeper) SetDelegatorStartingInfo(ctx sdk.Context, val AccountID, del AccountID, ...)
- func (k Keeper) SetDelegatorWithdrawAddr(ctx sdk.Context, delAddr, withdrawAddr AccountID)
- func (k Keeper) SetFeePool(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) SetStartNotDistributionTimePoint(ctx sdk.Context, t time.Time)
- func (k Keeper) SetValidatorAccumulatedCommission(ctx sdk.Context, val AccountID, ...)
- func (k Keeper) SetValidatorCurrentRewards(ctx sdk.Context, val AccountID, rewards types.ValidatorCurrentRewards)
- func (k Keeper) SetValidatorHistoricalRewards(ctx sdk.Context, val AccountID, period uint64, ...)
- func (k Keeper) SetValidatorOutstandingRewards(ctx sdk.Context, val AccountID, rewards types.ValidatorOutstandingRewards)
- func (k Keeper) SetValidatorSlashEvent(ctx sdk.Context, val AccountID, height, period uint64, ...)
- func (k Keeper) SetWithdrawAddr(ctx sdk.Context, delegatorId chainType.AccountID, ...) error
- func (k Keeper) WithdrawDelegationRewards(ctx sdk.Context, delAddr chainType.AccountID, valAddr chainType.AccountID) (sdk.Coins, error)
- func (k Keeper) WithdrawValidatorCommission(ctx sdk.Context, valAddr chainType.AccountID) (sdk.Coins, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AllInvariants ¶
AllInvariants runs all invariants of the distribution module
func CanWithdrawInvariant ¶
CanWithdrawInvariant checks that current rewards can be completely withdrawn
func HandleCommunityPoolSpendProposal ¶
func HandleCommunityPoolSpendProposal(ctx sdk.Context, k Keeper, p types.CommunityPoolSpendProposal) error
HandleCommunityPoolSpendProposal is a handler for executing a passed community spend proposal
func ModuleAccountInvariant ¶
ModuleAccountInvariant checks that the coins held by the distr ModuleAccount is consistent with the sum of validator outstanding rewards
func NewQuerier ¶
func NonNegativeOutstandingInvariant ¶
NonNegativeOutstandingInvariant checks that outstanding unWithdrawn fees are never negative
func ReferenceCountInvariant ¶
ReferenceCountInvariant checks that the number of historical rewards records is correct
func RegisterInvariants ¶
func RegisterInvariants(ir sdk.InvariantRegistry, k Keeper)
register all distribution invariants
Types ¶
type Hooks ¶
type Hooks struct {
// contains filtered or unexported fields
}
Wrapper struct
func (Hooks) AfterDelegationModified ¶
func (h Hooks) AfterDelegationModified(ctx sdk.Context, delId chainType.AccountID, valId chainType.AccountID)
create new delegation period record
func (Hooks) AfterValidatorBeginUnbonding ¶
func (Hooks) AfterValidatorBonded ¶
func (Hooks) AfterValidatorCreated ¶
initialize validator distribution record
func (Hooks) AfterValidatorRemoved ¶
cleanup for after validator is removed
func (Hooks) BeforeDelegationCreated ¶
func (h Hooks) BeforeDelegationCreated(ctx sdk.Context, _ chainType.AccountID, valId chainType.AccountID)
increment period
func (Hooks) BeforeDelegationRemoved ¶
func (Hooks) BeforeDelegationSharesModified ¶
func (h Hooks) BeforeDelegationSharesModified(ctx sdk.Context, delAddr chainType.AccountID, valAId chainType.AccountID)
withdraw delegation rewards (which also increments period)
func (Hooks) BeforeValidatorModified ¶
nolint - unused hooks
type Keeper ¶
type Keeper struct { BankKeeper types.BankKeeperAccountID AccKeeper account.Keeper // contains filtered or unexported fields }
Keeper of the distribution store
func NewKeeper ¶
func NewKeeper( cdc codec.Marshaler, key sdk.StoreKey, paramSpace params.Subspace, bk types.BankKeeperAccountID, sk types.StakingKeeperAccountID, supplyKeeper types.SupplyKeeperAccountID, accKeeper account.Keeper, feeCollectorName string, blacklistedAddrs map[string]bool, ) Keeper
NewKeeper creates a new distribution Keeper instance
func (Keeper) AllocateTokens ¶
func (k Keeper) AllocateTokens( ctx sdk.Context, sumPreviousPrecommitPower, totalPreviousPower int64, previousProposer sdk.ConsAddress, previousVotes []abci.VoteInfo, )
AllocateTokens handles distribution of the collected fees by cancer
func (Keeper) AllocateTokensToValidator ¶
func (k Keeper) AllocateTokensToValidator(ctx sdk.Context, val types.StakingExportedValidatorI, tokens sdk.DecCoins)
AllocateTokensToValidator allocate tokens to a particular validator, splitting according to commission
func (Keeper) CalculateDelegationRewards ¶
func (k Keeper) CalculateDelegationRewards(ctx sdk.Context, val types.ValidatorI, del types.DelegationI, endingPeriod uint64) (rewards sdk.DecCoins)
calculate the total rewards accrued by a delegation
func (Keeper) DeleteAllValidatorHistoricalRewards ¶
delete all historical rewards
func (Keeper) DeleteAllValidatorSlashEvents ¶
delete all slash events
func (Keeper) DeleteDelegatorStartingInfo ¶
delete the starting info associated with a delegator
func (Keeper) DeleteDelegatorWithdrawAddr ¶
delete a delegator withdraw addr
func (Keeper) DeleteValidatorAccumulatedCommission ¶
delete accumulated commission for a validator
func (Keeper) DeleteValidatorCurrentRewards ¶
delete current rewards for a validator
func (Keeper) DeleteValidatorHistoricalReward ¶
delete a historical reward
func (Keeper) DeleteValidatorHistoricalRewards ¶
delete historical rewards for a validator
func (Keeper) DeleteValidatorOutstandingRewards ¶
delete validator outstanding rewards
func (Keeper) DeleteValidatorSlashEvents ¶
delete slash events for a particular validator
func (Keeper) DistributeFromFeePool ¶
func (k Keeper) DistributeFromFeePool(ctx sdk.Context, amount sdk.Coins, receiveId chainType.AccountID) error
DistributeFromFeePool distributes funds from the distribution module account to a receiver address while updating the community pool
func (Keeper) FundCommunityPool ¶
func (k Keeper) FundCommunityPool(ctx sdk.Context, amount sdk.Coins, sender chainType.AccountID) 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 (Keeper) GetBaseProposerReward ¶
GetBaseProposerReward returns the current distribution base proposer rate.
func (Keeper) GetBonusProposerReward ¶
GetBonusProposerReward returns the current distribution bonus proposer reward rate.
func (Keeper) GetCommunityTax ¶
GetCommunityTax returns the current distribution community tax.
func (Keeper) GetDelegatorStartingInfo ¶
func (k Keeper) GetDelegatorStartingInfo(ctx sdk.Context, val AccountID, del AccountID) (period types.DelegatorStartingInfo)
get the starting info associated with a delegator
func (Keeper) GetDelegatorWithdrawAddr ¶
get the delegator withdraw address, defaulting to the delegator address
func (Keeper) GetDistributionAccount ¶
func (k Keeper) GetDistributionAccount(ctx sdk.Context) supplyexported.ModuleAccountI
GetDistributionAccount returns the distribution ModuleAccount
func (Keeper) GetFeePool ¶
get the global fee pool distribution info
func (Keeper) GetFeePoolCommunityCoins ¶
get the community coins
func (Keeper) GetPreviousProposerConsAddr ¶
func (k Keeper) GetPreviousProposerConsAddr(ctx sdk.Context) sdk.ConsAddress
GetPreviousProposerConsAddr returns the proposer consensus address for the current block. by cancer
func (Keeper) GetStartNotDistributionTimePoint ¶
func (Keeper) GetTotalRewards ¶
GetTotalRewards returns the total amount of fee distribution rewards held in the store
func (Keeper) GetValidatorAccumulatedCommission ¶
func (k Keeper) GetValidatorAccumulatedCommission(ctx sdk.Context, val AccountID) (commission types.ValidatorAccumulatedCommission)
get accumulated commission for a validator
func (Keeper) GetValidatorCurrentRewards ¶
func (k Keeper) GetValidatorCurrentRewards(ctx sdk.Context, val AccountID) (rewards types.ValidatorCurrentRewards)
get current rewards for a validator
func (Keeper) GetValidatorHistoricalReferenceCount ¶
historical reference count (used for testcases)
func (Keeper) GetValidatorHistoricalRewards ¶
func (k Keeper) GetValidatorHistoricalRewards(ctx sdk.Context, val AccountID, period uint64) (rewards types.ValidatorHistoricalRewards)
get historical rewards for a particular period
func (Keeper) GetValidatorOutstandingRewards ¶
func (k Keeper) GetValidatorOutstandingRewards(ctx sdk.Context, val AccountID) (rewards types.ValidatorOutstandingRewards)
get validator outstanding rewards
func (Keeper) GetValidatorOutstandingRewardsCoins ¶
get outstanding rewards , old by cancer
func (Keeper) GetValidatorSlashEvent ¶
func (k Keeper) GetValidatorSlashEvent(ctx sdk.Context, val AccountID, height, period uint64) (event types.ValidatorSlashEvent, found bool)
get slash event for height
func (Keeper) GetWithdrawAddrEnabled ¶
GetWithdrawAddrEnabled returns the current distribution withdraw address enabled parameter.
func (Keeper) HasDelegatorStartingInfo ¶
check existence of the starting info associated with a delegator
func (Keeper) IncrementValidatorPeriod ¶
func (k Keeper) IncrementValidatorPeriod(ctx sdk.Context, val types.StakingExportedValidatorI) uint64
IncrementValidatorPeriod increment validator period, returning the period just ended
func (Keeper) IterateDelegatorStartingInfos ¶
func (k Keeper) IterateDelegatorStartingInfos(ctx sdk.Context, handler func(val AccountID, del AccountID, info types.DelegatorStartingInfo) (stop bool))
iterate over delegator starting infos
func (Keeper) IterateDelegatorWithdrawAddId ¶
func (k Keeper) IterateDelegatorWithdrawAddId(ctx sdk.Context, handler func(del AccountID, addr AccountID) (stop bool))
iterate over delegator withdraw addrs
func (Keeper) IterateValidatorAccumulatedCommissions ¶
func (k Keeper) IterateValidatorAccumulatedCommissions(ctx sdk.Context, handler func(val AccountID, commission types.ValidatorAccumulatedCommission) (stop bool))
iterate over accumulated commissions
func (Keeper) IterateValidatorCurrentRewards ¶
func (k Keeper) IterateValidatorCurrentRewards(ctx sdk.Context, handler func(val AccountID, rewards types.ValidatorCurrentRewards) (stop bool))
iterate over current rewards
func (Keeper) IterateValidatorHistoricalRewards ¶
func (k Keeper) IterateValidatorHistoricalRewards(ctx sdk.Context, handler func(val AccountID, period uint64, rewards types.ValidatorHistoricalRewards) (stop bool))
iterate over historical rewards
func (Keeper) IterateValidatorOutstandingRewards ¶
func (k Keeper) IterateValidatorOutstandingRewards(ctx sdk.Context, handler func(val AccountID, rewards types.ValidatorOutstandingRewards) (stop bool))
iterate validator outstanding rewards
func (Keeper) IterateValidatorSlashEvents ¶
func (k Keeper) IterateValidatorSlashEvents(ctx sdk.Context, handler func(val AccountID, height uint64, event types.ValidatorSlashEvent) (stop bool))
iterate over all slash events
func (Keeper) IterateValidatorSlashEventsBetween ¶
func (k Keeper) IterateValidatorSlashEventsBetween(ctx sdk.Context, val AccountID, startingHeight uint64, endingHeight uint64, handler func(height uint64, event types.ValidatorSlashEvent) (stop bool))
iterate over slash events between heights, inclusive
func (Keeper) SetDelegatorStartingInfo ¶
func (k Keeper) SetDelegatorStartingInfo(ctx sdk.Context, val AccountID, del AccountID, period types.DelegatorStartingInfo)
set the starting info associated with a delegator
func (Keeper) SetDelegatorWithdrawAddr ¶
set the delegator withdraw address
func (Keeper) SetFeePool ¶
set the global fee pool distribution info
func (Keeper) SetPreviousProposerConsAddr ¶
func (k Keeper) SetPreviousProposerConsAddr(ctx sdk.Context, consAddr sdk.ConsAddress)
set the proposer public key for this block
func (Keeper) SetStartNotDistributionTimePoint ¶
func (Keeper) SetValidatorAccumulatedCommission ¶
func (k Keeper) SetValidatorAccumulatedCommission(ctx sdk.Context, val AccountID, commission types.ValidatorAccumulatedCommission)
set accumulated commission for a validator
func (Keeper) SetValidatorCurrentRewards ¶
func (k Keeper) SetValidatorCurrentRewards(ctx sdk.Context, val AccountID, rewards types.ValidatorCurrentRewards)
set current rewards for a validator
func (Keeper) SetValidatorHistoricalRewards ¶
func (k Keeper) SetValidatorHistoricalRewards(ctx sdk.Context, val AccountID, period uint64, rewards types.ValidatorHistoricalRewards)
set historical rewards for a particular period
func (Keeper) SetValidatorOutstandingRewards ¶
func (k Keeper) SetValidatorOutstandingRewards(ctx sdk.Context, val AccountID, rewards types.ValidatorOutstandingRewards)
set validator outstanding rewards
func (Keeper) SetValidatorSlashEvent ¶
func (k Keeper) SetValidatorSlashEvent(ctx sdk.Context, val AccountID, height, period uint64, event types.ValidatorSlashEvent)
set slash event for height
func (Keeper) SetWithdrawAddr ¶
func (k Keeper) SetWithdrawAddr(ctx sdk.Context, delegatorId chainType.AccountID, withdrawId chainType.AccountID) error
SetWithdrawAddr sets a new address that will receive the rewards upon withdrawal