-
Notifications
You must be signed in to change notification settings - Fork 20.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
accounts/abi/bind: link dependent libs in deploy #19718
Conversation
@ligi could you please have a look at the java code being generated? |
Didn't mean to close this 🤦♂️ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM (haven't tested)
f60e9c9
to
6268729
Compare
6268729
to
1ee8697
Compare
A few changes I made diff --git a/cmd/abigen/main.go b/cmd/abigen/main.go
index 16cb0df08..ab70b6f46 100644
--- a/cmd/abigen/main.go
+++ b/cmd/abigen/main.go
@@ -22,6 +22,7 @@ import (
"fmt"
"io/ioutil"
"os"
"strings"
"github.com/ethereum/go-ethereum/accounts/abi/bind"
@@ -82,7 +83,7 @@ func main() {
bins []string
types []string
sigs []map[string]string
- libs map[string]string
+ libs = make(map[string]string)
)
if *solFlag != "" || *vyFlag != "" || *abiFlag == "-" {
// Generate the list of types to exclude from binding
@@ -151,7 +152,19 @@ func main() {
os.Exit(-1)
}
} But we can't get the library bin from the input, how can we deploy the library first? |
The golang part is good to me. But I try the java binding, get these errors
Error: can't resolve method should be And also if we have multi contracts(e.g. contract + library), we will have 2 java public classes which can't be defined in single java class file. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
This PR addresses #17010
Upon loading the
solc
output,abigen
will make a list of potential "linker" references to pass the template. If a linker reference is found, a call to the library deployment code will be added to the contact deployment code, and the bytecode will be updated with the deployment address.I also had to change the way bind was being tested: now the test has to specify all dependent ABIs and bytecodes, as well as the list of contract dependencies. Basically, this assumes an input a bit closer to what
abigen
provides to theBind
function.