{"id":13803307,"url":"https://github.com/smartcontractkit/foundry-starter-kit","last_synced_at":"2025-04-05T00:10:35.872Z","repository":{"id":41902269,"uuid":"510465194","full_name":"smartcontractkit/foundry-starter-kit","owner":"smartcontractkit","description":null,"archived":false,"fork":false,"pushed_at":"2024-08-20T10:35:22.000Z","size":159,"stargazers_count":346,"open_issues_count":20,"forks_count":95,"subscribers_count":14,"default_branch":"main","last_synced_at":"2025-03-28T23:08:06.457Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Solidity","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/smartcontractkit.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2022-07-04T18:29:41.000Z","updated_at":"2025-03-11T05:15:20.000Z","dependencies_parsed_at":"2024-05-23T09:50:19.816Z","dependency_job_id":"10581c82-9674-412c-8181-a425e14b1eda","html_url":"https://github.com/smartcontractkit/foundry-starter-kit","commit_stats":null,"previous_names":[],"tags_count":1,"template":true,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smartcontractkit%2Ffoundry-starter-kit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smartcontractkit%2Ffoundry-starter-kit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smartcontractkit%2Ffoundry-starter-kit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smartcontractkit%2Ffoundry-starter-kit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/smartcontractkit","download_url":"https://codeload.github.com/smartcontractkit/foundry-starter-kit/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247266565,"owners_count":20910836,"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":[],"created_at":"2024-08-04T01:00:28.536Z","updated_at":"2025-04-05T00:10:35.852Z","avatar_url":"https://github.com/smartcontractkit.png","language":"Solidity","funding_links":[],"categories":["Templates \u0026 Libraries"],"sub_categories":[],"readme":"_Note: This repo has been recently updated for Sepolia_\n\n# Foundry Starter Kit\n\n\u003cbr/\u003e\n\u003cp align=\"center\"\u003e\n\u003ca href=\"https://chain.link\" target=\"_blank\"\u003e\n\u003cimg src=\"./img/chainlink-foundry.png\" width=\"225\" alt=\"Chainlink Foundry logo\"\u003e\n\u003c/a\u003e\n\u003c/p\u003e\n\u003cbr/\u003e\n\n[![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/smartcontractkit/foundry-starter-kit)\n\nFoundry Starter Kit is a repo that shows developers how to quickly build, test, and deploy smart contracts with one of the fastest frameworks out there, [foundry](https://github.com/gakonst/foundry)!\n\n- [Foundry Starter Kit](#foundry-starter-kit)\n- [Getting Started](#getting-started)\n  - [Requirements](#requirements)\n  - [Quickstart](#quickstart)\n  - [Testing](#testing)\n- [Deploying to a network](#deploying-to-a-network)\n  - [Setup](#setup)\n  - [Deploying](#deploying)\n    - [Working with a local network](#working-with-a-local-network)\n    - [Working with other chains](#working-with-other-chains)\n- [Security](#security)\n- [Contributing](#contributing)\n- [Thank You!](#thank-you)\n  - [Resources](#resources)\n    - [TODO](#todo)\n\n# Getting Started\n\n## Requirements\n\nPlease install the following:\n\n- [Git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git)\n  - You'll know you've done it right if you can run `git --version`\n- [Foundry / Foundryup](https://github.com/gakonst/foundry)\n  - This will install `forge`, `cast`, and `anvil`\n  - You can test you've installed them right by running `forge --version` and get an output like: `forge 0.2.0 (f016135 2022-07-04T00:15:02.930499Z)`\n  - To get the latest of each, just run `foundryup`\n\n## Quickstart\n\n```sh\ngit clone https://github.com/smartcontractkit/foundry-starter-kit\ncd foundry-starter-kit\n```\n\n## Install dependencies as follows:\n\nRun `forge install` to install dependencies. [Foundry uses git submodules](https://book.getfoundry.sh/projects/dependencies) as its dependency management system.\n\n\u003e ⚠️  when running forge install, you may see an error message if you have uncomitted changes in your repo.  Read the message carefully - it may inform you that you can add the `--no-commit` flag to each of these `install` commands if your workspace has uncommitted changes.\n\nYou can update dependencies by running `forge update`\n\n## Testing\nTo check that everything is compiling and working as intended after cloning and installing dependencies, run\n```\nforge test\n```\n\nAll tests should pass.\n\n# Chainlink Foundry Starter Kit\n\nImplementation of the following 4 Chainlink services using the [Foundry] (https://book.getfoundry.sh/) smart contract development tooling:\n\n- [Chainlink Price Feeds](https://docs.chain.link/docs/using-chainlink-reference-contracts)\n- [Chainlink VRF V2](https://docs.chain.link/docs/chainlink-vrf)\n- [Chainlink Automation](https://docs.chain.link/chainlink-automation/introduction)\n\nFor [Chainlink Functions](https://docs.chain.link/chainlink-functions) please go to these starter kits: [Hardhat](https://github.com/smartcontractkit/functions-hardhat-starter-kit) | [Foundry (coming soon)](https://github.com/smartcontractkit/functions-foundry-starter-kit)\n\nFor [Chainlink CCIP (Cross Chain Interoperability Prototocol)](https://docs.chain.link/ccip) please go to these starter kits: [Hardhat](https://github.com/smartcontractkit/ccip-starter-kit-hardhat) | [Foundry](https://github.com/smartcontractkit/ccip-starter-kit-foundry)\n\n# Deploying to a network\n\nDeploying to a network uses the [foundry scripting system](https://book.getfoundry.sh/tutorials/solidity-scripting.html), where you write your deploy scripts in solidity!\n\n## Setup\n\nWe'll demo using the Sepolia testnet. (Go here for [testnet sepolia ETH](https://faucets.chain.link/).)\n\nYou'll need to add the following variables to a `.env` file:\n\n- `SEPOLIA_RPC_URL`: A URL to connect to the blockchain. You can get one for free from [Infura](https://www.infura.io/) account\n- `PRIVATE_KEY`: A private key from your wallet. You can get a private key from a new [Metamask](https://metamask.io/) account\n  - Additionally, if you want to deploy to a testnet, you'll need test ETH and/or LINK. You can get them from [faucets.chain.link](https://faucets.chain.link/).\n- Optional `ETHERSCAN_API_KEY`: If you want to verify on etherscan\n\nWhen you've added your environment variables to the `.env` file, run `source .env` in your terminal (and for each new terminal session) to load the environment variables into your terminal.\n\n## Deploying\n\nDeploy scripts are in `./script`. The relevant Chainlink Service can be determined from the name of the Contract script. `HelperConfig` is not meant to be deployed.\n\nTo deploy one of the Chainlink Service consumer contracts run the script as follows:\n\n```\nforge script script/${CONTRACT_NAME}.s.sol:Deploy${CONTRACT_NAME} --rpc-url $SEPOLIA_RPC_URL  --private-key PRIVATE_KEY --broadcast --verify --etherscan-api-key $ETHERSCAN_API_KEY  -vvvv\nmake deploy-sepolia contract=\u003cCONTRACT_NAME\u003e\n```\n\nFor example, to deploy the `PriceFeedConsumer` contract:\n\n```\nforge script script/PriceFeedConsumer.s.sol:DeployPriceFeedConsumer  --rpc-url $SEPOLIA_RPC_URL --private-key $PRIVATE_KEY --broadcast --verify --etherscan-api-key $ETHERSCAN_API_KEY -vvvv\n```\n\nIf you don't have an `ETHERSCAN_API_KEY`, you can omit `--verify --etherscan-api-key $ETHERSCAN_API_KEY`\n\n\n### Working with Anvil local development network\n\nFoundry comes with local network [anvil](https://book.getfoundry.sh/anvil/index.html) baked in, and allows us to deploy to our local network for quick testing locally.\n\nTo start a local network run the following in a new terminal window or tab:\n\n```\nanvil\n```\n\nThis will spin up a local blockchain on `http://localhost:8545` :  (see console output for the mnemonic used, and 10 private keys and their associated wallet address), so you can use the same private key each time.\n\nThen, you can deploy to it with one of those private keys; in this example we use the first one:\n\n```\nforge script script/${contract}.s.sol:Deploy${contract} --rpc-url http://localhost:8545  --private-key 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80 --broadcast \n```\n\n\n### Working with other chains\n\nTo add a chain, you'd just need to pass in the RPC URL for the relevant chain to the `--rpc-url` flag.\n\n```\nforge script script/${contract}.s.sol:Deploy${contract} --rpc-url ${\u003cOTHER_CHAIN\u003e_RPC_URL}  --private-key ${PRIVATE_KEY} --broadcast -vvvv\n\n```\n\n# Security\n\nThis framework comes with slither parameters, a popular security framework from [Trail of Bits](https://www.trailofbits.com/). To use slither, you'll first need to [install python](https://www.python.org/downloads/) and [install slither](https://github.com/crytic/slither#how-to-install).\n\nThen, you can run:\n\n```\nmake slither\n```\n\nAnd get your slither output.\n\n# Contributing\n\nContributions are always welcome! Open a PR or an issue!\nIf you do contribute please add `solidity.formatter\": \"forge` to your VSCode Settings, or run `forge fmt` before you commit and push.\n\n# Thank You!\n\n## Resources\n\n- [Chainlink Documentation](https://docs.chain.link/)\n- [Foundry Documentation](https://book.getfoundry.sh/)\n\n### TODO\n\n[ ] Add bash scripts to interact with contracts using `cast`\n\n[ ] Make deploying contracts to `anvil` simpler\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsmartcontractkit%2Ffoundry-starter-kit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsmartcontractkit%2Ffoundry-starter-kit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsmartcontractkit%2Ffoundry-starter-kit/lists"}