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

feat: allow passing in the source file as a parameter #214

Open
0xPhaze opened this issue Mar 7, 2023 · 2 comments
Open

feat: allow passing in the source file as a parameter #214

0xPhaze opened this issue Mar 7, 2023 · 2 comments

Comments

@0xPhaze
Copy link

0xPhaze commented Mar 7, 2023

It would be nice to simply allow to pass in the path to a source file, e.g. hevm exec --contract Contract.sol:Contract which would recompile the source if outdated.
Currently I'm using the workaround hevm exec --code $(solc --bin-runtime src/Contract.sol | grep '^60\S*' -m 1), which could be made more robust (and currently isn't looking for a specific contract to compile).

@d-xo
Copy link
Collaborator

d-xo commented Mar 13, 2023

hm, yeah this could be a nice ux, I guess theres a few feature requests here:

  1. making hevm exec aware of some project structure
  2. being able to refer to artifacts from a solc output file by name
  3. automatically calling the project build tool before running a contract

I think it would change the character of the exec subcommand a little, which up until now has been more of a one shot tool for ad hoc analysis, and the unit testing interface under dapp-test has been used for more structured work in an existing project, but it seems doable without breaking existing workflows. I would be open to merging if someone wants to do the work and make a PR.

@d-xo
Copy link
Collaborator

d-xo commented Mar 13, 2023

A simpler (and probably nicer) version would be to call solc on the given contract filename and parse the resulting output json directly. We could add a cli arg to allow users to choose a solc version, and perhaps respect any discovered remappings.txt files?

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

No branches or pull requests

2 participants