Overview

The Governance precompile provides a Solidity interface to the Cosmos SDK x/gov module. Smart contracts can submit proposals, vote, and query governance state. Precompile Address: 0x0000000000000000000000000000000000000805

Gas Costs

Method TypeGas Cost
Transactions2000 + (30 x bytes of input)
Queries1000 + (3 x bytes of input)

Transaction Methods

MethodDescription
submitProposalSubmit a JSON proposal with deposit
cancelProposalCancel a proposal
voteCast a vote on an active proposal
voteWeightedCast a weighted vote with split options
depositDeposit tokens to a proposal

Query Methods

MethodDescription
getConstitutionGet the active constitution text
getProposalGet proposal details by ID
getProposalsList proposals with optional status, voter, depositor, and pagination filters
getVoteGet a specific vote record
getVotesList votes for a proposal
getDepositGet a specific deposit record
getDepositsList deposits for a proposal
getTallyResultGet current tally for a proposal
getParamsGet governance parameters

Example

// Pseudocode: import IGov from the canonical interface.
IGov constant gov = IGov(0x0000000000000000000000000000000000000805);

// Vote YES on proposal #1
gov.vote(msg.sender, 1, 1, ""); // 1 = VOTE_OPTION_YES
For exact signatures, return structs, and events, see Precompile ABI Reference.