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

Add --from option to vm.py, to generate Vm.sol from json file #619

Merged
merged 1 commit into from
Oct 7, 2024

Conversation

Tudmotu
Copy link
Contributor

@Tudmotu Tudmotu commented Oct 4, 2024

Defaults to "foundry-rs" and "master" respectively to maintain backwards-compatibility.

Added the --from option which lets you specify a local json file to generate Vm.sol from.

This PR uses argparse to implement the argument handling.

When running vm.py -h will display help information:
image

Running the script with no args should behave same as before.

@mds1
Copy link
Collaborator

mds1 commented Oct 4, 2024

Can you describe your use case for this? Also cc @DaniPopes who wrote the script originally

@mds1 mds1 requested a review from DaniPopes October 4, 2024 19:47
@DaniPopes
Copy link
Member

It would be much easier to have just one argument that's the path of cheatcodes.json

@Tudmotu
Copy link
Contributor Author

Tudmotu commented Oct 4, 2024

@mds1 yes, my use case is that I like to open the Foundry Book and Forge-Std PRs before the main PR on Foundry gets merged. The reason I do it like this is because I have very little time to actually write code so when I have the opportunity, I try to get everything done all at once.

This means that in order to update the Vm interface using vm.py, I need to manually edit the CHEATCODES_JSON_URL to point to my feature branch on my Foundry fork.

Adding these params lets me run e.g. ./scripts/vm.py tudmotu vm.mockCalls and it'll be updated based on my feature branch.

@Tudmotu
Copy link
Contributor Author

Tudmotu commented Oct 4, 2024

It would be much easier to have just one argument that's the path of cheatcodes.json

You mean provide the entire URL on the command line?

@DaniPopes
Copy link
Member

No, a path to a file, defaulting to fetching from the default source and keeping it in memory

@Tudmotu
Copy link
Contributor Author

Tudmotu commented Oct 4, 2024

No, a path to a file, defaulting to fetching from the default source and keeping it in memory

Oh, so for example vm.py --from /path/to/my/cheatcodes.json?

@mds1
Copy link
Collaborator

mds1 commented Oct 4, 2024

Thanks @DaniPopes

@Tudmotu I can review + merge once that change is made!

@Tudmotu Tudmotu changed the title Add [user] and [branch] args to vm.py Add --from option to vm.py, to generate Vm.sol from json file Oct 4, 2024
@Tudmotu
Copy link
Contributor Author

Tudmotu commented Oct 4, 2024

@mds1, @DaniPopes , updated the PR with the --from flag

@zerosnacks zerosnacks merged commit 035de35 into foundry-rs:master Oct 7, 2024
3 checks passed
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 this pull request may close these issues.

4 participants