Skip to content

Commit

Permalink
Use string for sdk.Dec proto types
Browse files Browse the repository at this point in the history
  • Loading branch information
drklee3 committed Nov 16, 2021
1 parent 4f31cb2 commit e796f0c
Show file tree
Hide file tree
Showing 4 changed files with 150 additions and 151 deletions.
2 changes: 1 addition & 1 deletion docs/core/proto-docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,7 @@ QueryCdpsRequest is the params for a filtered CDP query, the request type for th
| `collateral_type` | [string](#string) | | |
| `owner` | [string](#string) | | |
| `id` | [uint64](#uint64) | | |
| `ratio` | [string](#string) | | |
| `ratio` | [string](#string) | | sdk.Dec as a string |
| `pagination` | [cosmos.base.query.v1beta1.PageRequest](#cosmos.base.query.v1beta1.PageRequest) | | |


Expand Down
19 changes: 4 additions & 15 deletions proto/kava/cdp/v1beta1/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,8 @@ message QueryCdpsRequest {
string collateral_type = 1;
string owner = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];
uint64 id = 3 [(gogoproto.customname) = "ID"];
string ratio = 4 [
(cosmos_proto.scalar) = "cosmos.Dec",
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec",
(gogoproto.nullable) = false
];
// sdk.Dec as a string
string ratio = 4;

cosmos.base.query.v1beta1.PageRequest pagination = 5;
}
Expand Down Expand Up @@ -144,15 +141,7 @@ message CDPResponse {
cosmos.base.v1beta1.Coin principal = 5 [(gogoproto.nullable) = false];
cosmos.base.v1beta1.Coin accumulated_fees = 6 [(gogoproto.nullable) = false];
google.protobuf.Timestamp fees_updated = 7 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false];
string interest_factor = 8 [
(cosmos_proto.scalar) = "cosmos.Dec",
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec",
(gogoproto.nullable) = false
];
string interest_factor = 8;
cosmos.base.v1beta1.Coin collateral_value = 9 [(gogoproto.nullable) = false];
string collateralization_ratio = 10 [
(cosmos_proto.scalar) = "cosmos.Dec",
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec",
(gogoproto.nullable) = false
];
string collateralization_ratio = 10;
}
4 changes: 2 additions & 2 deletions x/cdp/types/cdp.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,9 +172,9 @@ func NewCDPResponse(cdp CDP, collateralValue sdk.Coin, collateralizationRatio sd
Principal: cdp.Principal,
AccumulatedFees: cdp.AccumulatedFees,
FeesUpdated: cdp.FeesUpdated,
InterestFactor: cdp.InterestFactor,
InterestFactor: cdp.InterestFactor.String(),
CollateralValue: collateralValue,
CollateralizationRatio: collateralizationRatio,
CollateralizationRatio: collateralizationRatio.String(),
}
}

Expand Down
Loading

0 comments on commit e796f0c

Please sign in to comment.