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.
It will look through your broadcast
folder at your most recent deployment.
- git
- You'll know you did it right if you can run
git --version
and you see a response likegit version x.x.x
- You'll know you did it right if you can run
- foundry
- You'll know you did it right if you can run
forge --version
and you see a response likeforge 0.2.0 (816e00b 2023-03-16T00:05:26.396218Z)
- You'll know you did it right if you can run
- jq
- A lot already have it installed. Try it with
jq --version
and see a response likejq-1.6
- A lot already have it installed. Try it with
forge install Cyfrin/foundry-devops --no-commit
- Update your
foundry.toml
to have read permissions on thebroadcast
folder.
fs_permissions = [{ access = "read", path = "./broadcast" }]
- Import the package, and call
DevOpsTools.get_most_recent_deployment("MyContract", chainid);
ie:
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();
}
PRs are welcome!
git clone https://github.com/Cyfrin/foundry-devops
cd foundry-devops
forge install
forge test