diff --git a/bindings/encoding/custom_error.go b/bindings/encoding/custom_error.go index 51ef8a02f..d01173ebf 100644 --- a/bindings/encoding/custom_error.go +++ b/bindings/encoding/custom_error.go @@ -2,6 +2,7 @@ package encoding import ( "errors" + "github.com/ethereum/go-ethereum/common" "strings" ) @@ -22,7 +23,8 @@ func TryParsingCustomError(originalError error) error { for _, customErrors := range customErrorMaps { for _, customError := range customErrors { - if strings.HasPrefix(customError.ID.Hex(), errData) || strings.Contains(errData, customError.Name) { + if strings.Contains(errData, common.Bytes2Hex(customError.ID[:4])) || + strings.Contains(errData, customError.Name) { return errors.New(customError.Name) } }