Skip to content

Commit

Permalink
address the coderabbitai suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
gsk967 committed Jun 24, 2024
1 parent 3e09259 commit 3454207
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 62 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions proto/umee/leverage/v1/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
104 changes: 55 additions & 49 deletions swagger/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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.
Expand Down Expand Up @@ -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.
Expand All @@ -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.
Expand Down Expand Up @@ -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.
Expand All @@ -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.
Expand Down Expand Up @@ -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.
Expand All @@ -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.
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand All @@ -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.
Expand Down Expand Up @@ -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.
Expand All @@ -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.
Expand Down
16 changes: 8 additions & 8 deletions x/leverage/keeper/grpc_query_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -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{
Expand All @@ -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)),
},
},
{
Expand All @@ -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)),
},
},
{
Expand All @@ -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)),
},
},
},
Expand Down
4 changes: 2 additions & 2 deletions x/leverage/types/query.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 3454207

Please sign in to comment.