feat(x/protocolpool): Stream funds from community pool (#18103)

This commit is contained in:
Likhita Polavarapu
2023-11-06 14:07:34 +00:00
committed by GitHub
parent 9c0256e368
commit 56351179b8
27 changed files with 8727 additions and 236 deletions
File diff suppressed because it is too large Load Diff
+40 -3
View File
@@ -1,5 +1,3 @@
// Since: cosmos-sdk 0.50
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.3.0
@@ -21,7 +19,8 @@ import (
const _ = grpc.SupportPackageIsVersion7
const (
Query_CommunityPool_FullMethodName = "/cosmos.protocolpool.v1.Query/CommunityPool"
Query_CommunityPool_FullMethodName = "/cosmos.protocolpool.v1.Query/CommunityPool"
Query_UnclaimedBudget_FullMethodName = "/cosmos.protocolpool.v1.Query/UnclaimedBudget"
)
// QueryClient is the client API for Query service.
@@ -30,6 +29,8 @@ const (
type QueryClient interface {
// CommunityPool queries the community pool coins.
CommunityPool(ctx context.Context, in *QueryCommunityPoolRequest, opts ...grpc.CallOption) (*QueryCommunityPoolResponse, error)
// UnclaimedBudget queries the remaining budget left to be claimed and it gives overall budget allocation view.
UnclaimedBudget(ctx context.Context, in *QueryUnclaimedBudgetRequest, opts ...grpc.CallOption) (*QueryUnclaimedBudgetResponse, error)
}
type queryClient struct {
@@ -49,12 +50,23 @@ func (c *queryClient) CommunityPool(ctx context.Context, in *QueryCommunityPoolR
return out, nil
}
func (c *queryClient) UnclaimedBudget(ctx context.Context, in *QueryUnclaimedBudgetRequest, opts ...grpc.CallOption) (*QueryUnclaimedBudgetResponse, error) {
out := new(QueryUnclaimedBudgetResponse)
err := c.cc.Invoke(ctx, Query_UnclaimedBudget_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
type QueryServer interface {
// CommunityPool queries the community pool coins.
CommunityPool(context.Context, *QueryCommunityPoolRequest) (*QueryCommunityPoolResponse, error)
// UnclaimedBudget queries the remaining budget left to be claimed and it gives overall budget allocation view.
UnclaimedBudget(context.Context, *QueryUnclaimedBudgetRequest) (*QueryUnclaimedBudgetResponse, error)
mustEmbedUnimplementedQueryServer()
}
@@ -65,6 +77,9 @@ type UnimplementedQueryServer struct {
func (UnimplementedQueryServer) CommunityPool(context.Context, *QueryCommunityPoolRequest) (*QueryCommunityPoolResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method CommunityPool not implemented")
}
func (UnimplementedQueryServer) UnclaimedBudget(context.Context, *QueryUnclaimedBudgetRequest) (*QueryUnclaimedBudgetResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method UnclaimedBudget not implemented")
}
func (UnimplementedQueryServer) mustEmbedUnimplementedQueryServer() {}
// UnsafeQueryServer may be embedded to opt out of forward compatibility for this service.
@@ -96,6 +111,24 @@ func _Query_CommunityPool_Handler(srv interface{}, ctx context.Context, dec func
return interceptor(ctx, in, info, handler)
}
func _Query_UnclaimedBudget_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryUnclaimedBudgetRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).UnclaimedBudget(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Query_UnclaimedBudget_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).UnclaimedBudget(ctx, req.(*QueryUnclaimedBudgetRequest))
}
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)
@@ -107,6 +140,10 @@ var Query_ServiceDesc = grpc.ServiceDesc{
MethodName: "CommunityPool",
Handler: _Query_CommunityPool_Handler,
},
{
MethodName: "UnclaimedBudget",
Handler: _Query_UnclaimedBudget_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "cosmos/protocolpool/v1/query.proto",
File diff suppressed because it is too large Load Diff
+80 -12
View File
@@ -1,5 +1,3 @@
// Since: cosmos-sdk 0.50
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.3.0
@@ -21,8 +19,10 @@ import (
const _ = grpc.SupportPackageIsVersion7
const (
Msg_FundCommunityPool_FullMethodName = "/cosmos.protocolpool.v1.Msg/FundCommunityPool"
Msg_CommunityPoolSpend_FullMethodName = "/cosmos.protocolpool.v1.Msg/CommunityPoolSpend"
Msg_FundCommunityPool_FullMethodName = "/cosmos.protocolpool.v1.Msg/FundCommunityPool"
Msg_CommunityPoolSpend_FullMethodName = "/cosmos.protocolpool.v1.Msg/CommunityPoolSpend"
Msg_SubmitBudgetProposal_FullMethodName = "/cosmos.protocolpool.v1.Msg/SubmitBudgetProposal"
Msg_ClaimBudget_FullMethodName = "/cosmos.protocolpool.v1.Msg/ClaimBudget"
)
// MsgClient is the client API for Msg service.
@@ -31,16 +31,16 @@ const (
type MsgClient interface {
// FundCommunityPool defines a method to allow an account to directly
// fund the community pool.
//
// Since: cosmos-sdk 0.50
FundCommunityPool(ctx context.Context, in *MsgFundCommunityPool, opts ...grpc.CallOption) (*MsgFundCommunityPoolResponse, error)
// CommunityPoolSpend defines a governance operation for sending tokens from
// the community pool in the x/protocolpool module to another account, which
// could be the governance module itself. The authority is defined in the
// keeper.
//
// Since: cosmos-sdk 0.50
CommunityPoolSpend(ctx context.Context, in *MsgCommunityPoolSpend, opts ...grpc.CallOption) (*MsgCommunityPoolSpendResponse, error)
// SubmitBudgetProposal defines a method to set a budget proposal.
SubmitBudgetProposal(ctx context.Context, in *MsgSubmitBudgetProposal, opts ...grpc.CallOption) (*MsgSubmitBudgetProposalResponse, error)
// ClaimBudget defines a method to claim the distributed budget.
ClaimBudget(ctx context.Context, in *MsgClaimBudget, opts ...grpc.CallOption) (*MsgClaimBudgetResponse, error)
}
type msgClient struct {
@@ -69,22 +69,40 @@ func (c *msgClient) CommunityPoolSpend(ctx context.Context, in *MsgCommunityPool
return out, nil
}
func (c *msgClient) SubmitBudgetProposal(ctx context.Context, in *MsgSubmitBudgetProposal, opts ...grpc.CallOption) (*MsgSubmitBudgetProposalResponse, error) {
out := new(MsgSubmitBudgetProposalResponse)
err := c.cc.Invoke(ctx, Msg_SubmitBudgetProposal_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *msgClient) ClaimBudget(ctx context.Context, in *MsgClaimBudget, opts ...grpc.CallOption) (*MsgClaimBudgetResponse, error) {
out := new(MsgClaimBudgetResponse)
err := c.cc.Invoke(ctx, Msg_ClaimBudget_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
type MsgServer interface {
// FundCommunityPool defines a method to allow an account to directly
// fund the community pool.
//
// Since: cosmos-sdk 0.50
FundCommunityPool(context.Context, *MsgFundCommunityPool) (*MsgFundCommunityPoolResponse, error)
// CommunityPoolSpend defines a governance operation for sending tokens from
// the community pool in the x/protocolpool module to another account, which
// could be the governance module itself. The authority is defined in the
// keeper.
//
// Since: cosmos-sdk 0.50
CommunityPoolSpend(context.Context, *MsgCommunityPoolSpend) (*MsgCommunityPoolSpendResponse, error)
// SubmitBudgetProposal defines a method to set a budget proposal.
SubmitBudgetProposal(context.Context, *MsgSubmitBudgetProposal) (*MsgSubmitBudgetProposalResponse, error)
// ClaimBudget defines a method to claim the distributed budget.
ClaimBudget(context.Context, *MsgClaimBudget) (*MsgClaimBudgetResponse, error)
mustEmbedUnimplementedMsgServer()
}
@@ -98,6 +116,12 @@ func (UnimplementedMsgServer) FundCommunityPool(context.Context, *MsgFundCommuni
func (UnimplementedMsgServer) CommunityPoolSpend(context.Context, *MsgCommunityPoolSpend) (*MsgCommunityPoolSpendResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method CommunityPoolSpend not implemented")
}
func (UnimplementedMsgServer) SubmitBudgetProposal(context.Context, *MsgSubmitBudgetProposal) (*MsgSubmitBudgetProposalResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method SubmitBudgetProposal not implemented")
}
func (UnimplementedMsgServer) ClaimBudget(context.Context, *MsgClaimBudget) (*MsgClaimBudgetResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method ClaimBudget not implemented")
}
func (UnimplementedMsgServer) mustEmbedUnimplementedMsgServer() {}
// UnsafeMsgServer may be embedded to opt out of forward compatibility for this service.
@@ -147,6 +171,42 @@ func _Msg_CommunityPoolSpend_Handler(srv interface{}, ctx context.Context, dec f
return interceptor(ctx, in, info, handler)
}
func _Msg_SubmitBudgetProposal_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(MsgSubmitBudgetProposal)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(MsgServer).SubmitBudgetProposal(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Msg_SubmitBudgetProposal_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(MsgServer).SubmitBudgetProposal(ctx, req.(*MsgSubmitBudgetProposal))
}
return interceptor(ctx, in, info, handler)
}
func _Msg_ClaimBudget_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(MsgClaimBudget)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(MsgServer).ClaimBudget(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Msg_ClaimBudget_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(MsgServer).ClaimBudget(ctx, req.(*MsgClaimBudget))
}
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)
@@ -162,6 +222,14 @@ var Msg_ServiceDesc = grpc.ServiceDesc{
MethodName: "CommunityPoolSpend",
Handler: _Msg_CommunityPoolSpend_Handler,
},
{
MethodName: "SubmitBudgetProposal",
Handler: _Msg_SubmitBudgetProposal_Handler,
},
{
MethodName: "ClaimBudget",
Handler: _Msg_ClaimBudget_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "cosmos/protocolpool/v1/tx.proto",
File diff suppressed because it is too large Load Diff