distribution

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2021 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
	MakeTestCodec                              = keeper.MakeTestCodec
	CreateTestInputDefault                     = keeper.CreateTestInputDefault
	CreateTestInputAdvanced                    = keeper.CreateTestInputAdvanced
	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

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

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

ExportGenesis returns a GenesisState for a given context and keeper.

func InitGenesis

func InitGenesis(ctx sdk.Context, keeper Keeper, supplyKeeper types.SupplyKeeper, data types.GenesisState)

InitGenesis sets distribution information for genesis

func NewCommunityPoolSpendProposalHandler

func NewCommunityPoolSpendProposalHandler(k Keeper) govtypes.Handler

func NewHandler

func NewHandler(k keeper.Keeper) sdk.Handler

Types

type AppModule

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

AppModule implements an application module for the distribution module.

func NewAppModule

func NewAppModule(keeper Keeper, accountKeeper types.AccountKeeper,
	supplyKeeper types.SupplyKeeper, stakingKeeper stakingkeeper.Keeper) AppModule

NewAppModule creates a new AppModule object

func (AppModule) BeginBlock

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

BeginBlock returns the begin blocker for the distribution module.

func (AppModule) EndBlock

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

func (AppModule) ExportGenesis

func (am AppModule) ExportGenesis(ctx sdk.Context) json.RawMessage

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

func (AppModule) GenerateGenesisState

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

GenerateGenesisState creates a randomized GenState of the distribution module.

func (AppModule) InitGenesis

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

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

func (AppModule) Name

func (AppModule) Name() string

Name returns the distribution module's name.

func (AppModule) NewHandler

func (am AppModule) NewHandler() sdk.Handler

NewHandler returns an sdk.Handler for the distribution module.

func (AppModule) NewQuerierHandler

func (am AppModule) NewQuerierHandler() sdk.Querier

NewQuerierHandler returns the distribution module sdk.Querier.

func (AppModule) ProposalContents

func (am AppModule) ProposalContents(_ module.SimulationState) []sim.WeightedProposalContent

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

func (AppModule) QuerierRoute

func (AppModule) QuerierRoute() string

QuerierRoute returns the distribution module's querier route name.

func (AppModule) RandomizedParams

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

RandomizedParams creates randomized distribution param changes for the simulator.

func (AppModule) RegisterInvariants

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

RegisterInvariants registers the distribution module invariants.

func (AppModule) RegisterStoreDecoder

func (AppModule) RegisterStoreDecoder(sdr sdk.StoreDecoderRegistry)

RegisterStoreDecoder registers a decoder for distribution module's types

func (AppModule) Route

func (AppModule) Route() string

Route returns the message routing key for the distribution module.

func (AppModule) WeightedOperations

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

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

type AppModuleBasic

type AppModuleBasic struct{}

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

func (AppModuleBasic) DefaultGenesis

func (AppModuleBasic) DefaultGenesis() json.RawMessage

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

func (AppModuleBasic) GetQueryCmd

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

GetQueryCmd returns the root query command for the distribution module.

func (AppModuleBasic) GetTxCmd

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

GetTxCmd returns the root tx command for the distribution module.

func (AppModuleBasic) Name

func (AppModuleBasic) Name() string

Name returns the distribution module's name.

func (AppModuleBasic) RegisterCodec

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

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

func (AppModuleBasic) RegisterRESTRoutes

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

RegisterRESTRoutes registers the REST routes for the distribution module.

func (AppModuleBasic) ValidateGenesis

func (AppModuleBasic) ValidateGenesis(bz json.RawMessage) error

ValidateGenesis performs genesis state validation for the distribution module.

type CommunityPoolSpendProposal

type CommunityPoolSpendProposal = types.CommunityPoolSpendProposal

type DelegationDelegatorReward

type DelegationDelegatorReward = types.DelegationDelegatorReward

type DelegatorStartingInfo

type DelegatorStartingInfo = types.DelegatorStartingInfo

type DelegatorStartingInfoRecord

type DelegatorStartingInfoRecord = types.DelegatorStartingInfoRecord

type DelegatorWithdrawInfo

type DelegatorWithdrawInfo = types.DelegatorWithdrawInfo

type FeePool

type FeePool = types.FeePool

type GenesisState

type GenesisState = types.GenesisState

type Hooks

type Hooks = keeper.Hooks

type Keeper

type Keeper = keeper.Keeper

type MsgSetWithdrawAddress

type MsgSetWithdrawAddress = types.MsgSetWithdrawAddress

type MsgWithdrawDelegatorReward

type MsgWithdrawDelegatorReward = types.MsgWithdrawDelegatorReward

type MsgWithdrawValidatorCommission

type MsgWithdrawValidatorCommission = types.MsgWithdrawValidatorCommission

type Params

type Params = types.Params

type QueryDelegationRewardsParams

type QueryDelegationRewardsParams = types.QueryDelegationRewardsParams

type QueryDelegatorParams

type QueryDelegatorParams = types.QueryDelegatorParams

type QueryDelegatorTotalRewardsResponse

type QueryDelegatorTotalRewardsResponse = types.QueryDelegatorTotalRewardsResponse

type QueryDelegatorWithdrawAddrParams

type QueryDelegatorWithdrawAddrParams = types.QueryDelegatorWithdrawAddrParams

type QueryValidatorCommissionParams

type QueryValidatorCommissionParams = types.QueryValidatorCommissionParams

type QueryValidatorOutstandingRewardsParams

type QueryValidatorOutstandingRewardsParams = types.QueryValidatorOutstandingRewardsParams

type QueryValidatorSlashesParams

type QueryValidatorSlashesParams = types.QueryValidatorSlashesParams

type ValidatorAccumulatedCommission

type ValidatorAccumulatedCommission = types.ValidatorAccumulatedCommission

type ValidatorAccumulatedCommissionRecord

type ValidatorAccumulatedCommissionRecord = types.ValidatorAccumulatedCommissionRecord

type ValidatorCurrentRewards

type ValidatorCurrentRewards = types.ValidatorCurrentRewards

type ValidatorCurrentRewardsRecord

type ValidatorCurrentRewardsRecord = types.ValidatorCurrentRewardsRecord

type ValidatorHistoricalRewards

type ValidatorHistoricalRewards = types.ValidatorHistoricalRewards

type ValidatorHistoricalRewardsRecord

type ValidatorHistoricalRewardsRecord = types.ValidatorHistoricalRewardsRecord

type ValidatorOutstandingRewards

type ValidatorOutstandingRewards = types.ValidatorOutstandingRewards

type ValidatorOutstandingRewardsRecord

type ValidatorOutstandingRewardsRecord = types.ValidatorOutstandingRewardsRecord

type ValidatorSlashEvent

type ValidatorSlashEvent = types.ValidatorSlashEvent

type ValidatorSlashEventRecord

type ValidatorSlashEventRecord = types.ValidatorSlashEventRecord

type ValidatorSlashEvents

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