distribution

package
v1.0.0-playground Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2020 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Overview

Package distribution implements a Cosmos SDK module, that provides an implementation of the F1 fee distribution algorithm. It handles reward tracking, allocation, and distribution. Please refer to the specification under /spec for further information.

Index

Constants

View Source
const (
	ModuleName                       = types.ModuleName
	StoreKey                         = types.StoreKey
	RouterKey                        = types.RouterKey
	QuerierRoute                     = types.QuerierRoute
	ProposalTypeCommunityPoolSpend   = types.ProposalTypeCommunityPoolSpend
	QueryParams                      = types.QueryParams
	QueryValidatorOutstandingRewards = types.QueryValidatorOutstandingRewards
	QueryValidatorCommission         = types.QueryValidatorCommission
	QueryValidatorSlashes            = types.QueryValidatorSlashes
	QueryDelegationRewards           = types.QueryDelegationRewards
	QueryDelegatorTotalRewards       = types.QueryDelegatorTotalRewards
	QueryDelegatorValidators         = types.QueryDelegatorValidators
	QueryWithdrawAddr                = types.QueryWithdrawAddr
	QueryCommunityPool               = types.QueryCommunityPool
	DefaultParamspace                = types.DefaultParamspace
	TypeMsgFundCommunityPool         = types.TypeMsgFundCommunityPool
)

Variables

