Skip to content

Commit

Permalink
[Leveragelp]:refactor usd value to dec (#770)
Browse files Browse the repository at this point in the history
refactor:usd value to dec
  • Loading branch information
cryptokage1996 authored Sep 4, 2024
1 parent 07ad6ea commit fe1f2c2
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion proto/elys/leveragelp/types.proto
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ message QueryPosition {
Position position = 1;
string updated_leverage = 2 [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false];
string position_usd_value = 3 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec",
(gogoproto.nullable) = false
];
}
Expand Down
2 changes: 1 addition & 1 deletion x/leveragelp/keeper/query_get_position_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ func (suite KeeperTestSuite) TestQueryGetPosition() {
Position: &types.QueryPosition{
Position: position,
UpdatedLeverage: updated_leverage,
PositionUsdValue: sdk.NewInt(5000),
PositionUsdValue: sdk.NewDec(5000).Quo(sdk.NewDec(1000000)),
},
InterestRateHour: sdk.MustNewDecFromStr("0.000017123287671233"),
InterestRateHourUsd: sdk.ZeroDec(),
Expand Down
2 changes: 1 addition & 1 deletion x/leveragelp/keeper/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ func (k Keeper) GetLeverageLpUpdatedLeverage(ctx sdk.Context, positions []*types
updatedLeveragePositions = append(updatedLeveragePositions, &types.QueryPosition{
Position: position,
UpdatedLeverage: updated_leverage,
PositionUsdValue: exitAmountAfterFee,
PositionUsdValue: sdk.NewDecFromIntWithPrec(exitAmountAfterFee, 6),
})
}
return updatedLeveragePositions, nil
Expand Down
24 changes: 12 additions & 12 deletions x/leveragelp/types/types.pb.go

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

0 comments on commit fe1f2c2

Please sign in to comment.