From f651d6d56b4e7cc706f43074baf598813eb28644 Mon Sep 17 00:00:00 2001 From: Mikhail Vazhnov Date: Thu, 29 Sep 2022 13:44:22 +0400 Subject: [PATCH] accounts/abi/bind: parse ABI only once on bind (#25574) * accounts/abi/bind: parse ABI once on bind * accounts/abi/bind: suppress 'imported and not used' error for abi package --- accounts/abi/bind/template.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/accounts/abi/bind/template.go b/accounts/abi/bind/template.go index c9b001133d..855c8ead87 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}} @@ -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