How can I pass data while calling forge script? #2456
Unanswered
CaledoniaProject
asked this question in
Help
Replies: 2 comments 1 reply
-
I am currently using environment variables for this, but it's kind of ugly: address owner = vm.envAddress("OWNER");
uint256 pk = vm.envOr("DEPLOYER_PRIVATE_KEY", uint256(0));
pk == 0 ? vm.startBroadcast() : vm.startBroadcast(pk);
/// … The |
Beta Was this translation helpful? Give feedback.
0 replies
-
You can do this similar to how to you'd pass arguments to contract MyScript is Script {
function setUp() public {}
function run(uint256 x) public {
console2.log(x);
}
} Then invoke with |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I'm trying to invoke the
run()
method and pass a parameter, how can I do that? From the document the default method isrun()
but it doesn't tell me how to pass a parameter.Here's the test contract:
Beta Was this translation helpful? Give feedback.
All reactions