diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 0000000..0bc7f93 --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1,2 @@ +# Root +* @zeuslawyer @andrejrakic @thodges-gh @Nalon @smartcontractkit/devrel \ No newline at end of file diff --git a/.gitmodules b/.gitmodules index 274f71a..15c92d6 100644 --- a/.gitmodules +++ b/.gitmodules @@ -11,3 +11,18 @@ [submodule "lib/chainlink-evm"] path = lib/chainlink-evm url = https://github.com/smartcontractkit/chainlink-evm +[submodule "lib/openzeppelin-contracts-4.8.3"] + path = lib/openzeppelin-contracts-4.8.3 + url = https://github.com/openzeppelin/openzeppelin-contracts +[submodule "lib/openzeppelin-contracts-4.7.3"] + path = lib/openzeppelin-contracts-4.7.3 + url = https://github.com/openzeppelin/openzeppelin-contracts +[submodule "lib/openzeppelin-contracts-4.9.6"] + path = lib/openzeppelin-contracts-4.9.6 + url = https://github.com/openzeppelin/openzeppelin-contracts +[submodule "lib/openzeppelin-contracts-5.0.2"] + path = lib/openzeppelin-contracts-5.0.2 + url = https://github.com/openzeppelin/openzeppelin-contracts +[submodule "lib/openzeppelin-contracts-5.1.0"] + path = lib/openzeppelin-contracts-5.1.0 + url = https://github.com/openzeppelin/openzeppelin-contracts diff --git a/README.md b/README.md index de5ca60..511477e 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ -_Note: This repo has been recently updated for Sepolia_ - +> [!IMPORTANT] +> This repository has recently been updated for use with [Chainlink contracts](https://github.com/smartcontractkit/chainlink-evm/) v1.5.0. See the [dependency installation section for instructions on how to set up v1.5.0](#installing-chainlink-contracts-with-forge-install) within your own project using `forge install`. # Foundry Starter Kit
@@ -18,6 +18,7 @@ Foundry Starter Kit is a repo that shows developers how to quickly build, test, - [Getting Started](#getting-started) - [Requirements](#requirements) - [Quickstart](#quickstart) + - [Dependencies](#install-dependencies-as-follows) - [Testing](#testing) - [Deploying to a network](#deploying-to-a-network) - [Setup](#setup) @@ -50,14 +51,74 @@ git clone https://github.com/smartcontractkit/foundry-starter-kit cd foundry-starter-kit ``` -## Install dependencies as follows: +## Install dependencies as follows: Run `forge install` to install dependencies. [Foundry uses git submodules](https://book.getfoundry.sh/projects/dependencies) as its dependency management system. -> ⚠️ 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. +> ⚠️ when running forge install, you may see an error message if you have uncommitted 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. You can update dependencies by running `forge update` +## Installing Chainlink contracts: + +``` +forge install +``` + +> [!IMPORTANT] +> For this starter kit, the packages have already been included and can be installed using the above `forge install` command. This package includes Chainlink contracts v1.5.0. + +To add Chainlink contracts to an existing project: + +
+v1.5.0 and above + +### Step 1: Install >= v1.5.0 and required dependencies + +``` +forge install \ + smartcontractkit/chainlink-evm@contracts-v \ + openzeppelin-contracts-4.7.3=openzeppelin/openzeppelin-contracts@v4.7.3 \ + openzeppelin-contracts-4.8.3=openzeppelin/openzeppelin-contracts@v4.8.3 \ + openzeppelin-contracts-4.9.6=openzeppelin/openzeppelin-contracts@v4.9.6 \ + openzeppelin-contracts-5.0.2=openzeppelin/openzeppelin-contracts@v5.0.2 \ + openzeppelin-contracts-5.1.0=openzeppelin/openzeppelin-contracts@v5.1.0 +``` + +### Step 2: Set remappings + +Include the following remappings within your project's `remappings.txt` or `foundry.toml`. + +``` +@chainlink/=lib/chainlink-evm/ +@openzeppelin/contracts@4.7.3/=lib/openzeppelin-contracts-4.7.3/contracts/ +@openzeppelin/contracts@4.8.3/=lib/openzeppelin-contracts-4.8.3/contracts/ +@openzeppelin/contracts@4.9.6/=lib/openzeppelin-contracts-4.9.6/contracts/ +@openzeppelin/contracts@5.0.2/=lib/openzeppelin-contracts-5.0.2/contracts/ +@openzeppelin/contracts@5.1.0/=lib/openzeppelin-contracts-5.1.0/contracts/ +``` + +
+ +
+v1.4.0 and below + +#### Step 1: Install <= v1.4.0 + +``` +forge install smartcontractkit/chainlink-evm@contracts-v +``` + +#### Step 2: Set remappings + +Include the following remappings within your project's `remappings.txt` or `foundry.toml`. + +``` +@chainlink/contracts/=lib/chainlink-evm/contracts/ +``` + +
+ ## Testing To check that everything is compiling and working as intended after cloning and installing dependencies, run ``` @@ -76,7 +137,7 @@ Implementation of the following 4 Chainlink services using the [Foundry] (https: For [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) -For [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) +For [Chainlink CCIP (Cross Chain Interoperability Protocol)](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) # Deploying to a network @@ -89,7 +150,7 @@ We'll demo using the Sepolia testnet. (Go here for [testnet sepolia ETH](https:/ You'll need to add the following variables to a `.env` file: - `SEPOLIA_RPC_URL`: A URL to connect to the blockchain. You can get one for free from [Infura](https://www.infura.io/) account -- `PRIVATE_KEY`: A private key from your wallet. You can get a private key from a new [Metamask](https://metamask.io/) account +- `PRIVATE_KEY`: A private key from your wallet. You can get a private key from a new [MetaMask](https://metamask.io/) account - 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/). - Optional `ETHERSCAN_API_KEY`: If you want to verify on etherscan diff --git a/foundry.lock b/foundry.lock new file mode 100644 index 0000000..a16d598 --- /dev/null +++ b/foundry.lock @@ -0,0 +1,32 @@ +{ + "lib/chainlink-evm": { + "rev": "86aa5a1d34b20eda8d18fe6eb0e4882948e545ba" + }, + "lib/forge-std": { + "rev": "1714bee72e286e73f76e320d110e0eaf5c4e649d" + }, + "lib/foundry-chainlink-toolkit": { + "branch": { + "name": "feature/integration-automation", + "rev": "caa68b15a67340b13f4d1a2147a7c454b3443744" + } + }, + "lib/openzeppelin-contracts-4.7.3": { + "rev": "ecd2ca2cd7cac116f7a37d0e474bbb3d7d5e1c4d" + }, + "lib/openzeppelin-contracts-4.8.3": { + "rev": "0a25c1940ca220686588c4af3ec526f725fe2582" + }, + "lib/openzeppelin-contracts-4.9.6": { + "rev": "dc44c9f1a4c3b10af99492eed84f83ed244203f6" + }, + "lib/openzeppelin-contracts-5.0.2": { + "rev": "dbb6104ce834628e473d2173bbc9d47f81a9eec3" + }, + "lib/openzeppelin-contracts-5.1.0": { + "rev": "69c8def5f222ff96f2b5beff05dfba996368aa79" + }, + "lib/solmate": { + "rev": "97bdb2003b70382996a79a406813f76417b1cf90" + } +} \ No newline at end of file diff --git a/lib/chainlink-evm b/lib/chainlink-evm index df6a094..86aa5a1 160000 --- a/lib/chainlink-evm +++ b/lib/chainlink-evm @@ -1 +1 @@ -Subproject commit df6a094dcee6bbde43dc51a416c4bb244c12588c +Subproject commit 86aa5a1d34b20eda8d18fe6eb0e4882948e545ba diff --git a/lib/openzeppelin-contracts-4.7.3 b/lib/openzeppelin-contracts-4.7.3 new file mode 160000 index 0000000..ecd2ca2 --- /dev/null +++ b/lib/openzeppelin-contracts-4.7.3 @@ -0,0 +1 @@ +Subproject commit ecd2ca2cd7cac116f7a37d0e474bbb3d7d5e1c4d diff --git a/lib/openzeppelin-contracts-4.8.3 b/lib/openzeppelin-contracts-4.8.3 new file mode 160000 index 0000000..0a25c19 --- /dev/null +++ b/lib/openzeppelin-contracts-4.8.3 @@ -0,0 +1 @@ +Subproject commit 0a25c1940ca220686588c4af3ec526f725fe2582 diff --git a/lib/openzeppelin-contracts-4.9.6 b/lib/openzeppelin-contracts-4.9.6 new file mode 160000 index 0000000..dc44c9f --- /dev/null +++ b/lib/openzeppelin-contracts-4.9.6 @@ -0,0 +1 @@ +Subproject commit dc44c9f1a4c3b10af99492eed84f83ed244203f6 diff --git a/lib/openzeppelin-contracts-5.0.2 b/lib/openzeppelin-contracts-5.0.2 new file mode 160000 index 0000000..dbb6104 --- /dev/null +++ b/lib/openzeppelin-contracts-5.0.2 @@ -0,0 +1 @@ +Subproject commit dbb6104ce834628e473d2173bbc9d47f81a9eec3 diff --git a/lib/openzeppelin-contracts-5.1.0 b/lib/openzeppelin-contracts-5.1.0 new file mode 160000 index 0000000..69c8def --- /dev/null +++ b/lib/openzeppelin-contracts-5.1.0 @@ -0,0 +1 @@ +Subproject commit 69c8def5f222ff96f2b5beff05dfba996368aa79 diff --git a/remappings.txt b/remappings.txt index 1627a9e..371dc69 100644 --- a/remappings.txt +++ b/remappings.txt @@ -3,3 +3,10 @@ @clones=lib/clones-with-immutable-args/src/ @chainlink/=lib/chainlink-evm/ forge-std/=lib/forge-std/src/ + + +@openzeppelin/contracts@4.7.3/=lib/openzeppelin-contracts-4.7.3/contracts/ +@openzeppelin/contracts@4.8.3/=lib/openzeppelin-contracts-4.8.3/contracts/ +@openzeppelin/contracts@4.9.6/=lib/openzeppelin-contracts-4.9.6/contracts/ +@openzeppelin/contracts@5.0.2/=lib/openzeppelin-contracts-5.0.2/contracts/ +@openzeppelin/contracts@5.1.0/=lib/openzeppelin-contracts-5.1.0/contracts/ \ No newline at end of file