cosmos-sdk: Index | Files

package keeper

import ""


Package Files

alias_functions.go allocation.go delegation.go fee_pool.go genesis.go grpc_query.go hooks.go invariants.go keeper.go msg_server.go params.go proposal_handler.go querier.go store.go validator.go

func AllInvariants Uses

func AllInvariants(k Keeper) sdk.Invariant

AllInvariants runs all invariants of the distribution module

func CanWithdrawInvariant Uses

func CanWithdrawInvariant(k Keeper) sdk.Invariant

CanWithdrawInvariant checks that current rewards can be completely withdrawn

func HandleCommunityPoolSpendProposal Uses

func HandleCommunityPoolSpendProposal(ctx sdk.Context, k Keeper, p *types.CommunityPoolSpendProposal) error

HandleCommunityPoolSpendProposal is a handler for executing a passed community spend proposal

func ModuleAccountInvariant Uses

func ModuleAccountInvariant(k Keeper) sdk.Invariant

ModuleAccountInvariant checks that the coins held by the distr ModuleAccount is consistent with the sum of validator outstanding rewards

func NewMsgServerImpl Uses

func NewMsgServerImpl(keeper Keeper) types.MsgServer

NewMsgServerImpl returns an implementation of the distribution MsgServer interface for the provided Keeper.

func NewQuerier Uses

func NewQuerier(k Keeper, legacyQuerierCdc *codec.LegacyAmino) sdk.Querier

func NonNegativeOutstandingInvariant Uses

func NonNegativeOutstandingInvariant(k Keeper) sdk.Invariant

NonNegativeOutstandingInvariant checks that outstanding unwithdrawn fees are never negative

func ReferenceCountInvariant Uses

func ReferenceCountInvariant(k Keeper) sdk.Invariant

ReferenceCountInvariant checks that the number of historical rewards records is correct

func RegisterInvariants Uses

func RegisterInvariants(ir sdk.InvariantRegistry, k Keeper)

register all distribution invariants

type Hooks Uses

