Skip to content

Commit f651d6d

Browse files
authored
accounts/abi/bind: parse ABI only once on bind (ethereum#25574)
* accounts/abi/bind: parse ABI once on bind * accounts/abi/bind: suppress 'imported and not used' error for abi package
1 parent ff1f492 commit f651d6d

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

accounts/abi/bind/template.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ var (
110110
_ = common.Big1
111111
_ = types.BloomLookup
112112
_ = event.NewSubscription
113+
_ = abi.ConvertType
113114
)
114115
115116
{{$structs := .Structs}}
@@ -268,11 +269,11 @@ var (
268269
269270
// bind{{.Type}} binds a generic wrapper to an already deployed contract.
270271
func bind{{.Type}}(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) {
271-
parsed, err := abi.JSON(strings.NewReader({{.Type}}ABI))
272+
parsed, err := {{.Type}}MetaData.GetAbi()
272273
if err != nil {
273274
return nil, err
274275
}
275-
return bind.NewBoundContract(address, parsed, caller, transactor, filterer), nil
276+
return bind.NewBoundContract(address, *parsed, caller, transactor, filterer), nil
276277
}
277278
278279
// Call invokes the (constant) contract method with params as input values and

0 commit comments

Comments
 (0)