Skip to content

Commit

Permalink
accounts/abi: eplace strings.Replace with string.ReplaceAll (ethereum…
Browse files Browse the repository at this point in the history
  • Loading branch information
gzliudan committed Jan 10, 2025
1 parent feb8c17 commit 48e5623
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion accounts/abi/bind/bind.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ func Bind(types []string, abis []string, bytecodes []string, fsigs []map[string]

contracts[types[i]] = &tmplContract{
Type: capitalise(types[i]),
InputABI: strings.Replace(strippedABI, "\"", "\\\"", -1),
InputABI: strings.ReplaceAll(strippedABI, "\"", "\\\""),
InputBin: strings.TrimPrefix(strings.TrimSpace(bytecodes[i]), "0x"),
Constructor: evmABI.Constructor,
Calls: calls,
Expand Down
2 changes: 1 addition & 1 deletion accounts/abi/bind/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ var (
}
{{range $pattern, $name := .Libraries}}
{{decapitalise $name}}Addr, _, _, _ := Deploy{{capitalise $name}}(auth, backend)
{{$contract.Type}}Bin = strings.Replace({{$contract.Type}}Bin, "__${{$pattern}}$__", {{decapitalise $name}}Addr.String()[2:], -1)
{{$contract.Type}}Bin = strings.ReplaceAll({{$contract.Type}}Bin, "__${{$pattern}}$__", {{decapitalise $name}}Addr.String()[2:])
{{end}}
address, tx, contract, err := bind.DeployContract(auth, *parsed, common.FromHex({{.Type}}Bin), backend {{range .Constructor.Inputs}}, {{.Name}}{{end}})
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion accounts/abi/type.go
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ func NewType(t string, internalType string, components []ArgumentMarshaling) (ty
if internalType != "" && strings.HasPrefix(internalType, structPrefix) {
// Foo.Bar type definition is not allowed in golang,
// convert the format to FooBar
typ.TupleRawName = strings.Replace(internalType[len(structPrefix):], ".", "", -1)
typ.TupleRawName = strings.ReplaceAll(internalType[len(structPrefix):], ".", "")
}

case "function":
Expand Down

0 comments on commit 48e5623

Please sign in to comment.