types

package
v0.0.0-...-f498596 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2023 License: Apache-2.0 Imports: 12 Imported by: 3

Documentation

Overview

nolint

nolint

nolint

nolint

Index

Constants

View Source
const (
	DefaultCodespace string = ModuleName

	CodeNilDelegatorAddr                            uint32 = 67800
	CodeNoValidatorCommission                       uint32 = 67801
	CodeSetWithdrawAddrDisabled                     uint32 = 67802
	CodeInvalidRoute                                uint32 = 67803
	CodeWithdrawValidatorRewardsAndCommissionFailed uint32 = 67804
	CodeAccAddressFromBech32Failed                  uint32 = 67805
	CodeValAddressFromBech32                        uint32 = 67806
	CodeSendCoinsFromModuleToAccountFailed          uint32 = 67807
	CodeWithdrawValidatorCommissionFailed           uint32 = 67808
	CodeUnknownDistributionMsgType                  uint32 = 67809
	CodeUnknownDistributionCommunityPoolProposaType uint32 = 67810
	CodeUnknownDistributionQueryType                uint32 = 67811
	CodeUnknownDistributionParamType                uint32 = 67812
	CodeWithdrawAddrInBlacklist                     uint32 = 67813
	CodeNilWithdrawAddr                             uint32 = 67814
	CodeNilValidatorAddr                            uint32 = 67815
	CodeBadDistribution                             uint32 = 67816
	CodeInvalidProposalAmount                       uint32 = 67817
	CodeEmptyProposalRecipient                      uint32 = 67818
)
View Source
const (
	CodeInvalidDistributionType                   uint32 = 67819
	CodeEmptyDelegationDistInfo                   uint32 = 67820
	CodeEmptyValidatorDistInfo                    uint32 = 67821
	CodeEmptyDelegationVoteValidator              uint32 = 67822
	CodeZeroDelegationShares                      uint32 = 67823
	CodeNotSupportWithdrawDelegationRewards       uint32 = 67824
	CodeNotSupportDistributionProposal            uint32 = 67825
	CodeDisabledWithdrawRewards                   uint32 = 67826
	CodeNotSupportWithdrawRewardEnabledProposal   uint32 = 67827
	CodeProposerMustBeValidator                   uint32 = 67828
	CodeNotSupportRewardTruncatePrecisionProposal uint32 = 67829
	CodeOutOfRangeRewardTruncatePrecision         uint32 = 67830
)
View Source
const (
	EventTypeSetWithdrawAddress = "set_withdraw_address"
	EventTypeCommission         = "commission"
	EventTypeWithdrawCommission = "withdraw_commission"
	EventTypeProposerReward     = "proposer_reward"

	AttributeKeyWithdrawAddress = "withdraw_address"
	AttributeKeyValidator       = "validator"

	AttributeValueCategory = ModuleName
)

distribution module event types

View Source
const (
	EventTypeRewards         = "rewards"
	EventTypeWithdrawRewards = "withdraw_rewards"
)

distribution module event types

View Source
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

	// ShortUseByCli added for fbchaincli
	ShortUseByCli = "distr"
)
View Source
const (
	// ProposalTypeChangeDistributionType defines the type for a ChangeDistributionTypeProposal
	ProposalTypeChangeDistributionType = "ChangeDistributionType"

	// ProposalTypeWithdrawRewardEnabled defines the type for a WithdrawRewardEnabledProposal
	ProposalTypeWithdrawRewardEnabled = "WithdrawRewardEnabled"

	// ProposalTypeRewardTruncatePrecision defines the type for a RewardTruncatePrecision
	ProposalTypeRewardTruncatePrecision = "RewardTruncatePrecision"
)
View Source
const (
	DistributionTypeOffChain uint32 = 0
	DistributionTypeOnChain  uint32 = 1
)
View Source
const (
	QueryParams              = "params"
	QueryValidatorCommission = "validator_commission"
	QueryWithdrawAddr        = "withdraw_addr"
	QueryCommunityPool       = "community_pool"

	ParamCommunityTax        = "community_tax"
	ParamWithdrawAddrEnabled = "withdraw_addr_enabled"
)

