Skip to content

Commit 8a65262

Browse files
committed
add back code that got mistakenly removed in the rebase
1 parent c6f7571 commit 8a65262

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

accounts/abi/bind/bind.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,14 @@ func bind(types []string, abis []string, bytecodes []string, fsigs []map[string]
266266

267267
// Ensure there is no duplicated identifier
268268
normalizedName := methodNormalizer(alias(aliases, original.Name))
269+
// Name shouldn't start with a digit. It will make the generated code invalid.
270+
if len(normalizedName) > 0 && unicode.IsDigit(rune(normalizedName[0])) {
271+
normalizedName = fmt.Sprintf("E%s", normalizedName)
272+
normalizedName = abi.ResolveNameConflict(normalizedName, func(name string) bool {
273+
_, ok := eventIdentifiers[name]
274+
return ok
275+
})
276+
}
269277
if eventIdentifiers[normalizedName] {
270278
return nil, fmt.Errorf("duplicated identifier \"%s\"(normalized \"%s\"), use --alias for renaming", original.Name, normalizedName)
271279
}

0 commit comments

Comments
 (0)