diff --git a/x/bank/keeper/keeper.go b/x/bank/keeper/keeper.go index ba7ee06976e8..9b1d79c1091b 100644 --- a/x/bank/keeper/keeper.go +++ b/x/bank/keeper/keeper.go @@ -150,7 +150,7 @@ func (k BaseKeeper) DelegateCoins(ctx context.Context, delegatorAddr, moduleAccA if err != nil { return err } - if err := k.EventService.EventManager(ctx).EmitKV( + if err = k.EventService.EventManager(ctx).EmitKV( types.EventTypeCoinSpent, event.NewAttribute(types.AttributeKeySpender, delAddrStr), event.NewAttribute(sdk.AttributeKeyAmount, amt.String()), @@ -158,12 +158,7 @@ func (k BaseKeeper) DelegateCoins(ctx context.Context, delegatorAddr, moduleAccA return err } - err = k.addCoins(ctx, moduleAccAddr, amt) - if err != nil { - return err - } - - return nil + return k.addCoins(ctx, moduleAccAddr, amt) } // UndelegateCoins performs undelegation by crediting amt coins to an account with @@ -181,8 +176,7 @@ func (k BaseKeeper) UndelegateCoins(ctx context.Context, moduleAccAddr, delegato return errorsmod.Wrap(sdkerrors.ErrInvalidCoins, amt.String()) } - err := k.subUnlockedCoins(ctx, moduleAccAddr, amt) - if err != nil { + if err := k.subUnlockedCoins(ctx, moduleAccAddr, amt); err != nil { return err } @@ -190,12 +184,7 @@ func (k BaseKeeper) UndelegateCoins(ctx context.Context, moduleAccAddr, delegato return errorsmod.Wrap(err, "failed to track undelegation") } - err = k.addCoins(ctx, delegatorAddr, amt) - if err != nil { - return err - } - - return nil + return k.addCoins(ctx, delegatorAddr, amt) } // GetSupply retrieves the Supply from store