querier keys

View Source
const (
	QueryValidatorOutstandingRewards = "validator_outstanding_rewards"
	QueryDelegatorTotalRewards       = "delegator_total_rewards"
	QueryDelegatorValidators         = "delegator_validators"
	QueryDelegationRewards           = "delegation_rewards"

	ParamDistributionType        = "distribution_type"
	ParamWithdrawRewardEnabled   = "withdraw_reward_enabled"
	ParamRewardTruncatePrecision = "reward_truncate_precision"
)

querier keys

View Source
const (
	// default paramspace for params keeper
	DefaultParamspace = ModuleName
)
View Source
const (
	// ProposalTypeCommunityPoolSpend defines the type for a CommunityPoolSpendProposal
	ProposalTypeCommunityPoolSpend = "CommunityPoolSpend"
)

Variables

View Source
var (
	FeePoolKey                           = []byte{0x00} // key for global distribution state
	ProposerKey                          = []byte{0x01} // key for the proposer operator address
	DelegatorWithdrawAddrPrefix          = []byte{0x03} // key for delegator withdraw address
	ValidatorAccumulatedCommissionPrefix = []byte{0x07} // key for accumulated validator commission
)

Keys for distribution store Items are stored with the following key: values

- 0x01: sdk.ConsAddress

- 0x03<accAddr_Bytes>: sdk.AccAddress

- 0x07<valAddr_Bytes>: ValidatorCurrentRewards

View Source
var (
	ValidatorOutstandingRewardsPrefix       = []byte{0x02} // key for outstanding rewards
	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
	InitExistedValidatorForDistrProposalKey = []byte{0x09} // key for check init old validator distribution proposal
)
View Source
var (
	ParamStoreKeyCommunityTax            = []byte("communitytax")
	ParamStoreKeyWithdrawAddrEnabled     = []byte("withdrawaddrenabled")
	ParamStoreKeyDistributionType        = []byte("distributiontype")
	ParamStoreKeyWithdrawRewardEnabled   = []byte("withdrawrewardenabled")
	ParamStoreKeyRewardTruncatePrecision = []byte("rewardtruncateprecision")

	IgnoreInitGenesisList = [][]byte{ParamStoreKeyDistributionType, ParamStoreKeyWithdrawRewardEnabled, ParamStoreKeyRewardTruncatePrecision}
)

Parameter keys

View Source
var ModuleCdc *codec.Codec

ModuleCdc generic sealed codec to be used throughout module

Functions

func ErrBadDistribution

func ErrBadDistribution() sdk.Error

func ErrCodeDisabledWithdrawRewards

func ErrCodeDisabledWithdrawRewards() sdk.Error

func ErrCodeEmptyDelegationDistInfo

func ErrCodeEmptyDelegationDistInfo() sdk.Error

func ErrCodeEmptyDelegationVoteValidator

func ErrCodeEmptyDelegationVoteValidator() sdk.Error

func ErrCodeEmptyValidatorDistInfo

func ErrCodeEmptyValidatorDistInfo() sdk.Error

func ErrCodeNotSupportDistributionProposal

func ErrCodeNotSupportDistributionProposal() sdk.Error

func ErrCodeNotSupportRewardTruncateProposal

func ErrCodeNotSupportRewardTruncateProposal() sdk.Error

func ErrCodeNotSupportWithdrawDelegationRewards

func ErrCodeNotSupportWithdrawDelegationRewards() sdk.Error

func ErrCodeNotSupportWithdrawRewardEnabledProposal

func ErrCodeNotSupportWithdrawRewardEnabledProposal() sdk.Error

func ErrCodeProposerMustBeValidator

func ErrCodeProposerMustBeValidator() sdk.Error

func ErrCodeRewardTruncatePrecision

