types

package
v0.50.8-lsm Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2024 License: Apache-2.0 Imports: 8 Imported by: 5,423

Documentation

Index

Constants

View Source
const (
	EventTypeSubmitProposal   = "submit_proposal"
	EventTypeProposalDeposit  = "proposal_deposit"
	EventTypeProposalVote     = "proposal_vote"
	EventTypeInactiveProposal = "inactive_proposal"
	EventTypeActiveProposal   = "active_proposal"
	EventTypeCancelProposal   = "cancel_proposal"

	AttributeKeyProposalResult              = "proposal_result"
	AttributeKeyVoter                       = "voter"
	AttributeKeyOption                      = "option"
	AttributeKeyProposalID                  = "proposal_id"
	AttributeKeyDepositor                   = "depositor"
	AttributeKeyProposalMessages            = "proposal_messages" // Msg type_urls in the proposal
	AttributeKeyVotingPeriodStart           = "voting_period_start"
	AttributeKeyProposalLog                 = "proposal_log"                // log of proposal execution
	AttributeValueProposalDropped           = "proposal_dropped"            // didn't meet min deposit
	AttributeValueProposalPassed            = "proposal_passed"             // met vote quorum
	AttributeValueProposalRejected          = "proposal_rejected"           // didn't meet vote quorum
	AttributeValueExpeditedProposalRejected = "expedited_proposal_rejected" // didn't meet expedited vote quorum
	AttributeValueProposalFailed            = "proposal_failed"             // error on proposal handler
	AttributeValueProposalCanceled          = "proposal_canceled"           // error on proposal handler
	AttributeKeyProposalProposer            = "proposal_proposer"           // account address of the proposer

	AttributeKeyProposalType   = "proposal_type"
	AttributeSignalTitle       = "signal_title"
	AttributeSignalDescription = "signal_description"
)

Governance module event types

View Source
const (
	// ModuleName is the name of the module
	ModuleName = "gov"

	// StoreKey is the store key string for gov
	StoreKey = ModuleName

	// RouterKey is the message route for gov
	RouterKey = ModuleName
)

Variables

View Source
var (
	ErrInactiveProposal      = errors.Register(ModuleName, 3, "inactive proposal")
	ErrAlreadyActiveProposal = errors.Register(ModuleName, 4, "proposal already active")
	// Errors 5 & 6 are legacy errors related to v1beta1.Proposal.
	ErrInvalidProposalContent  = errors.Register(ModuleName, 5, "invalid proposal content")
	ErrInvalidProposalType     = errors.Register(ModuleName, 6, "invalid proposal type")
	ErrInvalidVote             = errors.Register(ModuleName, 7, "invalid vote option")
	ErrInvalidGenesis          = errors.Register(ModuleName, 8, "invalid genesis state")
	ErrNoProposalHandlerExists = errors.Register(ModuleName, 9, "no handler exists for proposal type")
	ErrUnroutableProposalMsg   = errors.Register(ModuleName, 10, "proposal message not recognized by router")
	ErrNoProposalMsgs          = errors.Register(ModuleName, 11, "no messages proposed")
	ErrInvalidProposalMsg      = errors.Register(ModuleName, 12, "invalid proposal message")
	ErrInvalidSigner           = errors.Register(ModuleName, 13, "expected gov account as only signer for proposal message")
	ErrMetadataTooLong         = errors.Register(ModuleName, 15, "metadata too long")
	ErrMinDepositTooSmall      = errors.Register(ModuleName, 16, "minimum deposit is too small")
	ErrInvalidProposer         = errors.Register(ModuleName, 18, "invalid proposer")
	ErrVotingPeriodEnded       = errors.Register(ModuleName, 20, "voting period already ended")
	ErrInvalidProposal         = errors.Register(ModuleName, 21, "invalid proposal")
	ErrSummaryTooLong          = errors.Register(ModuleName, 22, "summary too long")
	ErrInvalidDepositDenom     = errors.Register(ModuleName, 23, "invalid deposit denom")
)

x/gov module sentinel errors

View Source
var (
	ProposalsKeyPrefix            = collections.NewPrefix(0)  // ProposalsKeyPrefix stores the proposals raw bytes.
	ActiveProposalQueuePrefix     = collections.NewPrefix(1)  // ActiveProposalQueuePrefix stores the active proposals.
	InactiveProposalQueuePrefix   = collections.NewPrefix(2)  // InactiveProposalQueuePrefix stores the inactive proposals.
	ProposalIDKey                 = collections.NewPrefix(3)  // ProposalIDKey stores the sequence representing the next proposal ID.
	VotingPeriodProposalKeyPrefix = collections.NewPrefix(4)  // VotingPeriodProposalKeyPrefix stores which proposals are on voting period.
	DepositsKeyPrefix             = collections.NewPrefix(16) // DepositsKeyPrefix stores deposits.
	VotesKeyPrefix                = collections.NewPrefix(32) // VotesKeyPrefix stores the votes of proposals.
	ParamsKey                     = collections.NewPrefix(48) // ParamsKey stores the module's params.
	ConstitutionKey               = collections.NewPrefix(49) // ConstitutionKey stores a chain's constitution.
)

Functions

This section is empty.

Types

type AccountKeeper

type AccountKeeper interface {
	AddressCodec() addresscodec.Codec

	GetAccount(ctx context.Context, addr sdk.AccAddress) sdk.AccountI

	GetModuleAddress(name string) sdk.AccAddress
	GetModuleAccount(ctx context.Context, name string) sdk.ModuleAccountI

	// TODO remove with genesis 2-phases refactor https://github.com/cosmos/cosmos-sdk/issues/2862
	SetModuleAccount(context.Context, sdk.ModuleAccountI)
}

