-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
feat: cheatcode to get recent deployments by contract name #4732
Comments
Would be cool to also add something like
and it runs through a deploy script when you start up anvil. Much easier than having to roll your own |
I'm not sure if we have an issue for this, but a related idea I've had was: when running a forge script, if the RPC URL is localhost, instead of treating cheatcode calls like normal (i.e. they won't work, since they're forge vm specific) automatically change them to be the special RPC calls to the anvil node |
As mentioned in this twitter thread: https://twitter.com/jj_ranalli/status/1656384664020434949 It would be nice to be able to pull in known deployments, as contract instances, from dependencies so we can easily interact with them in scripts. For example, assuming we have run import "forge-std/Script.sol";
import {Deployments} from "somecoin/deployed/1/Deployments.sol";
contract MyScript is Script {
function run() public {
vm.startBroadcast(me);
Deployments.somecoin.transfer(to, 1 ether);
vm.stopBroadcast();
}
} or maybe this is better? import "forge-std/Script.sol";
import {Deployments} from "somecoin/deployed/1/Deployments.sol";
contract MyScript is Script, Deployments {
function run() public {
vm.startBroadcast(me);
somecoin.transfer(to, 1 ether);
vm.stopBroadcast();
}
} My proposal would be that we add a new command e.g. Regardless, this command would create a file such as Happy to hear thoughts on this as an alternative to this design, or as a separate feature completely (because I also like the general idea here from @mds1). |
That's also a nice UX, I. like the idea. It does feel like being able to pull in deployments/ABIs from dependencies like that is very related to package management ideas that @fubuloubu and @brockelmore have discussed (which I'm not too familiar with, so I have no summary or other info to share) |
Chiming in here to add some thoughts on @devanoneth suggestion, originally shared in the twitter post. I think it would be desirable to have deployments auto-generation:
I also like @mds1 proposed feature btw. Would be nice to have both, as they can be useful in different circumstances. |
I feel like #3911 is too big an issue to ever be completed. But adding at least the API suggested above would allow users or foundary to iterate on solutions, solutions that could therefor be used as a specification to finish #3911 AFAICT it would also need a |
If it still makes sense to introduce this change maybe I can take on a challenge. Seems like a useful util to improve scripts UX |
Component
Forge
Describe the feature you would like
Add new methods that parse JSON files in the
broadcast
folder to find contract addresses.cc @PatrickAlphaC @karmacoma-eth for thoughts on syntax/UX/cheat names/etc
Additional context
No response
The text was updated successfully, but these errors were encountered: