keeper

package
v0.55.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 28, 2026 License: Apache-2.0 Imports: 24 Imported by: 2,213

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewMsgServerImpl added in v0.40.0

func NewMsgServerImpl(keeper Keeper) types.MsgServer

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

Types

type Hooks

type Hooks struct {
	// contains filtered or unexported fields
}

func (Hooks) AfterDelegationModified

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

AfterDelegationModified creates a new delegation period record

func (Hooks) AfterUnbondingInitiated added in v0.47.0

func (h Hooks) AfterUnbondingInitiated(_ context.Context, _ uint64) error

func (Hooks) AfterValidatorBeginUnbonding

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

func (Hooks) AfterValidatorBonded

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

func (Hooks) AfterValidatorConsKeyUpdated added in v0.55.0

func (h Hooks) AfterValidatorConsKeyUpdated(_ context.Context, _, _ sdk.ConsAddress, _ sdk.ValAddress) error

AfterValidatorConsKeyUpdated is a no-op for distribution.

func (Hooks) AfterValidatorCreated

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

AfterValidatorCreated initializes validator distribution record

func (Hooks) AfterValidatorRemoved

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

AfterValidatorRemoved performs clean up after a validator is removed

func (Hooks) BeforeDelegationCreated

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

BeforeDelegationCreated increments period

func (Hooks) BeforeDelegationRemoved

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

func (Hooks) BeforeDelegationSharesModified

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

BeforeDelegationSharesModified withdraws delegation rewards (which also increments period)

func (Hooks) BeforeValidatorModified

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

func (Hooks) BeforeValidatorSlashed

func (h Hooks) BeforeValidatorSlashed(ctx context.Context, valAddr sdk.ValAddress, fraction sdkmath.LegacyDec) error

BeforeValidatorSlashed records the slash event

type Keeper

type Keeper struct {
	Schema  collections.Schema
	Params  collections.Item[types.Params]
	FeePool collections.Item[types.FeePool]
	// contains filtered or unexported fields
}

Keeper of the distribution store

func NewKeeper

func NewKeeper(
	cdc codec.BinaryCodec,
	storeService store.KVStoreService,
	ak types.AccountKeeper,
	bk types.BankKeeper,
	sk types.StakingKeeper,
	feeCollectorName, authority string,
) Keeper

NewKeeper creates a new distribution Keeper instance

func (Keeper) AllocateTokens

func (k Keeper) AllocateTokens(ctx context.Context, totalPreviousPower int64, bondedVotes []abci.VoteInfo) error

AllocateTokens performs reward and fee distribution to all validators based on the F1 fee distribution specification.

func (Keeper) AllocateTokensToValidator

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

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

func (Keeper) BeginBlocker added in v0.53.0

func (k Keeper) BeginBlocker(ctx sdk.Context) error

BeginBlocker sets the proposer for determining distribution during endblock and distribute rewards for the previous block.

func (Keeper) CalculateDelegationRewards

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

CalculateDelegationRewards calculates the total rewards accrued by a delegation

func (Keeper) DeleteAllValidatorHistoricalRewards

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

DeleteAllValidatorHistoricalRewards deletes all historical rewards

func (Keeper) DeleteAllValidatorSlashEvents

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

DeleteAllValidatorSlashEvents deletes all slash events

func (Keeper) DeleteDelegatorStartingInfo

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

DeleteDelegatorStartingInfo deletes the starting info associated with a delegator

func (Keeper) DeleteDelegatorWithdrawAddr

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

DeleteDelegatorWithdrawAddr deletes a delegator withdraw addr

func (Keeper) DeleteValidatorAccumulatedCommission

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

DeleteValidatorAccumulatedCommission deletes accumulated commission for a validator

func (Keeper) DeleteValidatorCurrentRewards

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

DeleteValidatorCurrentRewards deletes current rewards for a validator

func (Keeper) DeleteValidatorHistoricalReward

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

