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
This commit is contained in:
Guillaume Ballet
2019-07-08 10:27:05 +02:00
committed by GitHub
parent f2eb3b1c56
commit 5bc9ccfa0a
4 changed files with 224 additions and 61 deletions

View File

@ -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)