Search Apps Documentation Source Content File Folder Download Copy Actions Download

governance package

Overview

Package governance implements proposal lifecycle management and voting. It supports text proposals, parameter changes, and community pool spending. Proposals go through creation, voting, and execution phases with configurable parameters for voting delays, periods, and thresholds.

Functions

Cancel

func Cancel( cur realm, proposalId int64, ) int64

Cancel cancels a proposal before voting begins. Only callable by the proposer. Parameters: - proposalId: ID of the proposal to cancel Returns: - int64: cancellation result code

Param

Command

# WARNING: This command is running in an INSECURE mode.
# It is strongly recommended to use a hardware device for signing
# and avoid trusting any computer connected to the internet,
# as your private keys could be exposed.

gnokey maketx call -pkgpath "gno.land/r/gnoswap/gov/governance" -func "Cancel" -args $'' -gas-fee 1000000ugnot -gas-wanted 5000000 -send "" -broadcast -chainid "test11" -remote "https://rpc.test11.testnets.gno.land" ADDRESSgnokey query -remote "https://rpc.test11.testnets.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/gnoswap/gov/governance" -func "Cancel" -args $'' -gas-fee 1000000ugnot -gas-wanted 5000000 -send "" ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "test11" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.test11.testnets.gno.land" call.tx
  

Execute

func Execute( cur realm, proposalId int64, ) int64

Execute executes a passed proposal that is in the execution window. Parameters: - proposalId: ID of the proposal to execute Returns: - int64: execution result code

Param

Command

# WARNING: This command is running in an INSECURE mode.
# It is strongly recommended to use a hardware device for signing
# and avoid trusting any computer connected to the internet,
# as your private keys could be exposed.

gnokey maketx call -pkgpath "gno.land/r/gnoswap/gov/governance" -func "Execute" -args $'' -gas-fee 1000000ugnot -gas-wanted 5000000 -send "" -broadcast -chainid "test11" -remote "https://rpc.test11.testnets.gno.land" ADDRESSgnokey query -remote "https://rpc.test11.testnets.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/gnoswap/gov/governance" -func "Execute" -args $'' -gas-fee 1000000ugnot -gas-wanted 5000000 -send "" ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "test11" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.test11.testnets.gno.land" call.tx
  

ExistsProposal

func ExistsProposal(proposalID int64) bool

ExistsProposal checks if a proposal exists.

Param

Command

gnokey query vm/qeval -remote "https://rpc.test11.testnets.gno.land" -data "gno.land/r/gnoswap/gov/governance.ExistsProposal()"

Result

ExistsVotingInfo

func ExistsVotingInfo(proposalID int64, addr address) bool

ExistsVotingInfo checks if a voting info exists for a user on a proposal.

Params

Command

gnokey query vm/qeval -remote "https://rpc.test11.testnets.gno.land" -data "gno.land/r/gnoswap/gov/governance.ExistsVotingInfo(,)"

Result

GetConfigVersionByProposalId

func GetConfigVersionByProposalId(proposalId int64) (int64, error)

GetConfigVersionByProposalId returns the config version used by a proposal.

Param

Command

gnokey query vm/qeval -remote "https://rpc.test11.testnets.gno.land" -data "gno.land/r/gnoswap/gov/governance.GetConfigVersionByProposalId()"

Result

GetCurrentProposalID

func GetCurrentProposalID() int64

GetCurrentProposalID returns the current proposal ID counter.

Command

gnokey query vm/qeval -remote "https://rpc.test11.testnets.gno.land" -data "gno.land/r/gnoswap/gov/governance.GetCurrentProposalID()"

Result

GetCurrentVotingWeightSnapshot

func GetCurrentVotingWeightSnapshot() (int64, int64, error)

GetCurrentVotingWeightSnapshot returns the current voting weight snapshot.

Command

gnokey query vm/qeval -remote "https://rpc.test11.testnets.gno.land" -data "gno.land/r/gnoswap/gov/governance.GetCurrentVotingWeightSnapshot()"

