types

package
v0.50.9 Latest Latest
Warning

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

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

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/T-ragon/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

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

func DefaultConfig() Config

DefaultConfig returns the default config for gov.

type DistributionKeeper

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

DistributionKeeper defines the expected distribution keeper (noalias)

type GovHooks

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

type GovHooksWrapper struct{ GovHooks }

func (GovHooksWrapper) IsOnePerModuleType

func (GovHooksWrapper) IsOnePerModuleType()

IsOnePerModuleType implements the depinject.OnePerModuleType interface.

type MultiGovHooks

type MultiGovHooks []GovHooks

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

func NewMultiGovHooks

func NewMultiGovHooks(hooks ...GovHooks) MultiGovHooks

func (MultiGovHooks) AfterProposalDeposit

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

func (MultiGovHooks) AfterProposalFailedMinDeposit

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

func (MultiGovHooks) AfterProposalSubmission

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

func (MultiGovHooks) AfterProposalVote

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

func (MultiGovHooks) AfterProposalVotingPeriodEnded

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

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