-
Notifications
You must be signed in to change notification settings - Fork 121
Expand file tree
/
Copy pathREADME.md
More file actions
93 lines (58 loc) · 1.92 KB
/
README.md
File metadata and controls
93 lines (58 loc) · 1.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# A template for EVM-based smart contract development
A template for developing EVM smart contract using hardhat (v3) and hardhat-deploy (v2)
It is setup as a monorepo so it is easy to add a web app or other components
## How to use it?
### Compile your contracts
```bash
pnpm contracts:compile
```
### Test your contracts
```bash
pnpm contracts:test
```
This will test both solidity and node test (as hardhat v3 does)
### watch for changes and rebuild automatically
```bash
pnpm contracts:compile:watch
```
### deploy your contract
- on localhost
This assumes you have a local node running which can do by executing `pnpm contracts:local_node`
```bash
pnpm run contracts:deploy localhost
```
- on a network of your choice
Just make sure you have your .env.local setup, see [.env](.env) or if you use hardhat secret store, configure it.
```bash
pnpm run contracts:deploy <network>
```
### execute scripts
```bash
pnpm contracts:execute <network name> scripts/setMessage.ts "hello"
```
or if you want to execute in a forked environment :
```bash
pnpm contracts:fork:execute <network name> scripts/setMessage.ts "Hello world"
```
### zellij
[zellij](https://zellij.dev/) is a useful multiplexer (think tmux) for which we have included a [layout file](./zellij.kdl) to get started
Once installed simply run the following to get a local in-memory Ethereum node running along with the tests
```bash
pnpm start
```
In the shell in the upper pane, you execute the script as mentioned above
```bash
pnpm contracts:execute localhost scripts/setMessage.ts "Hello everyone"
```
## Initial Setup
You need to have these installed
- [nodejs](https://nodejs.org/en)
- [pnpm](https://pnpm.io/)
```bash
npm i -g pnpm
```
Then you need to install the local dependencies with the following command:
```bash
pnpm i
```
We also recommend installing [Zellij](https://zellij.dev/) to have your dev env setup in one go via `pnpm start`