DeleteValidatorHistoricalReward deletes a historical reward

func (Keeper) DeleteValidatorHistoricalRewards

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

DeleteValidatorHistoricalRewards deletes historical rewards for a validator

func (Keeper) DeleteValidatorOutstandingRewards

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

DeleteValidatorOutstandingRewards deletes validator outstanding rewards

func (Keeper) DeleteValidatorSlashEvents

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

DeleteValidatorSlashEvents deletes slash events for a particular validator

func (Keeper) DistributeFromFeePool

func (k Keeper) DistributeFromFeePool(ctx context.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 added in v0.40.0

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

ExportGenesis returns a GenesisState for a given context and keeper.

func (Keeper) FundCommunityPool

func (k Keeper) FundCommunityPool(ctx context.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) GetAuthority added in v0.47.0

func (k Keeper) GetAuthority() string

GetAuthority returns the x/distribution module's authority.

func (Keeper) GetCommunityTax

func (k Keeper) GetCommunityTax(ctx context.Context) (math.LegacyDec, error)

GetCommunityTax returns the current distribution community tax.

func (Keeper) GetDelegatorStartingInfo

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

GetDelegatorStartingInfo gets the starting info associated with a delegator

func (Keeper) GetDelegatorWithdrawAddr

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

GetDelegatorWithdrawAddr get the delegator withdraw address, defaulting to the delegator address

func (Keeper) GetDistributionAccount

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

GetDistributionAccount returns the distribution ModuleAccount

func (Keeper) GetPreviousProposerConsAddr

func (k Keeper) GetPreviousProposerConsAddr(ctx context.Context) (sdk.ConsAddress, error)

GetPreviousProposerConsAddr returns the proposer consensus address for the current block.

func (Keeper) GetTotalRewards

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

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

func (Keeper) GetValidatorAccumulatedCommission

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

GetValidatorAccumulatedCommission gets accumulated commission for a validator

func (Keeper) GetValidatorCurrentRewards

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

GetValidatorCurrentRewards gets current rewards for a validator

func (Keeper) GetValidatorHistoricalReferenceCount

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

GetValidatorHistoricalReferenceCount gets a historical reference count (used for testcases)

func (Keeper) GetValidatorHistoricalRewards

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

GetValidatorHistoricalRewards gets historical rewards for a particular period

func (Keeper) GetValidatorOutstandingRewards

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

GetValidatorOutstandingRewards gets validator outstanding rewards

func (Keeper) GetValidatorOutstandingRewardsCoins

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

GetValidatorOutstandingRewardsCoins gets outstanding rewards

func (Keeper) GetValidatorSlashEvent

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

GetValidatorSlashEvent gets slash event for height

func (Keeper) GetWithdrawAddrEnabled

func (k Keeper) GetWithdrawAddrEnabled(ctx context.Context) (enabled bool, err error)

GetWithdrawAddrEnabled returns the current distribution withdraw address enabled parameter.

func (Keeper) HasDelegatorStartingInfo

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

HasDelegatorStartingInfo checks existence of the starting info associated with a delegator

func (Keeper) Hooks

func (k Keeper) Hooks() Hooks

Hooks creates new distribution hooks

func (Keeper) IncrementValidatorPeriod

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

IncrementValidatorPeriod increments validator period, returning the period just ended

func (Keeper) InitGenesis added in v0.40.0

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

InitGenesis sets distribution information for genesis

func (Keeper) IterateDelegatorStartingInfos

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

IterateDelegatorStartingInfos iterates over delegator starting infos

func (Keeper) IterateDelegatorWithdrawAddrs

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

IterateDelegatorWithdrawAddrs iterates over delegator withdraw addrs

func (Keeper) IterateValidatorAccumulatedCommissions

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

IterateValidatorAccumulatedCommissions iterates over accumulated commissions

func (Keeper) IterateValidatorCurrentRewards

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

IterateValidatorCurrentRewards iterates over current rewards

func (Keeper) IterateValidatorHistoricalRewards

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

IterateValidatorHistoricalRewards iterates over historical rewards

func (Keeper) IterateValidatorOutstandingRewards

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

IterateValidatorOutstandingRewards iterates validator outstanding rewards

func (Keeper) IterateValidatorSlashEvents

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

IterateValidatorSlashEvents iterates over all slash events

func (Keeper) IterateValidatorSlashEventsBetween

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

IterateValidatorSlashEventsBetween iterates over slash events between heights, inclusive

func (Keeper) Logger

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

Logger returns a module-specific logger.

func (Keeper) SetDelegatorStartingInfo

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

SetDelegatorStartingInfo sets the starting info associated with a delegator

func (Keeper) SetDelegatorWithdrawAddr

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

SetDelegatorWithdrawAddr sets the delegator withdraw address

func (Keeper) SetPreviousProposerConsAddr

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

SetPreviousProposerConsAddr sets the proposer public key for this block

func (Keeper) SetValidatorAccumulatedCommission

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

SetValidatorAccumulatedCommission sets accumulated commission for a validator

func (Keeper) SetValidatorCurrentRewards

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

SetValidatorCurrentRewards sets current rewards for a validator

func (Keeper) SetValidatorHistoricalRewards

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

SetValidatorHistoricalRewards sets historical rewards for a particular period

func (Keeper) SetValidatorOutstandingRewards

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

SetValidatorOutstandingRewards sets validator outstanding rewards

func (Keeper) SetValidatorSlashEvent

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

SetValidatorSlashEvent sets slash event for height

func (Keeper) SetWithdrawAddr

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

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

func (Keeper) WithdrawDelegationRewards

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

WithdrawDelegationRewards withdraws rewards from a delegation

func (Keeper) WithdrawValidatorCommission

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

WithdrawValidatorCommission withdraws validator commission.

type Migrator added in v0.43.0

type Migrator struct {
	// contains filtered or unexported fields
}

Migrator is a struct for handling in-place store migrations.

func NewMigrator added in v0.43.0

func NewMigrator(keeper Keeper) Migrator

NewMigrator returns a new Migrator.

type Querier added in v0.47.0

type Querier struct {
	Keeper
}

func NewQuerier

func NewQuerier(keeper Keeper) Querier

func (Querier) CommunityPool added in v0.47.0

CommunityPool queries the community pool coins

func (Querier) DelegationRewards added in v0.47.0

DelegationRewards the total rewards accrued by a delegation

func (Querier) DelegationTotalRewards added in v0.47.0

DelegationTotalRewards the total rewards accrued by each validator

func (Querier) DelegatorStartingInfo added in v0.54.0

DelegatorStartingInfo queries the starting info for a delegator

func (Querier) DelegatorValidators added in v0.47.0

DelegatorValidators queries the validators list of a delegator

func (Querier) DelegatorWithdrawAddress added in v0.47.0

DelegatorWithdrawAddress queries Query/delegatorWithdrawAddress

func (Querier) Params added in v0.47.0

Params queries params of distribution module

func (Querier) ValidatorCommission added in v0.47.0

ValidatorCommission queries accumulated commission for a validator

func (Querier) ValidatorCurrentRewards added in v0.54.0

ValidatorCurrentRewards queries current rewards for a validator

func (Querier) ValidatorDistributionInfo added in v0.47.0

ValidatorDistributionInfo query validator's commission and self-delegation rewards

func (Querier) ValidatorHistoricalRewards added in v0.54.0

ValidatorHistoricalRewards queries historical rewards for a validator at a specific period

func (Querier) ValidatorOutstandingRewards added in v0.47.0

ValidatorOutstandingRewards queries rewards of a validator address

func (Querier) ValidatorSlashes added in v0.47.0

ValidatorSlashes queries slash events of a validator

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL