From a26aa1637dad4dcb069ed3f874fdda115cd7f5ab Mon Sep 17 00:00:00 2001 From: Sai Kumar Date: Mon, 24 Jun 2024 21:04:22 +0530 Subject: [PATCH 1/5] improve the inspect query for front-end --- proto/umee/leverage/v1/query.proto | 32 +- swagger/swagger.yaml | 361 +++++++++++----- x/leverage/keeper/grpc_query_test.go | 26 +- x/leverage/keeper/inspector.go | 42 +- x/leverage/types/query.pb.go | 588 ++++++++++++++++++++------- 5 files changed, 793 insertions(+), 256 deletions(-) diff --git a/proto/umee/leverage/v1/query.proto b/proto/umee/leverage/v1/query.proto index 3ecb42ca4c..1e8dd5215a 100644 --- a/proto/umee/leverage/v1/query.proto +++ b/proto/umee/leverage/v1/query.proto @@ -7,6 +7,7 @@ import "umee/leverage/v1/leverage.proto"; import "gogoproto/gogo.proto"; import "cosmos/base/v1beta1/coin.proto"; import "cosmos/base/query/v1beta1/pagination.proto"; +import "cosmos_proto/cosmos.proto"; option go_package = "github.com/umee-network/umee/v6/x/leverage/types"; @@ -489,13 +490,32 @@ message RiskInfo { // DecBalances contains an account's position denoted in symbol denom tokens. message DecBalances { // Collateral contains all uTokens the account has collateralized. It has been converted from uTokens to tokens. - repeated cosmos.base.v1beta1.DecCoin collateral = 1 [ - (gogoproto.nullable) = false, - (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.DecCoins" + repeated PositionBalance collateral = 1 [ + (gogoproto.nullable) = false ]; // Borrowed contains all tokens the account has borrowed, including interest owed. - repeated cosmos.base.v1beta1.DecCoin borrowed = 2 [ - (gogoproto.nullable) = false, - (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.DecCoins" + repeated PositionBalance borrowed = 2 [ + (gogoproto.nullable) = false + ]; +} + +// PositionBalance contains denom, amount with base_denom, base_amount for account position. +message PositionBalance { + // denom will SYMBOL Denom (Ex: AKT, USDT) + string denom = 1; + // base_denom will be ibc_denom or native base denom of umee (Ex: uumee, ibc/XXXX) + string base_denom = 2; + // amount will be convert base tokens into symbol tokens with exchange rates + // Ex: 1000u/uumee becomes 0.0015UMEE at an exponent of 6 and uToken exchange rate of 1.5 + string amount = 3 [ + (cosmos_proto.scalar) = "cosmos.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", + (gogoproto.nullable) = false + ]; + // base_amount will base tokens without coverting to symbol denoms + string base_amount = 4 [ + (cosmos_proto.scalar) = "cosmos.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", + (gogoproto.nullable) = false ]; } diff --git a/swagger/swagger.yaml b/swagger/swagger.yaml index 85d0ac00da..caab4ab899 100644 --- a/swagger/swagger.yaml +++ b/swagger/swagger.yaml @@ -581,17 +581,28 @@ paths: properties: denom: type: string + title: 'denom will SYMBOL Denom (Ex: AKT, USDT)' + base_denom: + type: string + title: >- + base_denom will be ibc_denom or native base + denom of umee (Ex: uumee, ibc/XXXX) amount: type: string - description: >- - DecCoin defines a token with a denomination and a - decimal amount. - + title: >- + amount will be convert base tokens into symbol + tokens with exchange rates - NOTE: The amount field is an Dec which implements - the custom method - - signatures required by gogoproto. + Ex: 1000u/uumee becomes 0.0015UMEE at an + exponent of 6 and uToken exchange rate of 1.5 + base_amount: + type: string + title: >- + base_amount will base tokens without coverting + to symbol denoms + description: >- + PositionBalance contains denom, amount with + base_denom, base_amount for account position. description: >- Collateral contains all uTokens the account has collateralized. It has been converted from uTokens @@ -603,17 +614,28 @@ paths: properties: denom: type: string + title: 'denom will SYMBOL Denom (Ex: AKT, USDT)' + base_denom: + type: string + title: >- + base_denom will be ibc_denom or native base + denom of umee (Ex: uumee, ibc/XXXX) 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 + title: >- + amount will be convert base tokens into symbol + tokens with exchange rates - signatures required by gogoproto. + Ex: 1000u/uumee becomes 0.0015UMEE at an + exponent of 6 and uToken exchange rate of 1.5 + base_amount: + type: string + title: >- + base_amount will base tokens without coverting + to symbol denoms + description: >- + PositionBalance contains denom, amount with + base_denom, base_amount for account position. description: >- Borrowed contains all tokens the account has borrowed, including interest owed. @@ -752,17 +774,28 @@ paths: properties: denom: type: string + title: 'denom will SYMBOL Denom (Ex: AKT, USDT)' + base_denom: + type: string + title: >- + base_denom will be ibc_denom or native base + denom of umee (Ex: uumee, ibc/XXXX) amount: type: string - description: >- - DecCoin defines a token with a denomination and a - decimal amount. - + title: >- + amount will be convert base tokens into symbol + tokens with exchange rates - NOTE: The amount field is an Dec which implements - the custom method - - signatures required by gogoproto. + Ex: 1000u/uumee becomes 0.0015UMEE at an + exponent of 6 and uToken exchange rate of 1.5 + base_amount: + type: string + title: >- + base_amount will base tokens without coverting + to symbol denoms + description: >- + PositionBalance contains denom, amount with + base_denom, base_amount for account position. description: >- Collateral contains all uTokens the account has collateralized. It has been converted from uTokens to @@ -774,17 +807,28 @@ paths: properties: denom: type: string + title: 'denom will SYMBOL Denom (Ex: AKT, USDT)' + base_denom: + type: string + title: >- + base_denom will be ibc_denom or native base + denom of umee (Ex: uumee, ibc/XXXX) amount: type: string - description: >- - DecCoin defines a token with a denomination and a - decimal amount. + title: >- + amount will be convert base tokens into symbol + tokens with exchange rates - - NOTE: The amount field is an Dec which implements - the custom method - - signatures required by gogoproto. + Ex: 1000u/uumee becomes 0.0015UMEE at an + exponent of 6 and uToken exchange rate of 1.5 + base_amount: + type: string + title: >- + base_amount will base tokens without coverting + to symbol denoms + description: >- + PositionBalance contains denom, amount with + base_denom, base_amount for account position. description: >- Borrowed contains all tokens the account has borrowed, including interest owed. @@ -6349,18 +6393,6 @@ definitions: NOTE: The amount field is an Int which implements the custom method signatures required by gogoproto. - cosmos.base.v1beta1.DecCoin: - type: object - properties: - denom: - 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. google.protobuf.Any: type: object properties: @@ -6812,13 +6844,26 @@ definitions: properties: denom: type: string + title: 'denom will SYMBOL Denom (Ex: AKT, USDT)' + base_denom: + type: string + title: >- + base_denom will be ibc_denom or native base denom of umee (Ex: + uumee, ibc/XXXX) amount: type: string - description: |- - DecCoin defines a token with a denomination and a decimal amount. + title: >- + amount will be convert base tokens into symbol tokens with + exchange rates - NOTE: The amount field is an Dec which implements the custom method - signatures required by gogoproto. + Ex: 1000u/uumee becomes 0.0015UMEE at an exponent of 6 and + uToken exchange rate of 1.5 + base_amount: + type: string + title: base_amount will base tokens without coverting to symbol denoms + description: >- + PositionBalance contains denom, amount with base_denom, base_amount + for account position. description: >- Collateral contains all uTokens the account has collateralized. It has been converted from uTokens to tokens. @@ -6829,13 +6874,26 @@ definitions: properties: denom: type: string + title: 'denom will SYMBOL Denom (Ex: AKT, USDT)' + base_denom: + type: string + title: >- + base_denom will be ibc_denom or native base denom of umee (Ex: + uumee, ibc/XXXX) amount: type: string - description: |- - DecCoin defines a token with a denomination and a decimal amount. + title: >- + amount will be convert base tokens into symbol tokens with + exchange rates - NOTE: The amount field is an Dec which implements the custom method - signatures required by gogoproto. + Ex: 1000u/uumee becomes 0.0015UMEE at an exponent of 6 and + uToken exchange rate of 1.5 + base_amount: + type: string + title: base_amount will base tokens without coverting to symbol denoms + description: >- + PositionBalance contains denom, amount with base_denom, base_amount + for account position. description: >- Borrowed contains all tokens the account has borrowed, including interest owed. @@ -6875,17 +6933,28 @@ definitions: properties: denom: type: string + title: 'denom will SYMBOL Denom (Ex: AKT, USDT)' + base_denom: + type: string + title: >- + base_denom will be ibc_denom or native base denom of umee + (Ex: uumee, ibc/XXXX) 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 + title: >- + amount will be convert base tokens into symbol tokens with + exchange rates - signatures required by gogoproto. + Ex: 1000u/uumee becomes 0.0015UMEE at an exponent of 6 and + uToken exchange rate of 1.5 + base_amount: + type: string + title: >- + base_amount will base tokens without coverting to symbol + denoms + description: >- + PositionBalance contains denom, amount with base_denom, + base_amount for account position. description: >- Collateral contains all uTokens the account has collateralized. It has been converted from uTokens to tokens. @@ -6896,17 +6965,28 @@ definitions: properties: denom: type: string + title: 'denom will SYMBOL Denom (Ex: AKT, USDT)' + base_denom: + type: string + title: >- + base_denom will be ibc_denom or native base denom of umee + (Ex: uumee, ibc/XXXX) 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 + title: >- + amount will be convert base tokens into symbol tokens with + exchange rates - signatures required by gogoproto. + Ex: 1000u/uumee becomes 0.0015UMEE at an exponent of 6 and + uToken exchange rate of 1.5 + base_amount: + type: string + title: >- + base_amount will base tokens without coverting to symbol + denoms + description: >- + PositionBalance contains denom, amount with base_denom, + base_amount for account position. description: >- Borrowed contains all tokens the account has borrowed, including interest owed. @@ -7007,6 +7087,31 @@ definitions: Valid values: 0-1. description: Params defines the parameters for the leverage module. + umee.leverage.v1.PositionBalance: + type: object + properties: + denom: + type: string + title: 'denom will SYMBOL Denom (Ex: AKT, USDT)' + base_denom: + type: string + title: >- + base_denom will be ibc_denom or native base denom of umee (Ex: uumee, + ibc/XXXX) + amount: + type: string + title: >- + amount will be convert base tokens into symbol tokens with exchange + rates + + Ex: 1000u/uumee becomes 0.0015UMEE at an exponent of 6 and uToken + exchange rate of 1.5 + base_amount: + type: string + title: base_amount will base tokens without coverting to symbol denoms + description: >- + PositionBalance contains denom, amount with base_denom, base_amount for + account position. umee.leverage.v1.QueryAccountBalancesResponse: type: object properties: @@ -7336,17 +7441,28 @@ definitions: properties: denom: type: string + title: 'denom will SYMBOL Denom (Ex: AKT, USDT)' + base_denom: + type: string + title: >- + base_denom will be ibc_denom or native base denom of + umee (Ex: uumee, ibc/XXXX) 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 + title: >- + amount will be convert base tokens into symbol tokens + with exchange rates - signatures required by gogoproto. + Ex: 1000u/uumee becomes 0.0015UMEE at an exponent of 6 + and uToken exchange rate of 1.5 + base_amount: + type: string + title: >- + base_amount will base tokens without coverting to symbol + denoms + description: >- + PositionBalance contains denom, amount with base_denom, + base_amount for account position. description: >- Collateral contains all uTokens the account has collateralized. It has been converted from uTokens to tokens. @@ -7357,17 +7473,28 @@ definitions: properties: denom: type: string + title: 'denom will SYMBOL Denom (Ex: AKT, USDT)' + base_denom: + type: string + title: >- + base_denom will be ibc_denom or native base denom of + umee (Ex: uumee, ibc/XXXX) 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 + title: >- + amount will be convert base tokens into symbol tokens + with exchange rates - signatures required by gogoproto. + Ex: 1000u/uumee becomes 0.0015UMEE at an exponent of 6 + and uToken exchange rate of 1.5 + base_amount: + type: string + title: >- + base_amount will base tokens without coverting to symbol + denoms + description: >- + PositionBalance contains denom, amount with base_denom, + base_amount for account position. description: >- Borrowed contains all tokens the account has borrowed, including interest owed. @@ -7427,17 +7554,28 @@ definitions: properties: denom: type: string + title: 'denom will SYMBOL Denom (Ex: AKT, USDT)' + base_denom: + type: string + title: >- + base_denom will be ibc_denom or native base denom of + umee (Ex: uumee, ibc/XXXX) 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 + title: >- + amount will be convert base tokens into symbol tokens + with exchange rates - signatures required by gogoproto. + Ex: 1000u/uumee becomes 0.0015UMEE at an exponent of 6 + and uToken exchange rate of 1.5 + base_amount: + type: string + title: >- + base_amount will base tokens without coverting to + symbol denoms + description: >- + PositionBalance contains denom, amount with base_denom, + base_amount for account position. description: >- Collateral contains all uTokens the account has collateralized. It has been converted from uTokens to @@ -7449,17 +7587,28 @@ definitions: properties: denom: type: string + title: 'denom will SYMBOL Denom (Ex: AKT, USDT)' + base_denom: + type: string + title: >- + base_denom will be ibc_denom or native base denom of + umee (Ex: uumee, ibc/XXXX) 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 + title: >- + amount will be convert base tokens into symbol tokens + with exchange rates - signatures required by gogoproto. + Ex: 1000u/uumee becomes 0.0015UMEE at an exponent of 6 + and uToken exchange rate of 1.5 + base_amount: + type: string + title: >- + base_amount will base tokens without coverting to + symbol denoms + description: >- + PositionBalance contains denom, amount with base_denom, + base_amount for account position. description: >- Borrowed contains all tokens the account has borrowed, including interest owed. @@ -9187,6 +9336,18 @@ definitions: QueryMarketSummaryResponse defines the response structure for the MarketSummary gRPC service handler. description: TokenMarket is a token and its market summary. + cosmos.base.v1beta1.DecCoin: + type: object + properties: + denom: + 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. umee.oracle.v1.AggregateExchangeRatePrevote: type: object properties: diff --git a/x/leverage/keeper/grpc_query_test.go b/x/leverage/keeper/grpc_query_test.go index 9c5ff17b8c..9db7696af9 100644 --- a/x/leverage/keeper/grpc_query_test.go +++ b/x/leverage/keeper/grpc_query_test.go @@ -3,6 +3,7 @@ package keeper_test import ( "context" + "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" "gotest.tools/v3/assert" @@ -249,6 +250,19 @@ func (s *IntegrationTestSuite) TestQuerier_Inspect() { resp, err := s.queryClient.Inspect(ctx, &types.QueryInspect{}) require.NoError(err) + positionBal := func(c sdk.DecCoins, baseAmount math.Int) []types.PositionBalance { + res := make([]types.PositionBalance, 0) + for _, c := range c { + res = append(res, types.PositionBalance{ + Amount: c.Amount, + Denom: c.Denom, + BaseDenom: umeeDenom, + BaseAmount: baseAmount, + }) + } + return res + } + expected := types.QueryInspectResponse{ Borrowers: []types.InspectAccount{ { @@ -259,8 +273,8 @@ func (s *IntegrationTestSuite) TestQuerier_Inspect() { Value: 2526, }, Position: &types.DecBalances{ - Collateral: sdk.NewDecCoins(coin.Dec("UMEE", "600")), - Borrowed: sdk.NewDecCoins(coin.Dec("UMEE", "15")), + Collateral: positionBal(sdk.NewDecCoins(coin.Dec("UMEE", "600")), math.NewInt(600_000000)), + Borrowed: positionBal(sdk.NewDecCoins(coin.Dec("UMEE", "15")), math.NewInt(15_000000)), }, }, { @@ -271,8 +285,8 @@ func (s *IntegrationTestSuite) TestQuerier_Inspect() { Value: 4210, }, Position: &types.DecBalances{ - Collateral: sdk.NewDecCoins(coin.Dec("UMEE", "1000")), - Borrowed: sdk.NewDecCoins(coin.Dec("UMEE", "10.5")), + Collateral: positionBal(sdk.NewDecCoins(coin.Dec("UMEE", "1000")), math.NewInt(1000_000000)), + Borrowed: positionBal(sdk.NewDecCoins(coin.Dec("UMEE", "10.5")), math.NewInt(10_500000)), }, }, { @@ -283,8 +297,8 @@ func (s *IntegrationTestSuite) TestQuerier_Inspect() { Value: 252, }, Position: &types.DecBalances{ - Collateral: sdk.NewDecCoins(coin.Dec("UMEE", "60")), - Borrowed: sdk.NewDecCoins(coin.Dec("UMEE", "1.5")), + Collateral: positionBal(sdk.NewDecCoins(coin.Dec("UMEE", "60")), math.NewInt(60_000000)), + Borrowed: positionBal(sdk.NewDecCoins(coin.Dec("UMEE", "1.5")), math.NewInt(1_500000)), }, }, }, diff --git a/x/leverage/keeper/inspector.go b/x/leverage/keeper/inspector.go index 6fc83860a0..e7d8955810 100644 --- a/x/leverage/keeper/inspector.go +++ b/x/leverage/keeper/inspector.go @@ -7,6 +7,7 @@ import ( "sort" "strings" + sdkmath "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" @@ -16,6 +17,7 @@ import ( ) type tokenExchangeRate struct { + baseDenom string symbol string exponent uint32 exchangeRate sdk.Dec @@ -43,6 +45,7 @@ func (q Querier) Inspect( exchangeRates := map[string]tokenExchangeRate{} for _, t := range tokens { exchangeRates[t.BaseDenom] = tokenExchangeRate{ + baseDenom: t.BaseDenom, symbol: t.SymbolDenom, exponent: t.Exponent, exchangeRate: k.DeriveExchangeRate(ctx, t.BaseDenom), @@ -111,7 +114,21 @@ func (q Querier) Inspect( sort.SliceStable(borrowers, func(i, j int) bool { if req.Symbol != "" { // for non-empty symbol denom, sorts by borrowed amount (descending) of that token - return borrowers[i].Position.Borrowed.AmountOf(req.Symbol).GTE(borrowers[j].Position.Borrowed.AmountOf(req.Symbol)) + var a, b sdkmath.Int + for _, c := range borrowers[i].Position.Borrowed { + if c.Denom == req.Symbol { + a = c.BaseAmount + break + } + } + + for _, c := range borrowers[j].Position.Borrowed { + if c.Denom == req.Symbol { + b = c.BaseAmount + break + } + } + return a.GTE(b) } // otherwise, sorts by borrowed value (descending) return borrowers[i].Analysis.Borrowed > borrowers[j].Analysis.Borrowed @@ -185,13 +202,13 @@ func (q Querier) InspectAccount( return &types.QueryInspectAccountResponse{Borrower: account}, nil } -// symbolDecCoins converts an sdk.Coins containing base tokens or uTokens into an sdk.DecCoins containing symbol denom -// base tokens. for example, 1000u/uumee becomes 0.0015UMEE at an exponent of 6 and uToken exchange rate of 1.5 +// symbolDecCoins converts an sdk.Coins containing base tokens or uTokens into an PositionBalance format containing symbol denom +// , base_denom ,base token amount and exchange rate amount. for example, 1000u/uumee becomes 0.0015UMEE at an exponent of 6 and uToken exchange rate of 1.5 func symbolDecCoins( coins sdk.Coins, tokens map[string]tokenExchangeRate, -) sdk.DecCoins { - symbolCoins := sdk.NewDecCoins() +) []types.PositionBalance { + symbolCoins := make([]types.PositionBalance, 0) for _, c := range coins { exchangeRate := sdk.OneDec() @@ -203,12 +220,23 @@ func symbolDecCoins( t, ok := tokens[c.Denom] if !ok { // unregistered tokens cannot be converted, but can be returned as base denom - symbolCoins = symbolCoins.Add(sdk.NewDecCoinFromDec(c.Denom, sdk.NewDecFromInt(c.Amount))) + // symbolCoins = symbolCoins.Add(sdk.NewDecCoinFromDec(c.Denom, sdk.NewDecFromInt(c.Amount))) + symbolCoins = append(symbolCoins, types.PositionBalance{ + Amount: sdk.NewDecFromInt(c.Amount), + BaseDenom: c.Denom, + BaseAmount: c.Amount, + Denom: c.Denom, + }) continue } exponentMultiplier := ten.Power(uint64(t.exponent)) amount := exchangeRate.MulInt(c.Amount).Quo(exponentMultiplier) - symbolCoins = symbolCoins.Add(sdk.NewDecCoinFromDec(t.symbol, amount)) + symbolCoins = append(symbolCoins, types.PositionBalance{ + Denom: t.symbol, + BaseDenom: c.Denom, + Amount: amount, + BaseAmount: c.Amount, + }) } return symbolCoins diff --git a/x/leverage/types/query.pb.go b/x/leverage/types/query.pb.go index c77b1c9cea..d7b3a18f33 100644 --- a/x/leverage/types/query.pb.go +++ b/x/leverage/types/query.pb.go @@ -5,8 +5,10 @@ package types import ( context "context" + cosmossdk_io_math "cosmossdk.io/math" encoding_binary "encoding/binary" fmt "fmt" + _ "github.com/cosmos/cosmos-proto" github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" types "github.com/cosmos/cosmos-sdk/types" query "github.com/cosmos/cosmos-sdk/types/query" @@ -1378,9 +1380,9 @@ var xxx_messageInfo_RiskInfo proto.InternalMessageInfo // DecBalances contains an account's position denoted in symbol denom tokens. type DecBalances struct { // Collateral contains all uTokens the account has collateralized. It has been converted from uTokens to tokens. - Collateral github_com_cosmos_cosmos_sdk_types.DecCoins `protobuf:"bytes,1,rep,name=collateral,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.DecCoins" json:"collateral"` + Collateral []PositionBalance `protobuf:"bytes,1,rep,name=collateral,proto3" json:"collateral"` // Borrowed contains all tokens the account has borrowed, including interest owed. - Borrowed github_com_cosmos_cosmos_sdk_types.DecCoins `protobuf:"bytes,2,rep,name=borrowed,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.DecCoins" json:"borrowed"` + Borrowed []PositionBalance `protobuf:"bytes,2,rep,name=borrowed,proto3" json:"borrowed"` } func (m *DecBalances) Reset() { *m = DecBalances{} } @@ -1416,6 +1418,52 @@ func (m *DecBalances) XXX_DiscardUnknown() { var xxx_messageInfo_DecBalances proto.InternalMessageInfo +// PositionBalance contains denom, amount with base_denom, base_amount for account position. +type PositionBalance struct { + // denom will SYMBOL Denom (Ex: AKT, USDT) + Denom string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty"` + // base_denom will be ibc_denom or native base denom of umee (Ex: uumee, ibc/XXXX) + BaseDenom string `protobuf:"bytes,2,opt,name=base_denom,json=baseDenom,proto3" json:"base_denom,omitempty"` + // amount will be convert base tokens into symbol tokens with exchange rates + // Ex: 1000u/uumee becomes 0.0015UMEE at an exponent of 6 and uToken exchange rate of 1.5 + Amount cosmossdk_io_math.LegacyDec `protobuf:"bytes,3,opt,name=amount,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"amount"` + // base_amount will base tokens without coverting to symbol denoms + BaseAmount cosmossdk_io_math.Int `protobuf:"bytes,4,opt,name=base_amount,json=baseAmount,proto3,customtype=cosmossdk.io/math.Int" json:"base_amount"` +} + +func (m *PositionBalance) Reset() { *m = PositionBalance{} } +func (m *PositionBalance) String() string { return proto.CompactTextString(m) } +func (*PositionBalance) ProtoMessage() {} +func (*PositionBalance) Descriptor() ([]byte, []int) { + return fileDescriptor_1e8137dcabb0ccc7, []int{33} +} +func (m *PositionBalance) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *PositionBalance) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_PositionBalance.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 *PositionBalance) XXX_Merge(src proto.Message) { + xxx_messageInfo_PositionBalance.Merge(m, src) +} +func (m *PositionBalance) XXX_Size() int { + return m.Size() +} +func (m *PositionBalance) XXX_DiscardUnknown() { + xxx_messageInfo_PositionBalance.DiscardUnknown(m) +} + +var xxx_messageInfo_PositionBalance proto.InternalMessageInfo + func init() { proto.RegisterType((*QueryParams)(nil), "umee.leverage.v1.QueryParams") proto.RegisterType((*QueryParamsResponse)(nil), "umee.leverage.v1.QueryParamsResponse") @@ -1450,145 +1498,151 @@ func init() { proto.RegisterType((*InspectAccount)(nil), "umee.leverage.v1.InspectAccount") proto.RegisterType((*RiskInfo)(nil), "umee.leverage.v1.RiskInfo") proto.RegisterType((*DecBalances)(nil), "umee.leverage.v1.DecBalances") + proto.RegisterType((*PositionBalance)(nil), "umee.leverage.v1.PositionBalance") } func init() { proto.RegisterFile("umee/leverage/v1/query.proto", fileDescriptor_1e8137dcabb0ccc7) } var fileDescriptor_1e8137dcabb0ccc7 = []byte{ - // 2117 bytes of a gzipped FileDescriptorProto + // 2207 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x59, 0xcd, 0x6f, 0x1b, 0xc7, - 0x15, 0xd7, 0x4a, 0x11, 0x25, 0x3d, 0xea, 0x73, 0x2c, 0xdb, 0x6b, 0x5a, 0xa2, 0xe4, 0xb5, 0xf5, - 0x11, 0x27, 0x22, 0x6d, 0x19, 0x30, 0x9a, 0x7e, 0x9b, 0x56, 0xd3, 0x3a, 0xb0, 0x03, 0x79, 0x1d, - 0x3b, 0x70, 0xd2, 0x86, 0x18, 0x92, 0x63, 0x6a, 0xa0, 0xe5, 0x2e, 0xbd, 0xb3, 0x94, 0xa5, 0x02, - 0xb9, 0x18, 0xe8, 0xad, 0x2d, 0x1a, 0x14, 0x05, 0xda, 0x63, 0xaf, 0xbd, 0xf5, 0xd4, 0x3f, 0xa1, - 0x3e, 0x06, 0xe8, 0xa5, 0x28, 0x50, 0xb5, 0xb5, 0x8b, 0x1e, 0x72, 0xe9, 0xad, 0xa7, 0x1e, 0x8a, - 0xf9, 0xe4, 0x2e, 0x97, 0x94, 0x48, 0xa2, 0x3a, 0x89, 0xb3, 0xf3, 0xde, 0xef, 0xfd, 0xde, 0x9b, - 0x79, 0x33, 0xef, 0x8d, 0x60, 0xa9, 0xd5, 0x20, 0xa4, 0xe8, 0x91, 0x03, 0x12, 0xe2, 0x3a, 0x29, - 0x1e, 0xd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, 0x05, 0x0e, 0x82, 0x7e, 0x04, 0x48, 0xc1, 0x46, 0x02, 0x39, + 0x35, 0x10, 0xf4, 0x9c, 0x44, 0xda, 0x6d, 0xc5, 0xf3, 0x63, 0x98, 0xab, 0x39, 0x1e, 0x87, 0x6f, + 0xc5, 0x62, 0x7a, 0x20, 0xf4, 0x59, 0x09, 0x74, 0xa0, 0x43, 0x52, 0x81, 0x29, 0x99, 0xc8, 0x22, + 0x0b, 0xcc, 0x19, 0x0e, 0xfc, 0x9d, 0xfe, 0x80, 0xbf, 0x3c, 0x5b, 0x9e, 0x92, 0x19, 0x2c, 0x60, + 0xec, 0x49, 0x81, 0xfa, 0x80, 0x8f, 0xd0, 0x63, 0x98, 0xc5, 0x27, 0xd8, 0x71, 0x71, 0xc9, 0x25, + 0x2a, 0xf4, 0xb3, 0x03, 0x79, 0x30, 0xa3, 0x71, 0x5a, 0xc1, 0x6f, 0x41, 0x3f, 0x73, 0xc2, 0xa3, + 0x4a, 0x80, 0x9f, 0x99, 0x73, 0x83, 0x05, 0x5f, 0x23, 0x7d, 0x28, 0x81, 0x50, 0x15, 0xae, 0xb6, + 0xe0, 0x5b, 0xab, 0xeb, 0xfc, 0x98, 0x98, 0x68, 0x20, 0x1b, 0x57, 0x34, 0xdc, 0x6e, 0x14, 0x0d, + 0x95, 0x60, 0x41, 0x1e, 0xd2, 0x47, 0x0e, 0x0d, 0xfd, 0xc0, 0x29, 0xcb, 0xd3, 0xfa, 0xf2, 0x40, + 0xa7, 0xf5, 0x65, 0x01, 0xf6, 0x03, 0x89, 0x25, 0x4e, 0xed, 0x2b, 0x90, 0x22, 0x41, 0xe0, 0x07, + 0xd4, 0x9c, 0xe7, 0x37, 0x88, 0x1c, 0x59, 0x77, 0x60, 0x9e, 0xdf, 0x3e, 0x3b, 0xe5, 0xb2, 0xdf, + 0xf0, 0xc2, 0x02, 0x76, 0xb1, 0x57, 0x26, 0x14, 0x99, 0x30, 0x86, 0x2b, 0x95, 0x80, 0x50, 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0x47, 0x5b, 0x00, 0xab, 0x6b, 0x36, 0x69, 0x99, 0xcc, 0xed, 0x8b, 0x65, 0x34, 0x89, 0x35, 0x4e, + 0x62, 0x05, 0x65, 0x3b, 0xe5, 0xdb, 0xa9, 0x7e, 0xe1, 0x44, 0x9f, 0xc2, 0x44, 0xab, 0xb8, 0x5e, + 0xe9, 0x6e, 0x40, 0x48, 0x64, 0x36, 0x2e, 0x92, 0xd0, 0x04, 0x6e, 0x71, 0x02, 0x59, 0x74, 0xbd, + 0x33, 0x01, 0x71, 0xa5, 0xa3, 0x10, 0xc6, 0x54, 0x65, 0x9c, 0xed, 0x02, 0x2d, 0xe7, 0x33, 0x6b, + 0xe7, 0xcf, 0x6b, 0xc3, 0x37, 0xb8, 0xe1, 0x45, 0x74, 0x2d, 0x69, 0xd8, 0x91, 0xa6, 0x3e, 0x4b, + 0x16, 0x7e, 0xab, 0xe7, 0xa3, 0x4b, 0xb1, 0xae, 0xa9, 0xdc, 0xb9, 0x4a, 0x3d, 0x2f, 0x95, 0x25, + 0x97, 0x4d, 0x99, 0x38, 0x85, 0xf7, 0x5f, 0xfc, 0x2b, 0x3b, 0xf4, 0xe2, 0x65, 0xd6, 0xf8, 0xfc, + 0x65, 0xd6, 0xf8, 0xe7, 0xcb, 0xac, 0xf1, 0x8b, 0x57, 0xd9, 0xa1, 0xcf, 0x5f, 0x65, 0x87, 0xfe, + 0xf6, 0x2a, 0x3b, 0xf4, 0xd1, 0x9d, 0x48, 0xe7, 0xc1, 0xa0, 0x36, 0x3d, 0x12, 0x3e, 0xf3, 0x83, + 0x63, 0x81, 0x7b, 0x72, 0x37, 0x7f, 0xda, 0x02, 0xe7, 0x7d, 0x48, 0x29, 0xc5, 0xff, 0xb5, 0xfd, + 0xf6, 0xff, 0x03, 0x00, 0x00, 0xff, 0xff, 0xde, 0xb2, 0xe8, 0x2c, 0xe8, 0x1f, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -3677,6 +3731,63 @@ func (m *DecBalances) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *PositionBalance) 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 *PositionBalance) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *PositionBalance) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size := m.BaseAmount.Size() + i -= size + if _, err := m.BaseAmount.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + { + 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] = 0x1a + if len(m.BaseDenom) > 0 { + i -= len(m.BaseDenom) + copy(dAtA[i:], m.BaseDenom) + i = encodeVarintQuery(dAtA, i, uint64(len(m.BaseDenom))) + i-- + dAtA[i] = 0x12 + } + 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 encodeVarintQuery(dAtA []byte, offset int, v uint64) int { offset -= sovQuery(v) base := offset @@ -4255,6 +4366,27 @@ func (m *DecBalances) Size() (n int) { return n } +func (m *PositionBalance) 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)) + } + l = len(m.BaseDenom) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = m.Amount.Size() + n += 1 + l + sovQuery(uint64(l)) + l = m.BaseAmount.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + func sovQuery(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -8169,7 +8301,7 @@ func (m *DecBalances) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Collateral = append(m.Collateral, types.DecCoin{}) + m.Collateral = append(m.Collateral, PositionBalance{}) if err := m.Collateral[len(m.Collateral)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -8203,7 +8335,7 @@ func (m *DecBalances) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Borrowed = append(m.Borrowed, types.DecCoin{}) + m.Borrowed = append(m.Borrowed, PositionBalance{}) if err := m.Borrowed[len(m.Borrowed)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -8229,6 +8361,188 @@ func (m *DecBalances) Unmarshal(dAtA []byte) error { } return nil } +func (m *PositionBalance) 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: PositionBalance: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: PositionBalance: 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 + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BaseDenom", 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.BaseDenom = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + 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 + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BaseAmount", 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.BaseAmount.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 skipQuery(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 From 3e0925941245ef6cf7544e6c807a2e2aca8ddfe7 Mon Sep 17 00:00:00 2001 From: Sai Kumar Date: Mon, 24 Jun 2024 21:15:15 +0530 Subject: [PATCH 2/5] update the changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3f99bd4475..366a879230 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -60,6 +60,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ - [2494](https://github.com/umee-network/umee/pull/2494) Use go 1.22 - [2495](https://github.com/umee-network/umee/pull/2495) (util) `KeyWithUint64` and `KeyWithUint32` helper functions for db keys. - [2504](https://github.com/umee-network/umee/pull/2504) bump `wasmd` to v0.45.0. +- [2562](https://github.com/umee-network/umee/pull/2562) (x/leverage): improve the existed inspect account response. ### Bug Fixes From 34542076bb67b9afc2df5c761933f7dda50cbfd1 Mon Sep 17 00:00:00 2001 From: Sai Kumar Date: Mon, 24 Jun 2024 22:22:34 +0530 Subject: [PATCH 3/5] address the coderabbitai suggestions --- CHANGELOG.md | 2 +- proto/umee/leverage/v1/query.proto | 4 +- swagger/swagger.yaml | 104 ++++++++++++++------------- x/leverage/keeper/grpc_query_test.go | 16 ++--- x/leverage/types/query.pb.go | 4 +- 5 files changed, 68 insertions(+), 62 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 366a879230..5699f14a9e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -60,7 +60,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ - [2494](https://github.com/umee-network/umee/pull/2494) Use go 1.22 - [2495](https://github.com/umee-network/umee/pull/2495) (util) `KeyWithUint64` and `KeyWithUint32` helper functions for db keys. - [2504](https://github.com/umee-network/umee/pull/2504) bump `wasmd` to v0.45.0. -- [2562](https://github.com/umee-network/umee/pull/2562) (x/leverage): improve the existed inspect account response. +- [2562](https://github.com/umee-network/umee/pull/2562) (x/leverage): Improved the existing inspect account response by adding `base_denom` and `base_amount`. ### Bug Fixes diff --git a/proto/umee/leverage/v1/query.proto b/proto/umee/leverage/v1/query.proto index 1e8dd5215a..b0c2196c05 100644 --- a/proto/umee/leverage/v1/query.proto +++ b/proto/umee/leverage/v1/query.proto @@ -505,14 +505,14 @@ message PositionBalance { string denom = 1; // base_denom will be ibc_denom or native base denom of umee (Ex: uumee, ibc/XXXX) string base_denom = 2; - // amount will be convert base tokens into symbol tokens with exchange rates + // amount represents the converted base tokens into symbol tokens using exchange rates // Ex: 1000u/uumee becomes 0.0015UMEE at an exponent of 6 and uToken exchange rate of 1.5 string amount = 3 [ (cosmos_proto.scalar) = "cosmos.Dec", (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", (gogoproto.nullable) = false ]; - // base_amount will base tokens without coverting to symbol denoms + // base_amount will represent base tokens without converting to symbol denominations string base_amount = 4 [ (cosmos_proto.scalar) = "cosmos.Int", (gogoproto.customtype) = "cosmossdk.io/math.Int", diff --git a/swagger/swagger.yaml b/swagger/swagger.yaml index caab4ab899..d1ce8ecd75 100644 --- a/swagger/swagger.yaml +++ b/swagger/swagger.yaml @@ -590,16 +590,16 @@ paths: amount: type: string title: >- - amount will be convert base tokens into symbol - tokens with exchange rates + amount represents the converted base tokens + into symbol tokens using exchange rates Ex: 1000u/uumee becomes 0.0015UMEE at an exponent of 6 and uToken exchange rate of 1.5 base_amount: type: string title: >- - base_amount will base tokens without coverting - to symbol denoms + base_amount will represent base tokens without + converting to symbol denominations description: >- PositionBalance contains denom, amount with base_denom, base_amount for account position. @@ -623,16 +623,16 @@ paths: amount: type: string title: >- - amount will be convert base tokens into symbol - tokens with exchange rates + amount represents the converted base tokens + into symbol tokens using exchange rates Ex: 1000u/uumee becomes 0.0015UMEE at an exponent of 6 and uToken exchange rate of 1.5 base_amount: type: string title: >- - base_amount will base tokens without coverting - to symbol denoms + base_amount will represent base tokens without + converting to symbol denominations description: >- PositionBalance contains denom, amount with base_denom, base_amount for account position. @@ -783,16 +783,16 @@ paths: amount: type: string title: >- - amount will be convert base tokens into symbol - tokens with exchange rates + amount represents the converted base tokens into + symbol tokens using exchange rates Ex: 1000u/uumee becomes 0.0015UMEE at an exponent of 6 and uToken exchange rate of 1.5 base_amount: type: string title: >- - base_amount will base tokens without coverting - to symbol denoms + base_amount will represent base tokens without + converting to symbol denominations description: >- PositionBalance contains denom, amount with base_denom, base_amount for account position. @@ -816,16 +816,16 @@ paths: amount: type: string title: >- - amount will be convert base tokens into symbol - tokens with exchange rates + amount represents the converted base tokens into + symbol tokens using exchange rates Ex: 1000u/uumee becomes 0.0015UMEE at an exponent of 6 and uToken exchange rate of 1.5 base_amount: type: string title: >- - base_amount will base tokens without coverting - to symbol denoms + base_amount will represent base tokens without + converting to symbol denominations description: >- PositionBalance contains denom, amount with base_denom, base_amount for account position. @@ -6853,14 +6853,16 @@ definitions: amount: type: string title: >- - amount will be convert base tokens into symbol tokens with - exchange rates + amount represents the converted base tokens into symbol tokens + using exchange rates Ex: 1000u/uumee becomes 0.0015UMEE at an exponent of 6 and uToken exchange rate of 1.5 base_amount: type: string - title: base_amount will base tokens without coverting to symbol denoms + title: >- + base_amount will represent base tokens without converting to + symbol denominations description: >- PositionBalance contains denom, amount with base_denom, base_amount for account position. @@ -6883,14 +6885,16 @@ definitions: amount: type: string title: >- - amount will be convert base tokens into symbol tokens with - exchange rates + amount represents the converted base tokens into symbol tokens + using exchange rates Ex: 1000u/uumee becomes 0.0015UMEE at an exponent of 6 and uToken exchange rate of 1.5 base_amount: type: string - title: base_amount will base tokens without coverting to symbol denoms + title: >- + base_amount will represent base tokens without converting to + symbol denominations description: >- PositionBalance contains denom, amount with base_denom, base_amount for account position. @@ -6942,16 +6946,16 @@ definitions: amount: type: string title: >- - amount will be convert base tokens into symbol tokens with - exchange rates + amount represents the converted base tokens into symbol + tokens using exchange rates Ex: 1000u/uumee becomes 0.0015UMEE at an exponent of 6 and uToken exchange rate of 1.5 base_amount: type: string title: >- - base_amount will base tokens without coverting to symbol - denoms + base_amount will represent base tokens without converting to + symbol denominations description: >- PositionBalance contains denom, amount with base_denom, base_amount for account position. @@ -6974,16 +6978,16 @@ definitions: amount: type: string title: >- - amount will be convert base tokens into symbol tokens with - exchange rates + amount represents the converted base tokens into symbol + tokens using exchange rates Ex: 1000u/uumee becomes 0.0015UMEE at an exponent of 6 and uToken exchange rate of 1.5 base_amount: type: string title: >- - base_amount will base tokens without coverting to symbol - denoms + base_amount will represent base tokens without converting to + symbol denominations description: >- PositionBalance contains denom, amount with base_denom, base_amount for account position. @@ -7101,14 +7105,16 @@ definitions: amount: type: string title: >- - amount will be convert base tokens into symbol tokens with exchange - rates + amount represents the converted base tokens into symbol tokens using + exchange rates Ex: 1000u/uumee becomes 0.0015UMEE at an exponent of 6 and uToken exchange rate of 1.5 base_amount: type: string - title: base_amount will base tokens without coverting to symbol denoms + title: >- + base_amount will represent base tokens without converting to symbol + denominations description: >- PositionBalance contains denom, amount with base_denom, base_amount for account position. @@ -7450,16 +7456,16 @@ definitions: amount: type: string title: >- - amount will be convert base tokens into symbol tokens - with exchange rates + amount represents the converted base tokens into symbol + tokens using exchange rates Ex: 1000u/uumee becomes 0.0015UMEE at an exponent of 6 and uToken exchange rate of 1.5 base_amount: type: string title: >- - base_amount will base tokens without coverting to symbol - denoms + base_amount will represent base tokens without + converting to symbol denominations description: >- PositionBalance contains denom, amount with base_denom, base_amount for account position. @@ -7482,16 +7488,16 @@ definitions: amount: type: string title: >- - amount will be convert base tokens into symbol tokens - with exchange rates + amount represents the converted base tokens into symbol + tokens using exchange rates Ex: 1000u/uumee becomes 0.0015UMEE at an exponent of 6 and uToken exchange rate of 1.5 base_amount: type: string title: >- - base_amount will base tokens without coverting to symbol - denoms + base_amount will represent base tokens without + converting to symbol denominations description: >- PositionBalance contains denom, amount with base_denom, base_amount for account position. @@ -7563,16 +7569,16 @@ definitions: amount: type: string title: >- - amount will be convert base tokens into symbol tokens - with exchange rates + amount represents the converted base tokens into + symbol tokens using exchange rates Ex: 1000u/uumee becomes 0.0015UMEE at an exponent of 6 and uToken exchange rate of 1.5 base_amount: type: string title: >- - base_amount will base tokens without coverting to - symbol denoms + base_amount will represent base tokens without + converting to symbol denominations description: >- PositionBalance contains denom, amount with base_denom, base_amount for account position. @@ -7596,16 +7602,16 @@ definitions: amount: type: string title: >- - amount will be convert base tokens into symbol tokens - with exchange rates + amount represents the converted base tokens into + symbol tokens using exchange rates Ex: 1000u/uumee becomes 0.0015UMEE at an exponent of 6 and uToken exchange rate of 1.5 base_amount: type: string title: >- - base_amount will base tokens without coverting to - symbol denoms + base_amount will represent base tokens without + converting to symbol denominations description: >- PositionBalance contains denom, amount with base_denom, base_amount for account position. diff --git a/x/leverage/keeper/grpc_query_test.go b/x/leverage/keeper/grpc_query_test.go index 9db7696af9..669caaea70 100644 --- a/x/leverage/keeper/grpc_query_test.go +++ b/x/leverage/keeper/grpc_query_test.go @@ -3,7 +3,7 @@ package keeper_test import ( "context" - "cosmossdk.io/math" + sdkmath "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" "gotest.tools/v3/assert" @@ -250,7 +250,7 @@ func (s *IntegrationTestSuite) TestQuerier_Inspect() { resp, err := s.queryClient.Inspect(ctx, &types.QueryInspect{}) require.NoError(err) - positionBal := func(c sdk.DecCoins, baseAmount math.Int) []types.PositionBalance { + convertToPositionBalances := func(c sdk.DecCoins, baseAmount sdkmath.Int) []types.PositionBalance { res := make([]types.PositionBalance, 0) for _, c := range c { res = append(res, types.PositionBalance{ @@ -273,8 +273,8 @@ func (s *IntegrationTestSuite) TestQuerier_Inspect() { Value: 2526, }, Position: &types.DecBalances{ - Collateral: positionBal(sdk.NewDecCoins(coin.Dec("UMEE", "600")), math.NewInt(600_000000)), - Borrowed: positionBal(sdk.NewDecCoins(coin.Dec("UMEE", "15")), math.NewInt(15_000000)), + Collateral: convertToPositionBalances(sdk.NewDecCoins(coin.Dec("UMEE", "600")), sdkmath.NewInt(600_000000)), + Borrowed: convertToPositionBalances(sdk.NewDecCoins(coin.Dec("UMEE", "15")), sdkmath.NewInt(15_000000)), }, }, { @@ -285,8 +285,8 @@ func (s *IntegrationTestSuite) TestQuerier_Inspect() { Value: 4210, }, Position: &types.DecBalances{ - Collateral: positionBal(sdk.NewDecCoins(coin.Dec("UMEE", "1000")), math.NewInt(1000_000000)), - Borrowed: positionBal(sdk.NewDecCoins(coin.Dec("UMEE", "10.5")), math.NewInt(10_500000)), + Collateral: convertToPositionBalances(sdk.NewDecCoins(coin.Dec("UMEE", "1000")), sdkmath.NewInt(1000_000000)), + Borrowed: convertToPositionBalances(sdk.NewDecCoins(coin.Dec("UMEE", "10.5")), sdkmath.NewInt(10_500000)), }, }, { @@ -297,8 +297,8 @@ func (s *IntegrationTestSuite) TestQuerier_Inspect() { Value: 252, }, Position: &types.DecBalances{ - Collateral: positionBal(sdk.NewDecCoins(coin.Dec("UMEE", "60")), math.NewInt(60_000000)), - Borrowed: positionBal(sdk.NewDecCoins(coin.Dec("UMEE", "1.5")), math.NewInt(1_500000)), + Collateral: convertToPositionBalances(sdk.NewDecCoins(coin.Dec("UMEE", "60")), sdkmath.NewInt(60_000000)), + Borrowed: convertToPositionBalances(sdk.NewDecCoins(coin.Dec("UMEE", "1.5")), sdkmath.NewInt(1_500000)), }, }, }, diff --git a/x/leverage/types/query.pb.go b/x/leverage/types/query.pb.go index d7b3a18f33..3b9dde2ad6 100644 --- a/x/leverage/types/query.pb.go +++ b/x/leverage/types/query.pb.go @@ -1424,10 +1424,10 @@ type PositionBalance struct { Denom string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty"` // base_denom will be ibc_denom or native base denom of umee (Ex: uumee, ibc/XXXX) BaseDenom string `protobuf:"bytes,2,opt,name=base_denom,json=baseDenom,proto3" json:"base_denom,omitempty"` - // amount will be convert base tokens into symbol tokens with exchange rates + // amount represents the converted base tokens into symbol tokens using exchange rates // Ex: 1000u/uumee becomes 0.0015UMEE at an exponent of 6 and uToken exchange rate of 1.5 Amount cosmossdk_io_math.LegacyDec `protobuf:"bytes,3,opt,name=amount,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"amount"` - // base_amount will base tokens without coverting to symbol denoms + // base_amount will represent base tokens without converting to symbol denominations BaseAmount cosmossdk_io_math.Int `protobuf:"bytes,4,opt,name=base_amount,json=baseAmount,proto3,customtype=cosmossdk.io/math.Int" json:"base_amount"` } From 7e6d206a3f0ed117a70f1a3a52fe4ca9f847b1f7 Mon Sep 17 00:00:00 2001 From: Sai Kumar Date: Mon, 24 Jun 2024 22:33:55 +0530 Subject: [PATCH 4/5] fix the lint --- x/leverage/keeper/inspector.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/x/leverage/keeper/inspector.go b/x/leverage/keeper/inspector.go index e7d8955810..f414bd4851 100644 --- a/x/leverage/keeper/inspector.go +++ b/x/leverage/keeper/inspector.go @@ -202,8 +202,9 @@ func (q Querier) InspectAccount( return &types.QueryInspectAccountResponse{Borrower: account}, nil } -// symbolDecCoins converts an sdk.Coins containing base tokens or uTokens into an PositionBalance format containing symbol denom -// , base_denom ,base token amount and exchange rate amount. for example, 1000u/uumee becomes 0.0015UMEE at an exponent of 6 and uToken exchange rate of 1.5 +// symbolDecCoins converts an sdk.Coins containing base tokens or uTokens into an PositionBalance format containing +// symbol denom, base_denom ,base token amount and exchange rate amount. +// for example, 1000u/uumee becomes 0.0015UMEE at an exponent of 6 and uToken exchange rate of 1.5 func symbolDecCoins( coins sdk.Coins, tokens map[string]tokenExchangeRate, From 49b82e0a6f0b0ea732b0b85fe249c5f64ffebf6f Mon Sep 17 00:00:00 2001 From: Sai Kumar Date: Tue, 25 Jun 2024 18:10:55 +0530 Subject: [PATCH 5/5] add tests for sort the borrowers --- CHANGELOG.md | 2 +- x/leverage/keeper/grpc_query_test.go | 6 ++++++ x/leverage/keeper/inspector.go | 4 ++++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5699f14a9e..b062d0a8c7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -60,7 +60,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ - [2494](https://github.com/umee-network/umee/pull/2494) Use go 1.22 - [2495](https://github.com/umee-network/umee/pull/2495) (util) `KeyWithUint64` and `KeyWithUint32` helper functions for db keys. - [2504](https://github.com/umee-network/umee/pull/2504) bump `wasmd` to v0.45.0. -- [2562](https://github.com/umee-network/umee/pull/2562) (x/leverage): Improved the existing inspect account response by adding `base_denom` and `base_amount`. +- [2562](https://github.com/umee-network/umee/pull/2562) (x/leverage proto): Add `base_denom` and `base_amount` to `QueryInspectResponse`. ### Bug Fixes diff --git a/x/leverage/keeper/grpc_query_test.go b/x/leverage/keeper/grpc_query_test.go index 669caaea70..7a9a1c8606 100644 --- a/x/leverage/keeper/grpc_query_test.go +++ b/x/leverage/keeper/grpc_query_test.go @@ -304,6 +304,12 @@ func (s *IntegrationTestSuite) TestQuerier_Inspect() { }, } require.Equal(expected, *resp) + + req := &types.QueryInspect{} + req.Symbol = "UMEE" + resp, err = s.queryClient.Inspect(ctx, req) + require.NoError(err) + require.Equal(expected, *resp) } func (s *IntegrationTestSuite) TestQuerier_LiquidationTargets() { diff --git a/x/leverage/keeper/inspector.go b/x/leverage/keeper/inspector.go index f414bd4851..799b478346 100644 --- a/x/leverage/keeper/inspector.go +++ b/x/leverage/keeper/inspector.go @@ -128,6 +128,10 @@ func (q Querier) Inspect( break } } + + if a.IsNil() || b.IsNil() { + return false + } return a.GTE(b) } // otherwise, sorts by borrowed value (descending)