Skip to content

Commit

Permalink
some small fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
mikluke committed Jul 17, 2024
1 parent 124b7b0 commit e5db912
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 13 deletions.
1 change: 0 additions & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
linters:
enable:
- bodyclose
# - deadcode
- dogsled
# - dupl
- errcheck
Expand Down
4 changes: 3 additions & 1 deletion x/scorum/keeper/gas.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package keeper

import (
"slices"

"github.com/cosmos/cosmos-sdk/store/prefix"
sdk "github.com/cosmos/cosmos-sdk/types"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
Expand Down Expand Up @@ -74,7 +76,7 @@ func (k Keeper) GetAverageSPBalance(ctx sdk.Context) sdk.Dec {
supervisors := k.GetParams(ctx).Supervisors
total, size := sdk.ZeroDec(), int64(0)
k.bankKeeper.IterateAllBalances(ctx, func(addr sdk.AccAddress, coin sdk.Coin) (stop bool) {
if contains(supervisors, addr.String()) {
if slices.Contains(supervisors, addr.String()) {
return false
}

Expand Down
10 changes: 0 additions & 10 deletions x/scorum/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,3 @@ func (k Keeper) Burn(ctx sdk.Context, addr sdk.AccAddress, coin sdk.Coin) error

return nil
}

func contains[T comparable](s []T, v T) bool {
for i := range s {
if s[i] == v {
return true
}
}

return false
}
4 changes: 3 additions & 1 deletion x/scorum/keeper/params.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package keeper

import (
"slices"

sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/scorum/cosmos-network/x/scorum/types"
)
Expand All @@ -18,5 +20,5 @@ func (k Keeper) SetParams(ctx sdk.Context, params types.Params) {
}

func (k Keeper) IsSupervisor(ctx sdk.Context, addr string) bool {
return contains(k.GetParams(ctx).Supervisors, addr)
return slices.Contains(k.GetParams(ctx).Supervisors, addr)
}

0 comments on commit e5db912

Please sign in to comment.