From 7326015a59ed770cf014fb7e1eeb432eda45a607 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=90=C3=B4ng=20Li=E1=BB=81u?= Date: Mon, 20 Jan 2025 16:30:15 +0700 Subject: [PATCH 1/2] proto --- proto/reserve/vaults/query.proto | 16 + x/vaults/keeper/query.go | 10 + x/vaults/types/query.pb.go | 524 ++++++++++++++++++++++++++----- x/vaults/types/query.pb.gw.go | 83 +++++ 4 files changed, 559 insertions(+), 74 deletions(-) diff --git a/proto/reserve/vaults/query.proto b/proto/reserve/vaults/query.proto index 888f52c..a64afd0 100644 --- a/proto/reserve/vaults/query.proto +++ b/proto/reserve/vaults/query.proto @@ -48,8 +48,24 @@ service Query { rpc QueryTotalCollateralLockedByDenom(QueryTotalCollateralLockedByDenomRequest) returns (QueryTotalCollateralLockedByDenomResponse){ option (google.api.http).get = "/reserve/vaults/params"; } + + rpc QueryShortfallAmount(QueryShortfallAmountRequest) returns (QueryShortfallAmountResponse){ + option (google.api.http).get = "/reserve/vaults/params"; + } +} + +message QueryShortfallAmountRequest { + string mint_denom = 1; } +message QueryShortfallAmountResponse { + string amount = 1 [ + (cosmos_proto.scalar) = "cosmos.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", + (amino.dont_omitempty) = true, + (gogoproto.nullable) = false + ]; +} // QueryParamsRequest is request type for the Query/Params RPC method. message QueryParamsRequest {} diff --git a/x/vaults/keeper/query.go b/x/vaults/keeper/query.go index 9359092..c5d8c9d 100644 --- a/x/vaults/keeper/query.go +++ b/x/vaults/keeper/query.go @@ -153,3 +153,13 @@ func (q queryServer) QueryTotalCollateralLockedByDenom(ctx context.Context, req Total: total, }, err } + +func (q queryServer) QueryShortfallAmount(ctx context.Context, req *types.QueryShortfallAmountRequest) (*types.QueryShortfallAmountResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + + amount, err := q.keeper.ShortfallAmount.Get(ctx, req.MintDenom) + + return &types.QueryShortfallAmountResponse{Amount: amount}, err +} diff --git a/x/vaults/types/query.pb.go b/x/vaults/types/query.pb.go index 077cb11..9081979 100644 --- a/x/vaults/types/query.pb.go +++ b/x/vaults/types/query.pb.go @@ -33,6 +33,87 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package +type QueryShortfallAmountRequest struct { + MintDenom string `protobuf:"bytes,1,opt,name=mint_denom,json=mintDenom,proto3" json:"mint_denom,omitempty"` +} + +func (m *QueryShortfallAmountRequest) Reset() { *m = QueryShortfallAmountRequest{} } +func (m *QueryShortfallAmountRequest) String() string { return proto.CompactTextString(m) } +func (*QueryShortfallAmountRequest) ProtoMessage() {} +func (*QueryShortfallAmountRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_5eedd1d3c0c88e0e, []int{0} +} +func (m *QueryShortfallAmountRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryShortfallAmountRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryShortfallAmountRequest.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 *QueryShortfallAmountRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryShortfallAmountRequest.Merge(m, src) +} +func (m *QueryShortfallAmountRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryShortfallAmountRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryShortfallAmountRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryShortfallAmountRequest proto.InternalMessageInfo + +func (m *QueryShortfallAmountRequest) GetMintDenom() string { + if m != nil { + return m.MintDenom + } + return "" +} + +type QueryShortfallAmountResponse struct { + Amount cosmossdk_io_math.Int `protobuf:"bytes,1,opt,name=amount,proto3,customtype=cosmossdk.io/math.Int" json:"amount"` +} + +func (m *QueryShortfallAmountResponse) Reset() { *m = QueryShortfallAmountResponse{} } +func (m *QueryShortfallAmountResponse) String() string { return proto.CompactTextString(m) } +func (*QueryShortfallAmountResponse) ProtoMessage() {} +func (*QueryShortfallAmountResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_5eedd1d3c0c88e0e, []int{1} +} +func (m *QueryShortfallAmountResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryShortfallAmountResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryShortfallAmountResponse.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 *QueryShortfallAmountResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryShortfallAmountResponse.Merge(m, src) +} +func (m *QueryShortfallAmountResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryShortfallAmountResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryShortfallAmountResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryShortfallAmountResponse proto.InternalMessageInfo + // QueryParamsRequest is request type for the Query/Params RPC method. type QueryParamsRequest struct { } @@ -41,7 +122,7 @@ func (m *QueryParamsRequest) Reset() { *m = QueryParamsRequest{} } func (m *QueryParamsRequest) String() string { return proto.CompactTextString(m) } func (*QueryParamsRequest) ProtoMessage() {} func (*QueryParamsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_5eedd1d3c0c88e0e, []int{0} + return fileDescriptor_5eedd1d3c0c88e0e, []int{2} } func (m *QueryParamsRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -80,7 +161,7 @@ func (m *QueryParamsResponse) Reset() { *m = QueryParamsResponse{} } func (m *QueryParamsResponse) String() string { return proto.CompactTextString(m) } func (*QueryParamsResponse) ProtoMessage() {} func (*QueryParamsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_5eedd1d3c0c88e0e, []int{1} + return fileDescriptor_5eedd1d3c0c88e0e, []int{3} } func (m *QueryParamsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -124,7 +205,7 @@ func (m *QueryVaultIdRequest) Reset() { *m = QueryVaultIdRequest{} } func (m *QueryVaultIdRequest) String() string { return proto.CompactTextString(m) } func (*QueryVaultIdRequest) ProtoMessage() {} func (*QueryVaultIdRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_5eedd1d3c0c88e0e, []int{2} + return fileDescriptor_5eedd1d3c0c88e0e, []int{4} } func (m *QueryVaultIdRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -168,7 +249,7 @@ func (m *QueryVaultIdResponse) Reset() { *m = QueryVaultIdResponse{} } func (m *QueryVaultIdResponse) String() string { return proto.CompactTextString(m) } func (*QueryVaultIdResponse) ProtoMessage() {} func (*QueryVaultIdResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_5eedd1d3c0c88e0e, []int{3} + return fileDescriptor_5eedd1d3c0c88e0e, []int{5} } func (m *QueryVaultIdResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -211,7 +292,7 @@ func (m *QueryAllVaultsRequest) Reset() { *m = QueryAllVaultsRequest{} } func (m *QueryAllVaultsRequest) String() string { return proto.CompactTextString(m) } func (*QueryAllVaultsRequest) ProtoMessage() {} func (*QueryAllVaultsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_5eedd1d3c0c88e0e, []int{4} + return fileDescriptor_5eedd1d3c0c88e0e, []int{6} } func (m *QueryAllVaultsRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -248,7 +329,7 @@ func (m *QueryAllVaultsResponse) Reset() { *m = QueryAllVaultsResponse{} func (m *QueryAllVaultsResponse) String() string { return proto.CompactTextString(m) } func (*QueryAllVaultsResponse) ProtoMessage() {} func (*QueryAllVaultsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_5eedd1d3c0c88e0e, []int{5} + return fileDescriptor_5eedd1d3c0c88e0e, []int{7} } func (m *QueryAllVaultsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -291,7 +372,7 @@ func (m *QueryAllCollateralRequest) Reset() { *m = QueryAllCollateralReq func (m *QueryAllCollateralRequest) String() string { return proto.CompactTextString(m) } func (*QueryAllCollateralRequest) ProtoMessage() {} func (*QueryAllCollateralRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_5eedd1d3c0c88e0e, []int{6} + return fileDescriptor_5eedd1d3c0c88e0e, []int{8} } func (m *QueryAllCollateralRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -328,7 +409,7 @@ func (m *QueryAllCollateralResponse) Reset() { *m = QueryAllCollateralRe func (m *QueryAllCollateralResponse) String() string { return proto.CompactTextString(m) } func (*QueryAllCollateralResponse) ProtoMessage() {} func (*QueryAllCollateralResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_5eedd1d3c0c88e0e, []int{7} + return fileDescriptor_5eedd1d3c0c88e0e, []int{9} } func (m *QueryAllCollateralResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -372,7 +453,7 @@ func (m *QueryCollateralsByDenomRequest) Reset() { *m = QueryCollaterals func (m *QueryCollateralsByDenomRequest) String() string { return proto.CompactTextString(m) } func (*QueryCollateralsByDenomRequest) ProtoMessage() {} func (*QueryCollateralsByDenomRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_5eedd1d3c0c88e0e, []int{8} + return fileDescriptor_5eedd1d3c0c88e0e, []int{10} } func (m *QueryCollateralsByDenomRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -416,7 +497,7 @@ func (m *QueryCollateralsByDenomResponse) Reset() { *m = QueryCollateral func (m *QueryCollateralsByDenomResponse) String() string { return proto.CompactTextString(m) } func (*QueryCollateralsByDenomResponse) ProtoMessage() {} func (*QueryCollateralsByDenomResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_5eedd1d3c0c88e0e, []int{9} + return fileDescriptor_5eedd1d3c0c88e0e, []int{11} } func (m *QueryCollateralsByDenomResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -460,7 +541,7 @@ func (m *QueryCollateralsByMintDenomRequest) Reset() { *m = QueryCollate func (m *QueryCollateralsByMintDenomRequest) String() string { return proto.CompactTextString(m) } func (*QueryCollateralsByMintDenomRequest) ProtoMessage() {} func (*QueryCollateralsByMintDenomRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_5eedd1d3c0c88e0e, []int{10} + return fileDescriptor_5eedd1d3c0c88e0e, []int{12} } func (m *QueryCollateralsByMintDenomRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -504,7 +585,7 @@ func (m *QueryCollateralsByMintDenomResponse) Reset() { *m = QueryCollat func (m *QueryCollateralsByMintDenomResponse) String() string { return proto.CompactTextString(m) } func (*QueryCollateralsByMintDenomResponse) ProtoMessage() {} func (*QueryCollateralsByMintDenomResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_5eedd1d3c0c88e0e, []int{11} + return fileDescriptor_5eedd1d3c0c88e0e, []int{13} } func (m *QueryCollateralsByMintDenomResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -551,7 +632,7 @@ func (m *QueryCollateralsByDenomMintDenomRequest) Reset() { func (m *QueryCollateralsByDenomMintDenomRequest) String() string { return proto.CompactTextString(m) } func (*QueryCollateralsByDenomMintDenomRequest) ProtoMessage() {} func (*QueryCollateralsByDenomMintDenomRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_5eedd1d3c0c88e0e, []int{12} + return fileDescriptor_5eedd1d3c0c88e0e, []int{14} } func (m *QueryCollateralsByDenomMintDenomRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -604,7 +685,7 @@ func (m *QueryCollateralsByDenomMintDenomResponse) Reset() { func (m *QueryCollateralsByDenomMintDenomResponse) String() string { return proto.CompactTextString(m) } func (*QueryCollateralsByDenomMintDenomResponse) ProtoMessage() {} func (*QueryCollateralsByDenomMintDenomResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_5eedd1d3c0c88e0e, []int{13} + return fileDescriptor_5eedd1d3c0c88e0e, []int{15} } func (m *QueryCollateralsByDenomMintDenomResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -648,7 +729,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{14} + return fileDescriptor_5eedd1d3c0c88e0e, []int{16} } func (m *QueryVaultByOwnerRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -692,7 +773,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{15} + return fileDescriptor_5eedd1d3c0c88e0e, []int{17} } func (m *QueryVaultByOwnerResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -738,7 +819,7 @@ func (m *QueryTotalCollateralLockedByDenomRequest) Reset() { func (m *QueryTotalCollateralLockedByDenomRequest) String() string { return proto.CompactTextString(m) } func (*QueryTotalCollateralLockedByDenomRequest) ProtoMessage() {} func (*QueryTotalCollateralLockedByDenomRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_5eedd1d3c0c88e0e, []int{16} + return fileDescriptor_5eedd1d3c0c88e0e, []int{18} } func (m *QueryTotalCollateralLockedByDenomRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -786,7 +867,7 @@ func (m *QueryTotalCollateralLockedByDenomResponse) String() string { } func (*QueryTotalCollateralLockedByDenomResponse) ProtoMessage() {} func (*QueryTotalCollateralLockedByDenomResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_5eedd1d3c0c88e0e, []int{17} + return fileDescriptor_5eedd1d3c0c88e0e, []int{19} } func (m *QueryTotalCollateralLockedByDenomResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -816,6 +897,8 @@ func (m *QueryTotalCollateralLockedByDenomResponse) XXX_DiscardUnknown() { var xxx_messageInfo_QueryTotalCollateralLockedByDenomResponse proto.InternalMessageInfo func init() { + proto.RegisterType((*QueryShortfallAmountRequest)(nil), "reserve.vaults.QueryShortfallAmountRequest") + proto.RegisterType((*QueryShortfallAmountResponse)(nil), "reserve.vaults.QueryShortfallAmountResponse") proto.RegisterType((*QueryParamsRequest)(nil), "reserve.vaults.QueryParamsRequest") proto.RegisterType((*QueryParamsResponse)(nil), "reserve.vaults.QueryParamsResponse") proto.RegisterType((*QueryVaultIdRequest)(nil), "reserve.vaults.QueryVaultIdRequest") @@ -839,62 +922,66 @@ func init() { func init() { proto.RegisterFile("reserve/vaults/query.proto", fileDescriptor_5eedd1d3c0c88e0e) } var fileDescriptor_5eedd1d3c0c88e0e = []byte{ - // 874 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x56, 0x4f, 0x6f, 0xe3, 0x44, - 0x1c, 0x8d, 0x17, 0x92, 0xdd, 0xfc, 0x80, 0x5d, 0x75, 0x48, 0xb3, 0xa9, 0xbb, 0x38, 0xcb, 0x2c, - 0x7f, 0xda, 0xa2, 0xb5, 0xdb, 0x14, 0x01, 0xbd, 0xd1, 0xb4, 0x42, 0x04, 0xb5, 0xa2, 0x44, 0x08, - 0x21, 0x0e, 0x44, 0x93, 0x64, 0x48, 0xad, 0xda, 0x9e, 0xd4, 0x33, 0x09, 0x44, 0x20, 0x21, 0x71, - 0xaa, 0xc4, 0x05, 0x89, 0x1b, 0x1f, 0x00, 0x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0x99, 0xcd, 0x7a, 0xbd, 0x71, 0x7a, 0x61, 0x68, 0x67, 0x17, 0x86, 0xf6, 0xcf, 0x85, 0xa1, - 0x7d, 0x77, 0x69, 0xe4, 0xce, 0x2e, 0x8d, 0xdc, 0x5f, 0x97, 0x46, 0xee, 0x13, 0xab, 0x67, 0x8b, - 0xc3, 0x41, 0xdb, 0xec, 0x30, 0xd7, 0x62, 0x1e, 0x73, 0x47, 0xc1, 0x67, 0x6d, 0x87, 0x39, 0x13, - 0xa6, 0x2f, 0x42, 0x2e, 0x31, 0xea, 0x53, 0xde, 0x2e, 0x04, 0x80, 0xcd, 0xff, 0x03, 0x00, 0x00, - 0xff, 0xff, 0x03, 0xc7, 0xae, 0xee, 0xd0, 0x0b, 0x00, 0x00, + // 935 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x57, 0xcf, 0x6f, 0x1b, 0x45, + 0x14, 0xce, 0x16, 0xe2, 0x36, 0xaf, 0xd0, 0x2a, 0x43, 0x92, 0x3a, 0x9b, 0xb0, 0x2e, 0x53, 0x7e, + 0x24, 0x29, 0xdd, 0x6d, 0x5d, 0x04, 0x54, 0xe2, 0x40, 0x9c, 0x0a, 0x61, 0xd4, 0x8a, 0x62, 0x10, + 0x42, 0x1c, 0xb0, 0xc6, 0xf6, 0xd4, 0x5e, 0x75, 0x77, 0xc7, 0xd9, 0x19, 0x1b, 0x2c, 0x90, 0x90, + 0x38, 0x55, 0xe2, 0x02, 0xe2, 0xc6, 0x1f, 0x80, 0x38, 0x72, 0x00, 0x89, 0x3f, 0xa1, 0xc7, 0x0a, + 0x2e, 0x88, 0x43, 0x41, 0x09, 0x12, 0xff, 0x46, 0xe5, 0x99, 0x59, 0x27, 0xbb, 0x5e, 0x7b, 0xa7, + 0xb9, 0x44, 0xde, 0x99, 0xef, 0x7d, 0xdf, 0xf7, 0x76, 0xdf, 0x7b, 0x33, 0x01,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3, 0xd7, 0xbe, 0x71, 0x82, 0x48, 0x43, 0xeb, 0xdf, 0x5b, 0xfa, 0x32, + 0x98, 0xb9, 0x10, 0xa3, 0xcb, 0xb9, 0x9a, 0xf9, 0x97, 0x6e, 0xfb, 0x55, 0x33, 0xb0, 0x99, 0xa7, + 0x5a, 0xfd, 0xc1, 0x81, 0x63, 0x3d, 0x3c, 0x70, 0xac, 0x7f, 0x0f, 0x1c, 0xeb, 0xbb, 0x43, 0x67, + 0xe1, 0xe1, 0xa1, 0xb3, 0xf0, 0xd7, 0xa1, 0xb3, 0xf0, 0xa9, 0xd7, 0xf5, 0x45, 0x6f, 0xd0, 0x72, + 0xdb, 0x2c, 0xf4, 0x58, 0xc4, 0xc2, 0x91, 0xfc, 0x97, 0xa0, 0xcd, 0x82, 0x09, 0xd3, 0x17, 0x09, + 0x97, 0x18, 0xf5, 0x29, 0x6f, 0x95, 0x24, 0xe0, 0xfa, 0xe3, 0x00, 0x00, 0x00, 0xff, 0xff, 0xa5, + 0xf5, 0xa0, 0x79, 0x0c, 0x0d, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -919,6 +1006,7 @@ type QueryClient interface { QueryVaultsByID(ctx context.Context, in *QueryVaultIdRequest, opts ...grpc.CallOption) (*QueryVaultIdResponse, error) QueryVaultByOwner(ctx context.Context, in *QueryVaultByOwnerRequest, opts ...grpc.CallOption) (*QueryVaultByOwnerResponse, error) QueryTotalCollateralLockedByDenom(ctx context.Context, in *QueryTotalCollateralLockedByDenomRequest, opts ...grpc.CallOption) (*QueryTotalCollateralLockedByDenomResponse, error) + QueryShortfallAmount(ctx context.Context, in *QueryShortfallAmountRequest, opts ...grpc.CallOption) (*QueryShortfallAmountResponse, error) } type queryClient struct { @@ -1010,6 +1098,15 @@ func (c *queryClient) QueryTotalCollateralLockedByDenom(ctx context.Context, in return out, nil } +func (c *queryClient) QueryShortfallAmount(ctx context.Context, in *QueryShortfallAmountRequest, opts ...grpc.CallOption) (*QueryShortfallAmountResponse, error) { + out := new(QueryShortfallAmountResponse) + err := c.cc.Invoke(ctx, "/reserve.vaults.Query/QueryShortfallAmount", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // QueryServer is the server API for Query service. type QueryServer interface { // Parameters queries the parameters of the module. @@ -1022,6 +1119,7 @@ type QueryServer interface { QueryVaultsByID(context.Context, *QueryVaultIdRequest) (*QueryVaultIdResponse, error) QueryVaultByOwner(context.Context, *QueryVaultByOwnerRequest) (*QueryVaultByOwnerResponse, error) QueryTotalCollateralLockedByDenom(context.Context, *QueryTotalCollateralLockedByDenomRequest) (*QueryTotalCollateralLockedByDenomResponse, error) + QueryShortfallAmount(context.Context, *QueryShortfallAmountRequest) (*QueryShortfallAmountResponse, error) } // UnimplementedQueryServer can be embedded to have forward compatible implementations. @@ -1055,6 +1153,9 @@ func (*UnimplementedQueryServer) QueryVaultByOwner(ctx context.Context, req *Que func (*UnimplementedQueryServer) QueryTotalCollateralLockedByDenom(ctx context.Context, req *QueryTotalCollateralLockedByDenomRequest) (*QueryTotalCollateralLockedByDenomResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method QueryTotalCollateralLockedByDenom not implemented") } +func (*UnimplementedQueryServer) QueryShortfallAmount(ctx context.Context, req *QueryShortfallAmountRequest) (*QueryShortfallAmountResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method QueryShortfallAmount not implemented") +} func RegisterQueryServer(s grpc1.Server, srv QueryServer) { s.RegisterService(&_Query_serviceDesc, srv) @@ -1222,6 +1323,24 @@ func _Query_QueryTotalCollateralLockedByDenom_Handler(srv interface{}, ctx conte return interceptor(ctx, in, info, handler) } +func _Query_QueryShortfallAmount_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryShortfallAmountRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).QueryShortfallAmount(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/reserve.vaults.Query/QueryShortfallAmount", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).QueryShortfallAmount(ctx, req.(*QueryShortfallAmountRequest)) + } + return interceptor(ctx, in, info, handler) +} + var _Query_serviceDesc = grpc.ServiceDesc{ ServiceName: "reserve.vaults.Query", HandlerType: (*QueryServer)(nil), @@ -1262,11 +1381,78 @@ var _Query_serviceDesc = grpc.ServiceDesc{ MethodName: "QueryTotalCollateralLockedByDenom", Handler: _Query_QueryTotalCollateralLockedByDenom_Handler, }, + { + MethodName: "QueryShortfallAmount", + Handler: _Query_QueryShortfallAmount_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "reserve/vaults/query.proto", } +func (m *QueryShortfallAmountRequest) 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 *QueryShortfallAmountRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryShortfallAmountRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.MintDenom) > 0 { + i -= len(m.MintDenom) + copy(dAtA[i:], m.MintDenom) + i = encodeVarintQuery(dAtA, i, uint64(len(m.MintDenom))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryShortfallAmountResponse) 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 *QueryShortfallAmountResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryShortfallAmountResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size := m.Amount.Size() + i -= size + if _, err := m.Amount.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + func (m *QueryParamsRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -1853,6 +2039,30 @@ func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } +func (m *QueryShortfallAmountRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.MintDenom) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryShortfallAmountResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Amount.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + func (m *QueryParamsRequest) Size() (n int) { if m == nil { return 0 @@ -2090,6 +2300,172 @@ func sovQuery(x uint64) (n int) { func sozQuery(x uint64) (n int) { return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } +func (m *QueryShortfallAmountRequest) 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: QueryShortfallAmountRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryShortfallAmountRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MintDenom", 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.MintDenom = 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 *QueryShortfallAmountResponse) 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: QueryShortfallAmountResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryShortfallAmountResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Amount", 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 + } + if err := m.Amount.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 *QueryParamsRequest) 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 4294223..c028175 100644 --- a/x/vaults/types/query.pb.gw.go +++ b/x/vaults/types/query.pb.gw.go @@ -303,6 +303,42 @@ func local_request_Query_QueryTotalCollateralLockedByDenom_0(ctx context.Context } +var ( + filter_Query_QueryShortfallAmount_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_Query_QueryShortfallAmount_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryShortfallAmountRequest + 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_QueryShortfallAmount_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.QueryShortfallAmount(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_QueryShortfallAmount_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryShortfallAmountRequest + 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_QueryShortfallAmount_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.QueryShortfallAmount(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. @@ -516,6 +552,29 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) + mux.Handle("GET", pattern_Query_QueryShortfallAmount_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_QueryShortfallAmount_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_QueryShortfallAmount_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -737,6 +796,26 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) + mux.Handle("GET", pattern_Query_QueryShortfallAmount_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_QueryShortfallAmount_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_QueryShortfallAmount_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -758,6 +837,8 @@ var ( pattern_Query_QueryVaultByOwner_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"reserve", "vaults", "params"}, "", runtime.AssumeColonVerbOpt(false))) pattern_Query_QueryTotalCollateralLockedByDenom_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"reserve", "vaults", "params"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_QueryShortfallAmount_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"reserve", "vaults", "params"}, "", runtime.AssumeColonVerbOpt(false))) ) var ( @@ -778,4 +859,6 @@ var ( forward_Query_QueryVaultByOwner_0 = runtime.ForwardResponseMessage forward_Query_QueryTotalCollateralLockedByDenom_0 = runtime.ForwardResponseMessage + + forward_Query_QueryShortfallAmount_0 = runtime.ForwardResponseMessage ) From e7261e9c36611d3d31783d9f569b18e68d568046 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=90=C3=B4ng=20Li=E1=BB=81u?= Date: Mon, 20 Jan 2025 16:32:56 +0700 Subject: [PATCH 2/2] cli --- x/vaults/cli/query.go | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/x/vaults/cli/query.go b/x/vaults/cli/query.go index 77f801c..668233f 100644 --- a/x/vaults/cli/query.go +++ b/x/vaults/cli/query.go @@ -29,6 +29,7 @@ func GetQueryCmd() *cobra.Command { cmd.AddCommand(CmdQueryVaultFromAddress()) cmd.AddCommand(CmdQueryCollateralsByDenom()) cmd.AddCommand(CmdQueryTotalCollateralLockedByDenom()) + cmd.AddCommand(CmdQueryShortfallAmount()) return cmd } @@ -245,3 +246,29 @@ func CmdQueryTotalCollateralLockedByDenom() *cobra.Command { flags.AddQueryFlagsToCmd(cmd) return cmd } + +func CmdQueryShortfallAmount() *cobra.Command { + cmd := &cobra.Command{ + Use: "query-shortfall-amount [mint-denom]", + Short: "show total shortfall amount by mint denom", + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx := client.GetClientContextFromCmd(cmd) + + queryClient := types.NewQueryClient(clientCtx) + + msg := types.QueryShortfallAmountRequest{ + MintDenom: args[0], + } + + res, err := queryClient.QueryShortfallAmount(context.Background(), &msg) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + flags.AddQueryFlagsToCmd(cmd) + return cmd +}