Documentation ¶
Overview ¶
nolint
Index ¶
- Constants
- Variables
- func GetDelegatorStartingInfoAddresses(key []byte) (valAddr sdk.ValAddress, delAddr sdk.AccAddress)
- func GetDelegatorStartingInfoKey(v sdk.ValAddress, d sdk.AccAddress) []byte
- func GetDelegatorWithdrawAddrKey(delAddr sdk.AccAddress) []byte
- func GetDelegatorWithdrawInfoAddress(key []byte) (delAddr sdk.AccAddress)
- func GetValidatorAccumulatedCommissionAddress(key []byte) (valAddr sdk.ValAddress)
- func GetValidatorAccumulatedCommissionKey(v sdk.ValAddress) []byte
- func GetValidatorCurrentRewardsAddress(key []byte) (valAddr sdk.ValAddress)
- func GetValidatorCurrentRewardsKey(v sdk.ValAddress) []byte
- func GetValidatorHistoricalRewardsAddressPeriod(key []byte) (valAddr sdk.ValAddress, period uint64)
- func GetValidatorHistoricalRewardsKey(v sdk.ValAddress, k uint64) []byte
- func GetValidatorHistoricalRewardsPrefix(v sdk.ValAddress) []byte
- func GetValidatorOutstandingRewardsAddress(key []byte) (valAddr sdk.ValAddress)
- func GetValidatorOutstandingRewardsKey(valAddr sdk.ValAddress) []byte
- func GetValidatorSlashEventAddressHeight(key []byte) (valAddr sdk.ValAddress, height uint64)
- func GetValidatorSlashEventKey(v sdk.ValAddress, height, period uint64) []byte
- func GetValidatorSlashEventKeyPrefix(v sdk.ValAddress, height uint64) []byte
- func GetValidatorSlashEventPrefix(v sdk.ValAddress) []byte
- func ParamKeyTable() params.KeyTable
- func RegisterCodec(cdc *codec.Codec)
- func ValidateGenesis(gs GenesisState) error
- type AccountKeeper
- type CommunityPoolSpendProposal
- func (csp CommunityPoolSpendProposal) GetDescription() string
- func (csp CommunityPoolSpendProposal) GetTitle() string
- func (csp CommunityPoolSpendProposal) ProposalRoute() string
- func (csp CommunityPoolSpendProposal) ProposalType() string
- func (csp CommunityPoolSpendProposal) String() string
- func (csp CommunityPoolSpendProposal) ValidateBasic() error
- type DelegationDelegatorReward
- type DelegatorStartingInfo
- type DelegatorStartingInfoRecord
- type DelegatorWithdrawInfo
- type FeePool
- type GenesisState
- type MsgFundCommunityPool
- type MsgSetWithdrawAddress
- type MsgWithdrawDelegatorReward
- type MsgWithdrawValidatorCommission
- func (msg MsgWithdrawValidatorCommission) GetSignBytes() []byte
- func (msg MsgWithdrawValidatorCommission) GetSigners() []sdk.AccAddress
- func (msg MsgWithdrawValidatorCommission) Route() string
- func (msg MsgWithdrawValidatorCommission) Type() string
- func (msg MsgWithdrawValidatorCommission) ValidateBasic() error
- type Params
- type QueryDelegationRewardsParams
- type QueryDelegatorParams
- type QueryDelegatorTotalRewardsResponse
- type QueryDelegatorWithdrawAddrParams
- type QueryValidatorCommissionParams
- type QueryValidatorOutstandingRewardsParams
- type QueryValidatorSlashesParams
- type StakingHooks
- type StakingKeeper
- type SupplyKeeper
- type ValidatorAccumulatedCommission
- type ValidatorAccumulatedCommissionRecord
- type ValidatorCurrentRewards
- type ValidatorCurrentRewardsRecord
- type ValidatorHistoricalRewards
- type ValidatorHistoricalRewardsRecord
- type ValidatorOutstandingRewards
- type ValidatorOutstandingRewardsRecord
- type ValidatorSlashEvent
- type ValidatorSlashEventRecord
- type ValidatorSlashEvents
Constants ¶
const ( EventTypeSetWithdrawAddress = "set_withdraw_address" EventTypeRewards = "rewards" EventTypeCommission = "commission" EventTypeWithdrawRewards = "withdraw_rewards" EventTypeWithdrawCommission = "withdraw_commission" EventTypeProposerReward = "proposer_reward" AttributeKeyWithdrawAddress = "withdraw_address" AttributeKeyValidator = "validator" AttributeValueCategory = ModuleName )
distribution module event types
const ( // ModuleName is the module name constant used in many places ModuleName = "distribution" // StoreKey is the store key string for distribution StoreKey = ModuleName // RouterKey is the message route for distribution RouterKey = ModuleName // QuerierRoute is the querier route for distribution QuerierRoute = ModuleName )
const ( QueryParams = "params" QueryValidatorOutstandingRewards = "validator_outstanding_rewards" QueryValidatorCommission = "validator_commission" QueryValidatorSlashes = "validator_slashes" QueryDelegationRewards = "delegation_rewards" QueryDelegatorTotalRewards = "delegator_total_rewards" QueryDelegatorValidators = "delegator_validators" QueryWithdrawAddr = "withdraw_addr" QueryCommunityPool = "community_pool" )
querier keys
const ( // default paramspace for params keeper DefaultParamspace = ModuleName )
const (
// ProposalTypeCommunityPoolSpend defines the type for a CommunityPoolSpendProposal
ProposalTypeCommunityPoolSpend = "CommunityPoolSpend"
)
const TypeMsgFundCommunityPool = "fund_community_pool"
Variables ¶
var ( ErrEmptyDelegatorAddr = sdkerrors.Register(ModuleName, 1, "delegator address is empty") ErrEmptyWithdrawAddr = sdkerrors.Register(ModuleName, 2, "withdraw address is empty") ErrEmptyValidatorAddr = sdkerrors.Register(ModuleName, 3, "validator address is empty") ErrEmptyDelegationDistInfo = sdkerrors.Register(ModuleName, 4, "no delegation distribution info") ErrNoValidatorDistInfo = sdkerrors.Register(ModuleName, 5, "no validator distribution info") ErrNoValidatorCommission = sdkerrors.Register(ModuleName, 6, "no validator commission to withdraw") ErrSetWithdrawAddrDisabled = sdkerrors.Register(ModuleName, 7, "set withdraw address disabled") ErrBadDistribution = sdkerrors.Register(ModuleName, 8, "community pool does not have sufficient coins to distribute") ErrInvalidProposalAmount = sdkerrors.Register(ModuleName, 9, "invalid community pool spend proposal amount") ErrEmptyProposalRecipient = sdkerrors.Register(ModuleName, 10, "invalid community pool spend proposal recipient") ErrNoValidatorExists = sdkerrors.Register(ModuleName, 11, "validator does not exist") ErrNoDelegationExists = sdkerrors.Register(ModuleName, 12, "delegation does not exist") )
x/distribution module sentinel errors
var ( FeePoolKey = []byte{0x00} // key for global distribution state ProposerKey = []byte{0x01} // key for the proposer operator address ValidatorOutstandingRewardsPrefix = []byte{0x02} // key for outstanding rewards DelegatorWithdrawAddrPrefix = []byte{0x03} // key for delegator withdraw address DelegatorStartingInfoPrefix = []byte{0x04} // key for delegator starting info ValidatorHistoricalRewardsPrefix = []byte{0x05} // key for historical validators rewards / stake ValidatorCurrentRewardsPrefix = []byte{0x06} // key for current validator rewards ValidatorAccumulatedCommissionPrefix = []byte{0x07} // key for accumulated validator commission ValidatorSlashEventPrefix = []byte{0x08} // key for validator slash fraction )
Keys for distribution store Items are stored with the following key: values
- 0x00<proposalID_Bytes>: FeePol
- 0x01: sdk.ConsAddress
- 0x02<valAddr_Bytes>: ValidatorOutstandingRewards
- 0x03<accAddr_Bytes>: sdk.AccAddress
- 0x04<valAddr_Bytes><accAddr_Bytes>: DelegatorStartingInfo
- 0x05<valAddr_Bytes><period_Bytes>: ValidatorHistoricalRewards
- 0x06<valAddr_Bytes>: ValidatorCurrentRewards
- 0x07<valAddr_Bytes>: ValidatorCurrentRewards
- 0x08<valAddr_Bytes><height>: ValidatorSlashEvent
var ( ParamStoreKeyCommunityTax = []byte("communitytax") ParamStoreKeyBaseProposerReward = []byte("baseproposerreward") ParamStoreKeyBonusProposerReward = []byte("bonusproposerreward") ParamStoreKeyWithdrawAddrEnabled = []byte("withdrawaddrenabled") )
Parameter keys
var ModuleCdc *codec.Codec
generic sealed codec to be used throughout module
Functions ¶
func GetDelegatorStartingInfoAddresses ¶
func GetDelegatorStartingInfoAddresses(key []byte) (valAddr sdk.ValAddress, delAddr sdk.AccAddress)
gets the addresses from a delegator starting info key
func GetDelegatorStartingInfoKey ¶
func GetDelegatorStartingInfoKey(v sdk.ValAddress, d sdk.AccAddress) []byte
gets the key for a delegator's starting info
func GetDelegatorWithdrawAddrKey ¶
func GetDelegatorWithdrawAddrKey(delAddr sdk.AccAddress) []byte
gets the key for a delegator's withdraw addr
func GetDelegatorWithdrawInfoAddress ¶
func GetDelegatorWithdrawInfoAddress(key []byte) (delAddr sdk.AccAddress)
gets an address from a delegator's withdraw info key
func GetValidatorAccumulatedCommissionAddress ¶
func GetValidatorAccumulatedCommissionAddress(key []byte) (valAddr sdk.ValAddress)
gets the address from a validator's accumulated commission key
func GetValidatorAccumulatedCommissionKey ¶
func GetValidatorAccumulatedCommissionKey(v sdk.ValAddress) []byte
gets the key for a validator's current commission
func GetValidatorCurrentRewardsAddress ¶
func GetValidatorCurrentRewardsAddress(key []byte) (valAddr sdk.ValAddress)
gets the address from a validator's current rewards key
func GetValidatorCurrentRewardsKey ¶
func GetValidatorCurrentRewardsKey(v sdk.ValAddress) []byte
gets the key for a validator's current rewards
func GetValidatorHistoricalRewardsAddressPeriod ¶
func GetValidatorHistoricalRewardsAddressPeriod(key []byte) (valAddr sdk.ValAddress, period uint64)
gets the address & period from a validator's historical rewards key
func GetValidatorHistoricalRewardsKey ¶
func GetValidatorHistoricalRewardsKey(v sdk.ValAddress, k uint64) []byte
gets the key for a validator's historical rewards
func GetValidatorHistoricalRewardsPrefix ¶
func GetValidatorHistoricalRewardsPrefix(v sdk.ValAddress) []byte
gets the prefix key for a validator's historical rewards
func GetValidatorOutstandingRewardsAddress ¶
func GetValidatorOutstandingRewardsAddress(key []byte) (valAddr sdk.ValAddress)
gets an address from a validator's outstanding rewards key
func GetValidatorOutstandingRewardsKey ¶
func GetValidatorOutstandingRewardsKey(valAddr sdk.ValAddress) []byte
gets the outstanding rewards key for a validator
func GetValidatorSlashEventAddressHeight ¶
func GetValidatorSlashEventAddressHeight(key []byte) (valAddr sdk.ValAddress, height uint64)
gets the height from a validator's slash event key
func GetValidatorSlashEventKey ¶
func GetValidatorSlashEventKey(v sdk.ValAddress, height, period uint64) []byte
gets the key for a validator's slash fraction
func GetValidatorSlashEventKeyPrefix ¶
func GetValidatorSlashEventKeyPrefix(v sdk.ValAddress, height uint64) []byte
gets the prefix key for a validator's slash fraction (ValidatorSlashEventPrefix + height)
func GetValidatorSlashEventPrefix ¶
func GetValidatorSlashEventPrefix(v sdk.ValAddress) []byte
gets the prefix key for a validator's slash fractions
func ParamKeyTable ¶
ParamKeyTable returns the parameter key table.
func ValidateGenesis ¶
func ValidateGenesis(gs GenesisState) error
ValidateGenesis validates the genesis state of distribution genesis input
Types ¶
type AccountKeeper ¶
type AccountKeeper interface {
GetAccount(ctx sdk.Context, addr sdk.AccAddress) authexported.Account
}
AccountKeeper defines the expected account keeper used for simulations (noalias)
type CommunityPoolSpendProposal ¶
type CommunityPoolSpendProposal struct { Title string `json:"title" yaml:"title"` Description string `json:"description" yaml:"description"` Recipient sdk.AccAddress `json:"recipient" yaml:"recipient"` Amount sdk.Coins `json:"amount" yaml:"amount"` }
CommunityPoolSpendProposal spends from the community pool
func NewCommunityPoolSpendProposal ¶
func NewCommunityPoolSpendProposal(title, description string, recipient sdk.AccAddress, amount sdk.Coins) CommunityPoolSpendProposal
NewCommunityPoolSpendProposal creates a new community pool spned proposal.
func (CommunityPoolSpendProposal) GetDescription ¶
func (csp CommunityPoolSpendProposal) GetDescription() string
GetDescription returns the description of a community pool spend proposal.
func (CommunityPoolSpendProposal) GetTitle ¶
func (csp CommunityPoolSpendProposal) GetTitle() string
GetTitle returns the title of a community pool spend proposal.
func (CommunityPoolSpendProposal) ProposalRoute ¶
func (csp CommunityPoolSpendProposal) ProposalRoute() string
GetDescription returns the routing key of a community pool spend proposal.
func (CommunityPoolSpendProposal) ProposalType ¶
func (csp CommunityPoolSpendProposal) ProposalType() string
ProposalType returns the type of a community pool spend proposal.
func (CommunityPoolSpendProposal) String ¶
func (csp CommunityPoolSpendProposal) String() string
String implements the Stringer interface.
func (CommunityPoolSpendProposal) ValidateBasic ¶
func (csp CommunityPoolSpendProposal) ValidateBasic() error
ValidateBasic runs basic stateless validity checks
type DelegationDelegatorReward ¶
type DelegationDelegatorReward struct { ValidatorAddress sdk.ValAddress `json:"validator_address" yaml:"validator_address"` Reward sdk.DecCoins `json:"reward" yaml:"reward"` }
DelegationDelegatorReward defines the properties of a delegator's delegation reward.
func NewDelegationDelegatorReward ¶
func NewDelegationDelegatorReward(valAddr sdk.ValAddress, reward sdk.DecCoins) DelegationDelegatorReward
NewDelegationDelegatorReward constructs a DelegationDelegatorReward.
type DelegatorStartingInfo ¶
type DelegatorStartingInfo struct { PreviousPeriod uint64 `json:"previous_period" yaml:"previous_period"` // period at which the delegation should withdraw starting from Stake sdk.Dec `json:"stake" yaml:"stake"` // amount of staking token delegated Height uint64 `json:"creation_height" yaml:"creation_height"` // height at which delegation was created }
starting info for a delegator reward period tracks the previous validator period, the delegation's amount of staking token, and the creation height (to check later on if any slashes have occurred) NOTE that even though validators are slashed to whole staking tokens, the delegators within the validator may be left with less than a full token, thus sdk.Dec is used
func NewDelegatorStartingInfo ¶
func NewDelegatorStartingInfo(previousPeriod uint64, stake sdk.Dec, height uint64) DelegatorStartingInfo
create a new DelegatorStartingInfo
type DelegatorStartingInfoRecord ¶
type DelegatorStartingInfoRecord struct { DelegatorAddress sdk.AccAddress `json:"delegator_address" yaml:"delegator_address"` ValidatorAddress sdk.ValAddress `json:"validator_address" yaml:"validator_address"` StartingInfo DelegatorStartingInfo `json:"starting_info" yaml:"starting_info"` }
used for import / export via genesis json
type DelegatorWithdrawInfo ¶
type DelegatorWithdrawInfo struct { DelegatorAddress sdk.AccAddress `json:"delegator_address" yaml:"delegator_address"` WithdrawAddress sdk.AccAddress `json:"withdraw_address" yaml:"withdraw_address"` }
the address for where distributions rewards are withdrawn to by default this struct is only used at genesis to feed in default withdraw addresses
type FeePool ¶
type FeePool struct {
CommunityPool sdk.DecCoins `json:"community_pool" yaml:"community_pool"` // pool for community funds yet to be spent
}
global fee pool for distribution
func (FeePool) ValidateGenesis ¶
ValidateGenesis validates the fee pool for a genesis state
type GenesisState ¶
type GenesisState struct { Params Params `json:"params" yaml:"params"` FeePool FeePool `json:"fee_pool" yaml:"fee_pool"` DelegatorWithdrawInfos []DelegatorWithdrawInfo `json:"delegator_withdraw_infos" yaml:"delegator_withdraw_infos"` PreviousProposer sdk.ConsAddress `json:"previous_proposer" yaml:"previous_proposer"` OutstandingRewards []ValidatorOutstandingRewardsRecord `json:"outstanding_rewards" yaml:"outstanding_rewards"` ValidatorAccumulatedCommissions []ValidatorAccumulatedCommissionRecord `json:"validator_accumulated_commissions" yaml:"validator_accumulated_commissions"` ValidatorHistoricalRewards []ValidatorHistoricalRewardsRecord `json:"validator_historical_rewards" yaml:"validator_historical_rewards"` ValidatorCurrentRewards []ValidatorCurrentRewardsRecord `json:"validator_current_rewards" yaml:"validator_current_rewards"` DelegatorStartingInfos []DelegatorStartingInfoRecord `json:"delegator_starting_infos" yaml:"delegator_starting_infos"` ValidatorSlashEvents []ValidatorSlashEventRecord `json:"validator_slash_events" yaml:"validator_slash_events"` }
GenesisState - all distribution state that must be provided at genesis
func DefaultGenesisState ¶
func DefaultGenesisState() GenesisState
get raw genesis raw message for testing
func NewGenesisState ¶
func NewGenesisState( params Params, fp FeePool, dwis []DelegatorWithdrawInfo, pp sdk.ConsAddress, r []ValidatorOutstandingRewardsRecord, acc []ValidatorAccumulatedCommissionRecord, historical []ValidatorHistoricalRewardsRecord, cur []ValidatorCurrentRewardsRecord, dels []DelegatorStartingInfoRecord, slashes []ValidatorSlashEventRecord, ) GenesisState
type MsgFundCommunityPool ¶
type MsgFundCommunityPool struct { Amount sdk.Coins `json:"amount" yaml:"amount"` Depositor sdk.AccAddress `json:"depositor" yaml:"depositor"` }
MsgFundCommunityPool defines a Msg type that allows an account to directly fund the community pool.
func NewMsgFundCommunityPool ¶
func NewMsgFundCommunityPool(amount sdk.Coins, depositor sdk.AccAddress) MsgFundCommunityPool
NewMsgFundCommunityPool returns a new MsgFundCommunityPool with a sender and a funding amount.
func (MsgFundCommunityPool) GetSignBytes ¶
func (msg MsgFundCommunityPool) GetSignBytes() []byte
GetSignBytes returns the raw bytes for a MsgFundCommunityPool message that the expected signer needs to sign.
func (MsgFundCommunityPool) GetSigners ¶
func (msg MsgFundCommunityPool) GetSigners() []sdk.AccAddress
GetSigners returns the signer addresses that are expected to sign the result of GetSignBytes.
func (MsgFundCommunityPool) Route ¶
func (msg MsgFundCommunityPool) Route() string
Route returns the MsgFundCommunityPool message route.
func (MsgFundCommunityPool) Type ¶
func (msg MsgFundCommunityPool) Type() string
Type returns the MsgFundCommunityPool message type.
func (MsgFundCommunityPool) ValidateBasic ¶
func (msg MsgFundCommunityPool) ValidateBasic() error
ValidateBasic performs basic MsgFundCommunityPool message validation.
type MsgSetWithdrawAddress ¶
type MsgSetWithdrawAddress struct { DelegatorAddress sdk.AccAddress `json:"delegator_address" yaml:"delegator_address"` WithdrawAddress sdk.AccAddress `json:"withdraw_address" yaml:"withdraw_address"` }
msg struct for changing the withdraw address for a delegator (or validator self-delegation)
func NewMsgSetWithdrawAddress ¶
func NewMsgSetWithdrawAddress(delAddr, withdrawAddr sdk.AccAddress) MsgSetWithdrawAddress
func (MsgSetWithdrawAddress) GetSignBytes ¶
func (msg MsgSetWithdrawAddress) GetSignBytes() []byte
get the bytes for the message signer to sign on
func (MsgSetWithdrawAddress) GetSigners ¶
func (msg MsgSetWithdrawAddress) GetSigners() []sdk.AccAddress
Return address that must sign over msg.GetSignBytes()
func (MsgSetWithdrawAddress) Route ¶
func (msg MsgSetWithdrawAddress) Route() string
func (MsgSetWithdrawAddress) Type ¶
func (msg MsgSetWithdrawAddress) Type() string
func (MsgSetWithdrawAddress) ValidateBasic ¶
func (msg MsgSetWithdrawAddress) ValidateBasic() error
quick validity check
type MsgWithdrawDelegatorReward ¶
type MsgWithdrawDelegatorReward struct { DelegatorAddress sdk.AccAddress `json:"delegator_address" yaml:"delegator_address"` ValidatorAddress sdk.ValAddress `json:"validator_address" yaml:"validator_address"` }
msg struct for delegation withdraw from a single validator
func NewMsgWithdrawDelegatorReward ¶
func NewMsgWithdrawDelegatorReward(delAddr sdk.AccAddress, valAddr sdk.ValAddress) MsgWithdrawDelegatorReward
func (MsgWithdrawDelegatorReward) GetSignBytes ¶
func (msg MsgWithdrawDelegatorReward) GetSignBytes() []byte
get the bytes for the message signer to sign on
func (MsgWithdrawDelegatorReward) GetSigners ¶
func (msg MsgWithdrawDelegatorReward) GetSigners() []sdk.AccAddress
Return address that must sign over msg.GetSignBytes()
func (MsgWithdrawDelegatorReward) Route ¶
func (msg MsgWithdrawDelegatorReward) Route() string
func (MsgWithdrawDelegatorReward) Type ¶
func (msg MsgWithdrawDelegatorReward) Type() string
func (MsgWithdrawDelegatorReward) ValidateBasic ¶
func (msg MsgWithdrawDelegatorReward) ValidateBasic() error
quick validity check
type MsgWithdrawValidatorCommission ¶
type MsgWithdrawValidatorCommission struct {
ValidatorAddress sdk.ValAddress `json:"validator_address" yaml:"validator_address"`
}
msg struct for validator withdraw
func NewMsgWithdrawValidatorCommission ¶
func NewMsgWithdrawValidatorCommission(valAddr sdk.ValAddress) MsgWithdrawValidatorCommission
func (MsgWithdrawValidatorCommission) GetSignBytes ¶
func (msg MsgWithdrawValidatorCommission) GetSignBytes() []byte
get the bytes for the message signer to sign on
func (MsgWithdrawValidatorCommission) GetSigners ¶
func (msg MsgWithdrawValidatorCommission) GetSigners() []sdk.AccAddress
Return address that must sign over msg.GetSignBytes()
func (MsgWithdrawValidatorCommission) Route ¶
func (msg MsgWithdrawValidatorCommission) Route() string
func (MsgWithdrawValidatorCommission) Type ¶
func (msg MsgWithdrawValidatorCommission) Type() string
func (MsgWithdrawValidatorCommission) ValidateBasic ¶
func (msg MsgWithdrawValidatorCommission) ValidateBasic() error
quick validity check
type Params ¶
type Params struct { CommunityTax sdk.Dec `json:"community_tax" yaml:"community_tax"` BaseProposerReward sdk.Dec `json:"base_proposer_reward" yaml:"base_proposer_reward"` BonusProposerReward sdk.Dec `json:"bonus_proposer_reward" yaml:"bonus_proposer_reward"` WithdrawAddrEnabled bool `json:"withdraw_addr_enabled" yaml:"withdraw_addr_enabled"` }
Params defines the set of distribution parameters.
func DefaultParams ¶
func DefaultParams() Params
DefaultParams returns default distribution parameters
func (*Params) ParamSetPairs ¶
func (p *Params) ParamSetPairs() params.ParamSetPairs
ParamSetPairs returns the parameter set pairs.
func (Params) ValidateBasic ¶
ValidateBasic performs basic validation on distribution parameters.
type QueryDelegationRewardsParams ¶
type QueryDelegationRewardsParams struct { DelegatorAddress sdk.AccAddress `json:"delegator_address" yaml:"delegator_address"` ValidatorAddress sdk.ValAddress `json:"validator_address" yaml:"validator_address"` }
params for query 'custom/distr/delegation_rewards'
func NewQueryDelegationRewardsParams ¶
func NewQueryDelegationRewardsParams(delegatorAddr sdk.AccAddress, validatorAddr sdk.ValAddress) QueryDelegationRewardsParams
creates a new instance of QueryDelegationRewardsParams
type QueryDelegatorParams ¶
type QueryDelegatorParams struct {
DelegatorAddress sdk.AccAddress `json:"delegator_address" yaml:"delegator_address"`
}
params for query 'custom/distr/delegator_total_rewards' and 'custom/distr/delegator_validators'
func NewQueryDelegatorParams ¶
func NewQueryDelegatorParams(delegatorAddr sdk.AccAddress) QueryDelegatorParams
creates a new instance of QueryDelegationRewardsParams
type QueryDelegatorTotalRewardsResponse ¶
type QueryDelegatorTotalRewardsResponse struct { Rewards []DelegationDelegatorReward `json:"rewards" yaml:"rewards"` Total sdk.DecCoins `json:"total" yaml:"total"` }
QueryDelegatorTotalRewardsResponse defines the properties of QueryDelegatorTotalRewards query's response.
func NewQueryDelegatorTotalRewardsResponse ¶
func NewQueryDelegatorTotalRewardsResponse(rewards []DelegationDelegatorReward, total sdk.DecCoins) QueryDelegatorTotalRewardsResponse
NewQueryDelegatorTotalRewardsResponse constructs a QueryDelegatorTotalRewardsResponse
func (QueryDelegatorTotalRewardsResponse) String ¶
func (res QueryDelegatorTotalRewardsResponse) String() string
type QueryDelegatorWithdrawAddrParams ¶
type QueryDelegatorWithdrawAddrParams struct {
DelegatorAddress sdk.AccAddress `json:"delegator_address" yaml:"delegator_address"`
}
params for query 'custom/distr/withdraw_addr'
func NewQueryDelegatorWithdrawAddrParams ¶
func NewQueryDelegatorWithdrawAddrParams(delegatorAddr sdk.AccAddress) QueryDelegatorWithdrawAddrParams
NewQueryDelegatorWithdrawAddrParams creates a new instance of QueryDelegatorWithdrawAddrParams.
type QueryValidatorCommissionParams ¶
type QueryValidatorCommissionParams struct {
ValidatorAddress sdk.ValAddress `json:"validator_address" yaml:"validator_address"`
}
params for query 'custom/distr/validator_commission'
func NewQueryValidatorCommissionParams ¶
func NewQueryValidatorCommissionParams(validatorAddr sdk.ValAddress) QueryValidatorCommissionParams
creates a new instance of QueryValidatorCommissionParams
type QueryValidatorOutstandingRewardsParams ¶
type QueryValidatorOutstandingRewardsParams struct {
ValidatorAddress sdk.ValAddress `json:"validator_address" yaml:"validator_address"`
}
params for query 'custom/distr/validator_outstanding_rewards'
func NewQueryValidatorOutstandingRewardsParams ¶
func NewQueryValidatorOutstandingRewardsParams(validatorAddr sdk.ValAddress) QueryValidatorOutstandingRewardsParams
creates a new instance of QueryValidatorOutstandingRewardsParams
type QueryValidatorSlashesParams ¶
type QueryValidatorSlashesParams struct { ValidatorAddress sdk.ValAddress `json:"validator_address" yaml:"validator_address"` StartingHeight uint64 `json:"starting_height" yaml:"starting_height"` EndingHeight uint64 `json:"ending_height" yaml:"ending_height"` }
params for query 'custom/distr/validator_slashes'
func NewQueryValidatorSlashesParams ¶
func NewQueryValidatorSlashesParams(validatorAddr sdk.ValAddress, startingHeight uint64, endingHeight uint64) QueryValidatorSlashesParams
creates a new instance of QueryValidatorSlashesParams
type StakingHooks ¶
type StakingHooks interface { AfterValidatorCreated(ctx sdk.Context, valAddr sdk.ValAddress) // Must be called when a validator is created AfterValidatorRemoved(ctx sdk.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress) // Must be called when a validator is deleted BeforeDelegationCreated(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) // Must be called when a delegation is created AfterDelegationModified(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) BeforeValidatorSlashed(ctx sdk.Context, valAddr sdk.ValAddress, fraction sdk.Dec) }
StakingHooks event hooks for staking validator object (noalias)
type StakingKeeper ¶
type StakingKeeper interface { // iterate through validators by operator address, execute func for each validator IterateValidators(sdk.Context, func(index int64, validator stakingexported.ValidatorI) (stop bool)) // iterate through bonded validators by operator address, execute func for each validator IterateBondedValidatorsByPower(sdk.Context, func(index int64, validator stakingexported.ValidatorI) (stop bool)) // iterate through the consensus validator set of the last block by operator address, execute func for each validator IterateLastValidators(sdk.Context, func(index int64, validator stakingexported.ValidatorI) (stop bool)) Validator(sdk.Context, sdk.ValAddress) stakingexported.ValidatorI // get a particular validator by operator address ValidatorByConsAddr(sdk.Context, sdk.ConsAddress) stakingexported.ValidatorI // get a particular validator by consensus address // slash the validator and delegators of the validator, specifying offence height, offence power, and slash fraction Slash(sdk.Context, sdk.ConsAddress, int64, int64, sdk.Dec) Jail(sdk.Context, sdk.ConsAddress) // jail a validator Unjail(sdk.Context, sdk.ConsAddress) // unjail a validator // Delegation allows for getting a particular delegation for a given validator // and delegator outside the scope of the staking module. Delegation(sdk.Context, sdk.AccAddress, sdk.ValAddress) stakingexported.DelegationI // MaxValidators returns the maximum amount of bonded validators MaxValidators(sdk.Context) uint16 IterateDelegations(ctx sdk.Context, delegator sdk.AccAddress, fn func(index int64, delegation stakingexported.DelegationI) (stop bool)) GetLastTotalPower(ctx sdk.Context) sdk.Int GetLastValidatorPower(ctx sdk.Context, valAddr sdk.ValAddress) int64 GetAllSDKDelegations(ctx sdk.Context) []staking.Delegation }
StakingKeeper expected staking keeper (noalias)
type SupplyKeeper ¶ added in v0.36.0
type SupplyKeeper interface { GetModuleAddress(name string) sdk.AccAddress GetModuleAccount(ctx sdk.Context, name string) supplyexported.ModuleAccountI // TODO remove with genesis 2-phases refactor https://github.com/cosmos/cosmos-sdk/issues/2862 SetModuleAccount(sdk.Context, supplyexported.ModuleAccountI) SendCoinsFromModuleToModule(ctx sdk.Context, senderModule string, recipientModule string, amt sdk.Coins) error SendCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error SendCoinsFromAccountToModule(ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error }
SupplyKeeper defines the expected supply Keeper (noalias)
type ValidatorAccumulatedCommission ¶
accumulated commission for a validator kept as a running counter, can be withdrawn at any time
func InitialValidatorAccumulatedCommission ¶
func InitialValidatorAccumulatedCommission() ValidatorAccumulatedCommission
return the initial accumulated commission (zero)
type ValidatorAccumulatedCommissionRecord ¶
type ValidatorAccumulatedCommissionRecord struct { ValidatorAddress sdk.ValAddress `json:"validator_address" yaml:"validator_address"` Accumulated ValidatorAccumulatedCommission `json:"accumulated" yaml:"accumulated"` }
used for import / export via genesis json
type ValidatorCurrentRewards ¶
type ValidatorCurrentRewards struct { Rewards sdk.DecCoins `json:"rewards" yaml:"rewards"` // current rewards Period uint64 `json:"period" yaml:"period"` // current period }
current rewards and current period for a validator kept as a running counter and incremented each block as long as the validator's tokens remain constant
func NewValidatorCurrentRewards ¶
func NewValidatorCurrentRewards(rewards sdk.DecCoins, period uint64) ValidatorCurrentRewards
create a new ValidatorCurrentRewards
type ValidatorCurrentRewardsRecord ¶
type ValidatorCurrentRewardsRecord struct { ValidatorAddress sdk.ValAddress `json:"validator_address" yaml:"validator_address"` Rewards ValidatorCurrentRewards `json:"rewards" yaml:"rewards"` }
used for import / export via genesis json
type ValidatorHistoricalRewards ¶
type ValidatorHistoricalRewards struct { CumulativeRewardRatio sdk.DecCoins `json:"cumulative_reward_ratio" yaml:"cumulative_reward_ratio"` ReferenceCount uint16 `json:"reference_count" yaml:"reference_count"` }
historical rewards for a validator height is implicit within the store key cumulative reward ratio is the sum from the zeroeth period until this period of rewards / tokens, per the spec The reference count indicates the number of objects which might need to reference this historical entry at any point. ReferenceCount =
number of outstanding delegations which ended the associated period (and might need to read that record) + number of slashes which ended the associated period (and might need to read that record) + one per validator for the zeroeth period, set on initialization
func NewValidatorHistoricalRewards ¶
func NewValidatorHistoricalRewards(cumulativeRewardRatio sdk.DecCoins, referenceCount uint16) ValidatorHistoricalRewards
create a new ValidatorHistoricalRewards
type ValidatorHistoricalRewardsRecord ¶
type ValidatorHistoricalRewardsRecord struct { ValidatorAddress sdk.ValAddress `json:"validator_address" yaml:"validator_address"` Period uint64 `json:"period" yaml:"period"` Rewards ValidatorHistoricalRewards `json:"rewards" yaml:"rewards"` }
used for import / export via genesis json
type ValidatorOutstandingRewards ¶
outstanding (un-withdrawn) rewards for a validator inexpensive to track, allows simple sanity checks
type ValidatorOutstandingRewardsRecord ¶
type ValidatorOutstandingRewardsRecord struct { ValidatorAddress sdk.ValAddress `json:"validator_address" yaml:"validator_address"` OutstandingRewards sdk.DecCoins `json:"outstanding_rewards" yaml:"outstanding_rewards"` }
used for import/export via genesis json
type ValidatorSlashEvent ¶
type ValidatorSlashEvent struct { ValidatorPeriod uint64 `json:"validator_period" yaml:"validator_period"` // period when the slash occurred Fraction sdk.Dec `json:"fraction" yaml:"fraction"` // slash fraction }
validator slash event height is implicit within the store key needed to calculate appropriate amounts of staking token for delegations which withdraw after a slash has occurred
func NewValidatorSlashEvent ¶
func NewValidatorSlashEvent(validatorPeriod uint64, fraction sdk.Dec) ValidatorSlashEvent
create a new ValidatorSlashEvent
func (ValidatorSlashEvent) String ¶
func (vs ValidatorSlashEvent) String() string
type ValidatorSlashEventRecord ¶
type ValidatorSlashEventRecord struct { ValidatorAddress sdk.ValAddress `json:"validator_address" yaml:"validator_address"` Height uint64 `json:"height" yaml:"height"` Period uint64 `json:"period" yaml:"period"` Event ValidatorSlashEvent `json:"validator_slash_event" yaml:"validator_slash_event"` }
used for import / export via genesis json
type ValidatorSlashEvents ¶
type ValidatorSlashEvents []ValidatorSlashEvent
ValidatorSlashEvents is a collection of ValidatorSlashEvent
func (ValidatorSlashEvents) String ¶
func (vs ValidatorSlashEvents) String() string