foundry
foundry copied to clipboard
Forge Scripts mnemonic-path flag not working as intended
Component
Forge
Have you ensured that all of these are up to date?
- [x] Foundry
- [X] Foundryup
What version of Foundry are you on?
forge 0.2.0 (b192af4 2022-05-30T00:08:26.00382Z)
What command(s) is the bug in?
forge script $FILE --rpc $RPC --mnemonic-path $PATH
Operating System
macOS (Apple Silicon)
Describe the bug
There are two issues, first one is the: documentation says --mnemonic-path but CLI requests --mnemonic-paths. Also doesn't matter the path I put I'm not getting on the script a different msg.sender (tested with --private-key and it does change)
cc @joshieDo
you can still manually set the sender with --sender ADDRESS
I'm still thinking about the best way to check for the presence of one
wallet in the beginning of the process, that sets the sender
by default. That's why it only exists for --private-key
@joshieDo do you mean that we cant have a script
- run forge scripts
- load a seed phrase from mnemonic path
- run script based on that mnemonic and index?
No, no I don't. You can have all that, given that you have the addresses of each path.
If you want to explicitly specify an account which would be the msg.sender
during the script, then you can pass --sender ADDRESS
. This address will now be the msg.sender
, the deployer of any necessary libraries and the address to be used on startBroadcast()
and broadcast()
.
If during the script you want to use other address to broadcast a tx other than msg.sender
, then you can always pass it as broadcast(adddress)
and startBroadcast(address)
As always, make sure not to test it in prod, and have some asserts
and requires
during the script, just to make sure everything is happening as you expect!
@joshieDo is there a clear to do here?
I'm not clear on if there's any todo's here. There's also now the deriveKey
and rememberKey
cheats that provide another way to use mnemonics, so going to close this. Happy to reopen if there's some action/bug here