func ErrCodeRewardTruncatePrecision() sdk.Error

func ErrCodeZeroDelegationShares

func ErrCodeZeroDelegationShares() sdk.Error

func ErrEmptyProposalRecipient

func ErrEmptyProposalRecipient() sdk.Error

func ErrInvalidDistributionType

func ErrInvalidDistributionType() sdk.Error

func ErrInvalidProposalAmount

func ErrInvalidProposalAmount() sdk.Error

func ErrNilDelegatorAddr

func ErrNilDelegatorAddr() sdk.Error

func ErrNilValidatorAddr

func ErrNilValidatorAddr() sdk.Error

func ErrNilWithdrawAddr

func ErrNilWithdrawAddr() sdk.Error

func ErrNoValidatorCommission

func ErrNoValidatorCommission() sdk.Error

func ErrSendCoinsFromModuleToAccountFailed

func ErrSendCoinsFromModuleToAccountFailed() sdk.Error

func ErrSetWithdrawAddrDisabled

func ErrSetWithdrawAddrDisabled() sdk.Error

func ErrUnknownDistributionCommunityPoolProposaType

func ErrUnknownDistributionCommunityPoolProposaType() sdk.Error

func ErrUnknownDistributionMsgType

func ErrUnknownDistributionMsgType() sdk.Error

func ErrUnknownDistributionParamType

func ErrUnknownDistributionParamType() sdk.Error

func ErrUnknownDistributionQueryType

func ErrUnknownDistributionQueryType() sdk.Error

func ErrWithdrawAddrInblacklist

func ErrWithdrawAddrInblacklist() sdk.Error

func ErrWithdrawValidatorCommissionFailed

func ErrWithdrawValidatorCommissionFailed() sdk.Error

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

GetDelegatorWithdrawAddrKey returns the key for a delegator's withdraw addr

func GetDelegatorWithdrawInfoAddress

func GetDelegatorWithdrawInfoAddress(key []byte) (delAddr sdk.AccAddress)

GetDelegatorWithdrawInfoAddress returns an address from a delegator's withdraw info key

func GetValidatorAccumulatedCommissionAddress

func GetValidatorAccumulatedCommissionAddress(key []byte) (valAddr sdk.ValAddress)

GetValidatorAccumulatedCommissionAddress returns the address from a validator's accumulated commission key

func GetValidatorAccumulatedCommissionKey

func GetValidatorAccumulatedCommissionKey(v sdk.ValAddress) []byte

GetValidatorAccumulatedCommissionKey returns 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 ParamKeyTable

func ParamKeyTable() params.KeyTable

ParamKeyTable returns the parameter key table.

func RegisterCodec

func RegisterCodec(cdc *codec.Codec)

RegisterCodec registers concrete types on codec codec

func ValidateGenesis

func ValidateGenesis(gs GenesisState) error

ValidateGenesis validates the genesis state of distribution genesis input

Types

type ChangeDistributionTypeProposal

type ChangeDistributionTypeProposal struct {
	Title       string `json:"title" yaml:"title"`
	Description string `json:"description" yaml:"description"`
	Type        uint32 `json:"type" yaml:"type"`
}

ChangeDistributionTypeProposal

func NewChangeDistributionTypeProposal

func NewChangeDistributionTypeProposal(title, description string, distrType uint32) ChangeDistributionTypeProposal

NewChangeDistributionTypeProposal creates a new change distribution type proposal.

func (ChangeDistributionTypeProposal) GetDescription

func (cdtp ChangeDistributionTypeProposal) GetDescription() string

GetDescription returns the description of a change distribution type proposal.

func (ChangeDistributionTypeProposal) GetTitle

func (cdtp ChangeDistributionTypeProposal) GetTitle() string

GetTitle returns the title of a change distribution type proposal.

func (ChangeDistributionTypeProposal) ProposalRoute

func (cdtp ChangeDistributionTypeProposal) ProposalRoute() string

GetDescription returns the routing key of a change distribution type proposal.

