Search Apps Documentation Source Content File Folder Download Copy Actions Download State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

proposal_type.gno

1.36 Kb · 44 lines
 1package governance
 2
 3// ProposalType defines the different types of proposals supported by the governance system.
 4// Each type has different execution behavior and validation requirements.
 5type ProposalType string
 6
 7const (
 8	Text               ProposalType = "TEXT"                 // Informational proposals for community discussion
 9	CommunityPoolSpend ProposalType = "COMMUNITY_POOL_SPEND" // Proposals to spend community pool funds
10	ParameterChange    ProposalType = "PARAMETER_CHANGE"     // Proposals to modify system parameters
11)
12
13// String returns the human-readable string representation of the proposal type.
14//
15// Returns:
16//   - string: "Text", "CommunityPoolSpend", or "ParameterChange" for a known type; "Unknown" otherwise
17func (p ProposalType) String() string {
18	switch p {
19	case Text:
20		return "Text"
21	case CommunityPoolSpend:
22		return "CommunityPoolSpend"
23	case ParameterChange:
24		return "ParameterChange"
25	default:
26		return "Unknown"
27	}
28}
29
30// IsExecutable determines whether this proposal type can be executed.
31// Text proposals are informational only and cannot be executed.
32//
33// Returns:
34//   - bool: true for executable CommunityPoolSpend or ParameterChange types; false for Text and unknown types
35func (p ProposalType) IsExecutable() bool {
36	switch p {
37	case Text:
38		return false
39	case CommunityPoolSpend, ParameterChange:
40		return true
41	default:
42		return false
43	}
44}