AccountKeeper defines the expected account keeper (noalias)

type BankKeeper

type BankKeeper interface {
	GetAllBalances(ctx context.Context, addr sdk.AccAddress) sdk.Coins
	GetBalance(ctx context.Context, addr sdk.AccAddress, denom string) sdk.Coin
	LockedCoins(ctx context.Context, addr sdk.AccAddress) sdk.Coins
	SpendableCoins(ctx context.Context, addr sdk.AccAddress) sdk.Coins

	SendCoinsFromModuleToAccount(ctx context.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error
	SendCoinsFromAccountToModule(ctx context.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error
	BurnCoins(ctx context.Context, name string, amt sdk.Coins) error
}

BankKeeper defines the expected interface needed to retrieve account balances.

type Config added in v0.46.0

type Config struct {
	// MaxMetadataLen defines the maximum proposal metadata length.
	MaxMetadataLen uint64
}

Config is a config struct used for intialising the gov module to avoid using globals.

func DefaultConfig added in v0.46.0

func DefaultConfig() Config

DefaultConfig returns the default config for gov.

type DistributionKeeper added in v0.50.1

type DistributionKeeper interface {
	FundCommunityPool(ctx context.Context, amount sdk.Coins, sender sdk.AccAddress) error
}

DistributionKeeper defines the expected distribution keeper (noalias)

type GovHooks added in v0.43.0

type GovHooks interface {
	AfterProposalSubmission(ctx context.Context, proposalID uint64) error                            // Must be called after proposal is submitted
	AfterProposalDeposit(ctx context.Context, proposalID uint64, depositorAddr sdk.AccAddress) error // Must be called after a deposit is made
	AfterProposalVote(ctx context.Context, proposalID uint64, voterAddr sdk.AccAddress) error        // Must be called after a vote on a proposal is cast
	AfterProposalFailedMinDeposit(ctx context.Context, proposalID uint64) error                      // Must be called when proposal fails to reach min deposit
	AfterProposalVotingPeriodEnded(ctx context.Context, proposalID uint64) error                     // Must be called when proposal's finishes it's voting period
}

GovHooks event hooks for governance proposal object (noalias)

type GovHooksWrapper added in v0.47.0

type GovHooksWrapper struct{ GovHooks }

func (GovHooksWrapper) IsOnePerModuleType added in v0.47.0

func (GovHooksWrapper) IsOnePerModuleType()

IsOnePerModuleType implements the depinject.OnePerModuleType interface.

type MultiGovHooks added in v0.43.0

type MultiGovHooks []GovHooks

combine multiple governance hooks, all hook functions are run in array sequence

func NewMultiGovHooks added in v0.43.0

func NewMultiGovHooks(hooks ...GovHooks) MultiGovHooks

func (MultiGovHooks) AfterProposalDeposit added in v0.43.0

func (h MultiGovHooks) AfterProposalDeposit(ctx context.Context, proposalID uint64, depositorAddr sdk.AccAddress) error

func (MultiGovHooks) AfterProposalFailedMinDeposit added in v0.43.0

func (h MultiGovHooks) AfterProposalFailedMinDeposit(ctx context.Context, proposalID uint64) error

func (MultiGovHooks) AfterProposalSubmission added in v0.43.0

func (h MultiGovHooks) AfterProposalSubmission(ctx context.Context, proposalID uint64) error

func (MultiGovHooks) AfterProposalVote added in v0.43.0

func (h MultiGovHooks) AfterProposalVote(ctx context.Context, proposalID uint64, voterAddr sdk.AccAddress) error

func (MultiGovHooks) AfterProposalVotingPeriodEnded added in v0.43.0

func (h MultiGovHooks) AfterProposalVotingPeriodEnded(ctx context.Context, proposalID uint64) error

type ParamSubspace

type ParamSubspace interface {
	Get(ctx sdk.Context, key []byte, ptr interface{})
	Set(ctx sdk.Context, key []byte, param interface{})
}

ParamSubspace defines the expected Subspace interface for parameters (noalias)

type ProposalMetadata added in v0.46.2

type ProposalMetadata struct {
	Title             string   `json:"title"`
	Authors           []string `json:"authors"`
	Summary           string   `json:"summary"`
	Details           string   `json:"details"`
	ProposalForumUrl  string   `json:"proposal_forum_url"` //nolint:revive // named 'Url' instead of 'URL' for avoiding the camel case split
	VoteOptionContext string   `json:"vote_option_context"`
}

ProposalMetadata is the metadata of a proposal This metadata is supposed to live off-chain when submitted in a proposal

type StakingKeeper

type StakingKeeper interface {
	ValidatorAddressCodec() addresscodec.Codec
	// iterate through bonded validators by operator address, execute func for each validator
	IterateBondedValidatorsByPower(
		context.Context, func(index int64, validator stakingtypes.ValidatorI) (stop bool),
	) error

	TotalBondedTokens(context.Context) (math.Int, error) // total bonded tokens within the validator set
	IterateDelegations(
		ctx context.Context, delegator sdk.AccAddress,
		fn func(index int64, delegation stakingtypes.DelegationI) (stop bool),
	) error
}

StakingKeeper expected staking keeper (Validator and Delegator sets) (noalias)

Directories

Path Synopsis
Package v1 is a reverse proxy.
Package v1 is a reverse proxy.
Package v1beta1 is a reverse proxy.
Package v1beta1 is a reverse proxy.

Jump to

Keyboard shortcuts

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