githubEdit

codeUseful Commands

weight-hangingAnvilchevron-rightwand-magic-sparklesCastchevron-rightfire-flame-curvedForgechevron-right

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>
forge install Cyfrin/foundry-devops --no-commit
import {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