File tree 2 files changed +31
-2
lines changed 2 files changed +31
-2
lines changed Original file line number Diff line number Diff line change @@ -264,6 +264,15 @@ RUN if [ "$TARGETARCH" = "arm64" ]; then \
264
264
# compilers for amd64 will be downloaded by brownie later in this Dockerfile
265
265
266
266
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 */\n module.exports = {\n solidity: \" 0.8.28\" ,\n };" | tee -a hardhat.config.js
274
+
275
+
267
276
# init script that runs when the container is started for the very first time
268
277
# it will install poetry, yarn libs and init brownie networks
269
278
WORKDIR /root/scripts
@@ -289,7 +298,7 @@ RUN echo "cd /root/scripts" >> /root/.bashrc
289
298
290
299
# verify prerequisites versions
291
300
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)
293
302
RUN node --version | grep 'v18.' || (echo "Incorrect node version" && exit 1)
294
303
RUN npm --version | grep '10.' || (echo "Incorrect npm version" && exit 1)
295
304
RUN poetry --version | grep 'Poetry (version 1.8.2)' || (echo "Incorrect poetry version" && exit 1)
Original file line number Diff line number Diff line change @@ -49,7 +49,11 @@ ssh root@localhost -p 2222 # password: 1234
49
49
>
50
50
> If you are asked 'Are you sure you want to continue connecting' - type ` yes ` and hit ` <ENTER> `
51
51
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
+ ```
53
57
54
58
You now have a fully functional environment to run scripts & tests in, which is linked to your local scripts repo, for example:
55
59
``` shell
@@ -120,6 +124,22 @@ need it.
120
124
poetry shell
121
125
```
122
126
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 */\n module.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
+
123
143
</br >
124
144
125
145
## ⚗️ Workflow
You can’t perform that action at this time.
0 commit comments