Result

GetDescriptionByProposalId

func GetDescriptionByProposalId(proposalId int64) (string, error)

GetDescriptionByProposalId returns the description of a proposal.

Param

Command

gnokey query vm/qeval -remote "https://rpc.test11.testnets.gno.land" -data "gno.land/r/gnoswap/gov/governance.GetDescriptionByProposalId()"

Result

GetImplementationPackagePath

func GetImplementationPackagePath() string

GetImplementationPackagePath returns the package path of the currently active implementation.

Command

gnokey query vm/qeval -remote "https://rpc.test11.testnets.gno.land" -data "gno.land/r/gnoswap/gov/governance.GetImplementationPackagePath()"

Result

GetLatestConfigVersion

func GetLatestConfigVersion() int64

GetLatestConfigVersion returns the current config version.

Command

gnokey query vm/qeval -remote "https://rpc.test11.testnets.gno.land" -data "gno.land/r/gnoswap/gov/governance.GetLatestConfigVersion()"

Result

GetMaxSmoothingPeriod

func GetMaxSmoothingPeriod() int64

GetMaxSmoothingPeriod returns the maximum smoothing period for delegation history cleanup.

Command

gnokey query vm/qeval -remote "https://rpc.test11.testnets.gno.land" -data "gno.land/r/gnoswap/gov/governance.GetMaxSmoothingPeriod()"

Result

GetNayByProposalId

func GetNayByProposalId(proposalId int64) (int64, error)

GetNayByProposalId returns the no vote weight of a proposal.

Param

Command

gnokey query vm/qeval -remote "https://rpc.test11.testnets.gno.land" -data "gno.land/r/gnoswap/gov/governance.GetNayByProposalId()"

Result

GetOldestActiveProposalSnapshotTime

func GetOldestActiveProposalSnapshotTime() (int64, bool)

GetOldestActiveProposalSnapshotTime returns the oldest snapshot time among active proposals.

Command

gnokey query vm/qeval -remote "https://rpc.test11.testnets.gno.land" -data "gno.land/r/gnoswap/gov/governance.GetOldestActiveProposalSnapshotTime()"

Result

GetProposalCount

func GetProposalCount() int

GetProposalCount returns the total number of proposals.

Command

gnokey query vm/qeval -remote "https://rpc.test11.testnets.gno.land" -data "gno.land/r/gnoswap/gov/governance.GetProposalCount()"

Result

GetProposalCreatedAt

func GetProposalCreatedAt(proposalId int64) (int64, error)

GetProposalCreatedAt returns the creation timestamp of a proposal.

Param

Command

gnokey query vm/qeval -remote "https://rpc.test11.testnets.gno.land" -data "gno.land/r/gnoswap/gov/governance.GetProposalCreatedAt()"

Result

GetProposalCreatedHeight

func GetProposalCreatedHeight(proposalId int64) (int64, error)

GetProposalCreatedHeight returns the creation block height of a proposal.

Param

Command

gnokey query vm/qeval -remote "https://rpc.test11.testnets.gno.land" -data "gno.land/r/gnoswap/gov/governance.GetProposalCreatedHeight()"

Result

GetProposalIDs

func GetProposalIDs(offset, count int) []int64

GetProposalIDs returns a paginated list of proposal IDs.

Params

Command

gnokey query vm/qeval -remote "https://rpc.test11.testnets.gno.land" -data "gno.land/r/gnoswap/gov/governance.GetProposalIDs(,)"

Result

GetProposalStatusByProposalId

func GetProposalStatusByProposalId(proposalId int64) (string, error)

GetProposalStatusByProposalId returns the current status of a proposal.

Param

Command

gnokey query vm/qeval -remote "https://rpc.test11.testnets.gno.land" -data "gno.land/r/gnoswap/gov/governance.GetProposalStatusByProposalId()"

Result

GetQuorumAmountByProposalId

