Skip to content

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

@Shadowfiend

Description

@Shadowfiend

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions