{"id":25304585,"url":"https://github.com/anuragshingare30/foundry-devops","last_synced_at":"2025-04-07T03:55:28.161Z","repository":{"id":269926885,"uuid":"908547714","full_name":"anuragShingare30/Foundry-Devops","owner":"anuragShingare30","description":"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.","archived":false,"fork":false,"pushed_at":"2024-12-27T07:23:30.000Z","size":3,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-13T08:42:35.592Z","etag":null,"topics":["devops","ethereum-blockchain","foundry","solidity"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/anuragShingare30.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-12-26T10:41:34.000Z","updated_at":"2025-01-19T10:01:56.000Z","dependencies_parsed_at":"2024-12-27T08:27:06.748Z","dependency_job_id":"74ecca5d-6243-43b2-8135-6ad933014fe1","html_url":"https://github.com/anuragShingare30/Foundry-Devops","commit_stats":null,"previous_names":["anuragshingare30/foundry-devops"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anuragShingare30%2FFoundry-Devops","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anuragShingare30%2FFoundry-Devops/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anuragShingare30%2FFoundry-Devops/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anuragShingare30%2FFoundry-Devops/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/anuragShingare30","download_url":"https://codeload.github.com/anuragShingare30/Foundry-Devops/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247589832,"owners_count":20963022,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["devops","ethereum-blockchain","foundry","solidity"],"created_at":"2025-02-13T08:29:54.373Z","updated_at":"2025-04-07T03:55:28.136Z","avatar_url":"https://github.com/anuragShingare30.png","language":null,"readme":"# foundry-devops\n\nA repo to get the most recent deployment from a given environment in foundry. This way, you can do scripting off previous deployments in solidity.\n\nIt will look through your `broadcast` folder at your most recent deployment.\n\n## Features\n- Get the most recent deployment of a contract in foundry\n- Checking if you're on a zkSync based chain\n\n\n# Getting Started\n\n\n## Installation\n\n```bash\nforge install Cyfrin/foundry-devops --no-commit\n```\n\n- Update forge-std to use newer FS cheatcodes\n```\ngit rm -rf lib/forge-std\n```\n```\n rm -rf lib/forge-std\n```\n```\n forge install foundry-rs/forge-std@v1.8.2 --no-commit\n```\n\n## Usage - Getting the most recent deployment\n\n1. Update your `foundry.toml` to have read permissions on the `broadcast` folder.\n\n```toml\nfs_permissions = [\n    { access = \"read\", path = \"./broadcast\" },\n    { access = \"read\", path = \"./reports\" },\n]\n```\n\n2. Import the package, and call `DevOpsTools.get_most_recent_deployment(\"MyContract\", chainid);`\n\nie:\n\n```javascript\nimport {DevOpsTools} from \"lib/foundry-devops/src/DevOpsTools.sol\";\nimport {MyContract} from \"my-contract/MyContract.sol\";\n.\n.\n.\nfunction interactWithPreviouslyDeployedContracts() public {\n    address contractAddress = DevOpsTools.get_most_recent_deployment(\"MyContract\", block.chainid);\n    MyContract myContract = MyContract(contractAddress);\n    myContract.doSomething();\n}\n```\n\n## Usage - zkSync Checker\n\n### Prerequisites\n- [foundry-zksync](https://github.com/matter-labs/foundry-zksync)\n  - You'll know you did it right if you can run `foundryup-zksync --help` and you see a response like:\n```\nThe installer for Foundry-zksync.\n\nUpdate or revert to a specific Foundry-zksync version with ease.\n.\n.\n.\n```\n\n### Usage - ZkSyncChainChecker\n\nIn your contract, you can import and inherit the abstract contract `ZkSyncChainChecker` to check if you are on a zkSync based chain. And add the `skipZkSync` modifier to any function you want to skip if you are on a zkSync based chain.\n\nIt will check both the precompiles or the `chainid` to determine if you are on a zkSync based chain.\n\n```javascript\nimport {ZkSyncChainChecker} from \"lib/foundry-devops/src/ZkSyncChainChecker.sol\";\n\ncontract MyContract is ZkSyncChainChecker {\n\n  function doStuff() skipZkSync {\n```\n\n### ZkSyncChainChecker modifiers:\n- `skipZkSync`: Skips the function if you are on a zkSync based chain.\n- `onlyZkSync`: Only allows the function if you are on a zkSync based chain.\n  \n### ZkSyncChainChecker Functions:\n- `isZkSyncChain()`: Returns true if you are on a zkSync based chain.\n- `isOnZkSyncPrecompiles()`: Returns true if you are on a zkSync based chain using the precompiles.\n- `isOnZkSyncChainId()`: Returns true if you are on a zkSync based chain using the chainid.\n\n### Usage - FoundryZkSyncChecker\n\nIn your contract, you can import and inherit the abstract contract `FoundryZkSyncChecker` to check if you are on the `foundry-zksync` fork of `foundry`. \n\n\u003e !Important: Functions and modifiers in `FoundryZkSyncChecker` are only available if you run `foundry-zksync` with the `--zksync` flag.\n\n```javascript\nimport {FoundryZkSyncChecker} from \"lib/foundry-devops/src/FoundryZkSyncChecker.sol\";\n\ncontract MyContract is FoundryZkSyncChecker {\n\n  function doStuff() onlyFoundryZkSync {\n```\n\nYou must also add `ffi = true` to your `foundry.toml` to use this feature. \n\n### FoundryZkSync modifiers:\n- `onlyFoundryZkSync`: Only allows the function if you are on `foundry-zksync`\n- `onlyVanillaFoundry`: Only allows the function if you are on `foundry`\n\n### FoundryZkSync Functions:\n- `is_foundry_zksync`: Returns true if you are on `foundry-zksync`\n\n\n# Testing\n\nFor testing on vanilla foundry, run:\n\n```bash\nmake test\n```\n\nFor testing with `foundry-zksync`, run:\n\n```bash\nmake test-zksync\n```\n\n# Limitations\n- You cannot deploy a contract with `FoundryZkSyncChainChecker` or `ZkSyncChainChecker` because `foundry-zksync` gets confused by a lot of cheatcodes, and doesn't recognize cheatcodes after compiling to the EraVM. \n\n# Contributing\n\nPRs are welcome!\n\n```\ngit clone https://github.com/Cyfrin/foundry-devops\ncd foundry-devops\nmake\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanuragshingare30%2Ffoundry-devops","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fanuragshingare30%2Ffoundry-devops","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanuragshingare30%2Ffoundry-devops/lists"}