Skip to content

Commit

Permalink
accounts/abi/bind: parse ABI only once on bind (ethereum#25574)
Browse files Browse the repository at this point in the history
* accounts/abi/bind: parse ABI once on bind

* accounts/abi/bind: suppress 'imported and not used' error for abi package
  • Loading branch information
mikhailv authored and shekhirin committed Jun 6, 2023
1 parent 5ac3442 commit 17452e2
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions accounts/abi/bind/template.go
Expand Up @@ -110,6 +110,7 @@ var (
_ = common.Big1
_ = types.BloomLookup
_ = event.NewSubscription
_ = abi.ConvertType
)
{{$structs := .Structs}}
Expand Down Expand Up @@ -268,11 +269,11 @@ var (
// bind{{.Type}} binds a generic wrapper to an already deployed contract.
func bind{{.Type}}(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) {
parsed, err := abi.JSON(strings.NewReader({{.Type}}ABI))
parsed, err := {{.Type}}MetaData.GetAbi()
if err != nil {
return nil, err
}
return bind.NewBoundContract(address, parsed, caller, transactor, filterer), nil
return bind.NewBoundContract(address, *parsed, caller, transactor, filterer), nil
}
// Call invokes the (constant) contract method with params as input values and
Expand Down

0 comments on commit 17452e2

Please sign in to comment.