func (ChangeDistributionTypeProposal) ProposalType

func (cdtp ChangeDistributionTypeProposal) ProposalType() string

ProposalType returns the type of a change distribution type proposal.

func (ChangeDistributionTypeProposal) String

func (cdtp ChangeDistributionTypeProposal) String() string

String implements the Stringer interface.

func (ChangeDistributionTypeProposal) ValidateBasic

func (cdtp ChangeDistributionTypeProposal) ValidateBasic() error

ValidateBasic runs basic stateless validity checks

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.SysCoins   `json:"amount" yaml:"amount"`
}

CommunityPoolSpendProposal spends from the community pool

func NewCommunityPoolSpendProposal

func NewCommunityPoolSpendProposal(title, description string, recipient sdk.AccAddress, amount sdk.SysCoins) 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 DelegatorWithdrawInfo

type DelegatorWithdrawInfo struct {
	DelegatorAddress sdk.AccAddress `json:"delegator_address" yaml:"delegator_address"`
	WithdrawAddress  sdk.AccAddress `json:"withdraw_address" yaml:"withdraw_address"`
}

DelegatorWithdrawInfo is 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.SysCoins `json:"community_pool" yaml:"community_pool"` // pool for community funds yet to be spent
}

FeePool is the struct of the global fee pool for distribution

func InitialFeePool

func InitialFeePool() FeePool

InitialFeePool zero fee pool

func (FeePool) ValidateGenesis

func (f FeePool) ValidateGenesis() error

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"`
	ValidatorAccumulatedCommissions []ValidatorAccumulatedCommissionRecord `json:"validator_accumulated_commissions" yaml:"validator_accumulated_commissions"`
}

GenesisState - all distribution state that must be provided at genesis

func DefaultGenesisState

func DefaultGenesisState() GenesisState

DefaultGenesisState returns default genesis

func NewGenesisState

func NewGenesisState(params Params, feePool FeePool,
	dwis []DelegatorWithdrawInfo, pp sdk.ConsAddress, acc []ValidatorAccumulatedCommissionRecord) GenesisState

NewGenesisState creates a new object of GenesisState

type GovKeeper

type GovKeeper interface {
	GetDepositParams(ctx sdk.Context) govtypes.DepositParams
	GetVotingParams(ctx sdk.Context) govtypes.VotingParams
	CheckMsgSubmitProposal(ctx sdk.Context, msg govtypes.MsgSubmitProposal) sdk.Error
}

GovKeeper defines the expected gov Keeper

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() sdk.Error

quick validity check

type MsgWithdrawDelegatorAllRewards

type MsgWithdrawDelegatorAllRewards struct {
	DelegatorAddress sdk.AccAddress `json:"delegator_address" yaml:"delegator_address"`
}

msg struct for delegation withdraw all rewards from all validator

func NewMsgWithdrawDelegatorAllRewards

func NewMsgWithdrawDelegatorAllRewards(delAddr sdk.AccAddress) MsgWithdrawDelegatorAllRewards

func (MsgWithdrawDelegatorAllRewards) GetSignBytes

func (msg MsgWithdrawDelegatorAllRewards) GetSignBytes() []byte

get the bytes for the message signer to sign on

func (MsgWithdrawDelegatorAllRewards) GetSigners

func (msg MsgWithdrawDelegatorAllRewards) GetSigners() []sdk.AccAddress

Return address that must sign over msg.GetSignBytes()

func (MsgWithdrawDelegatorAllRewards) Route

func (MsgWithdrawDelegatorAllRewards) Type

func (MsgWithdrawDelegatorAllRewards) ValidateBasic

