feat(x/gov): multiple choice proposals (#18762)

This commit is contained in:
Julien Robert
2024-01-08 11:55:37 +00:00
committed by GitHub
parent 6848448dc2
commit 41c84d6190
32 changed files with 6606 additions and 954 deletions
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+48 -9
View File
@@ -21,15 +21,16 @@ import (
const _ = grpc.SupportPackageIsVersion7
const (
Query_Constitution_FullMethodName = "/cosmos.gov.v1.Query/Constitution"
Query_Proposal_FullMethodName = "/cosmos.gov.v1.Query/Proposal"
Query_Proposals_FullMethodName = "/cosmos.gov.v1.Query/Proposals"
Query_Vote_FullMethodName = "/cosmos.gov.v1.Query/Vote"
Query_Votes_FullMethodName = "/cosmos.gov.v1.Query/Votes"
Query_Params_FullMethodName = "/cosmos.gov.v1.Query/Params"
Query_Deposit_FullMethodName = "/cosmos.gov.v1.Query/Deposit"
Query_Deposits_FullMethodName = "/cosmos.gov.v1.Query/Deposits"
Query_TallyResult_FullMethodName = "/cosmos.gov.v1.Query/TallyResult"
Query_Constitution_FullMethodName = "/cosmos.gov.v1.Query/Constitution"
Query_Proposal_FullMethodName = "/cosmos.gov.v1.Query/Proposal"
Query_Proposals_FullMethodName = "/cosmos.gov.v1.Query/Proposals"
Query_Vote_FullMethodName = "/cosmos.gov.v1.Query/Vote"
Query_Votes_FullMethodName = "/cosmos.gov.v1.Query/Votes"
Query_Params_FullMethodName = "/cosmos.gov.v1.Query/Params"
Query_Deposit_FullMethodName = "/cosmos.gov.v1.Query/Deposit"
Query_Deposits_FullMethodName = "/cosmos.gov.v1.Query/Deposits"
Query_TallyResult_FullMethodName = "/cosmos.gov.v1.Query/TallyResult"
Query_ProposalVoteOptions_FullMethodName = "/cosmos.gov.v1.Query/ProposalVoteOptions"
)
// QueryClient is the client API for Query service.
@@ -54,6 +55,8 @@ type QueryClient interface {
Deposits(ctx context.Context, in *QueryDepositsRequest, opts ...grpc.CallOption) (*QueryDepositsResponse, error)
// TallyResult queries the tally of a proposal vote.
TallyResult(ctx context.Context, in *QueryTallyResultRequest, opts ...grpc.CallOption) (*QueryTallyResultResponse, error)
// ProposalVoteOptions queries the valid voting options for a proposal.
ProposalVoteOptions(ctx context.Context, in *QueryProposalVoteOptionsRequest, opts ...grpc.CallOption) (*QueryProposalVoteOptionsResponse, error)
}
type queryClient struct {
@@ -145,6 +148,15 @@ func (c *queryClient) TallyResult(ctx context.Context, in *QueryTallyResultReque
return out, nil
}
func (c *queryClient) ProposalVoteOptions(ctx context.Context, in *QueryProposalVoteOptionsRequest, opts ...grpc.CallOption) (*QueryProposalVoteOptionsResponse, error) {
out := new(QueryProposalVoteOptionsResponse)
err := c.cc.Invoke(ctx, Query_ProposalVoteOptions_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// QueryServer is the server API for Query service.
// All implementations must embed UnimplementedQueryServer
// for forward compatibility
@@ -167,6 +179,8 @@ type QueryServer interface {
Deposits(context.Context, *QueryDepositsRequest) (*QueryDepositsResponse, error)
// TallyResult queries the tally of a proposal vote.
TallyResult(context.Context, *QueryTallyResultRequest) (*QueryTallyResultResponse, error)
// ProposalVoteOptions queries the valid voting options for a proposal.
ProposalVoteOptions(context.Context, *QueryProposalVoteOptionsRequest) (*QueryProposalVoteOptionsResponse, error)
mustEmbedUnimplementedQueryServer()
}
@@ -201,6 +215,9 @@ func (UnimplementedQueryServer) Deposits(context.Context, *QueryDepositsRequest)
func (UnimplementedQueryServer) TallyResult(context.Context, *QueryTallyResultRequest) (*QueryTallyResultResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method TallyResult not implemented")
}
func (UnimplementedQueryServer) ProposalVoteOptions(context.Context, *QueryProposalVoteOptionsRequest) (*QueryProposalVoteOptionsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method ProposalVoteOptions not implemented")
}
func (UnimplementedQueryServer) mustEmbedUnimplementedQueryServer() {}
// UnsafeQueryServer may be embedded to opt out of forward compatibility for this service.
@@ -376,6 +393,24 @@ func _Query_TallyResult_Handler(srv interface{}, ctx context.Context, dec func(i
return interceptor(ctx, in, info, handler)
}
func _Query_ProposalVoteOptions_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryProposalVoteOptionsRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).ProposalVoteOptions(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Query_ProposalVoteOptions_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).ProposalVoteOptions(ctx, req.(*QueryProposalVoteOptionsRequest))
}
return interceptor(ctx, in, info, handler)
}
// Query_ServiceDesc is the grpc.ServiceDesc for Query service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
@@ -419,6 +454,10 @@ var Query_ServiceDesc = grpc.ServiceDesc{
MethodName: "TallyResult",
Handler: _Query_TallyResult_Handler,
},
{
MethodName: "ProposalVoteOptions",
Handler: _Query_ProposalVoteOptions_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "cosmos/gov/v1/query.proto",
File diff suppressed because it is too large Load Diff
+50 -7
View File
@@ -21,13 +21,14 @@ import (
const _ = grpc.SupportPackageIsVersion7
const (
Msg_SubmitProposal_FullMethodName = "/cosmos.gov.v1.Msg/SubmitProposal"
Msg_ExecLegacyContent_FullMethodName = "/cosmos.gov.v1.Msg/ExecLegacyContent"
Msg_Vote_FullMethodName = "/cosmos.gov.v1.Msg/Vote"
Msg_VoteWeighted_FullMethodName = "/cosmos.gov.v1.Msg/VoteWeighted"
Msg_Deposit_FullMethodName = "/cosmos.gov.v1.Msg/Deposit"
Msg_UpdateParams_FullMethodName = "/cosmos.gov.v1.Msg/UpdateParams"
Msg_CancelProposal_FullMethodName = "/cosmos.gov.v1.Msg/CancelProposal"
Msg_SubmitProposal_FullMethodName = "/cosmos.gov.v1.Msg/SubmitProposal"
Msg_ExecLegacyContent_FullMethodName = "/cosmos.gov.v1.Msg/ExecLegacyContent"
Msg_Vote_FullMethodName = "/cosmos.gov.v1.Msg/Vote"
Msg_VoteWeighted_FullMethodName = "/cosmos.gov.v1.Msg/VoteWeighted"
Msg_Deposit_FullMethodName = "/cosmos.gov.v1.Msg/Deposit"
Msg_UpdateParams_FullMethodName = "/cosmos.gov.v1.Msg/UpdateParams"
Msg_CancelProposal_FullMethodName = "/cosmos.gov.v1.Msg/CancelProposal"
Msg_SubmitMultipleChoiceProposal_FullMethodName = "/cosmos.gov.v1.Msg/SubmitMultipleChoiceProposal"
)
// MsgClient is the client API for Msg service.
@@ -54,6 +55,10 @@ type MsgClient interface {
//
// Since: cosmos-sdk 0.50
CancelProposal(ctx context.Context, in *MsgCancelProposal, opts ...grpc.CallOption) (*MsgCancelProposalResponse, error)
// SubmitMultipleChoiceProposal defines a method to create new multiple choice proposal.
//
// Since: x/gov 1.0.0
SubmitMultipleChoiceProposal(ctx context.Context, in *MsgSubmitMultipleChoiceProposal, opts ...grpc.CallOption) (*MsgSubmitMultipleChoiceProposalResponse, error)
}
type msgClient struct {
@@ -127,6 +132,15 @@ func (c *msgClient) CancelProposal(ctx context.Context, in *MsgCancelProposal, o
return out, nil
}
func (c *msgClient) SubmitMultipleChoiceProposal(ctx context.Context, in *MsgSubmitMultipleChoiceProposal, opts ...grpc.CallOption) (*MsgSubmitMultipleChoiceProposalResponse, error) {
out := new(MsgSubmitMultipleChoiceProposalResponse)
err := c.cc.Invoke(ctx, Msg_SubmitMultipleChoiceProposal_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// MsgServer is the server API for Msg service.
// All implementations must embed UnimplementedMsgServer
// for forward compatibility
@@ -151,6 +165,10 @@ type MsgServer interface {
//
// Since: cosmos-sdk 0.50
CancelProposal(context.Context, *MsgCancelProposal) (*MsgCancelProposalResponse, error)
// SubmitMultipleChoiceProposal defines a method to create new multiple choice proposal.
//
// Since: x/gov 1.0.0
SubmitMultipleChoiceProposal(context.Context, *MsgSubmitMultipleChoiceProposal) (*MsgSubmitMultipleChoiceProposalResponse, error)
mustEmbedUnimplementedMsgServer()
}
@@ -179,6 +197,9 @@ func (UnimplementedMsgServer) UpdateParams(context.Context, *MsgUpdateParams) (*
func (UnimplementedMsgServer) CancelProposal(context.Context, *MsgCancelProposal) (*MsgCancelProposalResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method CancelProposal not implemented")
}
func (UnimplementedMsgServer) SubmitMultipleChoiceProposal(context.Context, *MsgSubmitMultipleChoiceProposal) (*MsgSubmitMultipleChoiceProposalResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method SubmitMultipleChoiceProposal not implemented")
}
func (UnimplementedMsgServer) mustEmbedUnimplementedMsgServer() {}
// UnsafeMsgServer may be embedded to opt out of forward compatibility for this service.
@@ -318,6 +339,24 @@ func _Msg_CancelProposal_Handler(srv interface{}, ctx context.Context, dec func(
return interceptor(ctx, in, info, handler)
}
func _Msg_SubmitMultipleChoiceProposal_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(MsgSubmitMultipleChoiceProposal)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(MsgServer).SubmitMultipleChoiceProposal(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Msg_SubmitMultipleChoiceProposal_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(MsgServer).SubmitMultipleChoiceProposal(ctx, req.(*MsgSubmitMultipleChoiceProposal))
}
return interceptor(ctx, in, info, handler)
}
// Msg_ServiceDesc is the grpc.ServiceDesc for Msg service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
@@ -353,6 +392,10 @@ var Msg_ServiceDesc = grpc.ServiceDesc{
MethodName: "CancelProposal",
Handler: _Msg_CancelProposal_Handler,
},
{
MethodName: "SubmitMultipleChoiceProposal",
Handler: _Msg_SubmitMultipleChoiceProposal_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "cosmos/gov/v1/tx.proto",