v18de63

package
v0.14.0-rc2 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2021 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const ModuleName = "distribution"

Variables

This section is empty.

Functions

This section is empty.

Types

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

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

type GenesisState

type GenesisState struct {
	FeePool                         FeePool                                `json:"fee_pool" yaml:"fee_pool"`
	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"`
	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

type ValidatorAccumulatedCommission

type ValidatorAccumulatedCommission = sdk.DecCoins

accumulated commission for a validator kept as a running counter, can be withdrawn at any time

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

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

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

type ValidatorOutstandingRewards = sdk.DecCoins

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

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

Jump to

Keyboard shortcuts

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