Documentation ¶
Index ¶
- func AllInvariants(k Keeper) sdk.Invariant
- func CanWithdrawInvariant(k Keeper) sdk.Invariant
- func ModuleAccountInvariant(k Keeper) sdk.Invariant
- func NewMsgServerImpl(keeper Keeper) types.MsgServer
- func NonNegativeOutstandingInvariant(k Keeper) sdk.Invariant
- func ReferenceCountInvariant(k Keeper) sdk.Invariant
- func RegisterInvariants(ir sdk.InvariantRegistry, k Keeper)
- type Hooks
- func (h Hooks) AfterConsensusPubKeyUpdate(_ context.Context, _, _ cryptotypes.PubKey, _ sdk.Coin) error
- func (h Hooks) AfterDelegationModified(ctx context.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) error
- func (h Hooks) AfterUnbondingInitiated(_ context.Context, _ uint64) error
- func (h Hooks) AfterValidatorBeginUnbonding(_ context.Context, _ sdk.ConsAddress, _ sdk.ValAddress) error
- func (h Hooks) AfterValidatorBonded(_ context.Context, _ sdk.ConsAddress, _ sdk.ValAddress) error
- func (h Hooks) AfterValidatorCreated(ctx context.Context, valAddr sdk.ValAddress) error
- func (h Hooks) AfterValidatorRemoved(ctx context.Context, _ sdk.ConsAddress, valAddr sdk.ValAddress) error
- func (h Hooks) BeforeDelegationCreated(ctx context.Context, _ sdk.AccAddress, valAddr sdk.ValAddress) error
- func (h Hooks) BeforeDelegationRemoved(_ context.Context, _ sdk.AccAddress, _ sdk.ValAddress) error
- func (h Hooks) BeforeDelegationSharesModified(ctx context.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) error
- func (h Hooks) BeforeValidatorModified(_ context.Context, _ sdk.ValAddress) error
- func (h Hooks) BeforeValidatorSlashed(ctx context.Context, valAddr sdk.ValAddress, fraction sdkmath.LegacyDec) error
- type Keeper
- func (k Keeper) AllocateTokens(ctx context.Context, totalPreviousPower int64, bondedVotes []comet.VoteInfo) error
- func (k Keeper) AllocateTokensToValidator(ctx context.Context, val sdk.ValidatorI, tokens sdk.DecCoins) error
- func (k Keeper) BeginBlocker(ctx context.Context) error
- func (k Keeper) CalculateDelegationRewards(ctx context.Context, val sdk.ValidatorI, del sdk.DelegationI, ...) (rewards sdk.DecCoins, err error)
- func (k Keeper) ExportGenesis(ctx context.Context) (*types.GenesisState, error)
- func (k Keeper) GetAuthority() string
- func (k Keeper) GetCommunityTax(ctx context.Context) (math.LegacyDec, error)
- func (k Keeper) GetDelegatorWithdrawAddr(ctx context.Context, delAddr sdk.AccAddress) (sdk.AccAddress, error)
- func (k Keeper) GetDistributionAccount(ctx context.Context) sdk.ModuleAccountI
- func (k Keeper) GetTotalRewards(ctx context.Context) (totalRewards sdk.DecCoins)
- func (k Keeper) GetValidatorOutstandingRewardsCoins(ctx context.Context, val sdk.ValAddress) (sdk.DecCoins, error)
- func (k Keeper) GetWithdrawAddrEnabled(ctx context.Context) (enabled bool, err error)
- func (k Keeper) Hooks() Hooks
- func (k Keeper) IncrementValidatorPeriod(ctx context.Context, val sdk.ValidatorI) (uint64, error)
- func (k Keeper) InitGenesis(ctx context.Context, data types.GenesisState) error
- func (k Keeper) IterateValidatorSlashEventsBetween(ctx context.Context, val sdk.ValAddress, startingHeight, endingHeight uint64, ...) error
- func (k Keeper) SetWithdrawAddr(ctx context.Context, delegatorAddr, withdrawAddr sdk.AccAddress) error
- func (k Keeper) WithdrawDelegationRewards(ctx context.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) (sdk.Coins, error)
- func (k Keeper) WithdrawValidatorCommission(ctx context.Context, valAddr sdk.ValAddress) (sdk.Coins, error)
- type Migrator
- type Querier
- func (k Querier) CommunityPool(ctx context.Context, req *types.QueryCommunityPoolRequest) (*types.QueryCommunityPoolResponse, error)deprecated
- func (k Querier) DelegationRewards(ctx context.Context, req *types.QueryDelegationRewardsRequest) (*types.QueryDelegationRewardsResponse, error)
- func (k Querier) DelegationTotalRewards(ctx context.Context, req *types.QueryDelegationTotalRewardsRequest) (*types.QueryDelegationTotalRewardsResponse, error)
- func (k Querier) DelegatorValidators(ctx context.Context, req *types.QueryDelegatorValidatorsRequest) (*types.QueryDelegatorValidatorsResponse, error)
- func (k Querier) DelegatorWithdrawAddress(ctx context.Context, req *types.QueryDelegatorWithdrawAddressRequest) (*types.QueryDelegatorWithdrawAddressResponse, error)
- func (k Querier) Params(ctx context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error)
- func (k Querier) ValidatorCommission(ctx context.Context, req *types.QueryValidatorCommissionRequest) (*types.QueryValidatorCommissionResponse, error)
- func (k Querier) ValidatorDistributionInfo(ctx context.Context, req *types.QueryValidatorDistributionInfoRequest) (*types.QueryValidatorDistributionInfoResponse, error)
- func (k Querier) ValidatorOutstandingRewards(ctx context.Context, req *types.QueryValidatorOutstandingRewardsRequest) (*types.QueryValidatorOutstandingRewardsResponse, error)
- func (k Querier) ValidatorSlashes(ctx context.Context, req *types.QueryValidatorSlashesRequest) (*types.QueryValidatorSlashesResponse, 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 ModuleAccountInvariant ¶
ModuleAccountInvariant checks that the coins held by the distr ModuleAccount is consistent with the sum of validator outstanding rewards
func NewMsgServerImpl ¶
NewMsgServerImpl returns an implementation of the distribution MsgServer interface for the provided Keeper.
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) AfterConsensusPubKeyUpdate ¶
func (Hooks) AfterDelegationModified ¶
func (h Hooks) AfterDelegationModified(ctx context.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) error
AfterDelegationModified create new delegation period record
func (Hooks) AfterUnbondingInitiated ¶
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) AfterValidatorCreated ¶
AfterValidatorCreated initialize 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, _ sdk.AccAddress, valAddr sdk.ValAddress) error
BeforeDelegationCreated increment 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 (Hooks) BeforeValidatorSlashed ¶
func (h Hooks) BeforeValidatorSlashed(ctx context.Context, valAddr sdk.ValAddress, fraction sdkmath.LegacyDec) error
BeforeValidatorSlashed record the slash event
type Keeper ¶
type Keeper struct { appmodule.Environment Schema collections.Schema Params collections.Item[types.Params] // FeePool stores decimal tokens that cannot be yet distributed. // In the past it held the community pool, but it has been replaced by x/protocolpool. FeePool collections.Item[types.FeePool] // DelegatorsWithdrawAddress key: delAddr | value: withdrawAddr DelegatorsWithdrawAddress collections.Map[sdk.AccAddress, sdk.AccAddress] // ValidatorCurrentRewards key: valAddr | value: ValidatorCurrentRewards ValidatorCurrentRewards collections.Map[sdk.ValAddress, types.ValidatorCurrentRewards] // DelegatorStartingInfo key: valAddr+delAccAddr | value: DelegatorStartingInfo DelegatorStartingInfo collections.Map[collections.Pair[sdk.ValAddress, sdk.AccAddress], types.DelegatorStartingInfo] // ValidatorsAccumulatedCommission key: valAddr | value: ValidatorAccumulatedCommission ValidatorsAccumulatedCommission collections.Map[sdk.ValAddress, types.ValidatorAccumulatedCommission] // ValidatorOutstandingRewards key: valAddr | value: ValidatorOutstandingRewards ValidatorOutstandingRewards collections.Map[sdk.ValAddress, types.ValidatorOutstandingRewards] // ValidatorHistoricalRewards key: valAddr+period | value: ValidatorHistoricalRewards ValidatorHistoricalRewards collections.Map[collections.Pair[sdk.ValAddress, uint64], types.ValidatorHistoricalRewards] // ValidatorSlashEvents key: valAddr+height+period | value: ValidatorSlashEvent ValidatorSlashEvents collections.Map[collections.Triple[sdk.ValAddress, uint64, uint64], types.ValidatorSlashEvent] // contains filtered or unexported fields }
Keeper of the distribution store
func NewKeeper ¶
func NewKeeper( cdc codec.BinaryCodec, env appmodule.Environment, ak types.AccountKeeper, bk types.BankKeeper, sk types.StakingKeeper, cometService comet.Service, feeCollectorName, authority string, ) Keeper
NewKeeper creates a new distribution Keeper instance
func (Keeper) AllocateTokens ¶
func (k Keeper) AllocateTokens(ctx context.Context, totalPreviousPower int64, bondedVotes []comet.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 sdk.ValidatorI, tokens sdk.DecCoins) error
AllocateTokensToValidator allocate tokens to a particular validator, splitting according to commission.
func (Keeper) BeginBlocker ¶
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 sdk.ValidatorI, del sdk.DelegationI, endingPeriod uint64) (rewards sdk.DecCoins, err error)
CalculateDelegationRewards calculate the total rewards accrued by a delegation
func (Keeper) ExportGenesis ¶
ExportGenesis returns a GenesisState for a given context and keeper.
func (Keeper) GetAuthority ¶
GetAuthority returns the x/distribution module's authority.
func (Keeper) GetCommunityTax ¶
GetCommunityTax returns the current distribution community tax.
func (Keeper) GetDelegatorWithdrawAddr ¶
func (k Keeper) GetDelegatorWithdrawAddr(ctx context.Context, delAddr sdk.AccAddress) (sdk.AccAddress, error)
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) GetTotalRewards ¶
GetTotalRewards returns the total amount of fee distribution rewards held in the store
func (Keeper) GetValidatorOutstandingRewardsCoins ¶
func (k Keeper) GetValidatorOutstandingRewardsCoins(ctx context.Context, val sdk.ValAddress) (sdk.DecCoins, error)
get outstanding rewards
func (Keeper) GetWithdrawAddrEnabled ¶
GetWithdrawAddrEnabled returns the current distribution withdraw address enabled parameter.
func (Keeper) IncrementValidatorPeriod ¶
increment validator period, returning the period just ended
func (Keeper) InitGenesis ¶
InitGenesis sets distribution information for genesis
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), ) error
iterate over slash events between heights, inclusive
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 withdraw rewards from a delegation
func (Keeper) WithdrawValidatorCommission ¶
func (k Keeper) WithdrawValidatorCommission(ctx context.Context, valAddr sdk.ValAddress) (sdk.Coins, error)
WithdrawValidatorCommission withdraw validator commission
type Migrator ¶
type Migrator struct {
// contains filtered or unexported fields
}
Migrator is a struct for handling in-place store migrations.
func (Migrator) Migrate1to2 ¶
Migrate1to2 migrates from version 1 to 2.
func (Migrator) Migrate2to3 ¶
Migrate2to3 migrates the x/distribution module state from the consensus version 2 to version 3. Specifically, it takes the parameters that are currently stored and managed by the x/params module and stores them directly into the x/distribution module state.
type Querier ¶
type Querier struct {
Keeper
}
func NewQuerier ¶
func (Querier) CommunityPool
deprecated
func (k Querier) CommunityPool(ctx context.Context, req *types.QueryCommunityPoolRequest) (*types.QueryCommunityPoolResponse, error)
Deprecated: DO NOT USE This method uses deprecated query request. Use CommunityPool from x/protocolpool module instead. CommunityPool queries the community pool coins
func (Querier) DelegationRewards ¶
func (k Querier) DelegationRewards(ctx context.Context, req *types.QueryDelegationRewardsRequest) (*types.QueryDelegationRewardsResponse, error)
DelegationRewards the total rewards accrued by a delegation
func (Querier) DelegationTotalRewards ¶
func (k Querier) DelegationTotalRewards(ctx context.Context, req *types.QueryDelegationTotalRewardsRequest) (*types.QueryDelegationTotalRewardsResponse, error)
DelegationTotalRewards the total rewards accrued by a each validator
func (Querier) DelegatorValidators ¶
func (k Querier) DelegatorValidators(ctx context.Context, req *types.QueryDelegatorValidatorsRequest) (*types.QueryDelegatorValidatorsResponse, error)
DelegatorValidators queries the validators list of a delegator
func (Querier) DelegatorWithdrawAddress ¶
func (k Querier) DelegatorWithdrawAddress(ctx context.Context, req *types.QueryDelegatorWithdrawAddressRequest) (*types.QueryDelegatorWithdrawAddressResponse, error)
DelegatorWithdrawAddress queries Query/delegatorWithdrawAddress
func (Querier) Params ¶
func (k Querier) Params(ctx context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error)
Params queries params of distribution module
func (Querier) ValidatorCommission ¶
func (k Querier) ValidatorCommission(ctx context.Context, req *types.QueryValidatorCommissionRequest) (*types.QueryValidatorCommissionResponse, error)
ValidatorCommission queries accumulated commission for a validator
func (Querier) ValidatorDistributionInfo ¶
func (k Querier) ValidatorDistributionInfo(ctx context.Context, req *types.QueryValidatorDistributionInfoRequest) (*types.QueryValidatorDistributionInfoResponse, error)
ValidatorDistributionInfo query validator's commission and self-delegation rewards
func (Querier) ValidatorOutstandingRewards ¶
func (k Querier) ValidatorOutstandingRewards(ctx context.Context, req *types.QueryValidatorOutstandingRewardsRequest) (*types.QueryValidatorOutstandingRewardsResponse, error)
ValidatorOutstandingRewards queries rewards of a validator address
func (Querier) ValidatorSlashes ¶
func (k Querier) ValidatorSlashes(ctx context.Context, req *types.QueryValidatorSlashesRequest) (*types.QueryValidatorSlashesResponse, error)
ValidatorSlashes queries slash events of a validator