Skip to main content
logo

gov

The gov module is a wrapper module around the vanilla governance module that comes as standard within the Cosmos SDK. This wrapper inherits most of the standard governance module but implements alternative vote tallying logic. That is, tokens locked in a vesting contract contribute towards that token-holders’ voting power. This module has been built to account for the builders’ token allocation and to facilitate their participation in governance.

Message Types

Msg defines the gov Msg service.

tx.proto
Copy

_17
service Msg {
_17
// SubmitProposal defines a method to create new proposal given a content.
_17
rpc SubmitProposal(MsgSubmitProposal) returns (MsgSubmitProposalResponse);
_17
_17
// ExecLegacyContent defines a Msg to be in included in a MsgSubmitProposal
_17
// to execute a legacy content-based proposal.
_17
rpc ExecLegacyContent(MsgExecLegacyContent) returns (MsgExecLegacyContentResponse);
_17
_17
// Vote defines a method to add a vote on a specific proposal.
_17
rpc Vote(MsgVote) returns (MsgVoteResponse);
_17
_17
// VoteWeighted defines a method to add a weighted vote on a specific proposal.
_17
rpc VoteWeighted(MsgVoteWeighted) returns (MsgVoteWeightedResponse);
_17
_17
// Deposit defines a method to add deposit on a specific proposal.
_17
rpc Deposit(MsgDeposit) returns (MsgDepositResponse);
_17
}

MsgSubmitProposal

MsgSubmitProposal defines an sdk.Msg type that supports submitting arbitrary proposal Content.

tx.proto
Copy

_9
message MsgSubmitProposal {
_9
option (cosmos.msg.v1.signer) = "proposer";
_9
_9
repeated google.protobuf.Any messages = 1;
_9
repeated cosmos.base.v1beta1.Coin initial_deposit = 2 [(gogoproto.nullable) = false];
_9
string proposer = 3 [(cosmos_proto.scalar) = "cosmos.AddressString"];
_9
// metadata is any arbitrary metadata attached to the proposal.
_9
string metadata = 4;
_9
}

MsgSubmitProposalResponse

MsgSubmitProposalResponse defines the Msg/SubmitProposal response type.

tx.proto
Copy

_3
message MsgSubmitProposalResponse {
_3
uint64 proposal_id = 1;
_3
}

MsgExecLegacyContent

MsgExecLegacyContent is used to wrap the legacy content field into a message. This ensures backwards compatibility with v1beta1.MsgSubmitProposal.

tx.proto
Copy

_8
message MsgExecLegacyContent {
_8
option (cosmos.msg.v1.signer) = "authority";
_8
_8
// content is the proposal's content.
_8
google.protobuf.Any content = 1 [(cosmos_proto.accepts_interface) = "Content"];
_8
// authority must be the gov module address.
_8
string authority = 2;
_8
}

MsgExecLegacyContentResponse

MsgExecLegacyContentResponse defines the Msg/ExecLegacyContent response type.

tx.proto
Copy

_1
message MsgExecLegacyContentResponse {}

MsgVote

MsgVote defines a message to cast a vote.

tx.proto
Copy

_8
message MsgVote {
_8
option (cosmos.msg.v1.signer) = "voter";
_8
_8
uint64 proposal_id = 1 [(gogoproto.jsontag) = "proposal_id"];
_8
string voter = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];
_8
VoteOption option = 3;
_8
string metadata = 4;
_8
}

MsgVoteResponse

MsgVoteResponse defines the Msg/Vote response type.

tx.proto
Copy

_1
message MsgVoteResponse {}

MsgVoteWeighted

MsgVoteWeighted defines a message to cast a vote.

tx.proto
Copy

_8
message MsgVoteWeighted {
_8
option (cosmos.msg.v1.signer) = "voter";
_8
_8
uint64 proposal_id = 1 [(gogoproto.jsontag) = "proposal_id"];
_8
string voter = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];
_8
repeated WeightedVoteOption options = 3;
_8
string metadata = 4;
_8
}

MsgVoteWeightedResponse

MsgVoteWeightedResponse defines the Msg/VoteWeighted response type.

tx.proto
Copy

_1
message MsgVoteWeightedResponse {}

MsgDeposit

