Search Apps Documentation Source Content File Folder Download Copy Actions Download

proxy.gno

3.47 Kb · 161 lines
  1package governance
  2
  3// ProposeText creates a new text proposal for general governance decisions.
  4//
  5// Parameters:
  6//   - title: proposal title
  7//   - description: detailed proposal description
  8//
  9// Returns:
 10//   - int64: ID of the created proposal
 11func ProposeText(
 12	cur realm,
 13	title string,
 14	description string,
 15) int64 {
 16	return getImplementation().ProposeText(
 17		0, cur,
 18		title,
 19		description,
 20	)
 21}
 22
 23// ProposeCommunityPoolSpend creates a new community pool spending proposal.
 24//
 25// Parameters:
 26//   - title: proposal title
 27//   - description: detailed proposal description
 28//   - to: recipient address
 29//   - tokenPath: token path to transfer
 30//   - amount: amount to transfer
 31//
 32// Returns:
 33//   - int64: ID of the created proposal
 34func ProposeCommunityPoolSpend(
 35	cur realm,
 36	title string,
 37	description string,
 38	to address,
 39	tokenPath string,
 40	amount int64,
 41) int64 {
 42	return getImplementation().ProposeCommunityPoolSpend(
 43		0, cur,
 44		title,
 45		description,
 46		to,
 47		tokenPath,
 48		amount,
 49	)
 50}
 51
 52// ProposeParameterChange creates a new parameter change proposal.
 53//
 54// Parameters:
 55//   - title: proposal title
 56//   - description: detailed proposal description
 57//   - numToExecute: number of executions to perform
 58//   - executions: encoded execution messages
 59//
 60// Returns:
 61//   - int64: ID of the created proposal
 62func ProposeParameterChange(
 63	cur realm,
 64	title string,
 65	description string,
 66	numToExecute int64,
 67	executions string,
 68) int64 {
 69	return getImplementation().ProposeParameterChange(
 70		0, cur,
 71		title,
 72		description,
 73		numToExecute,
 74		executions,
 75	)
 76}
 77
 78// Vote casts a vote on a proposal.
 79//
 80// Parameters:
 81//   - proposalId: ID of the proposal to vote on
 82//   - yes: true for yes vote, false for no vote
 83//
 84// Returns:
 85//   - string: voting result information
 86func Vote(
 87	cur realm,
 88	proposalId int64,
 89	yes bool,
 90) string {
 91	return getImplementation().Vote(
 92		0, cur,
 93		proposalId,
 94		yes,
 95	)
 96}
 97
 98// Execute executes a passed proposal that is in the execution window.
 99//
100// Parameters:
101//   - proposalId: ID of the proposal to execute
102//
103// Returns:
104//   - int64: execution result code
105func Execute(
106	cur realm,
107	proposalId int64,
108) int64 {
109	return getImplementation().Execute(0, cur, proposalId)
110}
111
112// Cancel cancels a proposal before voting begins.
113// Only callable by the proposer.
114//
115// Parameters:
116//   - proposalId: ID of the proposal to cancel
117//
118// Returns:
119//   - int64: cancellation result code
120func Cancel(
121	cur realm,
122	proposalId int64,
123) int64 {
124	return getImplementation().Cancel(0, cur, proposalId)
125}
126
127// Reconfigure updates the governance configuration parameters.
128// Only callable by admin or governance.
129//
130// Parameters:
131//   - votingStartDelay: delay before voting starts (seconds)
132//   - votingPeriod: voting duration (seconds)
133//   - votingWeightSmoothingDuration: weight smoothing duration (seconds)
134//   - quorum: minimum voting weight required (percentage)
135//   - proposalCreationThreshold: minimum weight to create proposal
136//   - executionDelay: delay before execution (seconds)
137//   - executionWindow: execution time window (seconds)
138//
139// Returns:
140//   - int64: new configuration version
141func Reconfigure(
142	cur realm,
143	votingStartDelay int64,
144	votingPeriod int64,
145	votingWeightSmoothingDuration int64,
146	quorum int64,
147	proposalCreationThreshold int64,
148	executionDelay int64,
149	executionWindow int64,
150) int64 {
151	return getImplementation().Reconfigure(
152		0, cur,
153		votingStartDelay,
154		votingPeriod,
155		votingWeightSmoothingDuration,
156		quorum,
157		proposalCreationThreshold,
158		executionDelay,
159		executionWindow,
160	)
161}