View Source
var (
	// functions aliases
	RegisterInvariants                         = keeper.RegisterInvariants
	AllInvariants                              = keeper.AllInvariants
	NonNegativeOutstandingInvariant            = keeper.NonNegativeOutstandingInvariant
	CanWithdrawInvariant                       = keeper.CanWithdrawInvariant
	ReferenceCountInvariant                    = keeper.ReferenceCountInvariant
	ModuleAccountInvariant                     = keeper.ModuleAccountInvariant
	NewKeeper                                  = keeper.NewKeeper
	GetValidatorOutstandingRewardsAddress      = types.GetValidatorOutstandingRewardsAddress
	GetDelegatorWithdrawInfoAddress            = types.GetDelegatorWithdrawInfoAddress
	GetDelegatorStartingInfoAddresses          = types.GetDelegatorStartingInfoAddresses
	GetValidatorHistoricalRewardsAddressPeriod = types.GetValidatorHistoricalRewardsAddressPeriod
	GetValidatorCurrentRewardsAddress          = types.GetValidatorCurrentRewardsAddress
	GetValidatorAccumulatedCommissionAddress   = types.GetValidatorAccumulatedCommissionAddress
	GetValidatorSlashEventAddressHeight        = types.GetValidatorSlashEventAddressHeight
	GetValidatorOutstandingRewardsKey          = types.GetValidatorOutstandingRewardsKey
	GetDelegatorWithdrawAddrKey                = types.GetDelegatorWithdrawAddrKey
	GetDelegatorStartingInfoKey                = types.GetDelegatorStartingInfoKey
	GetValidatorHistoricalRewardsPrefix        = types.GetValidatorHistoricalRewardsPrefix
	GetValidatorHistoricalRewardsKey           = types.GetValidatorHistoricalRewardsKey
	GetValidatorCurrentRewardsKey              = types.GetValidatorCurrentRewardsKey
	GetValidatorAccumulatedCommissionKey       = types.GetValidatorAccumulatedCommissionKey
	GetValidatorSlashEventPrefix               = types.GetValidatorSlashEventPrefix
	GetValidatorSlashEventKeyPrefix            = types.GetValidatorSlashEventKeyPrefix
	GetValidatorSlashEventKey                  = types.GetValidatorSlashEventKey
	HandleCommunityPoolSpendProposal           = keeper.HandleCommunityPoolSpendProposal
	NewQuerier                                 = keeper.NewQuerier
	ParamKeyTable                              = types.ParamKeyTable
	DefaultParams                              = types.DefaultParams
	RegisterCodec                              = types.RegisterCodec
	NewDelegatorStartingInfo                   = types.NewDelegatorStartingInfo
	ErrEmptyDelegatorAddr                      = types.ErrEmptyDelegatorAddr
	ErrEmptyWithdrawAddr                       = types.ErrEmptyWithdrawAddr
	ErrEmptyValidatorAddr                      = types.ErrEmptyValidatorAddr
	ErrEmptyDelegationDistInfo                 = types.ErrEmptyDelegationDistInfo
	ErrNoValidatorDistInfo                     = types.ErrNoValidatorDistInfo
	ErrNoValidatorExists                       = types.ErrNoValidatorExists
	ErrNoDelegationExists                      = types.ErrNoDelegationExists
	ErrNoValidatorCommission                   = types.ErrNoValidatorCommission
	ErrSetWithdrawAddrDisabled                 = types.ErrSetWithdrawAddrDisabled
	ErrBadDistribution                         = types.ErrBadDistribution
	ErrInvalidProposalAmount                   = types.ErrInvalidProposalAmount
	ErrEmptyProposalRecipient                  = types.ErrEmptyProposalRecipient
	InitialFeePool                             = types.InitialFeePool
	NewGenesisState                            = types.NewGenesisState
	DefaultGenesisState                        = types.DefaultGenesisState
	ValidateGenesis                            = types.ValidateGenesis
	NewMsgSetWithdrawAddress                   = types.NewMsgSetWithdrawAddress
	NewMsgWithdrawDelegatorReward              = types.NewMsgWithdrawDelegatorReward
	NewMsgWithdrawValidatorCommission          = types.NewMsgWithdrawValidatorCommission
	MsgFundCommunityPool                       = types.NewMsgFundCommunityPool
	NewCommunityPoolSpendProposal              = types.NewCommunityPoolSpendProposal
	NewQueryValidatorOutstandingRewardsParams  = types.NewQueryValidatorOutstandingRewardsParams
	NewQueryValidatorCommissionParams          = types.NewQueryValidatorCommissionParams
	NewQueryValidatorSlashesParams             = types.NewQueryValidatorSlashesParams
	NewQueryDelegationRewardsParams            = types.NewQueryDelegationRewardsParams
	NewQueryDelegatorParams                    = types.NewQueryDelegatorParams
	NewQueryDelegatorWithdrawAddrParams        = types.NewQueryDelegatorWithdrawAddrParams
	NewQueryDelegatorTotalRewardsResponse      = types.NewQueryDelegatorTotalRewardsResponse
	NewDelegationDelegatorReward               = types.NewDelegationDelegatorReward
	NewValidatorHistoricalRewards              = types.NewValidatorHistoricalRewards
	NewValidatorCurrentRewards                 = types.NewValidatorCurrentRewards
	InitialValidatorAccumulatedCommission      = types.InitialValidatorAccumulatedCommission
	NewValidatorSlashEvent                     = types.NewValidatorSlashEvent

	// variable aliases
	FeePoolKey                           = types.FeePoolKey
	ProposerKey                          = types.ProposerKey
	ValidatorOutstandingRewardsPrefix    = types.ValidatorOutstandingRewardsPrefix
	DelegatorWithdrawAddrPrefix          = types.DelegatorWithdrawAddrPrefix
	DelegatorStartingInfoPrefix          = types.DelegatorStartingInfoPrefix
	ValidatorHistoricalRewardsPrefix     = types.ValidatorHistoricalRewardsPrefix
	ValidatorCurrentRewardsPrefix        = types.ValidatorCurrentRewardsPrefix
	ValidatorAccumulatedCommissionPrefix = types.ValidatorAccumulatedCommissionPrefix
	ValidatorSlashEventPrefix            = types.ValidatorSlashEventPrefix
	ParamStoreKeyCommunityTax            = types.ParamStoreKeyCommunityTax
	ParamStoreKeyBaseProposerReward      = types.ParamStoreKeyBaseProposerReward
	ParamStoreKeyBonusProposerReward     = types.ParamStoreKeyBonusProposerReward
	ParamStoreKeyWithdrawAddrEnabled     = types.ParamStoreKeyWithdrawAddrEnabled
	ModuleCdc                            = types.ModuleCdc
	EventTypeSetWithdrawAddress          = types.EventTypeSetWithdrawAddress
	EventTypeRewards                     = types.EventTypeRewards
	EventTypeCommission                  = types.EventTypeCommission
	EventTypeWithdrawRewards             = types.EventTypeWithdrawRewards
	EventTypeWithdrawCommission          = types.EventTypeWithdrawCommission
	EventTypeProposerReward              = types.EventTypeProposerReward
	AttributeKeyWithdrawAddress          = types.AttributeKeyWithdrawAddress
	AttributeKeyValidator                = types.AttributeKeyValidator
	AttributeValueCategory               = types.AttributeValueCategory
	ProposalHandler                      = client.ProposalHandler
)

Functions

func BeginBlocker added in v0.25.0

func BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock, k keeper.Keeper)

BeginBlocker sets the proposer for determining distribution during endblock and distribute rewards for the previous block

func ExportGenesis added in v0.26.0

func ExportGenesis(ctx sdk.Context, keeper Keeper) types.GenesisState

ExportGenesis returns a GenesisState for a given context and keeper.

func InitGenesis added in v0.25.0

func InitGenesis(ctx sdk.Context, ak types.AccountKeeper, bk types.BankKeeper, keeper Keeper, data types.GenesisState)

InitGenesis sets distribution information for genesis

func NewCommunityPoolSpendProposalHandler added in v1.0.0