type Hooks struct {
    // contains filtered or unexported fields

Wrapper struct

func (Hooks) AfterDelegationModified Uses

func (h Hooks) AfterDelegationModified(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress)

create new delegation period record

func (Hooks) AfterValidatorBeginUnbonding Uses

func (h Hooks) AfterValidatorBeginUnbonding(_ sdk.Context, _ sdk.ConsAddress, _ sdk.ValAddress)

func (Hooks) AfterValidatorBonded Uses

func (h Hooks) AfterValidatorBonded(_ sdk.Context, _ sdk.ConsAddress, _ sdk.ValAddress)

func (Hooks) AfterValidatorCreated Uses

func (h Hooks) AfterValidatorCreated(ctx sdk.Context, valAddr sdk.ValAddress)

initialize validator distribution record

func (Hooks) AfterValidatorRemoved Uses

func (h Hooks) AfterValidatorRemoved(ctx sdk.Context, _ sdk.ConsAddress, valAddr sdk.ValAddress)

cleanup for after validator is removed

func (Hooks) BeforeDelegationCreated Uses

func (h Hooks) BeforeDelegationCreated(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress)

increment period

func (Hooks) BeforeDelegationRemoved Uses

func (h Hooks) BeforeDelegationRemoved(_ sdk.Context, _ sdk.AccAddress, _ sdk.ValAddress)

func (Hooks) BeforeDelegationSharesModified Uses

func (h Hooks) BeforeDelegationSharesModified(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress)

withdraw delegation rewards (which also increments period)

func (Hooks) BeforeValidatorModified Uses

func (h Hooks) BeforeValidatorModified(_ sdk.Context, _ sdk.ValAddress)

func (Hooks) BeforeValidatorSlashed Uses

func (h Hooks) BeforeValidatorSlashed(ctx sdk.Context, valAddr sdk.ValAddress, fraction sdk.Dec)

record the slash event

type Keeper Uses

type Keeper struct {
    // contains filtered or unexported fields

Keeper of the distribution store

func NewKeeper Uses

func NewKeeper(
    cdc codec.BinaryMarshaler, key sdk.StoreKey, paramSpace paramtypes.Subspace,
    ak types.AccountKeeper, bk types.BankKeeper, sk types.StakingKeeper,
    feeCollectorName string, blockedAddrs map[string]bool,
) Keeper

NewKeeper creates a new distribution Keeper instance

func (Keeper) AllocateTokens Uses

func (k Keeper) AllocateTokens(
    ctx sdk.Context, sumPreviousPrecommitPower, totalPreviousPower int64,
    previousProposer sdk.ConsAddress, previousVotes []abci.VoteInfo,

AllocateTokens handles distribution of the collected fees

func (Keeper) AllocateTokensToValidator Uses

func (k Keeper) AllocateTokensToValidator(ctx sdk.Context, val stakingtypes.ValidatorI, tokens sdk.DecCoins)

AllocateTokensToValidator allocate tokens to a particular validator, splitting according to commission

func (Keeper) CalculateDelegationRewards Uses

func (k Keeper) CalculateDelegationRewards(ctx sdk.Context, val stakingtypes.ValidatorI, del stakingtypes.DelegationI, endingPeriod uint64) (rewards sdk.DecCoins)

calculate the total rewards accrued by a delegation

func (Keeper) CommunityPool Uses

func (k Keeper) CommunityPool(c context.Context, req *types.QueryCommunityPoolRequest) (*types.QueryCommunityPoolResponse, error)

CommunityPool queries the community pool coins

func (Keeper) DelegationRewards Uses

func (k Keeper) DelegationRewards(c context.Context, req *types.QueryDelegationRewardsRequest) (*types.QueryDelegationRewardsResponse, error)

DelegationRewards the total rewards accrued by a delegation

func (Keeper) DelegationTotalRewards Uses

func (k Keeper) DelegationTotalRewards(c context.Context, req *types.QueryDelegationTotalRewardsRequest) (*types.QueryDelegationTotalRewardsResponse, error)

DelegationTotalRewards the total rewards accrued by a each validator

func (Keeper) DelegatorValidators Uses

func (k Keeper) DelegatorValidators(c context.Context, req *types.QueryDelegatorValidatorsRequest) (*types.QueryDelegatorValidatorsResponse, error)

DelegatorValidators queries the validators list of a delegator

func (Keeper) DelegatorWithdrawAddress Uses

func (k Keeper) DelegatorWithdrawAddress(c context.Context, req *types.QueryDelegatorWithdrawAddressRequest) (*types.QueryDelegatorWithdrawAddressResponse, error)

DelegatorWithdrawAddress queries Query/delegatorWithdrawAddress

func (Keeper) DeleteAllValidatorHistoricalRewards Uses

func (k Keeper) DeleteAllValidatorHistoricalRewards(ctx sdk.Context)

delete all historical rewards

func (Keeper) DeleteAllValidatorSlashEvents Uses

func (k Keeper) DeleteAllValidatorSlashEvents(ctx sdk.Context)

delete all slash events

func (Keeper) DeleteDelegatorStartingInfo Uses

func (k Keeper) DeleteDelegatorStartingInfo(ctx sdk.Context, val sdk.ValAddress, del sdk.AccAddress)

delete the starting info associated with a delegator

func (Keeper) DeleteDelegatorWithdrawAddr Uses

func (k Keeper) DeleteDelegatorWithdrawAddr(ctx sdk.Context, delAddr, withdrawAddr sdk.AccAddress)

delete a delegator withdraw addr

func (Keeper) DeleteValidatorAccumulatedCommission Uses

func (k Keeper) DeleteValidatorAccumulatedCommission(ctx sdk.Context, val sdk.ValAddress)

delete accumulated commission for a validator

func (Keeper) DeleteValidatorCurrentRewards Uses

func (k Keeper) DeleteValidatorCurrentRewards(ctx sdk.Context, val sdk.ValAddress)

delete current rewards for a validator

func (Keeper) DeleteValidatorHistoricalReward Uses

func (k Keeper) DeleteValidatorHistoricalReward(ctx sdk.Context, val sdk.ValAddress, period uint64)

delete a historical reward

func (Keeper) DeleteValidatorHistoricalRewards Uses

func (k Keeper) DeleteValidatorHistoricalRewards(ctx sdk.Context, val sdk.ValAddress)

delete historical rewards for a validator

func (Keeper) DeleteValidatorOutstandingRewards Uses

func (k Keeper) DeleteValidatorOutstandingRewards(ctx sdk.Context, val sdk.ValAddress)

delete validator outstanding rewards

func (Keeper) DeleteValidatorSlashEvents Uses

func (k Keeper) DeleteValidatorSlashEvents(ctx sdk.Context, val sdk.ValAddress)

delete slash events for a particular validator

func (Keeper) DistributeFromFeePool Uses

func (k Keeper) DistributeFromFeePool(ctx sdk.Context, amount sdk.Coins, receiveAddr sdk.AccAddress) error

DistributeFromFeePool distributes funds from the distribution module account to a receiver address while updating the community pool

func (Keeper) ExportGenesis Uses

func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState

ExportGenesis returns a GenesisState for a given context and keeper.

func (Keeper) FundCommunityPool Uses

func (k Keeper) FundCommunityPool(ctx sdk.Context, amount sdk.Coins, 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 (Keeper) GetBaseProposerReward Uses

func (k Keeper) GetBaseProposerReward(ctx sdk.Context) (percent sdk.Dec)

GetBaseProposerReward returns the current distribution base proposer rate.

func (Keeper) GetBonusProposerReward Uses

func (k Keeper) GetBonusProposerReward(ctx sdk.Context) (percent sdk.Dec)

GetBonusProposerReward returns the current distribution bonus proposer reward rate.

func (Keeper) GetCommunityTax Uses

func (k Keeper) GetCommunityTax(ctx sdk.Context) (percent sdk.Dec)

GetCommunityTax returns the current distribution community tax.

func (Keeper) GetDelegatorStartingInfo Uses

func (k Keeper) GetDelegatorStartingInfo(ctx sdk.Context, val sdk.ValAddress, del sdk.AccAddress) (period types.DelegatorStartingInfo)

get the starting info associated with a delegator

func (Keeper) GetDelegatorWithdrawAddr Uses

func (k Keeper) GetDelegatorWithdrawAddr(ctx sdk.Context, delAddr sdk.AccAddress) sdk.AccAddress

get the delegator withdraw address, defaulting to the delegator address

func (Keeper) GetDistributionAccount Uses

func (k Keeper) GetDistributionAccount(ctx sdk.Context) authtypes.ModuleAccountI

GetDistributionAccount returns the distribution ModuleAccount

func (Keeper) GetFeePool Uses

func (k Keeper) GetFeePool(ctx sdk.Context) (feePool types.FeePool)

get the global fee pool distribution info

func (Keeper) GetFeePoolCommunityCoins Uses

func (k Keeper) GetFeePoolCommunityCoins(ctx sdk.Context) sdk.DecCoins

get the community coins

func (Keeper) GetParams Uses

func (k Keeper) GetParams(clientCtx sdk.Context) (params types.Params)

GetParams returns the total set of distribution parameters.

func (Keeper) GetPreviousProposerConsAddr Uses

func (k Keeper) GetPreviousProposerConsAddr(ctx sdk.Context) sdk.ConsAddress

GetPreviousProposerConsAddr returns the proposer consensus address for the current block.

func (Keeper) GetTotalRewards Uses

func (k Keeper) GetTotalRewards(ctx sdk.Context) (totalRewards sdk.DecCoins)

GetTotalRewards returns the total amount of fee distribution rewards held in the store

func (Keeper) GetValidatorAccumulatedCommission Uses

func (k Keeper) GetValidatorAccumulatedCommission(ctx sdk.Context, val sdk.ValAddress) (commission types.ValidatorAccumulatedCommission)

get accumulated commission for a validator

func (Keeper) GetValidatorCurrentRewards Uses

func (k Keeper) GetValidatorCurrentRewards(ctx sdk.Context, val sdk.ValAddress) (rewards types.ValidatorCurrentRewards)

get current rewards for a validator

func (Keeper) GetValidatorHistoricalReferenceCount Uses

func (k Keeper) GetValidatorHistoricalReferenceCount(ctx sdk.Context) (count uint64)

historical reference count (used for testcases)

func (Keeper) GetValidatorHistoricalRewards Uses

func (k Keeper) GetValidatorHistoricalRewards(ctx sdk.Context, val sdk.ValAddress, period uint64) (rewards types.ValidatorHistoricalRewards)

get historical rewards for a particular period

func (Keeper) GetValidatorOutstandingRewards Uses

func (k Keeper) GetValidatorOutstandingRewards(ctx sdk.Context, val sdk.ValAddress) (rewards types.ValidatorOutstandingRewards)

get validator outstanding rewards

func (Keeper) GetValidatorOutstandingRewardsCoins Uses

func (k Keeper) GetValidatorOutstandingRewardsCoins(ctx sdk.Context, val sdk.ValAddress) sdk.DecCoins

get outstanding rewards

func (Keeper) GetValidatorSlashEvent Uses

func (k Keeper) GetValidatorSlashEvent(ctx sdk.Context, val sdk.ValAddress, height, period uint64) (event types.ValidatorSlashEvent, found bool)

get slash event for height

func (Keeper) GetWithdrawAddrEnabled Uses

func (k Keeper) GetWithdrawAddrEnabled(ctx sdk.Context) (enabled bool)

GetWithdrawAddrEnabled returns the current distribution withdraw address enabled parameter.

func (Keeper) HasDelegatorStartingInfo Uses

func (k Keeper) HasDelegatorStartingInfo(ctx sdk.Context, val sdk.ValAddress, del sdk.AccAddress) bool

check existence of the starting info associated with a delegator

func (Keeper) Hooks Uses

func (k Keeper) Hooks() Hooks

Create new distribution hooks

func (Keeper) IncrementValidatorPeriod Uses

func (k Keeper) IncrementValidatorPeriod(ctx sdk.Context, val stakingtypes.ValidatorI) uint64

increment validator period, returning the period just ended

func (Keeper) InitGenesis Uses

func (k Keeper) InitGenesis(ctx sdk.Context, data types.GenesisState)

InitGenesis sets distribution information for genesis

func (Keeper) IterateDelegatorStartingInfos Uses

func (k Keeper) IterateDelegatorStartingInfos(ctx sdk.Context, handler func(val sdk.ValAddress, del sdk.AccAddress, info types.DelegatorStartingInfo) (stop bool))

iterate over delegator starting infos

func (Keeper) IterateDelegatorWithdrawAddrs Uses

func (k Keeper) IterateDelegatorWithdrawAddrs(ctx sdk.Context, handler func(del sdk.AccAddress, addr sdk.AccAddress) (stop bool))

iterate over delegator withdraw addrs

func (Keeper) IterateValidatorAccumulatedCommissions Uses

func (k Keeper) IterateValidatorAccumulatedCommissions(ctx sdk.Context, handler func(val sdk.ValAddress, commission types.ValidatorAccumulatedCommission) (stop bool))

iterate over accumulated commissions

func (Keeper) IterateValidatorCurrentRewards Uses

func (k Keeper) IterateValidatorCurrentRewards(ctx sdk.Context, handler func(val sdk.ValAddress, rewards types.ValidatorCurrentRewards) (stop bool))

iterate over current rewards

func (Keeper) IterateValidatorHistoricalRewards Uses

func (k Keeper) IterateValidatorHistoricalRewards(ctx sdk.Context, handler func(val sdk.ValAddress, period uint64, rewards types.ValidatorHistoricalRewards) (stop bool))

iterate over historical rewards

func (Keeper) IterateValidatorOutstandingRewards Uses

func (k Keeper) IterateValidatorOutstandingRewards(ctx sdk.Context, handler func(val sdk.ValAddress, rewards types.ValidatorOutstandingRewards) (stop bool))

iterate validator outstanding rewards

func (Keeper) IterateValidatorSlashEvents Uses

func (k Keeper) IterateValidatorSlashEvents(ctx sdk.Context, handler func(val sdk.ValAddress, height uint64, event types.ValidatorSlashEvent) (stop bool))

iterate over all slash events

func (Keeper) IterateValidatorSlashEventsBetween Uses

func (k Keeper) IterateValidatorSlashEventsBetween(ctx sdk.Context, val sdk.ValAddress, startingHeight uint64, endingHeight uint64,
    handler func(height uint64, event types.ValidatorSlashEvent) (stop bool))

iterate over slash events between heights, inclusive

func (Keeper) Logger Uses

func (k Keeper) Logger(ctx sdk.Context) log.Logger

Logger returns a module-specific logger.

func (Keeper) Params Uses

func (k Keeper) Params(c context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error)

Params queries params of distribution module

func (Keeper) SetDelegatorStartingInfo Uses

func (k Keeper) SetDelegatorStartingInfo(ctx sdk.Context, val sdk.ValAddress, del sdk.AccAddress, period types.DelegatorStartingInfo)

set the starting info associated with a delegator

func (Keeper) SetDelegatorWithdrawAddr Uses

func (k Keeper) SetDelegatorWithdrawAddr(ctx sdk.Context, delAddr, withdrawAddr sdk.AccAddress)

set the delegator withdraw address

func (Keeper) SetFeePool Uses

func (k Keeper) SetFeePool(ctx sdk.Context, feePool types.FeePool)

set the global fee pool distribution info

func (Keeper) SetParams Uses

func (k Keeper) SetParams(ctx sdk.Context, params types.Params)

SetParams sets the distribution parameters to the param space.

func (Keeper) SetPreviousProposerConsAddr Uses

func (k Keeper) SetPreviousProposerConsAddr(ctx sdk.Context, consAddr sdk.ConsAddress)

set the proposer public key for this block

func (Keeper) SetValidatorAccumulatedCommission Uses

func (k Keeper) SetValidatorAccumulatedCommission(ctx sdk.Context, val sdk.ValAddress, commission types.ValidatorAccumulatedCommission)

set accumulated commission for a validator

func (Keeper) SetValidatorCurrentRewards Uses

func (k Keeper) SetValidatorCurrentRewards(ctx sdk.Context, val sdk.ValAddress, rewards types.ValidatorCurrentRewards)

set current rewards for a validator

func (Keeper) SetValidatorHistoricalRewards Uses

func (k Keeper) SetValidatorHistoricalRewards(ctx sdk.Context, val sdk.ValAddress, period uint64, rewards types.ValidatorHistoricalRewards)

set historical rewards for a particular period

func (Keeper) SetValidatorOutstandingRewards Uses

func (k Keeper) SetValidatorOutstandingRewards(ctx sdk.Context, val sdk.ValAddress, rewards types.ValidatorOutstandingRewards)

set validator outstanding rewards

func (Keeper) SetValidatorSlashEvent Uses

func (k Keeper) SetValidatorSlashEvent(ctx sdk.Context, val sdk.ValAddress, height, period uint64, event types.ValidatorSlashEvent)

set slash event for height

func (Keeper) SetWithdrawAddr Uses

func (k Keeper) SetWithdrawAddr(ctx sdk.Context, delegatorAddr sdk.AccAddress, withdrawAddr sdk.AccAddress) error

SetWithdrawAddr sets a new address that will receive the rewards upon withdrawal

func (Keeper) ValidatorCommission Uses

func (k Keeper) ValidatorCommission(c context.Context, req *types.QueryValidatorCommissionRequest) (*types.QueryValidatorCommissionResponse, error)

ValidatorCommission queries accumulated commission for a validator

func (Keeper) ValidatorOutstandingRewards Uses

func (k Keeper) ValidatorOutstandingRewards(c context.Context, req *types.QueryValidatorOutstandingRewardsRequest) (*types.QueryValidatorOutstandingRewardsResponse, error)

ValidatorOutstandingRewards queries rewards of a validator address

func (Keeper) ValidatorSlashes Uses

func (k Keeper) ValidatorSlashes(c context.Context, req *types.QueryValidatorSlashesRequest) (*types.QueryValidatorSlashesResponse, error)

ValidatorSlashes queries slash events of a validator

func (Keeper) WithdrawDelegationRewards Uses

func (k Keeper) WithdrawDelegationRewards(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) (sdk.Coins, error)

withdraw rewards from a delegation

func (Keeper) WithdrawValidatorCommission Uses

func (k Keeper) WithdrawValidatorCommission(ctx sdk.Context, valAddr sdk.ValAddress) (sdk.Coins, error)

withdraw validator commission

Package keeper imports 19 packages (graph) and is imported by 16 packages. Updated 2020-12-01. Refresh now. Tools for package owners.