aboutsummaryrefslogtreecommitdiffstats
path: root/cmd
diff options
context:
space:
mode:
Diffstat (limited to 'cmd')
-rw-r--r--cmd/abigen/main.go7
1 files changed, 6 insertions, 1 deletions
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)