func GetQuorumAmountByProposalId(proposalId int64) (int64, error)

GetQuorumAmountByProposalId returns the quorum requirement for a proposal.

Param

Command

gnokey query vm/qeval -remote "https://rpc.test11.testnets.gno.land" -data "gno.land/r/gnoswap/gov/governance.GetQuorumAmountByProposalId()"

Result

GetTitleByProposalId

func GetTitleByProposalId(proposalId int64) (string, error)

GetTitleByProposalId returns the title of a proposal.

Param

Command

gnokey query vm/qeval -remote "https://rpc.test11.testnets.gno.land" -data "gno.land/r/gnoswap/gov/governance.GetTitleByProposalId()"

Result

GetUserProposalCount

func GetUserProposalCount(user address) int

GetUserProposalCount returns the number of proposals created by a user.

Param

Command

gnokey query vm/qeval -remote "https://rpc.test11.testnets.gno.land" -data "gno.land/r/gnoswap/gov/governance.GetUserProposalCount()"

Result

GetUserProposalIDs

func GetUserProposalIDs(user address, offset, count int) []int64

GetUserProposalIDs returns a paginated list of proposal IDs created by a user.

Params

Command

gnokey query vm/qeval -remote "https://rpc.test11.testnets.gno.land" -data "gno.land/r/gnoswap/gov/governance.GetUserProposalIDs(,,)"

Result

GetVoteStatus

func GetVoteStatus(proposalId int64) (quorum, maxVotingWeight, yesWeight, noWeight int64, err error)

GetVoteStatus returns the vote status of a proposal. Returns: - quorum: minimum vote weight required for proposal to pass - maxVotingWeight: maximum possible voting weight - yesWeight: total weight of "yes" votes - noWeight: total weight of "no" votes

Param

Command

gnokey query vm/qeval -remote "https://rpc.test11.testnets.gno.land" -data "gno.land/r/gnoswap/gov/governance.GetVoteStatus()"

Result

GetVoteWeight

func GetVoteWeight(proposalID int64, addr address) (int64, error)

GetVoteWeight returns the voting weight of an address for a proposal.

Params

Command

gnokey query vm/qeval -remote "https://rpc.test11.testnets.gno.land" -data "gno.land/r/gnoswap/gov/governance.GetVoteWeight(,)"

Result

GetVotedAt

func GetVotedAt(proposalID int64, addr address) (int64, error)

GetVotedAt returns the timestamp when an address voted on a proposal.

Params

Command

gnokey query vm/qeval -remote "https://rpc.test11.testnets.gno.land" -data "gno.land/r/gnoswap/gov/governance.GetVotedAt(,)"

Result

GetVotedHeight

func GetVotedHeight(proposalID int64, addr address) (int64, error)

GetVotedHeight returns the block height when an address voted on a proposal.

Params

Command

gnokey query vm/qeval -remote "https://rpc.test11.testnets.gno.land" -data "gno.land/r/gnoswap/gov/governance.GetVotedHeight(,)"

Result

GetVotingInfoCount

func GetVotingInfoCount(proposalID int64) int

GetVotingInfoCount returns the number of voters for a proposal.

Param

Command

gnokey query vm/qeval -remote "https://rpc.test11.testnets.gno.land" -data "gno.land/r/gnoswap/gov/governance.GetVotingInfoCount()"

Result

GetYeaByProposalId

func GetYeaByProposalId(proposalId int64) (int64, error)

GetYeaByProposalId returns the yes vote weight of a proposal.

Param

Command

gnokey query vm/qeval -remote "https://rpc.test11.testnets.gno.land" -data "gno.land/r/gnoswap/gov/governance.GetYeaByProposalId()"

Result

ProposeCommunityPoolSpend

func ProposeCommunityPoolSpend( cur realm, title string, description string, to address, tokenPath string, amount int64, ) int64

