From 5bc9ccfa0af6e2892c1f40689dfb90a056ba81d6 Mon Sep 17 00:00:00 2001 From: Guillaume Ballet Date: Mon, 8 Jul 2019 10:27:05 +0200 Subject: accounts/abi/bind: link dependent libs in deploy (#19718) * accounts, abigen: link dependent libs in deploy * abigen: add java generation * bind: Fix unit tests * abigen: add unit test * Fix CI * Post-rebase fixes * Fix rebase issue * accounts/abi: Gary's review feedback * accounts/abi: More Gary feedback * accounts/abi: minor fixes --- cmd/abigen/main.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'cmd') diff --git a/cmd/abigen/main.go b/cmd/abigen/main.go index f9e048623..aaf2f9fa8 100644 --- a/cmd/abigen/main.go +++ b/cmd/abigen/main.go @@ -26,6 +26,7 @@ import ( "github.com/ethereum/go-ethereum/accounts/abi/bind" "github.com/ethereum/go-ethereum/common/compiler" + "github.com/ethereum/go-ethereum/crypto" ) var ( @@ -81,6 +82,7 @@ func main() { bins []string types []string sigs []map[string]string + libs = make(map[string]string) ) if *solFlag != "" || *vyFlag != "" || *abiFlag == "-" { // Generate the list of types to exclude from binding @@ -128,6 +130,9 @@ func main() { nameParts := strings.Split(name, ":") types = append(types, nameParts[len(nameParts)-1]) + + libPattern := crypto.Keccak256Hash([]byte(name)).String()[2:36] + libs[libPattern] = nameParts[len(nameParts)-1] } } else { // Otherwise load up the ABI, optional bytecode and type name from the parameters @@ -155,7 +160,7 @@ func main() { types = append(types, kind) } // Generate the contract binding - code, err := bind.Bind(types, abis, bins, sigs, *pkgFlag, lang) + code, err := bind.Bind(types, abis, bins, sigs, *pkgFlag, lang, libs) if err != nil { fmt.Printf("Failed to generate ABI binding: %v\n", err) os.Exit(-1) -- cgit v1.2.3