From 20ae5d5ff78e00fa0f9161c289e97b754f09fab2 Mon Sep 17 00:00:00 2001 From: Mikhail Vazhnov Date: Tue, 23 Aug 2022 01:11:29 +0300 Subject: [PATCH 1/2] accounts/abi/bind: parse ABI once on bind --- accounts/abi/bind/template.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/accounts/abi/bind/template.go b/accounts/abi/bind/template.go index c9b001133dd..a063231c8c4 100644 --- a/accounts/abi/bind/template.go +++ b/accounts/abi/bind/template.go @@ -268,11 +268,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 From 5ab773ee3ed64ff2854951204556ade46bbd5e19 Mon Sep 17 00:00:00 2001 From: Mikhail Vazhnov Date: Tue, 23 Aug 2022 02:15:15 +0300 Subject: [PATCH 2/2] accounts/abi/bind: suppress 'imported and not used' error for abi package --- accounts/abi/bind/template.go | 1 + 1 file changed, 1 insertion(+) diff --git a/accounts/abi/bind/template.go b/accounts/abi/bind/template.go index a063231c8c4..855c8ead87c 100644 --- a/accounts/abi/bind/template.go +++ b/accounts/abi/bind/template.go @@ -110,6 +110,7 @@ var ( _ = common.Big1 _ = types.BloomLookup _ = event.NewSubscription + _ = abi.ConvertType ) {{$structs := .Structs}}