ProposeCommunityPoolSpend creates a new community pool spending proposal. Parameters: - title: proposal title - description: detailed proposal description - to: recipient address - tokenPath: token path to transfer - amount: amount to transfer Returns: - int64: ID of the created proposal

Params

Command

# WARNING: This command is running in an INSECURE mode.
# It is strongly recommended to use a hardware device for signing
# and avoid trusting any computer connected to the internet,
# as your private keys could be exposed.

gnokey maketx call -pkgpath "gno.land/r/gnoswap/gov/governance" -func "ProposeCommunityPoolSpend" -args $'' -args $'' -args $'' -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 5000000 -send "" -broadcast -chainid "test11" -remote "https://rpc.test11.testnets.gno.land" ADDRESSgnokey query -remote "https://rpc.test11.testnets.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/gnoswap/gov/governance" -func "ProposeCommunityPoolSpend" -args $'' -args $'' -args $'' -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 5000000 -send "" ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "test11" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.test11.testnets.gno.land" call.tx
  

ProposeParameterChange

func ProposeParameterChange( cur realm, title string, description string, numToExecute int64, executions string, ) int64

ProposeParameterChange creates a new parameter change proposal. Parameters: - title: proposal title - description: detailed proposal description - numToExecute: number of executions to perform - executions: encoded execution messages Returns: - int64: ID of the created proposal

Params

Command

# WARNING: This command is running in an INSECURE mode.
# It is strongly recommended to use a hardware device for signing
# and avoid trusting any computer connected to the internet,
# as your private keys could be exposed.

gnokey maketx call -pkgpath "gno.land/r/gnoswap/gov/governance" -func "ProposeParameterChange" -args $'' -args $'' -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 5000000 -send "" -broadcast -chainid "test11" -remote "https://rpc.test11.testnets.gno.land" ADDRESSgnokey query -remote "https://rpc.test11.testnets.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/gnoswap/gov/governance" -func "ProposeParameterChange" -args $'' -args $'' -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 5000000 -send "" ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "test11" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.test11.testnets.gno.land" call.tx
  

ProposeText

func ProposeText( cur realm, title string, description string, ) int64

ProposeText creates a new text proposal for general governance decisions. Parameters: - title: proposal title - description: detailed proposal description Returns: - int64: ID of the created proposal

Params

Command

# WARNING: This command is running in an INSECURE mode.
# It is strongly recommended to use a hardware device for signing
# and avoid trusting any computer connected to the internet,
# as your private keys could be exposed.

gnokey maketx call -pkgpath "gno.land/r/gnoswap/gov/governance" -func "ProposeText" -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 5000000 -send "" -broadcast -chainid "test11" -remote "https://rpc.test11.testnets.gno.land" ADDRESSgnokey query -remote "https://rpc.test11.testnets.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/gnoswap/gov/governance" -func "ProposeText" -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 5000000 -send "" ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "test11" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.test11.testnets.gno.land" call.tx
  

Reconfigure

func Reconfigure( cur realm, votingStartDelay int64, votingPeriod int64, votingWeightSmoothingDuration int64, quorum int64, proposalCreationThreshold int64, executionDelay int64, executionWindow int64, ) int64

Reconfigure updates the governance configuration parameters. Only callable by admin or governance. Parameters: - votingStartDelay: delay before voting starts (seconds) - votingPeriod: voting duration (seconds) - votingWeightSmoothingDuration: weight smoothing duration (seconds) - quorum: minimum voting weight required (percentage) - proposalCreationThreshold: minimum weight to create proposal - executionDelay: delay before execution (seconds) - executionWindow: execution time window (seconds) Returns: - int64: new configuration version

Params

Command

# WARNING: This command is running in an INSECURE mode.
# It is strongly recommended to use a hardware device for signing
# and avoid trusting any computer connected to the internet,
# as your private keys could be exposed.

