-
Notifications
You must be signed in to change notification settings - Fork 661
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
args in script? #1012
Comments
I also was looking for a way to do this. As far as I understand, now this can only be done using the
By default when you run a script, the To make it easier to obtain calldata, you can use another tool that comes with foundry - For example your deploy script has a function like this: function run(uint256 arg1, bool arg2) external { ... } To get calldata to run it, use the command: cast calldata "run(uint256,bool)" 1 true Now you can run your script like this: forge script scripts/DeployFromDeployer.s.sol:Deploy \
--fork-url ${RPC_URL} --broadcast -vvvv \
--sig 0x0a3395f500000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001 Can be combined into oneliner: forge script scripts/DeployFromDeployer.s.sol:Deploy \
--fork-url ${RPC_URL} --broadcast -vvvv \
--sig $(cast calldata "run(uint256,bool)" 1 true) |
I have a script like this:
can I pass --constructor-args in a script? Or any args at all? I couldn't find much about constructor args or passing args to scripts. I can read them from a file, although. But I would like to set them from the command line. Is this achievable?
I know that hardhat has this concept called tasks, which does pretty much what I'm defining: https://hardhat.org/hardhat-runner/docs/advanced/create-task#creating-a-task
The text was updated successfully, but these errors were encountered: