proxy.gno
5.73 Kb · 198 lines
1package governance
2
3// ProposeText creates a new text proposal with the provided data.
4//
5// Parameters:
6// - cur: Current realm context; callers use cross(cur) when crossing into this realm.
7// - title: The title of the proposal.
8// - description: The description of the proposal.
9//
10// Returns:
11// - proposalId: The ID of the proposal.
12//
13// Halt check: reverts while the Governance halt scope is active.
14func ProposeText(
15 cur realm,
16 title string,
17 description string,
18) int64 {
19 return getImplementation().ProposeText(
20 0, cur,
21 title,
22 description,
23 )
24}
25
26// ProposeCommunityPoolSpend creates a CommunityPoolSpend proposal with the provided data.
27// The transfer is attempted when an approved proposal executes.
28//
29// Parameters:
30// - cur: Current realm context; callers use cross(cur) when crossing into this realm.
31// - title: The title of the proposal.
32// - description: The description of the proposal.
33// - to: A valid address to receive the spent token.
34// - tokenPath: A registered token path.
35// - amount: A strictly positive amount in the token's smallest unit.
36//
37// The community-pool balance is checked at execution, not proposal creation.
38//
39// Returns:
40// - proposalId: The ID of the proposal.
41//
42// Halt check: reverts while the Governance halt scope is active.
43func ProposeCommunityPoolSpend(
44 cur realm,
45 title string,
46 description string,
47 to address,
48 tokenPath string,
49 amount int64,
50) int64 {
51 return getImplementation().ProposeCommunityPoolSpend(
52 0, cur,
53 title,
54 description,
55 to,
56 tokenPath,
57 amount,
58 )
59}
60
61// ProposeParameterChange creates a ParameterChange proposal with the provided data.
62//
63// Parameters:
64// - cur: Current realm context; callers use cross(cur) when crossing into this realm.
65// - title: The title of the proposal.
66// - description: The description of the proposal.
67// - numToExecute: The number of changes to execute.
68// - executions: The list of changes to execute.
69//
70// Returns:
71// - proposalId: The ID of the proposal.
72//
73// Halt check: reverts while the Governance halt scope is active, except for halt-recovery proposals that only target the halt realm.
74func ProposeParameterChange(
75 cur realm,
76 title string,
77 description string,
78 numToExecute int64,
79 executions string,
80) int64 {
81 return getImplementation().ProposeParameterChange(
82 0, cur,
83 title,
84 description,
85 numToExecute,
86 executions,
87 )
88}
89
90// Vote allows a user to vote on a given proposal.
91//
92// The proposal's timestamp-based smoothing calculation determines the applied
93// weight. A vote cannot be changed after it is recorded.
94//
95// Parameters:
96// - cur: Current realm context; callers use cross(cur) when crossing into this realm.
97// - proposalId: The ID of the proposal to vote.
98// - yes: The flag to vote as yes or not.
99//
100// Returns:
101// - voteWeight: The caller's calculated vote weight, formatted as a decimal string.
102//
103// Halt check: reverts while the Governance halt scope is active, except for halt-recovery proposals that only target the halt realm.
104func Vote(
105 cur realm,
106 proposalId int64,
107 yes bool,
108) string {
109 return getImplementation().Vote(
110 0, cur,
111 proposalId,
112 yes,
113 )
114}
115
116// Execute executes the given proposal.
117//
118// Parameters:
119// - cur: Current realm context; callers use cross(cur) when crossing into this realm.
120// - proposalId: The ID of the proposal to execute.
121//
122// Returns:
123// - proposalId: The ID of the proposal.
124//
125// Halt check: reverts while the Governance halt scope is active, except for halt-recovery proposals that only target the halt realm.
126func Execute(
127 cur realm,
128 proposalId int64,
129) int64 {
130 return getImplementation().Execute(0, cur, proposalId)
131}
132
133// Cancel cancels the proposal with the given ID.
134//
135// Parameters:
136// - cur: Current realm context; callers use cross(cur) when crossing into this realm.
137// - proposalId: The ID of the proposal to cancel.
138//
139// Returns:
140// - proposalId: The ID of the proposal.
141//
142// Halt check: reverts while the Governance halt scope is active.
143func Cancel(
144 cur realm,
145 proposalId int64,
146) int64 {
147 return getImplementation().Cancel(0, cur, proposalId)
148}
149
150// RemoveInactiveProposalFromIndex removes an inactive proposal from the
151// timestamp-ordered index without deleting its proposal or voting history.
152// Parameters:
153// - cur: Current realm context; callers use cross(cur) when crossing into this realm.
154// - proposalID: Identifier of the inactive proposal to remove from the active index.
155//
156// Halt check: reverts while the Governance halt scope is active.
157func RemoveInactiveProposalFromIndex(cur realm, proposalID int64) {
158 getImplementation().RemoveInactiveProposalFromIndex(0, cur, proposalID)
159}
160
161// Reconfigure updates the governance configuration parameters.
162// Only callable by admin or governance.
163//
164// Parameters:
165// - cur: Current realm context; callers use cross(cur) when crossing into this realm.
166// - votingStartDelay: delay before voting starts (seconds)
167// - votingPeriod: voting duration (seconds)
168// - votingWeightSmoothingDuration: weight smoothing duration (seconds)
169// - quorum: minimum voting weight required (percentage)
170// - proposalCreationThreshold: minimum weight to create proposal
171// - executionDelay: delay before execution (seconds)
172// - executionWindow: execution time window (seconds)
173//
174// Returns:
175// - int64: new configuration version
176//
177// Halt check: reverts while the Governance halt scope is active.
178func Reconfigure(
179 cur realm,
180 votingStartDelay int64,
181 votingPeriod int64,
182 votingWeightSmoothingDuration int64,
183 quorum int64,
184 proposalCreationThreshold int64,
185 executionDelay int64,
186 executionWindow int64,
187) int64 {
188 return getImplementation().Reconfigure(
189 0, cur,
190 votingStartDelay,
191 votingPeriod,
192 votingWeightSmoothingDuration,
193 quorum,
194 proposalCreationThreshold,
195 executionDelay,
196 executionWindow,
197 )
198}