Skip to content
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

abigen support for solc flags and/or stdin reading #16518

Closed
Shadowfiend opened this issue Apr 17, 2018 · 1 comment · Fixed by #16683
Closed

abigen support for solc flags and/or stdin reading #16518

Shadowfiend opened this issue Apr 17, 2018 · 1 comment · Fixed by #16683

Comments

@Shadowfiend
Copy link
Contributor

We are trying to set up a go:generate call to generate our Go interfaces from our Solidity files. Unfortunately, abigen seems to be unable to support imports with the same diversity as solc or truffle. For example, our code imports code from a third-party library that is pulled in via npm. Truffle handles this relatively transparently. For solc, we can deal with the situation by mapping the import path to the node_modules import path and then specifying --allow-paths appropriately. Unfortunately, there's no way to ask abigen to pass any flags to solc when invoking it with a Solidity file, and abigen doesn't have first-class support for --allow-paths or import path mapping.

My next attempt was to pipe the output of solc to abigen. Unfortunately, there doesn't seem to be a way to ask abigen to read its contents from stdin.

It's not immediately obvious if one or the other (passing flags to solc or reading from stdin) would be preferable. stdin is probably most easily supported, by allowing --abi - to be interpreted as reading the ABI from standard input, a fairly common idiom.

I'm willing to put in some legwork and issue a PR here if either or both of these are acceptable ideas.

Thanks for all the tooling!

System information

Geth version: 1.8.1-stable
OS & Version: macOS

@pschlump
Copy link
Contributor

pschlump commented Apr 17, 2018

There needs to be a way to specify a "PATH" with multiple components. This is like "bash" or "sh" PATH that will be searched for files. To get both truffle and solc and abigen to work together seems at present to require copying of an entire library from node_modules/zepplin-* to the ./contracts directory. I think that a copy like this is a bad thing. abigen and solc need to be able to search for the files. Also solcjs seems to work differently with relative paths.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants