From 61554a4b87733c21f5eff8256df9fcaf04a17869 Mon Sep 17 00:00:00 2001 From: mattverse Date: Tue, 27 Feb 2024 16:57:33 +0900 Subject: [PATCH 1/6] Add query for querying all before send hooks --- .../osmosis/tokenfactory/v1beta1/query.proto | 21 + x/tokenfactory/client/cli/query.go | 7 + x/tokenfactory/keeper/before_send.go | 18 + x/tokenfactory/keeper/before_send_test.go | 4 + x/tokenfactory/keeper/grpc_query.go | 7 + x/tokenfactory/types/query.pb.go | 493 ++++++++++++++++-- x/tokenfactory/types/query.pb.gw.go | 65 +++ 7 files changed, 571 insertions(+), 44 deletions(-) diff --git a/proto/osmosis/tokenfactory/v1beta1/query.proto b/proto/osmosis/tokenfactory/v1beta1/query.proto index 9db59a9c129..505607de0e6 100644 --- a/proto/osmosis/tokenfactory/v1beta1/query.proto +++ b/proto/osmosis/tokenfactory/v1beta1/query.proto @@ -40,6 +40,17 @@ service Query { option (google.api.http).get = "/osmosis/tokenfactory/v1beta1/denoms/{denom}/before_send_hook"; } + + // AllBeforeSendHooksAddresses defines a gRPC query method for + // getting all addresses with before send hook registered. + // The response returns two arrays, an array with a list of denom and an array + // of before send hook addresses. The idx of denom correspons to before send + // hook addresse's idx. + rpc AllBeforeSendHooksAddresses(QueryAllBeforeSendHooksAddressesRequest) + returns (QueryAllBeforeSendHooksAddressesResponse) { + option (google.api.http).get = + "/osmosis/tokenfactory/v1beta1/all_before_send_hooks"; + } } // QueryParamsRequest is the request type for the Query/Params RPC method. @@ -87,4 +98,14 @@ message QueryBeforeSendHookAddressRequest { message QueryBeforeSendHookAddressResponse { string cosmwasm_address = 1 [ (gogoproto.moretags) = "yaml:\"cosmwasm_address\"" ]; +} + +message QueryAllBeforeSendHooksAddressesRequest {} + +// QueryAllBeforeSendHooksAddressesResponse defines the response structure for +// the AllBeforeSendHooksAddresses gRPC query. +message QueryAllBeforeSendHooksAddressesResponse { + repeated string denoms = 1 [ (gogoproto.moretags) = "yaml:\"denoms\"" ]; + repeated string before_send_hook_addresses = 2 + [ (gogoproto.moretags) = "yaml:\"before_send_addresses\"" ]; } \ No newline at end of file diff --git a/x/tokenfactory/client/cli/query.go b/x/tokenfactory/client/cli/query.go index 33436a4eba8..4dcec836eff 100644 --- a/x/tokenfactory/client/cli/query.go +++ b/x/tokenfactory/client/cli/query.go @@ -46,6 +46,13 @@ func GetCmdDenomsFromCreator() (*osmocli.QueryDescriptor, *types.QueryDenomsFrom Long: `{{.Short}}{{.ExampleHeader}} {{.CommandPrefix}}
`, }, &types.QueryDenomsFromCreatorRequest{} + +} +func GetCmdBeforeSendHooks() (*osmocli.QueryDescriptor, *types.QueryAllBeforeSendHooksAddressesRequest) { + return &osmocli.QueryDescriptor{ + Use: "all-before-send-hooks", + Short: "Returns a list of all before send hooks registered", + }, &types.QueryAllBeforeSendHooksAddressesRequest{} } // GetCmdDenomAuthorityMetadata returns the authority metadata for a queried denom diff --git a/x/tokenfactory/keeper/before_send.go b/x/tokenfactory/keeper/before_send.go index 16a8a08bd49..c8be986cc48 100644 --- a/x/tokenfactory/keeper/before_send.go +++ b/x/tokenfactory/keeper/before_send.go @@ -47,6 +47,24 @@ func (k Keeper) GetBeforeSendHook(ctx sdk.Context, denom string) string { return string(bz) } +func (k Keeper) GetAllBeforeSendHooks(ctx sdk.Context) ([]string, []string) { + denomsList := []string{} + beforeSendHooksList := []string{} + + iterator := k.GetAllDenomsIterator(ctx) + defer iterator.Close() + for ; iterator.Valid(); iterator.Next() { + denom := string(iterator.Value()) + + beforeSendHook := k.GetBeforeSendHook(ctx, denom) + if beforeSendHook != "" { + denomsList = append(denomsList, denom) + beforeSendHooksList = append(beforeSendHooksList, beforeSendHook) + } + } + return denomsList, beforeSendHooksList +} + // Hooks wrapper struct for bank keeper type Hooks struct { k Keeper diff --git a/x/tokenfactory/keeper/before_send_test.go b/x/tokenfactory/keeper/before_send_test.go index 7e3d31325eb..b4c3c93139f 100644 --- a/x/tokenfactory/keeper/before_send_test.go +++ b/x/tokenfactory/keeper/before_send_test.go @@ -113,6 +113,10 @@ func (s *KeeperTestSuite) TestBeforeSendHook() { _, err = s.msgServer.SetBeforeSendHook(sdk.WrapSDKContext(s.Ctx), types.NewMsgSetBeforeSendHook(s.TestAccs[0].String(), denom, cosmwasmAddress.String())) s.Require().NoError(err, "test: %v", tc.desc) + denoms, beforeSendHooks := s.App.TokenFactoryKeeper.GetAllBeforeSendHooks(s.Ctx) + s.Require().Equal(beforeSendHooks, []string{cosmwasmAddress.String()}) + s.Require().Equal(denoms, []string{denom}) + for _, sendTc := range tc.sendMsgs { _, err := s.bankMsgServer.Send(sdk.WrapSDKContext(s.Ctx), sendTc.msg(denom)) if sendTc.expectPass { diff --git a/x/tokenfactory/keeper/grpc_query.go b/x/tokenfactory/keeper/grpc_query.go index d70bb747824..5808527f0be 100644 --- a/x/tokenfactory/keeper/grpc_query.go +++ b/x/tokenfactory/keeper/grpc_query.go @@ -50,3 +50,10 @@ func (k Keeper) BeforeSendHookAddress(ctx context.Context, req *types.QueryBefor return &types.QueryBeforeSendHookAddressResponse{CosmwasmAddress: cosmwasmAddress}, nil } + +func (k Keeper) AllBeforeSendHooksAddresses(ctx context.Context, req *types.QueryAllBeforeSendHooksAddressesRequest) (*types.QueryAllBeforeSendHooksAddressesResponse, error) { + sdkCtx := sdk.UnwrapSDKContext(ctx) + denoms, beforesendHookAddresses := k.GetAllBeforeSendHooks(sdkCtx) + + return &types.QueryAllBeforeSendHooksAddressesResponse{Denoms: denoms, BeforeSendHookAddresses: beforesendHookAddresses}, nil +} diff --git a/x/tokenfactory/types/query.pb.go b/x/tokenfactory/types/query.pb.go index 556fd88aab8..9d0170de5e8 100644 --- a/x/tokenfactory/types/query.pb.go +++ b/x/tokenfactory/types/query.pb.go @@ -387,6 +387,100 @@ func (m *QueryBeforeSendHookAddressResponse) GetCosmwasmAddress() string { return "" } +type QueryAllBeforeSendHooksAddressesRequest struct { +} + +func (m *QueryAllBeforeSendHooksAddressesRequest) Reset() { + *m = QueryAllBeforeSendHooksAddressesRequest{} +} +func (m *QueryAllBeforeSendHooksAddressesRequest) String() string { return proto.CompactTextString(m) } +func (*QueryAllBeforeSendHooksAddressesRequest) ProtoMessage() {} +func (*QueryAllBeforeSendHooksAddressesRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_6f22013ad0f72e3f, []int{8} +} +func (m *QueryAllBeforeSendHooksAddressesRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryAllBeforeSendHooksAddressesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryAllBeforeSendHooksAddressesRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryAllBeforeSendHooksAddressesRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryAllBeforeSendHooksAddressesRequest.Merge(m, src) +} +func (m *QueryAllBeforeSendHooksAddressesRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryAllBeforeSendHooksAddressesRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryAllBeforeSendHooksAddressesRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryAllBeforeSendHooksAddressesRequest proto.InternalMessageInfo + +// QueryAllBeforeSendHooksAddressesResponse defines the response structure for +// the AllBeforeSendHooksAddresses gRPC query. +type QueryAllBeforeSendHooksAddressesResponse struct { + Denoms []string `protobuf:"bytes,1,rep,name=denoms,proto3" json:"denoms,omitempty" yaml:"denoms"` + BeforeSendHookAddresses []string `protobuf:"bytes,2,rep,name=before_send_hook_addresses,json=beforeSendHookAddresses,proto3" json:"before_send_hook_addresses,omitempty" yaml:"before_send_addresses"` +} + +func (m *QueryAllBeforeSendHooksAddressesResponse) Reset() { + *m = QueryAllBeforeSendHooksAddressesResponse{} +} +func (m *QueryAllBeforeSendHooksAddressesResponse) String() string { return proto.CompactTextString(m) } +func (*QueryAllBeforeSendHooksAddressesResponse) ProtoMessage() {} +func (*QueryAllBeforeSendHooksAddressesResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_6f22013ad0f72e3f, []int{9} +} +func (m *QueryAllBeforeSendHooksAddressesResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryAllBeforeSendHooksAddressesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryAllBeforeSendHooksAddressesResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryAllBeforeSendHooksAddressesResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryAllBeforeSendHooksAddressesResponse.Merge(m, src) +} +func (m *QueryAllBeforeSendHooksAddressesResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryAllBeforeSendHooksAddressesResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryAllBeforeSendHooksAddressesResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryAllBeforeSendHooksAddressesResponse proto.InternalMessageInfo + +func (m *QueryAllBeforeSendHooksAddressesResponse) GetDenoms() []string { + if m != nil { + return m.Denoms + } + return nil +} + +func (m *QueryAllBeforeSendHooksAddressesResponse) GetBeforeSendHookAddresses() []string { + if m != nil { + return m.BeforeSendHookAddresses + } + return nil +} + func init() { proto.RegisterType((*QueryParamsRequest)(nil), "osmosis.tokenfactory.v1beta1.QueryParamsRequest") proto.RegisterType((*QueryParamsResponse)(nil), "osmosis.tokenfactory.v1beta1.QueryParamsResponse") @@ -396,6 +490,8 @@ func init() { proto.RegisterType((*QueryDenomsFromCreatorResponse)(nil), "osmosis.tokenfactory.v1beta1.QueryDenomsFromCreatorResponse") proto.RegisterType((*QueryBeforeSendHookAddressRequest)(nil), "osmosis.tokenfactory.v1beta1.QueryBeforeSendHookAddressRequest") proto.RegisterType((*QueryBeforeSendHookAddressResponse)(nil), "osmosis.tokenfactory.v1beta1.QueryBeforeSendHookAddressResponse") + proto.RegisterType((*QueryAllBeforeSendHooksAddressesRequest)(nil), "osmosis.tokenfactory.v1beta1.QueryAllBeforeSendHooksAddressesRequest") + proto.RegisterType((*QueryAllBeforeSendHooksAddressesResponse)(nil), "osmosis.tokenfactory.v1beta1.QueryAllBeforeSendHooksAddressesResponse") } func init() { @@ -403,50 +499,55 @@ func init() { } var fileDescriptor_6f22013ad0f72e3f = []byte{ - // 674 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x55, 0x4d, 0x4f, 0x13, 0x5d, - 0x14, 0xee, 0xbc, 0xaf, 0xd4, 0x70, 0xfd, 0x82, 0x2b, 0x7e, 0x55, 0x9c, 0xca, 0x95, 0x10, 0x30, - 0xd8, 0x91, 0x8f, 0x85, 0x11, 0x09, 0x74, 0x50, 0x34, 0x41, 0x12, 0x1d, 0x57, 0xba, 0x69, 0x6e, - 0xdb, 0x4b, 0x69, 0xe8, 0xcc, 0x29, 0x73, 0x6f, 0xd1, 0x86, 0xb0, 0x71, 0xe1, 0xda, 0xc4, 0xa5, - 0xff, 0xc1, 0xdf, 0xc1, 0x92, 0x84, 0x8d, 0xab, 0x46, 0xc1, 0xf8, 0x03, 0xfa, 0x0b, 0xcc, 0xdc, - 0x7b, 0x8a, 0x40, 0xcb, 0xa4, 0xe0, 0xaa, 0x93, 0x73, 0x9e, 0xf3, 0x9c, 0xe7, 0xb9, 0xe7, 0x9c, - 0x94, 0x8c, 0x82, 0xf4, 0x41, 0x96, 0xa5, 0xa3, 0x60, 0x4d, 0x04, 0x2b, 0xbc, 0xa0, 0x20, 0xac, - 0x3b, 0x1b, 0x13, 0x79, 0xa1, 0xf8, 0x84, 0xb3, 0x5e, 0x13, 0x61, 0x3d, 0x53, 0x0d, 0x41, 0x01, - 0x1d, 0x44, 0x64, 0xe6, 0x30, 0x32, 0x83, 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, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x56, 0x4f, 0x4f, 0x13, 0x4f, + 0x18, 0xee, 0xf2, 0xfb, 0x51, 0x65, 0xfc, 0x07, 0x23, 0x0a, 0x2e, 0xd8, 0x85, 0x91, 0x60, 0x31, + 0xd8, 0x95, 0x3f, 0x26, 0x46, 0x24, 0xd0, 0x45, 0xd0, 0x04, 0x49, 0x74, 0x3d, 0x69, 0x62, 0x36, + 0xb3, 0xed, 0x50, 0x1a, 0x76, 0x77, 0xca, 0xce, 0x14, 0x6d, 0x08, 0x17, 0x0f, 0x9e, 0x4d, 0x3c, + 0xfa, 0x1d, 0x3c, 0xf1, 0x21, 0x38, 0x92, 0x70, 0xf1, 0xb4, 0x51, 0x30, 0x26, 0x5e, 0xfb, 0x09, + 0x4c, 0x67, 0xa7, 0x15, 0xda, 0xb2, 0xb4, 0x70, 0xea, 0x66, 0xe6, 0x79, 0x9f, 0xf7, 0x79, 0xde, + 0x77, 0xde, 0x37, 0x05, 0x49, 0xca, 0x5c, 0xca, 0xf2, 0x4c, 0xe7, 0x74, 0x9d, 0x78, 0xab, 0x38, + 0xc3, 0xa9, 0x5f, 0xd2, 0x37, 0x27, 0x6c, 0xc2, 0xf1, 0x84, 0xbe, 0x51, 0x24, 0x7e, 0x29, 0x55, + 0xf0, 0x29, 0xa7, 0x70, 0x50, 0x22, 0x53, 0x47, 0x91, 0x29, 0x89, 0x54, 0x7b, 0x73, 0x34, 0x47, + 0x05, 0x50, 0xaf, 0x7c, 0x85, 0x31, 0xea, 0x60, 0x8e, 0xd2, 0x9c, 0x43, 0x74, 0x5c, 0xc8, 0xeb, + 0xd8, 0xf3, 0x28, 0xc7, 0x3c, 0x4f, 0x3d, 0x26, 0x6f, 0xef, 0x65, 0x04, 0xa5, 0x6e, 0x63, 0x46, + 0xc2, 0x54, 0xb5, 0xc4, 0x05, 0x9c, 0xcb, 0x7b, 0x02, 0x2c, 0xb1, 0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 0x93, 0x53, 0xfa, 0x87, 0xe3, 0xb9, 0x78, 0xa9, 0x40, 0x98, 0x1d, 0x17, 0x7f, 0x1d, 0xa6, + 0xfe, 0x06, 0x00, 0x00, 0xff, 0xff, 0x35, 0xc3, 0xc1, 0x21, 0x45, 0x09, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -473,6 +574,12 @@ type QueryClient interface { // BeforeSendHookAddress defines a gRPC query method for // getting the address registered for the before send hook. BeforeSendHookAddress(ctx context.Context, in *QueryBeforeSendHookAddressRequest, opts ...grpc.CallOption) (*QueryBeforeSendHookAddressResponse, error) + // AllBeforeSendHooksAddresses defines a gRPC query method for + // getting all addresses with before send hook registered. + // The response returns two arrays, an array with a list of denom and an array + // of before send hook addresses. The idx of denom correspons to before send + // hook addresse's idx. + AllBeforeSendHooksAddresses(ctx context.Context, in *QueryAllBeforeSendHooksAddressesRequest, opts ...grpc.CallOption) (*QueryAllBeforeSendHooksAddressesResponse, error) } type queryClient struct { @@ -519,6 +626,15 @@ func (c *queryClient) BeforeSendHookAddress(ctx context.Context, in *QueryBefore return out, nil } +func (c *queryClient) AllBeforeSendHooksAddresses(ctx context.Context, in *QueryAllBeforeSendHooksAddressesRequest, opts ...grpc.CallOption) (*QueryAllBeforeSendHooksAddressesResponse, error) { + out := new(QueryAllBeforeSendHooksAddressesResponse) + err := c.cc.Invoke(ctx, "/osmosis.tokenfactory.v1beta1.Query/AllBeforeSendHooksAddresses", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // QueryServer is the server API for Query service. type QueryServer interface { // Params defines a gRPC query method that returns the tokenfactory module's @@ -533,6 +649,12 @@ type QueryServer interface { // BeforeSendHookAddress defines a gRPC query method for // getting the address registered for the before send hook. BeforeSendHookAddress(context.Context, *QueryBeforeSendHookAddressRequest) (*QueryBeforeSendHookAddressResponse, error) + // AllBeforeSendHooksAddresses defines a gRPC query method for + // getting all addresses with before send hook registered. + // The response returns two arrays, an array with a list of denom and an array + // of before send hook addresses. The idx of denom correspons to before send + // hook addresse's idx. + AllBeforeSendHooksAddresses(context.Context, *QueryAllBeforeSendHooksAddressesRequest) (*QueryAllBeforeSendHooksAddressesResponse, error) } // UnimplementedQueryServer can be embedded to have forward compatible implementations. @@ -551,6 +673,9 @@ func (*UnimplementedQueryServer) DenomsFromCreator(ctx context.Context, req *Que func (*UnimplementedQueryServer) BeforeSendHookAddress(ctx context.Context, req *QueryBeforeSendHookAddressRequest) (*QueryBeforeSendHookAddressResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method BeforeSendHookAddress not implemented") } +func (*UnimplementedQueryServer) AllBeforeSendHooksAddresses(ctx context.Context, req *QueryAllBeforeSendHooksAddressesRequest) (*QueryAllBeforeSendHooksAddressesResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method AllBeforeSendHooksAddresses not implemented") +} func RegisterQueryServer(s grpc1.Server, srv QueryServer) { s.RegisterService(&_Query_serviceDesc, srv) @@ -628,6 +753,24 @@ func _Query_BeforeSendHookAddress_Handler(srv interface{}, ctx context.Context, return interceptor(ctx, in, info, handler) } +func _Query_AllBeforeSendHooksAddresses_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryAllBeforeSendHooksAddressesRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).AllBeforeSendHooksAddresses(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/osmosis.tokenfactory.v1beta1.Query/AllBeforeSendHooksAddresses", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).AllBeforeSendHooksAddresses(ctx, req.(*QueryAllBeforeSendHooksAddressesRequest)) + } + return interceptor(ctx, in, info, handler) +} + var _Query_serviceDesc = grpc.ServiceDesc{ ServiceName: "osmosis.tokenfactory.v1beta1.Query", HandlerType: (*QueryServer)(nil), @@ -648,6 +791,10 @@ var _Query_serviceDesc = grpc.ServiceDesc{ MethodName: "BeforeSendHookAddress", Handler: _Query_BeforeSendHookAddress_Handler, }, + { + MethodName: "AllBeforeSendHooksAddresses", + Handler: _Query_AllBeforeSendHooksAddresses_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "osmosis/tokenfactory/v1beta1/query.proto", @@ -894,6 +1041,70 @@ func (m *QueryBeforeSendHookAddressResponse) MarshalToSizedBuffer(dAtA []byte) ( return len(dAtA) - i, nil } +func (m *QueryAllBeforeSendHooksAddressesRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryAllBeforeSendHooksAddressesRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryAllBeforeSendHooksAddressesRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *QueryAllBeforeSendHooksAddressesResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryAllBeforeSendHooksAddressesResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryAllBeforeSendHooksAddressesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.BeforeSendHookAddresses) > 0 { + for iNdEx := len(m.BeforeSendHookAddresses) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.BeforeSendHookAddresses[iNdEx]) + copy(dAtA[i:], m.BeforeSendHookAddresses[iNdEx]) + i = encodeVarintQuery(dAtA, i, uint64(len(m.BeforeSendHookAddresses[iNdEx]))) + i-- + dAtA[i] = 0x12 + } + } + if len(m.Denoms) > 0 { + for iNdEx := len(m.Denoms) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Denoms[iNdEx]) + copy(dAtA[i:], m.Denoms[iNdEx]) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Denoms[iNdEx]))) + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { offset -= sovQuery(v) base := offset @@ -1003,6 +1214,36 @@ func (m *QueryBeforeSendHookAddressResponse) Size() (n int) { return n } +func (m *QueryAllBeforeSendHooksAddressesRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryAllBeforeSendHooksAddressesResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Denoms) > 0 { + for _, s := range m.Denoms { + l = len(s) + n += 1 + l + sovQuery(uint64(l)) + } + } + if len(m.BeforeSendHookAddresses) > 0 { + for _, s := range m.BeforeSendHookAddresses { + l = len(s) + n += 1 + l + sovQuery(uint64(l)) + } + } + return n +} + func sovQuery(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -1635,6 +1876,170 @@ func (m *QueryBeforeSendHookAddressResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *QueryAllBeforeSendHooksAddressesRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryAllBeforeSendHooksAddressesRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryAllBeforeSendHooksAddressesRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryAllBeforeSendHooksAddressesResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryAllBeforeSendHooksAddressesResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryAllBeforeSendHooksAddressesResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Denoms", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Denoms = append(m.Denoms, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BeforeSendHookAddresses", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.BeforeSendHookAddresses = append(m.BeforeSendHookAddresses, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipQuery(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/tokenfactory/types/query.pb.gw.go b/x/tokenfactory/types/query.pb.gw.go index 5d75e90baf7..5f9b20996ca 100644 --- a/x/tokenfactory/types/query.pb.gw.go +++ b/x/tokenfactory/types/query.pb.gw.go @@ -213,6 +213,24 @@ func local_request_Query_BeforeSendHookAddress_0(ctx context.Context, marshaler } +func request_Query_AllBeforeSendHooksAddresses_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryAllBeforeSendHooksAddressesRequest + var metadata runtime.ServerMetadata + + msg, err := client.AllBeforeSendHooksAddresses(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_AllBeforeSendHooksAddresses_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryAllBeforeSendHooksAddressesRequest + var metadata runtime.ServerMetadata + + msg, err := server.AllBeforeSendHooksAddresses(ctx, &protoReq) + return msg, metadata, err + +} + // RegisterQueryHandlerServer registers the http handlers for service Query to "mux". // UnaryRPC :call QueryServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. @@ -311,6 +329,29 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) + mux.Handle("GET", pattern_Query_AllBeforeSendHooksAddresses_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_AllBeforeSendHooksAddresses_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_AllBeforeSendHooksAddresses_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -432,6 +473,26 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) + mux.Handle("GET", pattern_Query_AllBeforeSendHooksAddresses_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_AllBeforeSendHooksAddresses_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_AllBeforeSendHooksAddresses_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -443,6 +504,8 @@ var ( pattern_Query_DenomsFromCreator_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"osmosis", "tokenfactory", "v1beta1", "denoms_from_creator", "creator"}, "", runtime.AssumeColonVerbOpt(false))) pattern_Query_BeforeSendHookAddress_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4, 2, 5}, []string{"osmosis", "tokenfactory", "v1beta1", "denoms", "denom", "before_send_hook"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_AllBeforeSendHooksAddresses_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"osmosis", "tokenfactory", "v1beta1", "all_before_send_hooks"}, "", runtime.AssumeColonVerbOpt(false))) ) var ( @@ -453,4 +516,6 @@ var ( forward_Query_DenomsFromCreator_0 = runtime.ForwardResponseMessage forward_Query_BeforeSendHookAddress_0 = runtime.ForwardResponseMessage + + forward_Query_AllBeforeSendHooksAddresses_0 = runtime.ForwardResponseMessage ) From 1d30e23bb26420379ebea5e39b3c66d71bc15372 Mon Sep 17 00:00:00 2001 From: mattverse Date: Tue, 27 Feb 2024 17:43:41 +0900 Subject: [PATCH 2/6] Add cli --- x/tokenfactory/client/cli/query.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/x/tokenfactory/client/cli/query.go b/x/tokenfactory/client/cli/query.go index 4dcec836eff..8b5fb1190b7 100644 --- a/x/tokenfactory/client/cli/query.go +++ b/x/tokenfactory/client/cli/query.go @@ -21,6 +21,7 @@ func GetQueryCmd() *cobra.Command { osmocli.AddQueryCmd(cmd, types.NewQueryClient, GetCmdDenomAuthorityMetadata) osmocli.AddQueryCmd(cmd, types.NewQueryClient, GetCmdDenomsFromCreator) + osmocli.AddQueryCmd(cmd, types.NewQueryClient, GetCmdAllBeforeSendHooks) cmd.AddCommand( osmocli.GetParams[*types.QueryParamsRequest]( @@ -48,7 +49,7 @@ func GetCmdDenomsFromCreator() (*osmocli.QueryDescriptor, *types.QueryDenomsFrom }, &types.QueryDenomsFromCreatorRequest{} } -func GetCmdBeforeSendHooks() (*osmocli.QueryDescriptor, *types.QueryAllBeforeSendHooksAddressesRequest) { +func GetCmdAllBeforeSendHooks() (*osmocli.QueryDescriptor, *types.QueryAllBeforeSendHooksAddressesRequest) { return &osmocli.QueryDescriptor{ Use: "all-before-send-hooks", Short: "Returns a list of all before send hooks registered", From 897264488aee1bf124f6ef3cb31d602cc1429709 Mon Sep 17 00:00:00 2001 From: Dev Ojha Date: Tue, 27 Feb 2024 16:24:01 +0100 Subject: [PATCH 3/6] Update x/tokenfactory/client/cli/query.go --- x/tokenfactory/client/cli/query.go | 1 - 1 file changed, 1 deletion(-) diff --git a/x/tokenfactory/client/cli/query.go b/x/tokenfactory/client/cli/query.go index 8b5fb1190b7..f3eb9ac6a8a 100644 --- a/x/tokenfactory/client/cli/query.go +++ b/x/tokenfactory/client/cli/query.go @@ -47,7 +47,6 @@ func GetCmdDenomsFromCreator() (*osmocli.QueryDescriptor, *types.QueryDenomsFrom Long: `{{.Short}}{{.ExampleHeader}} {{.CommandPrefix}}
`, }, &types.QueryDenomsFromCreatorRequest{} - } func GetCmdAllBeforeSendHooks() (*osmocli.QueryDescriptor, *types.QueryAllBeforeSendHooksAddressesRequest) { return &osmocli.QueryDescriptor{ From d1cd408f44879895ecfb4b8b5e19ca0ccf82c6b0 Mon Sep 17 00:00:00 2001 From: "Matt, Park" <45252226+mattverse@users.noreply.github.com> Date: Wed, 28 Feb 2024 13:21:07 +0900 Subject: [PATCH 4/6] Update proto/osmosis/tokenfactory/v1beta1/query.proto Co-authored-by: Dev Ojha --- proto/osmosis/tokenfactory/v1beta1/query.proto | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proto/osmosis/tokenfactory/v1beta1/query.proto b/proto/osmosis/tokenfactory/v1beta1/query.proto index 505607de0e6..9d8ccf53268 100644 --- a/proto/osmosis/tokenfactory/v1beta1/query.proto +++ b/proto/osmosis/tokenfactory/v1beta1/query.proto @@ -44,7 +44,7 @@ service Query { // AllBeforeSendHooksAddresses defines a gRPC query method for // getting all addresses with before send hook registered. // The response returns two arrays, an array with a list of denom and an array - // of before send hook addresses. The idx of denom correspons to before send + // of before send hook addresses. The idx of denom corresponds to before send // hook addresse's idx. rpc AllBeforeSendHooksAddresses(QueryAllBeforeSendHooksAddressesRequest) returns (QueryAllBeforeSendHooksAddressesResponse) { From fdb140b21c46a6d8dbed5f2c53c0c3fb5423f74d Mon Sep 17 00:00:00 2001 From: github-actions Date: Wed, 28 Feb 2024 04:23:31 +0000 Subject: [PATCH 5/6] Generated protofile changes --- x/tokenfactory/types/query.pb.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/x/tokenfactory/types/query.pb.go b/x/tokenfactory/types/query.pb.go index 9d0170de5e8..16959b9aa78 100644 --- a/x/tokenfactory/types/query.pb.go +++ b/x/tokenfactory/types/query.pb.go @@ -577,7 +577,7 @@ type QueryClient interface { // AllBeforeSendHooksAddresses defines a gRPC query method for // getting all addresses with before send hook registered. // The response returns two arrays, an array with a list of denom and an array - // of before send hook addresses. The idx of denom correspons to before send + // of before send hook addresses. The idx of denom corresponds to before send // hook addresse's idx. AllBeforeSendHooksAddresses(ctx context.Context, in *QueryAllBeforeSendHooksAddressesRequest, opts ...grpc.CallOption) (*QueryAllBeforeSendHooksAddressesResponse, error) } @@ -652,7 +652,7 @@ type QueryServer interface { // AllBeforeSendHooksAddresses defines a gRPC query method for // getting all addresses with before send hook registered. // The response returns two arrays, an array with a list of denom and an array - // of before send hook addresses. The idx of denom correspons to before send + // of before send hook addresses. The idx of denom corresponds to before send // hook addresse's idx. AllBeforeSendHooksAddresses(context.Context, *QueryAllBeforeSendHooksAddressesRequest) (*QueryAllBeforeSendHooksAddressesResponse, error) } From 16159c2c388b0f26dc822a032905cefed3f7430c Mon Sep 17 00:00:00 2001 From: mattverse Date: Wed, 28 Feb 2024 13:53:09 +0900 Subject: [PATCH 6/6] Add changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6baaff0c9a8..4c49b4c2a11 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -55,6 +55,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 * [#7562](https://github.com/osmosis-labs/osmosis/pull/7562) Speedup Protorev estimation logic by removing unnecessary taker fee simulations. * [#7595](https://github.com/osmosis-labs/osmosis/pull/7595) Fix cosmwasm pool model code ID migration. * [#7619](https://github.com/osmosis-labs/osmosis/pull/7619) Slight speedup/gas improvement to CL GetTotalPoolLiquidity queries +* [#7623](https://github.com/osmosis-labs/osmosis/pull/7623) Add query for querying all before send hooks ### State Compatible