func (msg MsgWithdrawDelegatorAllRewards) 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 (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 (MsgWithdrawValidatorCommission) Type

func (MsgWithdrawValidatorCommission) ValidateBasic

func (msg MsgWithdrawValidatorCommission) ValidateBasic() sdk.Error

quick validity check

type Params

type Params struct {
	CommunityTax            sdk.Dec `json:"community_tax" yaml:"community_tax"`
	WithdrawAddrEnabled     bool    `json:"withdraw_addr_enabled" yaml:"withdraw_addr_enabled"`
	DistributionType        uint32  `json:"distribution_type" yaml:"distribution_type"`
	WithdrawRewardEnabled   bool    `json:"withdraw_reward_enabled" yaml:"withdraw_reward_enabled"`
	RewardTruncatePrecision int64   `json:"reward_truncate_precision" yaml:"reward_truncate_precision"`
}

Params defines the set of distribution parameters.

func DefaultParams

func DefaultParams() Params

DefaultParams returns default distribution parameters

func NewParams

func NewParams(communityTax sdk.Dec, withdrawAddrEnabled bool, distributionType uint32, withdrawRewardEnabled bool, rewardTruncatePrecision int64) Params

NewParams creates a new instance of Params

func (Params) MarshalYAML

func (p Params) MarshalYAML() (interface{}, error)

MarshalYAML implements the text format for yaml marshaling

func (*Params) ParamSetPairs

func (p *Params) ParamSetPairs() params.ParamSetPairs

ParamSetPairs returns the parameter set pairs.

func (Params) String

func (p Params) String() string

String returns a human readable string representation of Params

func (Params) ValidateBasic

func (p Params) ValidateBasic() error

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

type QueryDelegatorWithdrawAddrParams

type QueryDelegatorWithdrawAddrParams struct {
	DelegatorAddress sdk.AccAddress `json:"delegator_address" yaml:"delegator_address"`
}

QueryDelegatorWithdrawAddrParams is the struct of 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"`
}

QueryValidatorCommissionParams is the struct of params for query 'custom/distr/validator_commission'

func NewQueryValidatorCommissionParams

func NewQueryValidatorCommissionParams(validatorAddr sdk.ValAddress) QueryValidatorCommissionParams

NewQueryValidatorCommissionParams 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 RewardTruncatePrecisionProposal

type RewardTruncatePrecisionProposal struct {
	Title       string `json:"title" yaml:"title"`
	Description string `json:"description" yaml:"description"`
	Precision   int64  `json:"precision" yaml:"precision"`
}

RewardTruncatePrecisionProposal

func NewRewardTruncatePrecisionProposal

func NewRewardTruncatePrecisionProposal(title, description string, precision int64) RewardTruncatePrecisionProposal

NewRewardTruncatePrecisionProposal creates a reward truncate precision proposal.

func (RewardTruncatePrecisionProposal) GetDescription

func (proposal RewardTruncatePrecisionProposal) GetDescription() string

GetDescription returns the description of a set withdraw reward enabled proposal.

func (RewardTruncatePrecisionProposal) GetTitle

func (proposal RewardTruncatePrecisionProposal) GetTitle() string

GetTitle returns the title of a set withdraw reward enabled proposal.

func (RewardTruncatePrecisionProposal) ProposalRoute

func (proposal RewardTruncatePrecisionProposal) ProposalRoute() string

GetDescription returns the routing key of a set withdraw reward enabled proposal.

func (RewardTruncatePrecisionProposal) ProposalType

func (proposal RewardTruncatePrecisionProposal) ProposalType() string

ProposalType returns the type of a set withdraw reward enabled proposal.

func (RewardTruncatePrecisionProposal) String

func (proposal RewardTruncatePrecisionProposal) String() string

String implements the Stringer interface.

func (RewardTruncatePrecisionProposal) ValidateBasic

func (proposal RewardTruncatePrecisionProposal) ValidateBasic() error

ValidateBasic runs basic stateless validity checks

type StakingHooks

