You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+31-5Lines changed: 31 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -84,14 +84,16 @@ Testing is done with the following stack:
84
84
-[Ethers](https://docs.ethers.io/v5/)
85
85
86
86
## Contracts
87
-
To test all the smart contracts, use `yarn test`.
87
+
88
+
To test all the smart contracts, use `yarn test`.
88
89
To test a single file run: `npx hardhat test test/<FILE_NAME>.ts`
89
90
90
91
## E2E Testing
91
92
92
93
End to end tests are also available and can be run against a local network or a live network. These can be useful to validate a protocol deployment is configured and working as expected.
93
94
94
95
### Hardhat local node
96
+
95
97
To run e2e tests against a hardhat local node run:
96
98
97
99
```bash
@@ -108,6 +110,7 @@ The command will invoke several hardhat tasks, including:
108
110
- Run e2e tests
109
111
110
112
### Other networks
113
+
111
114
To run tests against a live testnet or even mainnet run:
112
115
113
116
```bash
@@ -120,7 +123,7 @@ This command will only run the tests so you need to be sure the protocol is alre
120
123
121
124
There are three ways to interact with the contracts through this repo:
122
125
123
-
**Hardhat**
126
+
### Hardhat
124
127
125
128
The most straightforward way to interact with the contracts is through the hardhat console. We have extended the hardhat runtime environment to include all of the contracts. This makes it easy to run the console with autocomplete for all contracts and all functions. It is a quick and easy way to read and write to the contracts.
126
129
@@ -129,13 +132,36 @@ The most straightforward way to interact with the contracts is through the hardh
129
132
npx hardhat console --network rinkeby
130
133
```
131
134
132
-
**Hardhat Tasks**
135
+
### Hardhat Tasks
133
136
134
137
There are hardhat tasks under the `/tasks` folder. Most tasks are for complex queries to get back data from the protocol.
135
138
136
-
**cli**
139
+
### CLI
140
+
141
+
There is a CLI that can be used to read or write to the contracts. It includes scripts to help with deployment.
142
+
143
+
## Environment
144
+
145
+
When running the Hardhat console or tasks you can set what network and accounts to use when sending transactions.
146
+
147
+
### Network
148
+
149
+
Selecting a network requires just passing `--network <name>` when running Hardhat. It's important that the network exists in the Hardhat configuration file.
150
+
151
+
_There is a special network called `localhost` that connects it to a node running on localhost._
152
+
153
+
### Accounts
154
+
155
+
The accounts used depends on a few environment variables:
156
+
157
+
- If MNEMONIC is set you will have available the set of addresses derived from the seed.
158
+
- If PRIVATE_KEY is set, just that account is imported. MNEMONIC always takes precedence over PRIVATE_KEY.
159
+
- If no MNEMONIC or PRIVATE_KEY is set it will use the remote accounts from the provider node.
160
+
- You can always get an account using `ethers.getSigner(<address>)`
161
+
162
+
Considerations when forking a chain:
137
163
138
-
There is a cli that can be used to read or write to the contracts. It includes scripts to help with deployment.
164
+
- When running on the `localhost` network it will use by default a deterministic seed for testing purposes. If you want to connect to a local node that is forking while retaining the capability to impersonate accounts or use local accounts you need to set the FORK=true environment variable.
0 commit comments