MsgDeposit defines a message to submit a deposit to an existing proposal.

tx.proto
Copy

_7
message MsgDeposit {
_7
option (cosmos.msg.v1.signer) = "depositor";
_7
_7
uint64 proposal_id = 1 [(gogoproto.jsontag) = "proposal_id"];
_7
string depositor = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];
_7
repeated cosmos.base.v1beta1.Coin amount = 3 [(gogoproto.nullable) = false];
_7
}

MsgDepositResponse

MsgDepositResponse defines the Msg/Deposit response type.

tx.proto
Copy

_1
message MsgDepositResponse {}

Queries

Query defines the gRPC querier service for gov module.

query.proto
Copy

_41
service Query {
_41
// Proposal queries proposal details based on ProposalID.
_41
rpc Proposal(QueryProposalRequest) returns (QueryProposalResponse) {
_41
option (google.api.http).get = "/cosmos/gov/v1/proposals/{proposal_id}";
_41
}
_41
_41
// Proposals queries all proposals based on given status.
_41
rpc Proposals(QueryProposalsRequest) returns (QueryProposalsResponse) {
_41
option (google.api.http).get = "/cosmos/gov/v1/proposals";
_41
}
_41
_41
// Vote queries voted information based on proposalID, voterAddr.
_41
rpc Vote(QueryVoteRequest) returns (QueryVoteResponse) {
_41
option (google.api.http).get = "/cosmos/gov/v1/proposals/{proposal_id}/votes/{voter}";
_41
}
_41
_41
// Votes queries votes of a given proposal.
_41
rpc Votes(QueryVotesRequest) returns (QueryVotesResponse) {
_41
option (google.api.http).get = "/cosmos/gov/v1/proposals/{proposal_id}/votes";
_41
}
_41
_41
// Params queries all parameters of the gov module.
_41
rpc Params(QueryParamsRequest) returns (QueryParamsResponse) {
_41
option (google.api.http).get = "/cosmos/gov/v1/params/{params_type}";
_41
}
_41
_41
// Deposit queries single deposit information based proposalID, depositAddr.
_41
rpc Deposit(QueryDepositRequest) returns (QueryDepositResponse) {
_41
option (google.api.http).get = "/cosmos/gov/v1/proposals/{proposal_id}/deposits/{depositor}";
_41
}
_41
_41
// Deposits queries all deposits of a single proposal.
_41
rpc Deposits(QueryDepositsRequest) returns (QueryDepositsResponse) {
_41
option (google.api.http).get = "/cosmos/gov/v1/proposals/{proposal_id}/deposits";
_41
}
_41
_41
// TallyResult queries the tally of a proposal vote.
_41
rpc TallyResult(QueryTallyResultRequest) returns (QueryTallyResultResponse) {
_41
option (google.api.http).get = "/cosmos/gov/v1/proposals/{proposal_id}/tally";
_41
}
_41
}

QueryProposalRequest

QueryProposalRequest is the request type for the Query/Proposal RPC method.

query.proto
Copy

_4
message QueryProposalRequest {
_4
// proposal_id defines the unique id of the proposal.
_4
uint64 proposal_id = 1;
_4
}

QueryProposalResponse

QueryProposalResponse is the response type for the Query/Proposal RPC method.

query.proto
Copy

_3
message QueryProposalResponse {
_3
Proposal proposal = 1;
_3
}

QueryProposalsRequest

QueryProposalsRequest is the request type for the Query/Proposals RPC method.

query.proto
Copy

_13
message QueryProposalsRequest {
_13
// proposal_status defines the status of the proposals.
_13
ProposalStatus proposal_status = 1;
_13
_13
// voter defines the voter address for the proposals.
_13
string voter = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];
_13
_13
// depositor defines the deposit addresses from the proposals.
_13
string depositor = 3 [(cosmos_proto.scalar) = "cosmos.AddressString"];
_13
_13
// pagination defines an optional pagination for the request.
_13
cosmos.base.query.v1beta1.PageRequest pagination = 4;
_13
}

QueryProposalsResponse

QueryProposalsResponse is the response type for the Query/Proposals RPC method.

query.proto
Copy

