Skip to content

Commit

Permalink
refactor: fix linter errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Unique-Divine committed Dec 1, 2023
1 parent 5b6655a commit 9d8503a
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 11 deletions.
3 changes: 1 addition & 2 deletions x/perp/v2/integration/action/dnr.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
18 changes: 12 additions & 6 deletions x/perp/v2/keeper/admin_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
},
} {
Expand Down
1 change: 0 additions & 1 deletion x/perp/v2/keeper/msg_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
14 changes: 12 additions & 2 deletions x/perp/v2/keeper/msg_server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 9d8503a

Please sign in to comment.