Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
toteki committed Sep 25, 2023
1 parent 85177c7 commit c2acb9a
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 8 deletions.
2 changes: 1 addition & 1 deletion x/leverage/client/cli/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -392,4 +392,4 @@ func QueryInspectAccount() *cobra.Command {
flags.AddQueryFlagsToCmd(cmd)

return cmd
}
}
9 changes: 6 additions & 3 deletions x/leverage/client/tests/tests.go
Original file line number Diff line number Diff line change
Expand Up @@ -328,11 +328,14 @@ func (s *IntegrationTests) TestLeverageScenario() {
// app/test_helpers.go/IntegrationTestNetworkConfig
// times the amount of umee, and then times params
// (1001 / 1000000) * 34.21 = 0.03424421
SuppliedValue: sdk.MustNewDecFromStr("0.03424421"),
SuppliedValue: sdk.MustNewDecFromStr("0.03424421"),
SpotSuppliedValue: sdk.MustNewDecFromStr("0.03424421"),
// (1001 / 1000000) * 34.21 = 0.03424421
CollateralValue: sdk.MustNewDecFromStr("0.03424421"),
CollateralValue: sdk.MustNewDecFromStr("0.03424421"),
SpotCollateralValue: sdk.MustNewDecFromStr("0.03424421"),
// (251 / 1000000) * 34.21 = 0.00858671
BorrowedValue: sdk.MustNewDecFromStr("0.00858671"),
BorrowedValue: sdk.MustNewDecFromStr("0.00858671"),
SpotBorrowedValue: sdk.MustNewDecFromStr("0.00858671"),
// (1001 / 1000000) * 34.21 * 0.25 = 0.0085610525
BorrowLimit: sdk.MustNewDecFromStr("0.0085610525"),
// (1001 / 1000000) * 0.26 * 34.21 = 0.008903494600000000
Expand Down
2 changes: 1 addition & 1 deletion x/leverage/keeper/grpc_query.go
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ func (q Querier) AccountSummary(
}

resp := &types.QueryAccountSummaryResponse{
SuppliedValue: suppliedValue,
SuppliedValue: suppliedValue,
SpotSuppliedValue: spotSuppliedValue,
SpotCollateralValue: spotCollateralValue,
SpotBorrowedValue: spotBorrowedValue,
Expand Down
9 changes: 6 additions & 3 deletions x/leverage/keeper/grpc_query_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,11 +141,14 @@ func (s *IntegrationTestSuite) TestQuerier_AccountSummary() {
// times the amount of umee, then sometimes times params
// from newToken in x/leverage/keeper/keeper_test.go
// (1000) * 4.21 = 4210
SuppliedValue: sdk.MustNewDecFromStr("4210"),
SuppliedValue: sdk.MustNewDecFromStr("4210"),
SpotSuppliedValue: sdk.MustNewDecFromStr("4210"),
// (1000) * 4.21 = 4210
CollateralValue: sdk.MustNewDecFromStr("4210"),
CollateralValue: sdk.MustNewDecFromStr("4210"),
SpotCollateralValue: sdk.MustNewDecFromStr("4210"),
// Nothing borrowed
BorrowedValue: sdk.ZeroDec(),
BorrowedValue: sdk.ZeroDec(),
SpotBorrowedValue: sdk.ZeroDec(),
// (1000) * 4.21 * 0.25 = 1052.5
BorrowLimit: sdk.MustNewDecFromStr("1052.5"),
// (1000) * 4.21 * 0.26 = 1094.6
Expand Down

0 comments on commit c2acb9a

Please sign in to comment.