func NewCommunityPoolSpendProposalHandler(k Keeper) govtypes.Handler

func NewHandler added in v0.25.0

func NewHandler(k keeper.Keeper) sdk.Handler

Types

type AppModule added in v1.0.0

type AppModule struct {
	AppModuleBasic
	// contains filtered or unexported fields
}

AppModule implements an application module for the distribution module.

func NewAppModule added in v1.0.0

func NewAppModule(
	cdc codec.Marshaler, keeper Keeper, accountKeeper types.AccountKeeper,
	bankKeeper types.BankKeeper, stakingKeeper stakingkeeper.Keeper,
) AppModule

NewAppModule creates a new AppModule object

func (AppModule) BeginBlock added in v1.0.0

func (am AppModule) BeginBlock(ctx sdk.Context, req abci.RequestBeginBlock)

BeginBlock returns the begin blocker for the distribution module.

func (AppModule) EndBlock added in v1.0.0

EndBlock returns the end blocker for the distribution module. It returns no validator updates.

func (AppModule) ExportGenesis added in v1.0.0

func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONMarshaler) json.RawMessage

ExportGenesis returns the exported genesis state as raw bytes for the distribution module.

func (AppModule) GenerateGenesisState added in v1.0.0

func (AppModule) GenerateGenesisState(simState *module.SimulationState)

GenerateGenesisState creates a randomized GenState of the distribution module.

func (AppModule) InitGenesis added in v1.0.0

func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONMarshaler, data json.RawMessage) []abci.ValidatorUpdate

InitGenesis performs genesis initialization for the distribution module. It returns no validator updates.

func (AppModule) Name added in v1.0.0

func (AppModule) Name() string

Name returns the distribution module's name.

func (AppModule) NewHandler added in v1.0.0

func (am AppModule) NewHandler() sdk.Handler

NewHandler returns an sdk.Handler for the distribution module.

func (AppModule) NewQuerierHandler added in v1.0.0

func (am AppModule) NewQuerierHandler() sdk.Querier

NewQuerierHandler returns the distribution module sdk.Querier.

func (AppModule) ProposalContents added in v1.0.0

func (am AppModule) ProposalContents(simState module.SimulationState) []simtypes.WeightedProposalContent

ProposalContents returns all the distribution content functions used to simulate governance proposals.

func (AppModule) QuerierRoute added in v1.0.0

func (AppModule) QuerierRoute() string

QuerierRoute returns the distribution module's querier route name.

func (AppModule) RandomizedParams added in v1.0.0

func (AppModule) RandomizedParams(r *rand.Rand) []simtypes.ParamChange

RandomizedParams creates randomized distribution param changes for the simulator.

func (AppModule) RegisterInvariants added in v1.0.0

func (am AppModule) RegisterInvariants(ir sdk.InvariantRegistry)

RegisterInvariants registers the distribution module invariants.

func (AppModule) RegisterStoreDecoder added in v1.0.0

func (am AppModule) RegisterStoreDecoder(sdr sdk.StoreDecoderRegistry)

RegisterStoreDecoder registers a decoder for distribution module's types

func (AppModule) Route added in v1.0.0

func (AppModule) Route() string

Route returns the message routing key for the distribution module.

func (AppModule) WeightedOperations added in v1.0.0

func (am AppModule) WeightedOperations(simState module.SimulationState) []simtypes.WeightedOperation

WeightedOperations returns the all the gov module operations with their respective weights.

type AppModuleBasic added in v1.0.0

type AppModuleBasic struct {
	// contains filtered or unexported fields
}

AppModuleBasic defines the basic application module used by the distribution module.

func (AppModuleBasic) DefaultGenesis added in v1.0.0

func (AppModuleBasic) DefaultGenesis(cdc codec.JSONMarshaler) json.RawMessage

DefaultGenesis returns default genesis state as raw bytes for the distribution module.

func (AppModuleBasic) GetQueryCmd added in v1.0.0

func (AppModuleBasic) GetQueryCmd(cdc *codec.Codec) *cobra.Command

GetQueryCmd returns the root query command for the distribution module.

func (AppModuleBasic) GetTxCmd added in v1.0.0

func (AppModuleBasic) GetTxCmd(cdc *codec.Codec) *cobra.Command

GetTxCmd returns the root tx command for the distribution module.

func (AppModuleBasic) Name added in v1.0.0

func (AppModuleBasic) Name() string

Name returns the distribution module's name.

func (AppModuleBasic) RegisterCodec added in v1.0.0

func (AppModuleBasic) RegisterCodec(cdc *codec.Codec)

RegisterCodec registers the distribution module's types for the given codec.

func (AppModuleBasic) RegisterRESTRoutes added in v1.0.0

