diff --git a/proto/reserve/vaults/query.proto b/proto/reserve/vaults/query.proto index b3832cc..d7dd47e 100644 --- a/proto/reserve/vaults/query.proto +++ b/proto/reserve/vaults/query.proto @@ -20,6 +20,10 @@ service Query { option (google.api.http).get = "/reserve/vaults/params"; } + rpc QueryCollateralsByDenom(QueryCollateralsByDenomRequest) returns (QueryCollateralsByDenomResponse){ + option (google.api.http).get = "/reserve/vaults/params"; + } + rpc QueryAllVaults(QueryAllVaultsRequest) returns (QueryAllVaultsResponse){ option (google.api.http).get = "/reserve/vaults/params"; } @@ -64,6 +68,14 @@ message QueryAllCollateralResponse{ repeated VaultMamager all_vault_mamager = 1; } +message QueryCollateralsByDenomRequest { + string denom = 1; +} + +message QueryCollateralsByDenomResponse{ + repeated VaultMamager all_vault_mamager_by_denom = 1; +} + message QueryVaultByOwnerRequest { string address = 1; } diff --git a/x/vaults/keeper/query.go b/x/vaults/keeper/query.go index 32fd465..106e303 100644 --- a/x/vaults/keeper/query.go +++ b/x/vaults/keeper/query.go @@ -47,6 +47,22 @@ func (q queryServer) QueryAllCollateral(ctx context.Context, req *types.QueryAll }, err } +func (q queryServer) QueryCollateralsByDenom(ctx context.Context, req *types.QueryCollateralsByDenomRequest) (*types.QueryCollateralsByDenomResponse, error) { + allCollateral := []*types.VaultMamager{} + + err := q.keeper.VaultsManager.Walk(ctx, nil, func(key string, value types.VaultMamager) (stop bool, err error) { + if value.Denom == req.Denom { + allCollateral = append(allCollateral, &value) + } + + return false, nil + }) + + return &types.QueryCollateralsByDenomResponse{ + AllVaultMamagerByDenom: allCollateral, + }, err +} + func (q queryServer) QueryAllVaults(ctx context.Context, req *types.QueryAllVaultsRequest) (*types.QueryAllVaultsResponse, error) { allVaults := []*types.Vault{} diff --git a/x/vaults/types/query.pb.go b/x/vaults/types/query.pb.go index 232b3ec..f306b60 100644 --- a/x/vaults/types/query.pb.go +++ b/x/vaults/types/query.pb.go @@ -362,6 +362,94 @@ func (m *QueryAllCollateralResponse) GetAllVaultMamager() []*VaultMamager { return nil } +type QueryCollateralsByDenomRequest struct { + Denom string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty"` +} + +func (m *QueryCollateralsByDenomRequest) Reset() { *m = QueryCollateralsByDenomRequest{} } +func (m *QueryCollateralsByDenomRequest) String() string { return proto.CompactTextString(m) } +func (*QueryCollateralsByDenomRequest) ProtoMessage() {} +func (*QueryCollateralsByDenomRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_5eedd1d3c0c88e0e, []int{8} +} +func (m *QueryCollateralsByDenomRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryCollateralsByDenomRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryCollateralsByDenomRequest.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 *QueryCollateralsByDenomRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryCollateralsByDenomRequest.Merge(m, src) +} +func (m *QueryCollateralsByDenomRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryCollateralsByDenomRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryCollateralsByDenomRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryCollateralsByDenomRequest proto.InternalMessageInfo + +func (m *QueryCollateralsByDenomRequest) GetDenom() string { + if m != nil { + return m.Denom + } + return "" +} + +type QueryCollateralsByDenomResponse struct { + AllVaultMamagerByDenom []*VaultMamager `protobuf:"bytes,1,rep,name=all_vault_mamager_by_denom,json=allVaultMamagerByDenom,proto3" json:"all_vault_mamager_by_denom,omitempty"` +} + +func (m *QueryCollateralsByDenomResponse) Reset() { *m = QueryCollateralsByDenomResponse{} } +func (m *QueryCollateralsByDenomResponse) String() string { return proto.CompactTextString(m) } +func (*QueryCollateralsByDenomResponse) ProtoMessage() {} +func (*QueryCollateralsByDenomResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_5eedd1d3c0c88e0e, []int{9} +} +func (m *QueryCollateralsByDenomResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryCollateralsByDenomResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryCollateralsByDenomResponse.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 *QueryCollateralsByDenomResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryCollateralsByDenomResponse.Merge(m, src) +} +func (m *QueryCollateralsByDenomResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryCollateralsByDenomResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryCollateralsByDenomResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryCollateralsByDenomResponse proto.InternalMessageInfo + +func (m *QueryCollateralsByDenomResponse) GetAllVaultMamagerByDenom() []*VaultMamager { + if m != nil { + return m.AllVaultMamagerByDenom + } + return nil +} + type QueryVaultByOwnerRequest struct { Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` } @@ -370,7 +458,7 @@ func (m *QueryVaultByOwnerRequest) Reset() { *m = QueryVaultByOwnerReque func (m *QueryVaultByOwnerRequest) String() string { return proto.CompactTextString(m) } func (*QueryVaultByOwnerRequest) ProtoMessage() {} func (*QueryVaultByOwnerRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_5eedd1d3c0c88e0e, []int{8} + return fileDescriptor_5eedd1d3c0c88e0e, []int{10} } func (m *QueryVaultByOwnerRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -414,7 +502,7 @@ func (m *QueryVaultByOwnerResponse) Reset() { *m = QueryVaultByOwnerResp func (m *QueryVaultByOwnerResponse) String() string { return proto.CompactTextString(m) } func (*QueryVaultByOwnerResponse) ProtoMessage() {} func (*QueryVaultByOwnerResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_5eedd1d3c0c88e0e, []int{9} + return fileDescriptor_5eedd1d3c0c88e0e, []int{11} } func (m *QueryVaultByOwnerResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -459,6 +547,8 @@ func init() { proto.RegisterType((*QueryAllVaultsResponse)(nil), "reserve.vaults.QueryAllVaultsResponse") proto.RegisterType((*QueryAllCollateralRequest)(nil), "reserve.vaults.QueryAllCollateralRequest") proto.RegisterType((*QueryAllCollateralResponse)(nil), "reserve.vaults.QueryAllCollateralResponse") + proto.RegisterType((*QueryCollateralsByDenomRequest)(nil), "reserve.vaults.QueryCollateralsByDenomRequest") + proto.RegisterType((*QueryCollateralsByDenomResponse)(nil), "reserve.vaults.QueryCollateralsByDenomResponse") proto.RegisterType((*QueryVaultByOwnerRequest)(nil), "reserve.vaults.QueryVaultByOwnerRequest") proto.RegisterType((*QueryVaultByOwnerResponse)(nil), "reserve.vaults.QueryVaultByOwnerResponse") } @@ -466,44 +556,48 @@ func init() { func init() { proto.RegisterFile("reserve/vaults/query.proto", fileDescriptor_5eedd1d3c0c88e0e) } var fileDescriptor_5eedd1d3c0c88e0e = []byte{ - // 578 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x94, 0x4f, 0x8f, 0xd2, 0x40, - 0x18, 0xc6, 0xa9, 0x0a, 0xbb, 0xbc, 0x26, 0xbb, 0x61, 0x64, 0x91, 0xed, 0x6e, 0xaa, 0xa9, 0x7f, - 0xb2, 0x8b, 0x91, 0x71, 0xd1, 0x8b, 0x47, 0x59, 0x0f, 0x62, 0x34, 0xae, 0x3d, 0x78, 0xf0, 0x42, - 0x06, 0x18, 0x6b, 0x93, 0xb6, 0x53, 0x3a, 0x05, 0x6d, 0x62, 0x62, 0xe2, 0xc9, 0xc4, 0x8b, 0xd1, - 0x2f, 0xe1, 0xd1, 0x8f,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0xe1, - 0xcc, 0x7d, 0x46, 0x9f, 0x34, 0xb5, 0xca, 0xa9, 0x39, 0xa3, 0xfd, 0x4c, 0xed, 0xac, 0x8b, 0xd2, - 0x1b, 0x79, 0xd0, 0x9c, 0x69, 0xde, 0xc3, 0x46, 0x7a, 0xbf, 0xd0, 0x8d, 0x65, 0xea, 0xa9, 0xc5, - 0xd4, 0x6f, 0xfe, 0x0f, 0xcb, 0x19, 0xe0, 0x1d, 0x6c, 0x9e, 0xde, 0x2b, 0x6f, 0xc7, 0x9d, 0x87, - 0x28, 0x7b, 0xcc, 0xe9, 0x5f, 0xa4, 0x7e, 0x7d, 0x35, 0x94, 0xd3, 0xfd, 0xa3, 0x06, 0x95, 0x33, - 0x6b, 0x85, 0xf6, 0x96, 0x6b, 0xa7, 0xf7, 0x55, 0xdf, 0xcf, 0x41, 0xe6, 0x8b, 0xd2, 0xee, 0x1c, - 0x4f, 0x0c, 0xed, 0x64, 0x62, 0x68, 0xbf, 0x27, 0x86, 0xf6, 0x79, 0x6a, 0x14, 0x4e, 0xa6, 0x46, - 0xe1, 0xe7, 0xd4, 0x28, 0xbc, 0xc4, 0xb6, 0x13, 0xbd, 0x1e, 0xf5, 0x9a, 0x7d, 0xe6, 0x61, 0xe6, - 0x33, 0x2f, 0x16, 0x7f, 0x89, 0x7d, 0xe6, 0xce, 0x95, 0xde, 0x26, 0x5a, 0x51, 0x1c, 0x50, 0xde, - 0x2b, 0x09, 0xe0, 0xee, 0xbf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x2b, 0x51, 0x44, 0xad, 0xf1, 0x05, - 0x00, 0x00, + // 645 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x55, 0x4f, 0x6b, 0xd4, 0x40, + 0x14, 0xdf, 0xa8, 0xdd, 0xb6, 0x4f, 0x68, 0xe9, 0xb8, 0xdd, 0x6e, 0xd3, 0x92, 0xca, 0xf8, 0x87, + 0xb6, 0x62, 0xc6, 0x56, 0x11, 0x3c, 0xba, 0xed, 0xc1, 0x8a, 0x62, 0xcd, 0x41, 0xc4, 0xcb, 0x32, + 0xdb, 0x1d, 0x63, 0x20, 0xc9, 0xa4, 0x99, 0xec, 0x6a, 0x50, 0x10, 0x3c, 0x09, 0x5e, 0x04, 0x6f, + 0x7e, 0x02, 0x6f, 0xfa, 0x31, 0x7a, 0x2c, 0x78, 0xf1, 0x24, 0xd2, 0x0a, 0x7e, 0x0d, 0xd9, 0x99, + 0x49, 0x4b, 0xb6, 0x49, 0x9b, 0xcb, 0x92, 0x99, 0xf7, 0xfb, 0x37, 0x93, 0xf7, 0x36, 0x60, 0xc6, + 0x4c, 0xb0, 0x78, 0xc0, 0xc8, 0x80, 0xf6, 0xfd, 0x44, 0x90, 0xdd, 0x3e, 0x8b, 0x53, 0x3b, 0x8a, + 0x79, 0xc2, 0xd1, 0x94, 0xae, 0xd9, 0xaa, 0x66, 0xce, 0xd0, 0xc0, 0x0b, 0x39, 0x91, 0xbf, 0x0a, + 0x62, 0x36, 0x5c, 0xee, 0x72, 0xf9, 0x48, 0x86, 0x4f, 0x7a, 0x77, 0xd1, 0xe5, 0xdc, 0xf5, 0x19, + 0xa1, 0x91, 0x47, 0x68, 0x18, 0xf2, 0x84, 0x26, 0x1e, 0x0f, 0x85, 0xae, 0xae, 0xee, 0x70, 0x11, + 0x70, 0x41, 0xba, 0x54, 0x30, 0xe5, 0x47, 0x06, 0x6b, 0x5d, 0x96, 0xd0, 0x35, 0x12, 0x51, 0xd7, + 0x0b, 0x25, 0x58, 0x63, 0x17, 0x46, 0xe2, 0x45, 0x34, 0xa6, 0x81, 0x16, 0xc2, 0x0d, 0x40, 0x4f, + 0x87, 0xf4, 0x6d, 0xb9, 0xe9, 0xb0, 0xdd, 0x3e, 0x13, 0x09, 0xde, 0x86, 0x4b, 0xb9, 0x5d, 0x11, + 0xf1, 0x50, 0x30, 0x74, 0x0f, 0xea, 0x8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da, 0x5b, 0x7b, 0x07, 0x96, 0xb1, 0x7f, 0x60, 0x19, 0x7f, 0x0e, 0x2c, 0xe3, 0xf3, 0xa1, 0x55, + 0xdb, 0x3f, 0xb4, 0x6a, 0xbf, 0x0e, 0xad, 0xda, 0x0b, 0xe2, 0x7a, 0xc9, 0xab, 0x7e, 0xd7, 0xde, + 0xe1, 0x01, 0xe1, 0x21, 0x0f, 0x52, 0xf9, 0x91, 0xd9, 0xe1, 0xfe, 0x91, 0xd2, 0x9b, 0x4c, 0x2b, + 0x49, 0x23, 0x26, 0xba, 0x75, 0x09, 0xb8, 0xfd, 0x3f, 0x00, 0x00, 0xff, 0xff, 0x0a, 0xb1, 0xf2, + 0x3e, 0x43, 0x07, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -521,6 +615,7 @@ type QueryClient interface { // Parameters queries the parameters of the module. Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) QueryAllCollateral(ctx context.Context, in *QueryAllCollateralRequest, opts ...grpc.CallOption) (*QueryAllCollateralResponse, error) + QueryCollateralsByDenom(ctx context.Context, in *QueryCollateralsByDenomRequest, opts ...grpc.CallOption) (*QueryCollateralsByDenomResponse, error) QueryAllVaults(ctx context.Context, in *QueryAllVaultsRequest, opts ...grpc.CallOption) (*QueryAllVaultsResponse, error) QueryVaultsByID(ctx context.Context, in *QueryVaultIdRequest, opts ...grpc.CallOption) (*QueryVaultIdResponse, error) QueryVaultByOwner(ctx context.Context, in *QueryVaultByOwnerRequest, opts ...grpc.CallOption) (*QueryVaultByOwnerResponse, error) @@ -552,6 +647,15 @@ func (c *queryClient) QueryAllCollateral(ctx context.Context, in *QueryAllCollat return out, nil } +func (c *queryClient) QueryCollateralsByDenom(ctx context.Context, in *QueryCollateralsByDenomRequest, opts ...grpc.CallOption) (*QueryCollateralsByDenomResponse, error) { + out := new(QueryCollateralsByDenomResponse) + err := c.cc.Invoke(ctx, "/reserve.vaults.Query/QueryCollateralsByDenom", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + func (c *queryClient) QueryAllVaults(ctx context.Context, in *QueryAllVaultsRequest, opts ...grpc.CallOption) (*QueryAllVaultsResponse, error) { out := new(QueryAllVaultsResponse) err := c.cc.Invoke(ctx, "/reserve.vaults.Query/QueryAllVaults", in, out, opts...) @@ -584,6 +688,7 @@ type QueryServer interface { // Parameters queries the parameters of the module. Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) QueryAllCollateral(context.Context, *QueryAllCollateralRequest) (*QueryAllCollateralResponse, error) + QueryCollateralsByDenom(context.Context, *QueryCollateralsByDenomRequest) (*QueryCollateralsByDenomResponse, error) QueryAllVaults(context.Context, *QueryAllVaultsRequest) (*QueryAllVaultsResponse, error) QueryVaultsByID(context.Context, *QueryVaultIdRequest) (*QueryVaultIdResponse, error) QueryVaultByOwner(context.Context, *QueryVaultByOwnerRequest) (*QueryVaultByOwnerResponse, error) @@ -599,6 +704,9 @@ func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsReq func (*UnimplementedQueryServer) QueryAllCollateral(ctx context.Context, req *QueryAllCollateralRequest) (*QueryAllCollateralResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method QueryAllCollateral not implemented") } +func (*UnimplementedQueryServer) QueryCollateralsByDenom(ctx context.Context, req *QueryCollateralsByDenomRequest) (*QueryCollateralsByDenomResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method QueryCollateralsByDenom not implemented") +} func (*UnimplementedQueryServer) QueryAllVaults(ctx context.Context, req *QueryAllVaultsRequest) (*QueryAllVaultsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method QueryAllVaults not implemented") } @@ -649,6 +757,24 @@ func _Query_QueryAllCollateral_Handler(srv interface{}, ctx context.Context, dec return interceptor(ctx, in, info, handler) } +func _Query_QueryCollateralsByDenom_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryCollateralsByDenomRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).QueryCollateralsByDenom(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/reserve.vaults.Query/QueryCollateralsByDenom", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).QueryCollateralsByDenom(ctx, req.(*QueryCollateralsByDenomRequest)) + } + return interceptor(ctx, in, info, handler) +} + func _Query_QueryAllVaults_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(QueryAllVaultsRequest) if err := dec(in); err != nil { @@ -715,6 +841,10 @@ var _Query_serviceDesc = grpc.ServiceDesc{ MethodName: "QueryAllCollateral", Handler: _Query_QueryAllCollateral_Handler, }, + { + MethodName: "QueryCollateralsByDenom", + Handler: _Query_QueryCollateralsByDenom_Handler, + }, { MethodName: "QueryAllVaults", Handler: _Query_QueryAllVaults_Handler, @@ -971,6 +1101,73 @@ func (m *QueryAllCollateralResponse) MarshalToSizedBuffer(dAtA []byte) (int, err return len(dAtA) - i, nil } +func (m *QueryCollateralsByDenomRequest) 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 *QueryCollateralsByDenomRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryCollateralsByDenomRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Denom) > 0 { + i -= len(m.Denom) + copy(dAtA[i:], m.Denom) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Denom))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryCollateralsByDenomResponse) 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 *QueryCollateralsByDenomResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryCollateralsByDenomResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.AllVaultMamagerByDenom) > 0 { + for iNdEx := len(m.AllVaultMamagerByDenom) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.AllVaultMamagerByDenom[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + func (m *QueryVaultByOwnerRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -1142,6 +1339,34 @@ func (m *QueryAllCollateralResponse) Size() (n int) { return n } +func (m *QueryCollateralsByDenomRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Denom) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryCollateralsByDenomResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.AllVaultMamagerByDenom) > 0 { + for _, e := range m.AllVaultMamagerByDenom { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + return n +} + func (m *QueryVaultByOwnerRequest) Size() (n int) { if m == nil { return 0 @@ -1732,6 +1957,172 @@ func (m *QueryAllCollateralResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *QueryCollateralsByDenomRequest) 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: QueryCollateralsByDenomRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryCollateralsByDenomRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Denom", 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.Denom = 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 (m *QueryCollateralsByDenomResponse) 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: QueryCollateralsByDenomResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryCollateralsByDenomResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AllVaultMamagerByDenom", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.AllVaultMamagerByDenom = append(m.AllVaultMamagerByDenom, &VaultMamager{}) + if err := m.AllVaultMamagerByDenom[len(m.AllVaultMamagerByDenom)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + 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 (m *QueryVaultByOwnerRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 diff --git a/x/vaults/types/query.pb.gw.go b/x/vaults/types/query.pb.gw.go index 4757dc3..dbe22c5 100644 --- a/x/vaults/types/query.pb.gw.go +++ b/x/vaults/types/query.pb.gw.go @@ -69,6 +69,42 @@ func local_request_Query_QueryAllCollateral_0(ctx context.Context, marshaler run } +var ( + filter_Query_QueryCollateralsByDenom_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_Query_QueryCollateralsByDenom_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryCollateralsByDenomRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_QueryCollateralsByDenom_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.QueryCollateralsByDenom(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_QueryCollateralsByDenom_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryCollateralsByDenomRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_QueryCollateralsByDenom_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.QueryCollateralsByDenom(ctx, &protoReq) + return msg, metadata, err + +} + func request_Query_QueryAllVaults_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq QueryAllVaultsRequest var metadata runtime.ServerMetadata @@ -211,6 +247,29 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) + mux.Handle("GET", pattern_Query_QueryCollateralsByDenom_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_QueryCollateralsByDenom_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_QueryCollateralsByDenom_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + mux.Handle("GET", pattern_Query_QueryAllVaults_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -361,6 +420,26 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) + mux.Handle("GET", pattern_Query_QueryCollateralsByDenom_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_QueryCollateralsByDenom_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_QueryCollateralsByDenom_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + mux.Handle("GET", pattern_Query_QueryAllVaults_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -429,6 +508,8 @@ var ( pattern_Query_QueryAllCollateral_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"reserve", "vaults", "params"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_QueryCollateralsByDenom_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"reserve", "vaults", "params"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_QueryAllVaults_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"reserve", "vaults", "params"}, "", runtime.AssumeColonVerbOpt(false))) pattern_Query_QueryVaultsByID_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"reserve", "vaults", "params"}, "", runtime.AssumeColonVerbOpt(false))) @@ -441,6 +522,8 @@ var ( forward_Query_QueryAllCollateral_0 = runtime.ForwardResponseMessage + forward_Query_QueryCollateralsByDenom_0 = runtime.ForwardResponseMessage + forward_Query_QueryAllVaults_0 = runtime.ForwardResponseMessage forward_Query_QueryVaultsByID_0 = runtime.ForwardResponseMessage