Skip to content

Commit ae391a8

Browse files
authored
Merge pull request #344 from lidofinance/feat/next-vote
Hardhat: docs + docker
2 parents 1c2a769 + 80a53ef commit ae391a8

File tree

2 files changed

+31
-2
lines changed

2 files changed

+31
-2
lines changed

Dockerfile

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,15 @@ RUN if [ "$TARGETARCH" = "arm64" ]; then \
264264
# compilers for amd64 will be downloaded by brownie later in this Dockerfile
265265

266266

267+
# install & configure hardhat
268+
RUN mkdir /root/hardhat
269+
WORKDIR /root/hardhat
270+
RUN npm install -d hardhat
271+
RUN npm install --save-dev @nomiclabs/hardhat-ethers ethers @nomiclabs/hardhat-waffle ethereum-waffle chai
272+
RUN touch hardhat.config.js
273+
RUN echo "/** @type import('hardhat/config').HardhatUserConfig */\nmodule.exports = {\n solidity: \"0.8.28\",\n};" | tee -a hardhat.config.js
274+
275+
267276
# init script that runs when the container is started for the very first time
268277
# it will install poetry, yarn libs and init brownie networks
269278
WORKDIR /root/scripts
@@ -289,7 +298,7 @@ RUN echo "cd /root/scripts" >> /root/.bashrc
289298

290299
# verify prerequisites versions
291300
RUN python --version | grep 'Python 3.10.' || (echo "Incorrect python version" && exit 1)
292-
RUN pip --version | grep 'pip 24.' || (echo "Incorrect pip version" && exit 1)
301+
RUN pip --version | grep 'pip 2' || (echo "Incorrect pip version" && exit 1)
293302
RUN node --version | grep 'v18.' || (echo "Incorrect node version" && exit 1)
294303
RUN npm --version | grep '10.' || (echo "Incorrect npm version" && exit 1)
295304
RUN poetry --version | grep 'Poetry (version 1.8.2)' || (echo "Incorrect poetry version" && exit 1)

README.md

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,11 @@ ssh root@localhost -p 2222 # password: 1234
4949
>
5050
> If you are asked 'Are you sure you want to continue connecting' - type `yes` and hit `<ENTER>`
5151
52-
</br>
52+
To run a Hardhat node inside a deployed Docker container:
53+
```shell
54+
cd /root/hardhat
55+
npx hardhat node --fork $ETH_RPC_URL
56+
```
5357

5458
You now have a fully functional environment to run scripts & tests in, which is linked to your local scripts repo, for example:
5559
```shell
@@ -120,6 +124,22 @@ need it.
120124
poetry shell
121125
```
122126

127+
#### To run a Hardhat node (preferred) instead of Ganache:
128+
Just use the [Dockerised Hardhat Node](https://github.com/lidofinance/hardhat-node) or alternatively run it manually:
129+
130+
Install Hardhat and dependencies into a separate folder:
131+
```shell
132+
mkdir hardhat && cd hardhat && npm install -d hardhat && npm install --save-dev @nomiclabs/hardhat-ethers ethers @nomiclabs/hardhat-waffle ethereum-waffle chai
133+
```
134+
Init empty Hardhat project in this folder:
135+
```shell
136+
touch hardhat.config.js && echo $'/** @type import(\'hardhat/config\').HardhatUserConfig */\nmodule.exports = {\n solidity: "0.8.28",\n};' | tee -a hardhat.config.js
137+
```
138+
Start Hardhat node in this folder:
139+
```shell
140+
npx hardhat node --fork $ETH_RPC_URL
141+
```
142+
123143
</br>
124144

125145
## ⚗️ Workflow

0 commit comments

Comments
 (0)