Skip to content

Commit

Permalink
changelog + address PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Unique-Divine committed Dec 3, 2023
1 parent 0f13580 commit 5ad427d
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

#### Dapp modules: perp, spot, etc.

* [#1687](https://github.com/NibiruChain/nibiru/pull/1687) - chore(wasmbinding): delete CustomQuerier since we have QueryRequest::Stargate now
* [#1686](https://github.com/NibiruChain/nibiru/pull/1686) - test(perp): add more tests for perp module msg server for DnR
* [#1683](https://github.com/NibiruChain/nibiru/pull/1683) - feat(perp): Add `StartDnREpoch` to `AfterEpochEnd` hook
* [#1680](https://github.com/NibiruChain/nibiru/pull/1680) - feat(perp): MsgShiftPegMultiplier, MsgShiftSwapInvariant.
Expand Down
4 changes: 3 additions & 1 deletion x/perp/v2/keeper/amm.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ func (k Keeper) handleMarketUpdateCost(
return costPaid, err

Check warning on line 19 in x/perp/v2/keeper/amm.go

View check run for this annotation

Codecov / codecov/patch

x/perp/v2/keeper/amm.go#L19

Added line #L19 was not covered by tests
}

if costAmt.IsPositive() {
if costAmt.IsZero() {
costPaid = sdk.NewCoin(collateral, costAmt)
} else if costAmt.IsPositive() {
// Positive cost, send from perp EF to vault
cost := sdk.NewCoins(
sdk.NewCoin(collateral, costAmt),
Expand Down
18 changes: 14 additions & 4 deletions x/perp/v2/types/msgs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ func TestMsgValidateBasic(t *testing.T) {
msg: &MsgShiftPegMultiplier{
Sender: validSender,
Pair: asset.Pair("not_a_pair"),
NewPegMult: sdk.NewDec(420),
NewPegMult: sdk.NewDec(420), // valid positive value, unused
},
expectErr: true,
expectedError: asset.ErrInvalidTokenPair.Error(),
Expand All @@ -387,7 +387,7 @@ func TestMsgValidateBasic(t *testing.T) {
msg: &MsgShiftPegMultiplier{
Sender: validSender,
Pair: asset.Pair("valid:pair"),
NewPegMult: sdk.NewDec(-420),
NewPegMult: sdk.NewDec(-420), // invalid nonpositive
},
expectErr: true,
expectedError: ErrNonPositivePegMultiplier.Error(),
Expand All @@ -398,7 +398,7 @@ func TestMsgValidateBasic(t *testing.T) {
msg: &MsgShiftSwapInvariant{
Sender: validSender,
Pair: asset.Pair("not_a_pair"),
NewSwapInvariant: sdk.NewInt(420),
NewSwapInvariant: sdk.NewInt(420), // valid positive
},
expectErr: true,
expectedError: asset.ErrInvalidTokenPair.Error(),
Expand All @@ -408,7 +408,17 @@ func TestMsgValidateBasic(t *testing.T) {
msg: &MsgShiftSwapInvariant{
Sender: validSender,
Pair: asset.Pair("valid:pair"),
NewSwapInvariant: sdk.NewInt(-420),
NewSwapInvariant: sdk.NewInt(-420), // invalid nonpositive
},
expectErr: true,
expectedError: ErrNonPositiveSwapInvariant.Error(),
},
{
name: "MsgShiftSwapInvariant: nonpositive swap invariant",
msg: &MsgShiftSwapInvariant{
Sender: validSender,
Pair: asset.Pair("valid:pair"),
NewSwapInvariant: sdk.ZeroInt(), // invalid nonpositive
},
expectErr: true,
expectedError: ErrNonPositiveSwapInvariant.Error(),
Expand Down

0 comments on commit 5ad427d

Please sign in to comment.