Useful Commands
AnvilCastForge
Run Scripts
forge build
forge script script/<SCRIPT>:<CONTRACT_NAME> --rpc-url http://<RPC_URL>
forge script script/<SCRIPT>:<CONTRACT_NAME> --fork-url http://<RPC_URL>Foundry DevOps
A repo to get the most recent deployment from a given environment in Foundry. This way, you can do scripting off previous deployments in solidity.
forge install Cyfrin/foundry-devops --no-commitimport {DevOpsTools} from "lib/foundry-devops/src/DevOpsTools.sol";
import {MyContract} from "my-contract/MyContract.sol";
function interactWithPreviouslyDeployedContracts() public {
address contractAddress = DevOpsTools.get_most_recent_deployment("MyContract", block.chainid);
MyContract myContract = MyContract(contractAddress);
myContract.doSomething();
}Makefile
@stops the command being printed out to the command line which is useful when you don't want sensitive info to be printed e.g. private keys.
Last updated