gnokey maketx call -pkgpath "gno.land/r/gnoswap/gov/governance" -func "Reconfigure" -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 5000000 -send "" -broadcast -chainid "test11" -remote "https://rpc.test11.testnets.gno.land" ADDRESSgnokey query -remote "https://rpc.test11.testnets.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/gnoswap/gov/governance" -func "Reconfigure" -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 5000000 -send "" ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "test11" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.test11.testnets.gno.land" call.tx
  

RegisterInitializer

func RegisterInitializer(cur realm, initializer func(governanceStore IGovernanceStore, stakerAccessor GovStakerAccessor) IGovernance)

Param

Command

# WARNING: This command is running in an INSECURE mode.
# It is strongly recommended to use a hardware device for signing
# and avoid trusting any computer connected to the internet,
# as your private keys could be exposed.

gnokey maketx call -pkgpath "gno.land/r/gnoswap/gov/governance" -func "RegisterInitializer" -args $'' -gas-fee 1000000ugnot -gas-wanted 5000000 -send "" -broadcast -chainid "test11" -remote "https://rpc.test11.testnets.gno.land" ADDRESSgnokey query -remote "https://rpc.test11.testnets.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/gnoswap/gov/governance" -func "RegisterInitializer" -args $'' -gas-fee 1000000ugnot -gas-wanted 5000000 -send "" ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "test11" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.test11.testnets.gno.land" call.tx
  

UpgradeImpl

func UpgradeImpl(cur realm, targetPackagePath string)

UpgradeImpl switches the active governance implementation to a different version. This function allows seamless upgrades from one version to another without data migration or downtime. Security: Only admin or governance can perform upgrades. The new implementation must have been previously registered via RegisterInitializer.

Param

Command

# WARNING: This command is running in an INSECURE mode.
# It is strongly recommended to use a hardware device for signing
# and avoid trusting any computer connected to the internet,
# as your private keys could be exposed.

gnokey maketx call -pkgpath "gno.land/r/gnoswap/gov/governance" -func "UpgradeImpl" -args $'' -gas-fee 1000000ugnot -gas-wanted 5000000 -send "" -broadcast -chainid "test11" -remote "https://rpc.test11.testnets.gno.land" ADDRESSgnokey query -remote "https://rpc.test11.testnets.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/gnoswap/gov/governance" -func "UpgradeImpl" -args $'' -gas-fee 1000000ugnot -gas-wanted 5000000 -send "" ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "test11" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.test11.testnets.gno.land" call.tx
  

Vote

func Vote( cur realm, proposalId int64, yes bool, ) string

Vote casts a vote on a proposal. Parameters: - proposalId: ID of the proposal to vote on - yes: true for yes vote, false for no vote Returns: - string: voting result information

Params

Command

# WARNING: This command is running in an INSECURE mode.
# It is strongly recommended to use a hardware device for signing
# and avoid trusting any computer connected to the internet,
# as your private keys could be exposed.

gnokey maketx call -pkgpath "gno.land/r/gnoswap/gov/governance" -func "Vote" -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 5000000 -send "" -broadcast -chainid "test11" -remote "https://rpc.test11.testnets.gno.land" ADDRESSgnokey query -remote "https://rpc.test11.testnets.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/gnoswap/gov/governance" -func "Vote" -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 5000000 -send "" ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "test11" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.test11.testnets.gno.land" call.tx
  

GetProposalCommunityPoolSpendInfo

func GetProposalCommunityPoolSpendInfo(proposalID int64) (*CommunityPoolSpendInfo, error)

GetProposalCommunityPoolSpendInfo returns the community pool spend info for a proposal.

Param

Command

gnokey query vm/qeval -remote "https://rpc.test11.testnets.gno.land" -data "gno.land/r/gnoswap/gov/governance.GetProposalCommunityPoolSpendInfo()"

Result

NewCommunityPoolSpendInfo

func NewCommunityPoolSpendInfo(to address, tokenPath string, amount int64) *CommunityPoolSpendInfo

Params

Command

gnokey query vm/qeval -remote "https://rpc.test11.testnets.gno.land" -data "gno.land/r/gnoswap/gov/governance.NewCommunityPoolSpendInfo(,,)"