_6
message QueryProposalsResponse {
_6
repeated Proposal proposals = 1;
_6
_6
// pagination defines the pagination in the response.
_6
cosmos.base.query.v1beta1.PageResponse pagination = 2;
_6
}

QueryVoteRequest

QueryVoteRequest is the request type for the Query/Vote RPC method.

query.proto
Copy

_7
message QueryVoteRequest {
_7
// proposal_id defines the unique id of the proposal.
_7
uint64 proposal_id = 1;
_7
_7
// voter defines the oter address for the proposals.
_7
string voter = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];
_7
}

QueryVoteResponse

QueryVoteResponse is the response type for the Query/Vote RPC method.

query.proto
Copy

_4
message QueryVoteResponse {
_4
// vote defined the queried vote.
_4
Vote vote = 1;
_4
}

QueryVotesRequest

QueryVotesRequest is the request type for the Query/Votes RPC method.

query.proto
Copy

_7
message QueryVotesRequest {
_7
// proposal_id defines the unique id of the proposal.
_7
uint64 proposal_id = 1;
_7
_7
// pagination defines an optional pagination for the request.
_7
cosmos.base.query.v1beta1.PageRequest pagination = 2;
_7
}

QueryVotesResponse

QueryVotesResponse is the response type for the Query/Votes RPC method.

query.proto
Copy

_7
message QueryVotesResponse {
_7
// votes defined the queried votes.
_7
repeated Vote votes = 1;
_7
_7
// pagination defines the pagination in the response.
_7
cosmos.base.query.v1beta1.PageResponse pagination = 2;
_7
}

QueryParamsRequest

QueryParamsRequest is the request type for the Query/Params RPC method.

query.proto
Copy

_5
message QueryParamsRequest {
_5
// params_type defines which parameters to query for, can be one of "voting",
_5
// "tallying" or "deposit".
_5
string params_type = 1;
_5
}

QueryParamsResponse

QueryParamsResponse is the response type for the Query/Params RPC method.

query.proto
Copy

_8
message QueryParamsResponse {
_8
// voting_params defines the parameters related to voting.
_8
VotingParams voting_params = 1;
_8
// deposit_params defines the parameters related to deposit.
_8
DepositParams deposit_params = 2;
_8
// tally_params defines the parameters related to tally.
_8
TallyParams tally_params = 3;
_8
}

QueryDepositRequest

QueryDepositRequest is the request type for the Query/Deposit RPC method.

query.proto
Copy

_7
message QueryDepositRequest {
_7
// proposal_id defines the unique id of the proposal.
_7
uint64 proposal_id = 1;
_7
_7
// depositor defines the deposit addresses from the proposals.
_7
string depositor = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];
_7
}

QueryDepositResponse

QueryDepositResponse is the response type for the Query/Deposit RPC method.

query.proto
Copy

_4
message QueryDepositResponse {
_4
// deposit defines the requested deposit.
_4
Deposit deposit = 1;
_4
}

QueryDepositsRequest

QueryDepositsRequest is the request type for the Query/Deposits RPC method.

query.proto
Copy

_7
message QueryDepositsRequest {
_7
// proposal_id defines the unique id of the proposal.
_7
uint64 proposal_id = 1;
_7
_7
// pagination defines an optional pagination for the request.
_7
cosmos.base.query.v1beta1.PageRequest pagination = 2;
_7
}

QueryDepositsResponse

QueryDepositsResponse is the response type for the Query/Deposits RPC method.

query.proto
Copy

_6
message QueryDepositsResponse {
_6
repeated Deposit deposits = 1;
_6
_6
// pagination defines the pagination in the response.
_6
cosmos.base.query.v1beta1.PageResponse pagination = 2;
_6
}

QueryTallyResultRequest

QueryTallyResultRequest is the request type for the Query/Tally RPC method.

query.proto
Copy

_4
message QueryTallyResultRequest {
_4
// proposal_id defines the unique id of the proposal.
_4
uint64 proposal_id = 1;
_4
}

QueryTallyResultResponse

QueryTallyResultResponse is the response type for the Query/Tally RPC method.

query.proto
Copy

_4
message QueryTallyResultResponse {
_4
// tally defines the requested tally.
_4
TallyResult tally = 1;
_4
}