type StakingHooks interface {
	// Must be called when a validator is created
	AfterValidatorCreated(ctx sdk.Context, valAddr sdk.ValAddress)
	// Must be called when a validator is deleted
	AfterValidatorRemoved(ctx sdk.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress)
	// Must be called when a delegation is created
	BeforeDelegationCreated(ctx sdk.Context, delAddr sdk.AccAddress, valAddrs []sdk.ValAddress)
	// Must be called when a delegation's shares are modified
	BeforeDelegationSharesModified(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress)
	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))

	// get a particular validator by operator address
	Validator(sdk.Context, sdk.ValAddress) stakingexported.ValidatorI
	// get a particular validator by consensus address
	ValidatorByConsAddr(sdk.Context, sdk.ConsAddress) stakingexported.ValidatorI

	Jail(sdk.Context, sdk.ConsAddress)   // jail a validator
	Unjail(sdk.Context, sdk.ConsAddress) // unjail a validator

	// MaxValidators returns the maximum amount of bonded validators
	MaxValidators(sdk.Context) uint16

	GetLastTotalPower(ctx sdk.Context) sdk.Int
	GetLastValidatorPower(ctx sdk.Context, valAddr sdk.ValAddress) int64

	Delegator(ctx sdk.Context, delAddr sdk.AccAddress) stakingexported.DelegatorI

	IsValidator(ctx sdk.Context, addr sdk.AccAddress) bool
}

StakingKeeper expected staking keeper (noalias)

type SupplyKeeper

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

type ValidatorAccumulatedCommission = sdk.SysCoins

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

func InitialValidatorAccumulatedCommission

func InitialValidatorAccumulatedCommission() ValidatorAccumulatedCommission

InitialValidatorAccumulatedCommission returns 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"`
}

ValidatorAccumulatedCommissionRecord is used for import / export via genesis json

type ValidatorCurrentRewards

type ValidatorCurrentRewards struct {
	Rewards sdk.SysCoins `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.SysCoins, period uint64) ValidatorCurrentRewards

create a new ValidatorCurrentRewards

type ValidatorHistoricalRewards

type ValidatorHistoricalRewards struct {
	CumulativeRewardRatio sdk.SysCoins `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.SysCoins, referenceCount uint16) ValidatorHistoricalRewards

create a new ValidatorHistoricalRewards

type ValidatorOutstandingRewards

type ValidatorOutstandingRewards = sdk.SysCoins

outstanding (un-withdrawn) rewards for a validator inexpensive to track, allows simple sanity checks

type WithdrawRewardEnabledProposal

type WithdrawRewardEnabledProposal struct {
	Title       string `json:"title" yaml:"title"`
	Description string `json:"description" yaml:"description"`
	Enabled     bool   `json:"enabled" yaml:"enabled"`
}

WithdrawRewardEnabledProposal

func NewWithdrawRewardEnabledProposal

func NewWithdrawRewardEnabledProposal(title, description string, enable bool) WithdrawRewardEnabledProposal

NewWithdrawRewardEnabledProposal creates a set withdraw reward enabled proposal.

func (WithdrawRewardEnabledProposal) GetDescription

func (proposal WithdrawRewardEnabledProposal) GetDescription() string

GetDescription returns the description of a set withdraw reward enabled proposal.

func (WithdrawRewardEnabledProposal) GetTitle

func (proposal WithdrawRewardEnabledProposal) GetTitle() string

GetTitle returns the title of a set withdraw reward enabled proposal.

func (WithdrawRewardEnabledProposal) ProposalRoute

func (proposal WithdrawRewardEnabledProposal) ProposalRoute() string

GetDescription returns the routing key of a set withdraw reward enabled proposal.

func (WithdrawRewardEnabledProposal) ProposalType

func (proposal WithdrawRewardEnabledProposal) ProposalType() string

ProposalType returns the type of a set withdraw reward enabled proposal.

func (WithdrawRewardEnabledProposal) String

func (proposal WithdrawRewardEnabledProposal) String() string

String implements the Stringer interface.

func (WithdrawRewardEnabledProposal) ValidateBasic

func (proposal WithdrawRewardEnabledProposal) ValidateBasic() error

ValidateBasic runs basic stateless validity checks

Jump to

Keyboard shortcuts

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