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.
Links
Message Types
Msg
defines the gov Msg
service.
_17 // SubmitProposal defines a method to create new proposal given a content.
_17 rpc SubmitProposal(MsgSubmitProposal) returns (MsgSubmitProposalResponse);
_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 // Vote defines a method to add a vote on a specific proposal.
_17 rpc Vote(MsgVote) returns (MsgVoteResponse);
_17 // VoteWeighted defines a method to add a weighted vote on a specific proposal.
_17 rpc VoteWeighted(MsgVoteWeighted) returns (MsgVoteWeightedResponse);
_17 // Deposit defines a method to add deposit on a specific proposal.
_17 rpc Deposit(MsgDeposit) returns (MsgDepositResponse);
MsgSubmitProposal
MsgSubmitProposal
defines an sdk.Msg
type that supports submitting arbitrary proposal Content.
_9message MsgSubmitProposal {
_9 option (cosmos.msg.v1.signer) = "proposer";
_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.
MsgSubmitProposalResponse
MsgSubmitProposalResponse
defines the Msg/SubmitProposal
response type.
_3message MsgSubmitProposalResponse {
_3 uint64 proposal_id = 1;
MsgExecLegacyContent
MsgExecLegacyContent
is used to wrap the legacy content field into a message. This ensures backwards compatibility with v1beta1.MsgSubmitProposal
.
_8message MsgExecLegacyContent {
_8 option (cosmos.msg.v1.signer) = "authority";
_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.
MsgExecLegacyContentResponse
MsgExecLegacyContentResponse
defines the Msg/ExecLegacyContent
response type.
_1message MsgExecLegacyContentResponse {}
MsgVote
MsgVote
defines a message to cast a vote.
_8 option (cosmos.msg.v1.signer) = "voter";
_8 uint64 proposal_id = 1 [(gogoproto.jsontag) = "proposal_id"];
_8 string voter = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];
_8 VoteOption option = 3;
MsgVoteResponse
MsgVoteResponse
defines the Msg/Vote
response type.
_1message MsgVoteResponse {}
MsgVoteWeighted
MsgVoteWeighted
defines a message to cast a vote.
_8message MsgVoteWeighted {
_8 option (cosmos.msg.v1.signer) = "voter";
_8 uint64 proposal_id = 1 [(gogoproto.jsontag) = "proposal_id"];
_8 string voter = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];
_8 repeated WeightedVoteOption options = 3;
MsgVoteWeightedResponse
MsgVoteWeightedResponse
defines the Msg/VoteWeighted
response type.
_1message MsgVoteWeightedResponse {}
MsgDeposit
MsgDeposit
defines a message to submit a deposit to an existing proposal.
_7 option (cosmos.msg.v1.signer) = "depositor";
_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];
MsgDepositResponse
MsgDepositResponse
defines the Msg/Deposit
response type.
_1message MsgDepositResponse {}
Queries
Query
defines the gRPC querier service for gov module.
_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 // 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 // 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 // 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 // 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 // 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 // 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 // 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";
QueryProposalRequest
QueryProposalRequest
is the request type for the Query/Proposal RPC
method.
_4message QueryProposalRequest {
_4 // proposal_id defines the unique id of the proposal.
_4 uint64 proposal_id = 1;
QueryProposalResponse
QueryProposalResponse
is the response type for the Query/Proposal
RPC method.
_3message QueryProposalResponse {
_3 Proposal proposal = 1;
QueryProposalsRequest
QueryProposalsRequest
is the request type for the Query/Proposals
RPC method.
_13message QueryProposalsRequest {
_13 // proposal_status defines the status of the proposals.
_13 ProposalStatus proposal_status = 1;
_13 // voter defines the voter address for the proposals.
_13 string voter = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];
_13 // depositor defines the deposit addresses from the proposals.
_13 string depositor = 3 [(cosmos_proto.scalar) = "cosmos.AddressString"];
_13 // pagination defines an optional pagination for the request.
_13 cosmos.base.query.v1beta1.PageRequest pagination = 4;
QueryProposalsResponse
QueryProposalsResponse
is the response type for the Query/Proposals
RPC method.
_6message QueryProposalsResponse {
_6 repeated Proposal proposals = 1;
_6 // pagination defines the pagination in the response.
_6 cosmos.base.query.v1beta1.PageResponse pagination = 2;
QueryVoteRequest
QueryVoteRequest
is the request type for the Query/Vote
RPC method.
_7message QueryVoteRequest {
_7 // proposal_id defines the unique id of the proposal.
_7 uint64 proposal_id = 1;
_7 // voter defines the oter address for the proposals.
_7 string voter = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];
QueryVoteResponse
QueryVoteResponse
is the response type for the Query/Vote RPC method.
_4message QueryVoteResponse {
_4 // vote defined the queried vote.
QueryVotesRequest
QueryVotesRequest
is the request type for the Query/Votes
RPC method.
_7message QueryVotesRequest {
_7 // proposal_id defines the unique id of the proposal.
_7 uint64 proposal_id = 1;
_7 // pagination defines an optional pagination for the request.
_7 cosmos.base.query.v1beta1.PageRequest pagination = 2;
QueryVotesResponse
QueryVotesResponse
is the response type for the Query/Votes
RPC method.
_7message QueryVotesResponse {
_7 // votes defined the queried votes.
_7 repeated Vote votes = 1;
_7 // pagination defines the pagination in the response.
_7 cosmos.base.query.v1beta1.PageResponse pagination = 2;
QueryParamsRequest
QueryParamsRequest
is the request type for the Query/Params
RPC method.
_5message QueryParamsRequest {
_5 // params_type defines which parameters to query for, can be one of "voting",
_5 // "tallying" or "deposit".
_5 string params_type = 1;
QueryParamsResponse
QueryParamsResponse
is the response type for the Query/Params
RPC method.
_8message 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;
QueryDepositRequest
QueryDepositRequest
is the request type for the Query/Deposit
RPC method.
_7message QueryDepositRequest {
_7 // proposal_id defines the unique id of the proposal.
_7 uint64 proposal_id = 1;
_7 // depositor defines the deposit addresses from the proposals.
_7 string depositor = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];
QueryDepositResponse
QueryDepositResponse
is the response type for the Query/Deposit
RPC method.
_4message QueryDepositResponse {
_4 // deposit defines the requested deposit.
QueryDepositsRequest
QueryDepositsRequest
is the request type for the Query/Deposits
RPC method.
_7message QueryDepositsRequest {
_7 // proposal_id defines the unique id of the proposal.
_7 uint64 proposal_id = 1;
_7 // pagination defines an optional pagination for the request.
_7 cosmos.base.query.v1beta1.PageRequest pagination = 2;
QueryDepositsResponse
QueryDepositsResponse
is the response type for the Query/Deposits
RPC method.
_6message QueryDepositsResponse {
_6 repeated Deposit deposits = 1;
_6 // pagination defines the pagination in the response.
_6 cosmos.base.query.v1beta1.PageResponse pagination = 2;
QueryTallyResultRequest
QueryTallyResultRequest
is the request type for the Query/Tally
RPC method.
_4message QueryTallyResultRequest {
_4 // proposal_id defines the unique id of the proposal.
_4 uint64 proposal_id = 1;
QueryTallyResultResponse
QueryTallyResultResponse
is the response type for the Query/Tally
RPC method.
_4message QueryTallyResultResponse {
_4 // tally defines the requested tally.
_4 TallyResult tally = 1;