0g-chain/proto/zgc/committee/v1beta1/query.proto
2024-05-02 01:43:59 +08:00

182 lines
6.7 KiB
Protocol Buffer

syntax = "proto3";
package zgc.committee.v1beta1;
import "cosmos/base/query/v1beta1/pagination.proto";
import "cosmos_proto/cosmos.proto";
import "gogoproto/gogo.proto";
import "google/api/annotations.proto";
import "google/protobuf/any.proto";
import "google/protobuf/timestamp.proto";
import "zgc/committee/v1beta1/genesis.proto";
option go_package = "github.com/0glabs/0g-chain/x/committee/types";
option (gogoproto.goproto_getters_all) = false;
// Query defines the gRPC querier service for committee module
service Query {
// Committees queries all committess of the committee module.
rpc Committees(QueryCommitteesRequest) returns (QueryCommitteesResponse) {
option (google.api.http).get = "/0g/committee/v1beta1/committees";
}
// Committee queries a committee based on committee ID.
rpc Committee(QueryCommitteeRequest) returns (QueryCommitteeResponse) {
option (google.api.http).get = "/0g/committee/v1beta1/committees/{committee_id}";
}
// Proposals queries proposals based on committee ID.
rpc Proposals(QueryProposalsRequest) returns (QueryProposalsResponse) {
option (google.api.http).get = "/0g/committee/v1beta1/proposals";
}
// Deposits queries a proposal based on proposal ID.
rpc Proposal(QueryProposalRequest) returns (QueryProposalResponse) {
option (google.api.http).get = "/0g/committee/v1beta1/proposals/{proposal_id}";
}
// NextProposalID queries the next proposal ID of the committee module.
rpc NextProposalID(QueryNextProposalIDRequest) returns (QueryNextProposalIDResponse) {
option (google.api.http).get = "/0g/committee/v1beta1/next-proposal-id";
}
// Votes queries all votes for a single proposal ID.
rpc Votes(QueryVotesRequest) returns (QueryVotesResponse) {
option (google.api.http).get = "/0g/committee/v1beta1/proposals/{proposal_id}/votes";
}
// Vote queries the vote of a single voter for a single proposal ID.
rpc Vote(QueryVoteRequest) returns (QueryVoteResponse) {
option (google.api.http).get = "/0g/committee/v1beta1/proposals/{proposal_id}/votes/{voter}";
}
// Tally queries the tally of a single proposal ID.
rpc Tally(QueryTallyRequest) returns (QueryTallyResponse) {
option (google.api.http).get = "/0g/committee/v1beta1/proposals/{proposal_id}/tally";
}
// RawParams queries the raw params data of any subspace and key.
rpc RawParams(QueryRawParamsRequest) returns (QueryRawParamsResponse) {
option (google.api.http).get = "/0g/committee/v1beta1/raw-params";
}
}
// QueryCommitteesRequest defines the request type for querying x/committee committees.
message QueryCommitteesRequest {}
// QueryCommitteesResponse defines the response type for querying x/committee committees.
message QueryCommitteesResponse {
repeated google.protobuf.Any committees = 1 [(cosmos_proto.accepts_interface) = "Committee"];
}
// QueryCommitteeRequest defines the request type for querying x/committee committee.
message QueryCommitteeRequest {
uint64 committee_id = 1;
}
// QueryCommitteeResponse defines the response type for querying x/committee committee.
message QueryCommitteeResponse {
google.protobuf.Any committee = 1 [(cosmos_proto.accepts_interface) = "Committee"];
}
// QueryProposalsRequest defines the request type for querying x/committee proposals.
message QueryProposalsRequest {
uint64 committee_id = 1;
}
// QueryProposalsResponse defines the response type for querying x/committee proposals.
message QueryProposalsResponse {
repeated QueryProposalResponse proposals = 1 [(gogoproto.nullable) = false];
}
// QueryProposalRequest defines the request type for querying x/committee proposal.
message QueryProposalRequest {
uint64 proposal_id = 1;
}
// QueryProposalResponse defines the response type for querying x/committee proposal.
message QueryProposalResponse {
google.protobuf.Any pub_proposal = 1 [
(cosmos_proto.accepts_interface) = "cosmos.gov.v1beta1.Content",
(gogoproto.customname) = "PubProposal"
];
uint64 id = 2 [(gogoproto.customname) = "ID"];
uint64 committee_id = 3 [(gogoproto.customname) = "CommitteeID"];
google.protobuf.Timestamp deadline = 4 [
(gogoproto.nullable) = false,
(gogoproto.stdtime) = true
];
}
// QueryNextProposalIDRequest defines the request type for querying x/committee NextProposalID.
message QueryNextProposalIDRequest {}
// QueryNextProposalIDRequest defines the response type for querying x/committee NextProposalID.
message QueryNextProposalIDResponse {
uint64 next_proposal_id = 1 [(gogoproto.customname) = "NextProposalID"];
}
// QueryVotesRequest defines the request type for querying x/committee votes.
message QueryVotesRequest {
uint64 proposal_id = 1;
cosmos.base.query.v1beta1.PageRequest pagination = 2;
}
// QueryVotesResponse defines the response type for querying x/committee votes.
message QueryVotesResponse {
// votes defined the queried votes.
repeated QueryVoteResponse votes = 1 [(gogoproto.nullable) = false];
// pagination defines the pagination in the response.
cosmos.base.query.v1beta1.PageResponse pagination = 2;
}
// QueryVoteRequest defines the request type for querying x/committee vote.
message QueryVoteRequest {
uint64 proposal_id = 1;
string voter = 2;
}
// QueryVoteResponse defines the response type for querying x/committee vote.
message QueryVoteResponse {
uint64 proposal_id = 1 [(gogoproto.customname) = "ProposalID"];
string voter = 2;
VoteType vote_type = 3;
}
// QueryTallyRequest defines the request type for querying x/committee tally.
message QueryTallyRequest {
uint64 proposal_id = 1;
}
// QueryTallyResponse defines the response type for querying x/committee tally.
message QueryTallyResponse {
uint64 proposal_id = 1 [(gogoproto.customname) = "ProposalID"];
string yes_votes = 2 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec",
(gogoproto.nullable) = false
];
string no_votes = 3 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec",
(gogoproto.nullable) = false
];
string current_votes = 4 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec",
(gogoproto.nullable) = false
];
string possible_votes = 5 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec",
(gogoproto.nullable) = false
];
string vote_threshold = 6 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec",
(gogoproto.nullable) = false
];
string quorum = 7 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec",
(gogoproto.nullable) = false
];
}
// QueryRawParamsRequest defines the request type for querying x/committee raw params.
message QueryRawParamsRequest {
string subspace = 1;
string key = 2;
}
// QueryRawParamsResponse defines the response type for querying x/committee raw params.
message QueryRawParamsResponse {
string raw_data = 1;
}