Result

GetConfig

func GetConfig(configVersion int64) (Config, error)

GetConfig returns a specific governance configuration by version.

Param

Command

gnokey query vm/qeval -remote "https://rpc.test11.testnets.gno.land" -data "gno.land/r/gnoswap/gov/governance.GetConfig()"

Result

GetLatestConfig

func GetLatestConfig() Config

GetLatestConfig returns the latest governance configuration.

Command

gnokey query vm/qeval -remote "https://rpc.test11.testnets.gno.land" -data "gno.land/r/gnoswap/gov/governance.GetLatestConfig()"

Result

NewCounter

func NewCounter() *Counter

NewCounter creates a new Counter starting at 0.

Command

gnokey query vm/qeval -remote "https://rpc.test11.testnets.gno.land" -data "gno.land/r/gnoswap/gov/governance.NewCounter()"

Result

GetProposalExecutionInfo

func GetProposalExecutionInfo(proposalID int64) (*ExecutionInfo, error)

GetProposalExecutionInfo returns the execution info for a proposal.

Param

Command

gnokey query vm/qeval -remote "https://rpc.test11.testnets.gno.land" -data "gno.land/r/gnoswap/gov/governance.GetProposalExecutionInfo()"

Result

NewExecutionInfo

func NewExecutionInfo(num int64, msgs []string) *ExecutionInfo

Params

Command

gnokey query vm/qeval -remote "https://rpc.test11.testnets.gno.land" -data "gno.land/r/gnoswap/gov/governance.NewExecutionInfo(,)"

Result

NewGovernanceStore

func NewGovernanceStore(kvStore store.KVStore) IGovernanceStore

NewGovernanceStore creates a new governance store instance with the provided KV store. This function is used by the upgrade system to create storage instances for each implementation.

Param

Command

gnokey query vm/qeval -remote "https://rpc.test11.testnets.gno.land" -data "gno.land/r/gnoswap/gov/governance.NewGovernanceStore()"

Result

NewParameterChangeInfo

func NewParameterChangeInfo(pkgPath string, function string, params []string) ParameterChangeInfo

Params

Command

gnokey query vm/qeval -remote "https://rpc.test11.testnets.gno.land" -data "gno.land/r/gnoswap/gov/governance.NewParameterChangeInfo(,,)"

Result

GetProposal

func GetProposal(proposalID int64) (*Proposal, error)

GetProposal returns a proposal by ID. Returns a clone to prevent external modification.

Param

Command

gnokey query vm/qeval -remote "https://rpc.test11.testnets.gno.land" -data "gno.land/r/gnoswap/gov/governance.GetProposal()"

Result

NewProposal

func NewProposal( proposalID int64, status *ProposalStatus, metadata *ProposalMetadata, data *ProposalData, proposerAddress address, configVersion int64, snapshotTime int64, createdAt int64, createdHeight int64, ) *Proposal

NewProposal creates a new proposal instance with the provided parameters. NewProposal is the main constructor for creating governance proposals. - metadata: proposal title and description - data: type-specific proposal data - proposerAddress: address of the proposal creator - configVersion: governance configuration version - snapshotTime: timestamp for voting weight snapshot lookup - createdAt: creation timestamp - createdHeight: creation block height Returns: - \*Proposal: newly created proposal instance

Params

Command

gnokey query vm/qeval -remote "https://rpc.test11.testnets.gno.land" -data "gno.land/r/gnoswap/gov/governance.NewProposal(,,,,,,,,)"

Result

NewProposalActionStatus

func NewProposalActionStatus(executable bool) *ProposalActionStatus

NewProposalActionStatus creates a new action status for a proposal. Initializes the status with default values and the executable flag. Parameters: - executable: whether this proposal type can be executed Returns: - \*ProposalActionStatus: new action status instance

Param

Command

