-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
feature(cheatcode): vm.predictContractAddr()
; pre-determine next deployed addresses
#6270
Comments
vm.predictContractAddr()
cheatcode; pre-determine next deployed addressesvm.predictContractAddr()
; pre-determine next deployed addresses
sgtm, we can do the same for create2 with salt. |
Hi, I would like to try implement this! Any hint on which category I should put this cheatcode under? |
Thanks @qiweiii, I’ll assign you We should match the function names and signatures of the forge-std methods that do this: https://github.com/foundry-rs/forge-std/blob/37a37ab73364d6644bfe11edf88a07880f99bd56/src/StdUtils.sol#L97-L134 Additionally, we should PR in a warning event emission to the existing forge-std methods that they’re deprecated in favor of the native cheats |
There is one more task to do😅
Does this mean do something like this? https://github.com/foundry-rs/forge-std/blob/37a37ab73364d6644bfe11edf88a07880f99bd56/src/StdCheats.sol#L700 |
Yes, just like that! So the forge-std PR will need that change + an update to |
Component
Forge
Describe the feature you would like
Would be useful to have a cheatcode that can pre-compute future contract deployment addresses based on deployer address and nonce:
Frequently run into use-cases where the contract ordering is dependent and I need to serialize some address/call for a future-deployed contract.
Additional context
Today, I just copy-paste @k06a's handy
addressFrom
function into a test-suite library.The text was updated successfully, but these errors were encountered: