Skip to content

Commit dab893b

Browse files
authored
Bump @chainlink/contracts to v1.5.0 + Add OpenZeppelin submodules (#45)
* Upgraded to 1.5.0 of Chainlink contracts The unvendoring of OpenZeppelin contracts in version 1.5.0 of @chainlink/contracts results in developers having to rely on remappings to resolve the OpenZeppelin import paths. - Install required OpenZeppelin versions with alias - Remap import paths to the alias OZ directories - Upgrade to 1.5.0 release of contracts from chainlink-evm repo * Added codeowners * Added Chainlink contracts install instructions to README - Added the installation instructions for Chainlink contracts depending on version - Included OZ dependency installation for versions >=1.5.0 * Fixed chainlink-evm tag for forge install - Corrected the tag used for specific versioning of chainlink-evm * Updated README - Modified forge install step
1 parent fd4ab9d commit dab893b

11 files changed

Lines changed: 129 additions & 7 deletions

.github/CODEOWNERS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Root
2+
* @zeuslawyer @andrejrakic @thodges-gh @Nalon @smartcontractkit/devrel

.gitmodules

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,18 @@
1111
[submodule "lib/chainlink-evm"]
1212
path = lib/chainlink-evm
1313
url = https://github.com/smartcontractkit/chainlink-evm
14+
[submodule "lib/openzeppelin-contracts-4.8.3"]
15+
path = lib/openzeppelin-contracts-4.8.3
16+
url = https://github.com/openzeppelin/openzeppelin-contracts
17+
[submodule "lib/openzeppelin-contracts-4.7.3"]
18+
path = lib/openzeppelin-contracts-4.7.3
19+
url = https://github.com/openzeppelin/openzeppelin-contracts
20+
[submodule "lib/openzeppelin-contracts-4.9.6"]
21+
path = lib/openzeppelin-contracts-4.9.6
22+
url = https://github.com/openzeppelin/openzeppelin-contracts
23+
[submodule "lib/openzeppelin-contracts-5.0.2"]
24+
path = lib/openzeppelin-contracts-5.0.2
25+
url = https://github.com/openzeppelin/openzeppelin-contracts
26+
[submodule "lib/openzeppelin-contracts-5.1.0"]
27+
path = lib/openzeppelin-contracts-5.1.0
28+
url = https://github.com/openzeppelin/openzeppelin-contracts

README.md

Lines changed: 67 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
_Note: This repo has been recently updated for Sepolia_
2-
1+
> [!IMPORTANT]
2+
> 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`.
33
# Foundry Starter Kit
44

55
<br/>
@@ -18,6 +18,7 @@ Foundry Starter Kit is a repo that shows developers how to quickly build, test,
1818
- [Getting Started](#getting-started)
1919
- [Requirements](#requirements)
2020
- [Quickstart](#quickstart)
21+
- [Dependencies](#install-dependencies-as-follows)
2122
- [Testing](#testing)
2223
- [Deploying to a network](#deploying-to-a-network)
2324
- [Setup](#setup)
@@ -50,14 +51,74 @@ git clone https://github.com/smartcontractkit/foundry-starter-kit
5051
cd foundry-starter-kit
5152
```
5253

53-
## Install dependencies as follows:
54+
## Install dependencies as follows:
5455

5556
Run `forge install` to install dependencies. [Foundry uses git submodules](https://book.getfoundry.sh/projects/dependencies) as its dependency management system.
5657

57-
> ⚠️ 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.
58+
> ⚠️ 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.
5859
5960
You can update dependencies by running `forge update`
6061

62+
## Installing Chainlink contracts:
63+
64+
```
65+
forge install
66+
```
67+
68+
> [!IMPORTANT]
69+
> 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.
70+
71+
To add Chainlink contracts to an existing project:
72+
73+
<details id=">=1.5.0">
74+
<summary>v1.5.0 and above</summary>
75+
76+
### Step 1: Install >= v1.5.0 and required dependencies
77+
78+
```
79+
forge install \
80+
smartcontractkit/chainlink-evm@contracts-v<version> \
81+
openzeppelin-contracts-4.7.3=openzeppelin/openzeppelin-contracts@v4.7.3 \
82+
openzeppelin-contracts-4.8.3=openzeppelin/openzeppelin-contracts@v4.8.3 \
83+
openzeppelin-contracts-4.9.6=openzeppelin/openzeppelin-contracts@v4.9.6 \
84+
openzeppelin-contracts-5.0.2=openzeppelin/openzeppelin-contracts@v5.0.2 \
85+
openzeppelin-contracts-5.1.0=openzeppelin/openzeppelin-contracts@v5.1.0
86+
```
87+
88+
### Step 2: Set remappings
89+
90+
Include the following remappings within your project's `remappings.txt` or `foundry.toml`.
91+
92+
```
93+
@chainlink/=lib/chainlink-evm/
94+
@openzeppelin/contracts@4.7.3/=lib/openzeppelin-contracts-4.7.3/contracts/
95+
@openzeppelin/contracts@4.8.3/=lib/openzeppelin-contracts-4.8.3/contracts/
96+
@openzeppelin/contracts@4.9.6/=lib/openzeppelin-contracts-4.9.6/contracts/
97+
@openzeppelin/contracts@5.0.2/=lib/openzeppelin-contracts-5.0.2/contracts/
98+
@openzeppelin/contracts@5.1.0/=lib/openzeppelin-contracts-5.1.0/contracts/
99+
```
100+
101+
</details>
102+
103+
<details id="<=1.4.0">
104+
<summary>v1.4.0 and below</summary>
105+
106+
#### Step 1: Install <= v1.4.0
107+
108+
```
109+
forge install smartcontractkit/chainlink-evm@contracts-v<version>
110+
```
111+
112+
#### Step 2: Set remappings
113+
114+
Include the following remappings within your project's `remappings.txt` or `foundry.toml`.
115+
116+
```
117+
@chainlink/contracts/=lib/chainlink-evm/contracts/
118+
```
119+
120+
</details>
121+
61122
## Testing
62123
To check that everything is compiling and working as intended after cloning and installing dependencies, run
63124
```
@@ -76,7 +137,7 @@ Implementation of the following 4 Chainlink services using the [Foundry] (https:
76137

77138
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)
78139

79-
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)
140+
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)
80141

81142
# Deploying to a network
82143

@@ -89,7 +150,7 @@ We'll demo using the Sepolia testnet. (Go here for [testnet sepolia ETH](https:/
89150
You'll need to add the following variables to a `.env` file:
90151

91152
- `SEPOLIA_RPC_URL`: A URL to connect to the blockchain. You can get one for free from [Infura](https://www.infura.io/) account
92-
- `PRIVATE_KEY`: A private key from your wallet. You can get a private key from a new [Metamask](https://metamask.io/) account
153+
- `PRIVATE_KEY`: A private key from your wallet. You can get a private key from a new [MetaMask](https://metamask.io/) account
93154
- 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/).
94155
- Optional `ETHERSCAN_API_KEY`: If you want to verify on etherscan
95156

foundry.lock

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{
2+
"lib/chainlink-evm": {
3+
"rev": "86aa5a1d34b20eda8d18fe6eb0e4882948e545ba"
4+
},
5+
"lib/forge-std": {
6+
"rev": "1714bee72e286e73f76e320d110e0eaf5c4e649d"
7+
},
8+
"lib/foundry-chainlink-toolkit": {
9+
"branch": {
10+
"name": "feature/integration-automation",
11+
"rev": "caa68b15a67340b13f4d1a2147a7c454b3443744"
12+
}
13+
},
14+
"lib/openzeppelin-contracts-4.7.3": {
15+
"rev": "ecd2ca2cd7cac116f7a37d0e474bbb3d7d5e1c4d"
16+
},
17+
"lib/openzeppelin-contracts-4.8.3": {
18+
"rev": "0a25c1940ca220686588c4af3ec526f725fe2582"
19+
},
20+
"lib/openzeppelin-contracts-4.9.6": {
21+
"rev": "dc44c9f1a4c3b10af99492eed84f83ed244203f6"
22+
},
23+
"lib/openzeppelin-contracts-5.0.2": {
24+
"rev": "dbb6104ce834628e473d2173bbc9d47f81a9eec3"
25+
},
26+
"lib/openzeppelin-contracts-5.1.0": {
27+
"rev": "69c8def5f222ff96f2b5beff05dfba996368aa79"
28+
},
29+
"lib/solmate": {
30+
"rev": "97bdb2003b70382996a79a406813f76417b1cf90"
31+
}
32+
}

lib/chainlink-evm

Submodule chainlink-evm updated 1287 files

lib/openzeppelin-contracts-4.7.3

lib/openzeppelin-contracts-4.8.3

lib/openzeppelin-contracts-4.9.6

lib/openzeppelin-contracts-5.0.2

lib/openzeppelin-contracts-5.1.0

0 commit comments

Comments
 (0)