gnokey query vm/qeval -remote "https://rpc.test11.testnets.gno.land" -data "gno.land/r/gnoswap/gov/governance.NewProposalActionStatus()"

Result

NewProposalData

func NewProposalData(proposalType ProposalType, communityPoolSpend *CommunityPoolSpendInfo, execution *ExecutionInfo) *ProposalData

NewProposalData creates a new proposal data instance with the specified components. Parameters: - proposalType: type of the proposal - communityPoolSpend: community pool spending information - execution: parameter change execution information Returns: - \*ProposalData: new proposal data instance

Params

Command

gnokey query vm/qeval -remote "https://rpc.test11.testnets.gno.land" -data "gno.land/r/gnoswap/gov/governance.NewProposalData(,,)"

Result

NewProposalMetadata

func NewProposalMetadata(title string, description string) *ProposalMetadata

NewProposalMetadata creates a new proposal metadata instance with trimmed input. Parameters: - title: proposal title - description: proposal description Returns: - \*ProposalMetadata: new metadata instance with trimmed whitespace

Params

Command

gnokey query vm/qeval -remote "https://rpc.test11.testnets.gno.land" -data "gno.land/r/gnoswap/gov/governance.NewProposalMetadata(,)"

Result

NewProposalScheduleStatus

func NewProposalScheduleStatus( createTime int64, activeTime int64, votingEndTime int64, executableTime int64, expiredTime int64, ) *ProposalScheduleStatus

Params

Command

gnokey query vm/qeval -remote "https://rpc.test11.testnets.gno.land" -data "gno.land/r/gnoswap/gov/governance.NewProposalScheduleStatus(,,,,)"

Result

NewProposalStatusBy

func NewProposalStatusBy( schedule *ProposalScheduleStatus, actionStatus *ProposalActionStatus, voteStatus *ProposalVoteStatus, ) *ProposalStatus

Params

Command

gnokey query vm/qeval -remote "https://rpc.test11.testnets.gno.land" -data "gno.land/r/gnoswap/gov/governance.NewProposalStatusBy(,,)"

Result

GetProposalTypeByProposalId

func GetProposalTypeByProposalId(proposalId int64) (ProposalType, error)

GetProposalTypeByProposalId returns the type of a proposal.

Param

Command

gnokey query vm/qeval -remote "https://rpc.test11.testnets.gno.land" -data "gno.land/r/gnoswap/gov/governance.GetProposalTypeByProposalId()"

Result

NewProposalVoteStatus

func NewProposalVoteStatus( maxVotingWeight int64, quorumAmount int64, ) *ProposalVoteStatus

NewProposalVoteStatus creates a new vote status for a proposal. Initializes vote tallies to zero and calculates the quorum requirement. Parameters: - maxVotingWeight: maximum possible voting weight for this proposal - quorumAmount: quorum amount required for passage Returns: - \*ProposalVoteStatus: new vote status instance

Params

Command

gnokey query vm/qeval -remote "https://rpc.test11.testnets.gno.land" -data "gno.land/r/gnoswap/gov/governance.NewProposalVoteStatus(,)"

Result

GetVotingInfo

func GetVotingInfo(proposalID int64, addr address) (*VotingInfo, error)

GetVotingInfo returns the voting info for a user on a proposal. Returns a clone to prevent external modification.

Params

Command

gnokey query vm/qeval -remote "https://rpc.test11.testnets.gno.land" -data "gno.land/r/gnoswap/gov/governance.GetVotingInfo(,)"

Result

NewVotingInfo

func NewVotingInfo(availableVoteWeight int64) *VotingInfo

NewVotingInfo creates a new voting information structure for a user. This constructor initializes the voting eligibility based on delegation snapshots. Parameters: - availableVoteWeight: total voting weight available to this user Returns: - \*VotingInfo: newly created voting information structure

Param

Command

gnokey query vm/qeval -remote "https://rpc.test11.testnets.gno.land" -data "gno.land/r/gnoswap/gov/governance.NewVotingInfo()"

Result