From cbf1d36e9deee4b086235a02e0fc9301e32bbcfc Mon Sep 17 00:00:00 2001 From: Robert Zaremba Date: Wed, 3 Jan 2024 11:32:34 +0100 Subject: [PATCH] feat: add symbol name to the x/uibc QueryInflowsResponse (#2377) * feat: add symbol name to the x/uibc QueryInflowsResponse * add missing file * changelog --- CHANGELOG.md | 1 + proto/umee/uibc/v1/query.proto | 6 +- swagger/swagger.yaml | 24 ++++---- x/uibc/query.pb.go | 104 ++++++++++++++++----------------- x/uibc/quota/grpc_query.go | 21 +++---- x/uibc/quota/token.go | 21 +++++++ 6 files changed, 91 insertions(+), 86 deletions(-) create mode 100644 x/uibc/quota/token.go diff --git a/CHANGELOG.md b/CHANGELOG.md index 6d3c771f6b..9c169a7d36 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -53,6 +53,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ - [2363](https://github.com/umee-network/umee/pull/2363) Upgrade Cosmos SDK to v0.47.7. - [2370](https://github.com/umee-network/umee/pull/2370) Add missing params to `uibc/MsgGovUpdateQuota`. - [2374](https://github.com/umee-network/umee/pull/2374) Add symbol name to the x/uibc QueryAllOutflowsResponse `outflows` entry. +- [2377](https://github.com/umee-network/umee/pull/2377) Add symbol name to the x/uibc QueryInflowsResponse `inflows` entry. ### Features diff --git a/proto/umee/uibc/v1/query.proto b/proto/umee/uibc/v1/query.proto index 3578aedbb2..901ad7efdd 100644 --- a/proto/umee/uibc/v1/query.proto +++ b/proto/umee/uibc/v1/query.proto @@ -1,7 +1,6 @@ syntax = "proto3"; package umee.uibc.v1; -import "cosmos/base/v1beta1/coin.proto"; import "cosmos_proto/cosmos.proto"; import "gogoproto/gogo.proto"; import "google/api/annotations.proto"; @@ -68,10 +67,7 @@ message QueryInflowsResponse { (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false ]; - repeated cosmos.base.v1beta1.DecCoin inflows = 2 [ - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.DecCoin", - (gogoproto.nullable) = false - ]; + repeated DecCoinSymbol inflows = 2 [(gogoproto.nullable) = false]; } // QueryParams defines the request structure for the Params gRPC service diff --git a/swagger/swagger.yaml b/swagger/swagger.yaml index 6760d139a7..da05f46036 100644 --- a/swagger/swagger.yaml +++ b/swagger/swagger.yaml @@ -3180,15 +3180,12 @@ paths: type: string amount: type: string + symbol: + type: string + title: token symbol name description: >- - DecCoin defines a token with a denomination and a decimal - amount. - - - NOTE: The amount field is an Dec which implements the custom - method - - signatures required by gogoproto. + DecCoinSymbol extends the Cosmos SDK DecCoin type and adds + symbol name. title: QueryInflowsResponse defines response type of Query/Inflows default: description: An unexpected error response. @@ -9249,11 +9246,12 @@ definitions: type: string amount: type: string - description: |- - DecCoin defines a token with a denomination and a decimal amount. - - NOTE: The amount field is an Dec which implements the custom method - signatures required by gogoproto. + symbol: + type: string + title: token symbol name + description: >- + DecCoinSymbol extends the Cosmos SDK DecCoin type and adds symbol + name. title: QueryInflowsResponse defines response type of Query/Inflows umee.uibc.v1.QueryOutflowsResponse: type: object diff --git a/x/uibc/query.pb.go b/x/uibc/query.pb.go index 28b9ed329e..4144fec82b 100644 --- a/x/uibc/query.pb.go +++ b/x/uibc/query.pb.go @@ -7,7 +7,6 @@ import ( context "context" fmt "fmt" _ "github.com/cosmos/cosmos-proto" - _ "github.com/cosmos/cosmos-sdk/types" github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" _ "github.com/cosmos/gogoproto/gogoproto" grpc1 "github.com/cosmos/gogoproto/grpc" @@ -151,8 +150,8 @@ var xxx_messageInfo_QueryInflows proto.InternalMessageInfo // QueryInflowsResponse defines response type of Query/Inflows type QueryInflowsResponse struct { - Sum github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,1,opt,name=sum,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"sum"` - Inflows []github_com_cosmos_cosmos_sdk_types.DecCoin `protobuf:"bytes,2,rep,name=inflows,proto3,customtype=github.com/cosmos/cosmos-sdk/types.DecCoin" json:"inflows"` + Sum github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,1,opt,name=sum,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"sum"` + Inflows []DecCoinSymbol `protobuf:"bytes,2,rep,name=inflows,proto3" json:"inflows"` } func (m *QueryInflowsResponse) Reset() { *m = QueryInflowsResponse{} } @@ -432,53 +431,50 @@ func init() { func init() { proto.RegisterFile("umee/uibc/v1/query.proto", fileDescriptor_2ca7e17b0958935d) } var fileDescriptor_2ca7e17b0958935d = []byte{ - // 721 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x54, 0xcf, 0x53, 0xd3, 0x40, - 0x18, 0x6d, 0xf8, 0x51, 0x70, 0x0b, 0xa3, 0x2e, 0x05, 0x4a, 0x28, 0x09, 0x2e, 0x8a, 0x8c, 0x23, - 0xd9, 0x69, 0x9d, 0xf1, 0xe0, 0xe8, 0xc1, 0x8a, 0x07, 0x2e, 0x2a, 0x95, 0x8b, 0x5e, 0x3a, 0x49, - 0xbb, 0x94, 0x48, 0x92, 0x8d, 0xcd, 0xa6, 0xd0, 0x83, 0x17, 0x67, 0xbc, 0x33, 0xe3, 0xbf, 0xe2, - 0xdd, 0x2b, 0x47, 0x06, 0x2f, 0x8e, 0x87, 0xaa, 0xe0, 0xc9, 0xa3, 0x7f, 0x81, 0xb3, 0x9b, 0x4d, - 0x4c, 0xa0, 0xa0, 0x07, 0x4f, 0xed, 0x7e, 0xef, 0xed, 0x7b, 0xef, 0xfb, 0xb2, 0xbb, 0xa0, 0x14, - 0xba, 0x84, 0xe0, 0xd0, 0xb6, 0x9a, 0xb8, 0x5b, 0xc1, 0xaf, 0x43, 0xd2, 0xe9, 0x19, 0x7e, 0x87, - 0x32, 0x0a, 0x27, 0x38, 0x62, 0x70, 0xc4, 0xe8, 0x56, 0x54, 0x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x5a, 0x92, 0xe2, 0x01, 0x18, 0xa7, 0xb2, 0x56, - 0x52, 0xc4, 0xc7, 0x98, 0xcf, 0xf6, 0x2e, 0x27, 0xfa, 0xbc, 0xe7, 0x5a, 0xd4, 0x91, 0x23, 0x48, - 0xb6, 0x54, 0x3f, 0x8e, 0x80, 0x51, 0xa1, 0x0d, 0x5b, 0x20, 0x1f, 0x8d, 0x09, 0xce, 0x65, 0x05, - 0x52, 0xf3, 0x56, 0xaf, 0x9d, 0x0b, 0xc5, 0x81, 0x50, 0xf9, 0xed, 0xa7, 0x1f, 0xef, 0x87, 0x66, - 0x60, 0x11, 0x67, 0xae, 0x5a, 0x34, 0x74, 0xe8, 0x80, 0xf1, 0x64, 0xde, 0xf3, 0x03, 0xc4, 0x62, - 0x50, 0x5d, 0xba, 0x00, 0x4c, 0xbc, 0x34, 0xe1, 0x55, 0x82, 0x33, 0x59, 0xaf, 0xb8, 0x3b, 0xd8, - 0x03, 0x85, 0xd4, 0xcc, 0xa0, 0x36, 0x40, 0x33, 0x85, 0xab, 0xcb, 0x17, 0xe3, 0x89, 0x2d, 0x12, - 0xb6, 0x65, 0xa8, 0x66, 0x6d, 0x4d, 0xc7, 0x69, 0x24, 0xd6, 0xdb, 0x60, 0x2c, 0xbe, 0xad, 0xea, - 0x00, 0x59, 0x89, 0xa9, 0xe8, 0x7c, 0x2c, 0xb1, 0x5b, 0x10, 0x76, 0xb3, 0x70, 0x3a, 0x6b, 0x27, - 0x6f, 0x08, 0x7c, 0xc3, 0x1f, 0x87, 0x3f, 0xcf, 0x13, 0xd4, 0x07, 0x48, 0xa6, 0x09, 0xea, 0xcd, - 0xbf, 0x10, 0x12, 0xe3, 0x25, 0x61, 0xbc, 0x00, 0xe7, 0xf1, 0xd9, 0xf7, 0xb4, 0x41, 0x22, 0x72, - 0x6d, 0xed, 0xe0, 0xbb, 0x96, 0x3b, 0x38, 0xd6, 0x94, 0xc3, 0x63, 0x4d, 0xf9, 0x76, 0xac, 0x29, - 0xfb, 0x27, 0x5a, 0xee, 0xf0, 0x44, 0xcb, 0x7d, 0x3e, 0xd1, 0x72, 0x2f, 0xd3, 0x97, 0x81, 0x8b, - 0xac, 0x7a, 0x84, 0xed, 0xd2, 0xce, 0x4e, 0xa4, 0xd8, 0xbd, 0x8b, 0xf7, 0x84, 0xac, 0x95, 0x17, - 0x2f, 0xe6, 0x9d, 0xdf, 0x01, 0x00, 0x00, 0xff, 0xff, 0x57, 0x94, 0x42, 0x76, 0x72, 0x06, 0x00, - 0x00, + // 685 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x54, 0x3f, 0x53, 0xd4, 0x4e, + 0x18, 0xbe, 0xf0, 0xe7, 0xe0, 0xb7, 0x07, 0xf3, 0xd3, 0xe5, 0x80, 0x10, 0x20, 0xc1, 0x45, 0x91, + 0x42, 0x92, 0xe1, 0x9c, 0xb1, 0xf0, 0x4f, 0xe1, 0x89, 0x05, 0x8d, 0xca, 0x49, 0xa3, 0xcd, 0x4d, + 0xee, 0x6e, 0x39, 0x32, 0x64, 0xb3, 0xf1, 0xb2, 0x01, 0x52, 0xd8, 0x38, 0x63, 0xcf, 0x8c, 0x1f, + 0xc1, 0xaf, 0x60, 0x6f, 0x4b, 0xc9, 0x68, 0xe3, 0x58, 0x9c, 0xca, 0x59, 0x59, 0xfa, 0x09, 0x9c, + 0xdd, 0x6c, 0x62, 0x02, 0xc7, 0x69, 0x61, 0x75, 0xb7, 0xef, 0xf3, 0xbc, 0xcf, 0xf3, 0xe4, 0xdd, + 0x79, 0x17, 0xa8, 0x21, 0xc1, 0xd8, 0x0a, 0x9d, 0x46, 0xd3, 0xda, 0x5f, 0xb7, 0x5e, 0x84, 0xb8, + 0x13, 0x99, 0x7e, 0x87, 0x32, 0x0a, 0x27, 0x38, 0x62, 0x72, 0xc4, 0xdc, 0x5f, 0xd7, 0xe6, 0x9a, + 0x34, 0x20, 0x34,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, 0x08, 0x23, 0x06, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -826,11 +822,11 @@ func (m *QueryInflowsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { if len(m.Inflows) > 0 { for iNdEx := len(m.Inflows) - 1; iNdEx >= 0; iNdEx-- { { - size := m.Inflows[iNdEx].Size() - i -= size - if _, err := m.Inflows[iNdEx].MarshalTo(dAtA[i:]); err != nil { + size, err := m.Inflows[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { return 0, err } + i -= size i = encodeVarintQuery(dAtA, i, uint64(size)) } i-- @@ -1471,7 +1467,7 @@ func (m *QueryInflowsResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Inflows = append(m.Inflows, github_com_cosmos_cosmos_sdk_types.DecCoin{}) + m.Inflows = append(m.Inflows, DecCoinSymbol{}) if err := m.Inflows[len(m.Inflows)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } diff --git a/x/uibc/quota/grpc_query.go b/x/uibc/quota/grpc_query.go index b0f333d289..6a36dab9a9 100644 --- a/x/uibc/quota/grpc_query.go +++ b/x/uibc/quota/grpc_query.go @@ -56,16 +56,7 @@ func (q Querier) AllOutflows(goCtx context.Context, _ *uibc.QueryAllOutflows) ( if err != nil { return nil, err } - tokenSymbols := map[string]string{} - for _, t := range k.leverage.GetAllRegisteredTokens(ctx) { - tokenSymbols[t.BaseDenom] = t.SymbolDenom - } - outflows := make([]uibc.DecCoinSymbol, len(o)) - for i := range o { - outflows[i].Denom = o[i].Denom - outflows[i].Amount = o[i].Amount - outflows[i].Symbol = tokenSymbols[o[i].Denom] - } + outflows := k.coinsWithTokenSymbols(ctx, o) return &uibc.QueryAllOutflowsResponse{Outflows: outflows}, nil } @@ -73,18 +64,20 @@ func (q Querier) AllOutflows(goCtx context.Context, _ *uibc.QueryAllOutflows) ( func (q Querier) Inflows(goCtx context.Context, req *uibc.QueryInflows) (*uibc.QueryInflowsResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) var ( - inflows sdk.DecCoins - err error + inflowCoins sdk.DecCoins + err error + k = q.Keeper(&ctx) ) if len(req.Denom) != 0 { - inflows = append(inflows, q.Keeper(&ctx).GetTokenInflow(req.Denom)) + inflowCoins = sdk.NewDecCoins(k.GetTokenInflow(req.Denom)) } else { - inflows, err = q.Keeper(&ctx).GetAllInflows() + inflowCoins, err = k.GetAllInflows() if err != nil { return nil, err } } + inflows := k.coinsWithTokenSymbols(ctx, inflowCoins) return &uibc.QueryInflowsResponse{Sum: q.Keeper(&ctx).GetInflowSum(), Inflows: inflows}, nil } diff --git a/x/uibc/quota/token.go b/x/uibc/quota/token.go new file mode 100644 index 0000000000..542a54e398 --- /dev/null +++ b/x/uibc/quota/token.go @@ -0,0 +1,21 @@ +package quota + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/umee-network/umee/v6/x/uibc" +) + +// returns mapping of token denom (according to x/bank) to token symbol name. +func (k Keeper) coinsWithTokenSymbols(ctx sdk.Context, coins sdk.DecCoins) []uibc.DecCoinSymbol { + tokenSymbols := map[string]string{} + for _, t := range k.leverage.GetAllRegisteredTokens(ctx) { + tokenSymbols[t.BaseDenom] = t.SymbolDenom + } + cs := make([]uibc.DecCoinSymbol, len(coins)) + for i := range coins { + cs[i].Denom = coins[i].Denom + cs[i].Amount = coins[i].Amount + cs[i].Symbol = tokenSymbols[coins[i].Denom] + } + return cs +}