Skip to content

Commit 93b58ac

Browse files
committed
chore: update docs
1 parent 12d4f93 commit 93b58ac

File tree

1 file changed

+31
-5
lines changed

1 file changed

+31
-5
lines changed

README.md

Lines changed: 31 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -84,14 +84,16 @@ Testing is done with the following stack:
8484
- [Ethers](https://docs.ethers.io/v5/)
8585

8686
## Contracts
87-
To test all the smart contracts, use `yarn test`.
87+
88+
To test all the smart contracts, use `yarn test`.
8889
To test a single file run: `npx hardhat test test/<FILE_NAME>.ts`
8990

9091
## E2E Testing
9192

9293
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.
9394

9495
### Hardhat local node
96+
9597
To run e2e tests against a hardhat local node run:
9698

9799
```bash
@@ -108,6 +110,7 @@ The command will invoke several hardhat tasks, including:
108110
- Run e2e tests
109111

110112
### Other networks
113+
111114
To run tests against a live testnet or even mainnet run:
112115

113116
```bash
@@ -120,7 +123,7 @@ This command will only run the tests so you need to be sure the protocol is alre
120123

121124
There are three ways to interact with the contracts through this repo:
122125

123-
**Hardhat**
126+
### Hardhat
124127

125128
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.
126129

@@ -129,13 +132,36 @@ The most straightforward way to interact with the contracts is through the hardh
129132
npx hardhat console --network rinkeby
130133
```
131134

132-
**Hardhat Tasks**
135+
### Hardhat Tasks
133136

134137
There are hardhat tasks under the `/tasks` folder. Most tasks are for complex queries to get back data from the protocol.
135138

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:
137163

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.
139165

140166
# Deploying Contracts
141167

0 commit comments

Comments
 (0)