keeper

package
v1.6.56 Latest Latest
Warning

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

Go to latest
Published: May 6, 2022 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	QueryRewards = "rewards"
)

Variables

View Source
var (
	ValidatorCurrentRewardsPrefix = []byte("val")
	ValidatorsInfoPrefix          = []byte("vals")
)

Functions

func GetDelegatorStartingInfoAddresses added in v1.5.23

func GetDelegatorStartingInfoAddresses(key []byte) (valAddr sdk.AccAddress, delAddr sdk.AccAddress)

GetDelegatorStartingInfoAddresses creates the addresses from a delegator starting info key.

func GetValidatorCurrentRewardsKey

func GetValidatorCurrentRewardsKey(v sdk.AccAddr) []byte

func GetValidatorHistoricalRewardsAddressPeriod added in v1.5.23

func GetValidatorHistoricalRewardsAddressPeriod(key []byte) (valAddr sdk.AccAddress, period uint64)

func GetValidatorSlashEventAddressHeight added in v1.5.23

func GetValidatorSlashEventAddressHeight(key []byte) (valAddr sdk.AccAddress, height uint64)

GetValidatorSlashEventAddressHeight creates the height from a validator's slash event key.

func GetValidatorsInfoKey

func GetValidatorsInfoKey(v []byte) []byte

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 (k DistrKeeper) AllocateTokensToValidator(ctx sdk.Context, val staking.Validator, tokens sdk.DecCoin)

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 (k *DistrKeeper) GetPreFixStore(ctx sdk.Context, prefix string) sdk.KVStore

func (*DistrKeeper) GetPreviousProposerAddr

func (k *DistrKeeper) GetPreviousProposerAddr(ctx sdk.Context) (proposer sdk.AccAddr)

lastProposer

func (DistrKeeper) GetPreviousProposerConsAddr added in v1.5.23

func (k DistrKeeper) GetPreviousProposerConsAddr(ctx sdk.Context) sdk.AccAddress

func (*DistrKeeper) GetProposerCurrentRewards

func (k *DistrKeeper) GetProposerCurrentRewards(ctx sdk.Context, val sdk.AccAddr, height int64) (rewards sdk.Coin)

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) Hooks

func (k DistrKeeper) Hooks() Hooks

Create new distribution hooks

func (DistrKeeper) IterateDelegatorStartingInfos added in v1.5.23

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

iterate over delegator starting infos

func (DistrKeeper) IterateDelegatorWithdrawAddrs added in v1.5.23

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

func (DistrKeeper) IterateValidatorAccumulatedCommissions added in v1.5.23

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

iterate over accumulated commissions

func (DistrKeeper) IterateValidatorCurrentRewards added in v1.5.23

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

func (DistrKeeper) IterateValidatorHistoricalRewards added in v1.5.23

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

iterate over historical rewards

func (DistrKeeper) IterateValidatorOutstandingRewards added in v1.5.23

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

iterate validator outstanding rewards

func (DistrKeeper) IterateValidatorSlashEvents added in v1.5.23

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

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) SetParams

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

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

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

record the slash event

Jump to

Keyboard shortcuts

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