diff --git a/x/perp/v2/integration/action/dnr.go b/x/perp/v2/integration/action/dnr.go index 110c4779e..9c5b69a54 100644 --- a/x/perp/v2/integration/action/dnr.go +++ b/x/perp/v2/integration/action/dnr.go @@ -236,8 +236,7 @@ func FundDnREpoch(amt sdk.Coins) action.Action { return fundDnREpoch{amt} } -type startNewDnRepochAction struct { -} +type startNewDnRepochAction struct{} func (s startNewDnRepochAction) Do(app *app.NibiruApp, ctx sdk.Context) (outCtx sdk.Context, err error, isMandatory bool) { currentEpoch, err := app.PerpKeeperV2.DnREpoch.Get(ctx) diff --git a/x/perp/v2/keeper/admin_test.go b/x/perp/v2/keeper/admin_test.go index 5e8d66e25..8b08ced29 100644 --- a/x/perp/v2/keeper/admin_test.go +++ b/x/perp/v2/keeper/admin_test.go @@ -296,28 +296,34 @@ func TestAdmin_ChangeCollateralDenom(t *testing.T) { }{ {name: "happy: normal denom", newDenom: "nusd", sender: adminSender, wantErr: ""}, - {name: "happy: token factory denom", + { + name: "happy: token factory denom", newDenom: tftypes.TFDenom{ Creator: testutil.AccAddress().String(), Subdenom: "nusd", - }.String(), sender: adminSender, wantErr: ""}, + }.String(), sender: adminSender, wantErr: "", + }, - {name: "happy: token factory denom", + { + name: "happy: token factory denom", newDenom: tftypes.TFDenom{ Creator: testutil.AccAddress().String(), Subdenom: "nusd", }.String(), sender: adminSender, wantErr: "", }, - {name: "happy: IBC denom", + { + name: "happy: IBC denom", newDenom: "ibc/46B44899322F3CD854D2D46DEEF881958467CDD4B3B10086DA49296BBED94BED", // JUNO on Osmosis sender: adminSender, wantErr: "", }, - {name: "sad: invalid denom", + { + name: "sad: invalid denom", newDenom: "", sender: adminSender, wantErr: types.ErrInvalidCollateral.Error(), }, - {name: "sad: sender not in sudoers", + { + name: "sad: sender not in sudoers", newDenom: "nusd", sender: nonAdminSender, wantErr: "insufficient permissions on smart contract", }, } { diff --git a/x/perp/v2/keeper/msg_server.go b/x/perp/v2/keeper/msg_server.go index 133275bf8..3274c3752 100644 --- a/x/perp/v2/keeper/msg_server.go +++ b/x/perp/v2/keeper/msg_server.go @@ -113,7 +113,6 @@ func (m msgServer) SettlePosition(ctx context.Context, msg *types.MsgSettlePosit // These fields should have already been validated by MsgSettlePosition.ValidateBasic() prior to being sent to the msgServer. traderAddr := sdk.MustAccAddressFromBech32(msg.Sender) resp, err := m.k.SettlePosition(sdk.UnwrapSDKContext(ctx), msg.Pair, msg.Version, traderAddr) - if err != nil { return nil, err } diff --git a/x/perp/v2/keeper/msg_server_test.go b/x/perp/v2/keeper/msg_server_test.go index e76c0a3b7..c13baad28 100644 --- a/x/perp/v2/keeper/msg_server_test.go +++ b/x/perp/v2/keeper/msg_server_test.go @@ -366,6 +366,7 @@ func TestFailMsgServer(t *testing.T) { }) require.ErrorContains(t, err, "spendable balance is smaller than 1luna") } + func TestMsgChangeCollateralDenom(t *testing.T) { app, ctx := testapp.NewNibiruTestAppAndContext() @@ -460,8 +461,17 @@ func TestAllocateEpochRebates(t *testing.T) { }) require.ErrorContains(t, err, "insufficient funds") - app.BankKeeper.MintCoins(ctx, inflationtypes.ModuleName, sdk.NewCoins(sdk.NewCoin("unibi", sdk.NewInt(100)))) - app.BankKeeper.SendCoinsFromModuleToAccount(ctx, inflationtypes.ModuleName, sdk.MustAccAddressFromBech32(sender), sdk.NewCoins(sdk.NewCoin("unibi", sdk.NewInt(100)))) + require.NoError(t, + app.BankKeeper.MintCoins(ctx, + inflationtypes.ModuleName, + sdk.NewCoins(sdk.NewCoin("unibi", sdk.NewInt(100))), + ), + ) + require.NoError(t, + app.BankKeeper.SendCoinsFromModuleToAccount(ctx, + inflationtypes.ModuleName, sdk.MustAccAddressFromBech32(sender), + sdk.NewCoins(sdk.NewCoin("unibi", sdk.NewInt(100)))), + ) _, err = msgServer.AllocateEpochRebates(ctx, &types.MsgAllocateEpochRebates{ Sender: sender,