func (AppModuleBasic) RegisterRESTRoutes(ctx context.CLIContext, rtr *mux.Router)

RegisterRESTRoutes registers the REST routes for the distribution module.

func (AppModuleBasic) ValidateGenesis added in v1.0.0

func (AppModuleBasic) ValidateGenesis(cdc codec.JSONMarshaler, bz json.RawMessage) error

ValidateGenesis performs genesis state validation for the distribution module.

type CommunityPoolSpendProposal added in v1.0.0

type CommunityPoolSpendProposal = types.CommunityPoolSpendProposal

type DelegationDelegatorReward added in v1.0.0

type DelegationDelegatorReward = types.DelegationDelegatorReward

type DelegatorStartingInfo added in v1.0.0

type DelegatorStartingInfo = types.DelegatorStartingInfo

type DelegatorStartingInfoRecord added in v1.0.0

type DelegatorStartingInfoRecord = types.DelegatorStartingInfoRecord

type DelegatorWithdrawInfo added in v0.25.0

type DelegatorWithdrawInfo = types.DelegatorWithdrawInfo

type FeePool added in v0.25.0

type FeePool = types.FeePool

type GenesisState added in v0.25.0

type GenesisState = types.GenesisState

type Hooks added in v0.25.0

type Hooks = keeper.Hooks

type Keeper added in v0.25.0

type Keeper = keeper.Keeper

type MsgSetWithdrawAddress added in v0.25.0

type MsgSetWithdrawAddress = types.MsgSetWithdrawAddress

type MsgWithdrawDelegatorReward added in v0.25.0

type MsgWithdrawDelegatorReward = types.MsgWithdrawDelegatorReward

type MsgWithdrawValidatorCommission added in v0.30.0

type MsgWithdrawValidatorCommission = types.MsgWithdrawValidatorCommission

type Params added in v1.0.0

type Params = types.Params

type QueryDelegationRewardsParams added in v0.30.0

type QueryDelegationRewardsParams = types.QueryDelegationRewardsParams

type QueryDelegatorParams added in v1.0.0

type QueryDelegatorParams = types.QueryDelegatorParams

type QueryDelegatorTotalRewardsResponse added in v1.0.0

type QueryDelegatorTotalRewardsResponse = types.QueryDelegatorTotalRewardsResponse

type QueryDelegatorWithdrawAddrParams added in v0.31.0

type QueryDelegatorWithdrawAddrParams = types.QueryDelegatorWithdrawAddrParams

type QueryValidatorCommissionParams added in v0.30.0

type QueryValidatorCommissionParams = types.QueryValidatorCommissionParams

type QueryValidatorOutstandingRewardsParams added in v1.0.0

type QueryValidatorOutstandingRewardsParams = types.QueryValidatorOutstandingRewardsParams

type QueryValidatorSlashesParams added in v0.30.0

type QueryValidatorSlashesParams = types.QueryValidatorSlashesParams

type ValidatorAccumulatedCommission added in v1.0.0

type ValidatorAccumulatedCommission = types.ValidatorAccumulatedCommission

type ValidatorAccumulatedCommissionRecord added in v1.0.0

type ValidatorAccumulatedCommissionRecord = types.ValidatorAccumulatedCommissionRecord

type ValidatorCurrentRewards added in v1.0.0

type ValidatorCurrentRewards = types.ValidatorCurrentRewards

type ValidatorCurrentRewardsRecord added in v1.0.0

type ValidatorCurrentRewardsRecord = types.ValidatorCurrentRewardsRecord

type ValidatorHistoricalRewards added in v1.0.0

type ValidatorHistoricalRewards = types.ValidatorHistoricalRewards

type ValidatorHistoricalRewardsRecord added in v1.0.0

type ValidatorHistoricalRewardsRecord = types.ValidatorHistoricalRewardsRecord

type ValidatorOutstandingRewards added in v1.0.0

type ValidatorOutstandingRewards = types.ValidatorOutstandingRewards

type ValidatorOutstandingRewardsRecord added in v1.0.0

type ValidatorOutstandingRewardsRecord = types.ValidatorOutstandingRewardsRecord

type ValidatorSlashEvent added in v1.0.0

type ValidatorSlashEvent = types.ValidatorSlashEvent

type ValidatorSlashEventRecord added in v1.0.0

type ValidatorSlashEventRecord = types.ValidatorSlashEventRecord

type ValidatorSlashEvents added in v1.0.0

type ValidatorSlashEvents = types.ValidatorSlashEvents

Directories

Path Synopsis
cli
nolint
nolint
legacy
v0_34
DONTCOVER nolint
DONTCOVER nolint
v0_36
DONTCOVER nolint
DONTCOVER nolint
nolint
nolint

Jump to

Keyboard shortcuts

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