Skip to content

Commit

Permalink
Simplify chain reader config validation
Browse files Browse the repository at this point in the history
  • Loading branch information
ilija42 committed Dec 6, 2023
1 parent 25c0f26 commit baa2373
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions core/services/relay/evm/chain_reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package evm
import (
"context"
"fmt"
"slices"
"strings"

"github.com/ethereum/go-ethereum/accounts/abi"
Expand Down Expand Up @@ -144,14 +145,7 @@ func validateMethods(abi abi.ABI, chainReaderDefinition types.ChainReaderDefinit

func areChainReaderArgumentsValid(contractArgs []abi.Argument, chainReaderArgs []string) bool {
for _, contractArg := range contractArgs {
found := false
for _, chArgName := range chainReaderArgs {
if chArgName == contractArg.Name {
found = true
break
}
}
if !found {
if !slices.Contains(chainReaderArgs, contractArg.Name) {
return false
}
}
Expand Down

0 comments on commit baa2373

Please sign in to comment.