Skip to content

Commit

Permalink
feat: Add group module proto definitions and basic types (#9631)
Browse files Browse the repository at this point in the history
<!--
The default pull request template is for types feat, fix, or refactor.
For other templates, add one of the following parameters to the url:
- template=docs.md
- template=other.md
-->

## Description

ref: #7633

<!-- Add a description of the changes that this PR introduces and the files that
are the most critical to review. -->

Following up on #9089, this PR is the first step towards the migration of [x/group](https://github.com/regen-network/regen-ledger/tree/master/x/group) into the SDK. It introduces the group module proto definitions (types, tx, query) and other types.
The rest of the code (module, server, client, genesis...) is dependent on various other discussions (#9238, #9182, #9237, #7773) and will be added in follow-up PRs incrementally.

---

### Author Checklist

*All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.*

I have...

- [x] included the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title
- [x] added `!` to the type prefix if API or client breaking change
- [x] targeted the correct branch (see [PR Targeting](https://github.com/cosmos/cosmos-sdk/blob/master/CONTRIBUTING.md#pr-targeting))
- [x] provided a link to the relevant issue or specification
- [x] followed the guidelines for [building modules](https://github.com/cosmos/cosmos-sdk/blob/master/docs/building-modules)
- [x] included the necessary unit and integration [tests](https://github.com/cosmos/cosmos-sdk/blob/master/CONTRIBUTING.md#testing)
- [ ] added a changelog entry to `CHANGELOG.md`
- [x] included comments for [documenting Go code](https://blog.golang.org/godoc)
- [x] updated the relevant documentation or specification
- [x] reviewed "Files changed" and left comments if necessary
- [x] confirmed all CI checks have passed

### Reviewers Checklist

*All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.*

I have...

- [ ] confirmed the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title
- [ ] confirmed `!` in the type prefix if API or client breaking change
- [ ] confirmed all author checklist items have been addressed 
- [ ] reviewed state machine logic
- [ ] reviewed API design and naming
- [ ] reviewed documentation is accurate
- [ ] reviewed tests and test coverage
- [ ] manually tested (if applicable)
  • Loading branch information
blushi authored Jul 9, 2021
1 parent d13d488 commit 402148a
Show file tree
Hide file tree
Showing 14 changed files with 16,045 additions and 24 deletions.
1,060 changes: 1,060 additions & 0 deletions docs/core/proto-docs.md

Large diffs are not rendered by default.

244 changes: 244 additions & 0 deletions proto/cosmos/group/v1beta1/query.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,244 @@
syntax = "proto3";

package cosmos.group.v1beta1;

import "cosmos/group/v1beta1/types.proto";
import "gogoproto/gogo.proto";
import "cosmos/base/query/v1beta1/pagination.proto";

option go_package = "github.com/cosmos/cosmos-sdk/x/group";

// Query is the cosmos.group.v1beta1 Query service.
service Query {

// GroupInfo queries group info based on group id.
rpc GroupInfo(QueryGroupInfoRequest) returns (QueryGroupInfoResponse);

// GroupAccountInfo queries group account info based on group account address.
rpc GroupAccountInfo(QueryGroupAccountInfoRequest) returns (QueryGroupAccountInfoResponse);

// GroupMembers queries members of a group
rpc GroupMembers(QueryGroupMembersRequest) returns (QueryGroupMembersResponse);

// GroupsByAdmin queries groups by admin address.
rpc GroupsByAdmin(QueryGroupsByAdminRequest) returns (QueryGroupsByAdminResponse);

// GroupAccountsByGroup queries group accounts by group id.
rpc GroupAccountsByGroup(QueryGroupAccountsByGroupRequest) returns (QueryGroupAccountsByGroupResponse);

// GroupsByAdmin queries group accounts by admin address.
rpc GroupAccountsByAdmin(QueryGroupAccountsByAdminRequest) returns (QueryGroupAccountsByAdminResponse);

// Proposal queries a proposal based on proposal id.
rpc Proposal(QueryProposalRequest) returns (QueryProposalResponse);

// ProposalsByGroupAccount queries proposals based on group account address.
rpc ProposalsByGroupAccount(QueryProposalsByGroupAccountRequest) returns (QueryProposalsByGroupAccountResponse);

// VoteByProposalVoter queries a vote by proposal id and voter.
rpc VoteByProposalVoter(QueryVoteByProposalVoterRequest) returns (QueryVoteByProposalVoterResponse);

// VotesByProposal queries a vote by proposal.
rpc VotesByProposal(QueryVotesByProposalRequest) returns (QueryVotesByProposalResponse);

// VotesByVoter queries a vote by voter.
rpc VotesByVoter(QueryVotesByVoterRequest) returns (QueryVotesByVoterResponse);
}

// QueryGroupInfoRequest is the Query/GroupInfo request type.
message QueryGroupInfoRequest {

// group_id is the unique ID of the group.
uint64 group_id = 1;
}

// QueryGroupInfoResponse is the Query/GroupInfo response type.
message QueryGroupInfoResponse {

// info is the GroupInfo for the group.
GroupInfo info = 1;
}

// QueryGroupAccountInfoRequest is the Query/GroupAccountInfo request type.
message QueryGroupAccountInfoRequest {

// address is the account address of the group account.
string address = 1;
}

// QueryGroupAccountInfoResponse is the Query/GroupAccountInfo response type.
message QueryGroupAccountInfoResponse {

// info is the GroupAccountInfo for the group account.
GroupAccountInfo info = 1;
}

// QueryGroupMembersRequest is the Query/GroupMembersRequest request type.
message QueryGroupMembersRequest {

// group_id is the unique ID of the group.
uint64 group_id = 1;

// pagination defines an optional pagination for the request.
cosmos.base.query.v1beta1.PageRequest pagination = 2;
}

// QueryGroupMembersResponse is the Query/GroupMembersResponse response type.
message QueryGroupMembersResponse {

// members are the members of the group with given group_id.
repeated GroupMember members = 1;

// pagination defines the pagination in the response.
cosmos.base.query.v1beta1.PageResponse pagination = 2;
}

// QueryGroupsByAdminRequest is the Query/GroupsByAdminRequest request type.
message QueryGroupsByAdminRequest {

// admin is the account address of a group's admin.
string admin = 1;

// pagination defines an optional pagination for the request.
cosmos.base.query.v1beta1.PageRequest pagination = 2;
}

// QueryGroupsByAdminResponse is the Query/GroupsByAdminResponse response type.
message QueryGroupsByAdminResponse {

// groups are the groups info with the provided admin.
repeated GroupInfo groups = 1;

// pagination defines the pagination in the response.
cosmos.base.query.v1beta1.PageResponse pagination = 2;
}

// QueryGroupAccountsByGroupRequest is the Query/GroupAccountsByGroup request type.
message QueryGroupAccountsByGroupRequest {

// group_id is the unique ID of the group account's group.
uint64 group_id = 1;

// pagination defines an optional pagination for the request.
cosmos.base.query.v1beta1.PageRequest pagination = 2;
}

// QueryGroupAccountsByGroupResponse is the Query/GroupAccountsByGroup response type.
message QueryGroupAccountsByGroupResponse {

// group_accounts are the group accounts info associated with the provided group.
repeated GroupAccountInfo group_accounts = 1;

// pagination defines the pagination in the response.
cosmos.base.query.v1beta1.PageResponse pagination = 2;
}

// QueryGroupAccountsByAdminRequest is the Query/GroupAccountsByAdmin request type.
message QueryGroupAccountsByAdminRequest {

// admin is the admin address of the group account.
string admin = 1;

// pagination defines an optional pagination for the request.
cosmos.base.query.v1beta1.PageRequest pagination = 2;
}

// QueryGroupAccountsByAdminResponse is the Query/GroupAccountsByAdmin response type.
message QueryGroupAccountsByAdminResponse {

// group_accounts are the group accounts info with provided admin.
repeated GroupAccountInfo group_accounts = 1;

// pagination defines the pagination in the response.
cosmos.base.query.v1beta1.PageResponse pagination = 2;
}

// QueryProposalRequest is the Query/Proposal request type.
message QueryProposalRequest {

// proposal_id is the unique ID of a proposal.
uint64 proposal_id = 1;
}

// QueryProposalResponse is the Query/Proposal response type.
message QueryProposalResponse {

// proposal is the proposal info.
Proposal proposal = 1;
}

// QueryProposalsByGroupAccountRequest is the Query/ProposalByGroupAccount request type.
message QueryProposalsByGroupAccountRequest {

// address is the group account address related to proposals.
string address = 1;

// pagination defines an optional pagination for the request.
cosmos.base.query.v1beta1.PageRequest pagination = 2;
}

// QueryProposalsByGroupAccountResponse is the Query/ProposalByGroupAccount response type.
message QueryProposalsByGroupAccountResponse {

// proposals are the proposals with given group account.
repeated Proposal proposals = 1;

// pagination defines the pagination in the response.
cosmos.base.query.v1beta1.PageResponse pagination = 2;
}

// QueryVoteByProposalVoterResponse is the Query/VoteByProposalVoter request type.
message QueryVoteByProposalVoterRequest {

// proposal_id is the unique ID of a proposal.
uint64 proposal_id = 1;

// voter is a proposal voter account address.
string voter = 2;
}

// QueryVoteByProposalVoterResponse is the Query/VoteByProposalVoter response type.
message QueryVoteByProposalVoterResponse {

// vote is the vote with given proposal_id and voter.
Vote vote = 1;
}

// QueryVotesByProposalResponse is the Query/VotesByProposal request type.
message QueryVotesByProposalRequest {

// proposal_id is the unique ID of a proposal.
uint64 proposal_id = 1;

// pagination defines an optional pagination for the request.
cosmos.base.query.v1beta1.PageRequest pagination = 2;
}

// QueryVotesByProposalResponse is the Query/VotesByProposal response type.
message QueryVotesByProposalResponse {

// votes are the list of votes for given proposal_id.
repeated Vote votes = 1;

// pagination defines the pagination in the response.
cosmos.base.query.v1beta1.PageResponse pagination = 2;
}

// QueryVotesByVoterResponse is the Query/VotesByVoter request type.
message QueryVotesByVoterRequest {
// voter is a proposal voter account address.
string voter = 1;

// pagination defines an optional pagination for the request.
cosmos.base.query.v1beta1.PageRequest pagination = 2;
}

// QueryVotesByVoterResponse is the Query/VotesByVoter response type.
message QueryVotesByVoterResponse {

// votes are the list of votes by given voter.
repeated Vote votes = 1;

// pagination defines the pagination in the response.
cosmos.base.query.v1beta1.PageResponse pagination = 2;
}
Loading

0 comments on commit 402148a

Please sign in to comment.