-
Notifications
You must be signed in to change notification settings - Fork 43
/
README.md.template
197 lines (129 loc) · 4.72 KB
/
README.md.template
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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
# @kleros/kleros-v2-contracts
Smart contracts for Kleros v2
## Deployments
Refresh the list of deployed contracts by running `./scripts/generateDeploymentsMarkdown.sh` or `./scripts/populateReadme.sh`.
$deployments
## Getting Started
### Install the Dependencies
```bash
yarn install
```
### Run Tests
```bash
yarn test
```
### Compile the Contracts
```bash
yarn build
```
### Run Linter on Files
```bash
yarn lint
```
### Fix Linter Issues on Files
```bash
yarn fix
```
### Deploy Instructions
**NOTICE:** the commands below work only if you are inside the `contracts/` directory.
#### 0. Set the Environment Variables
Copy `.env.example` file as `.env` and edit it accordingly.
```bash
cp .env.example .env
```
The following env vars are required:
- `PRIVATE_KEY`: the private key of the deployer account used for the testnets.
- `MAINNET_PRIVATE_KEY`: the private key of the deployer account used for Mainnet.
- `INFURA_API_KEY`: the API key for infura.
The ones below are optional:
- `ETHERSCAN_API_KEY`: to verify the source of the newly deployed contracts on **Etherscan**.
- `ARBISCAN_API_KEY`: to verify the source of the newly deployed contracts on **Arbitrum**.
- `GNOSISSCAN_API_KEY`: to verify the source of the newly deployed contracts on **Gnosis chain**.
#### 1. Update the Constructor Parameters (optional)
If some of the constructor parameters (such as the Meta Evidence) needs to change, you need to update the files in the `deploy/` directory.
#### 2. Deploy to a Local Network
The complete deployment is multi-chain, so a deployment to the local network can only simulate either the Home chain or the Foreign chain.
**Shell 1: the node**
```bash
yarn hardhat node --tags nothing
```
**Shell 2: the deploy script**
```bash
yarn deploy --network localhost --tags <Arbitration|VeaMock|ForeignGatewayOnEthereum|HomeGateway>
```
#### 3. Deploy to Public Testnets
```bash
# ArbitrumSepolia to Chiado
yarn deploy --network arbitrumSepolia --tags Arbitration
yarn deploy --network arbitrumSepolia --tags HomeArbitrable
yarn deploy --network chiado --tags ForeignGatewayOnGnosis
yarn deploy --network chiado --tags KlerosLiquidOnGnosis
yarn deploy --network chiado --tags ForeignArbitrable
yarn deploy --network arbitrumSepolia --tags HomeGatewayToGnosis
# Sepolia
yarn deploy --network sepolia --tags ForeignGatewayOnEthereum
yarn deploy --network sepolia --tags ForeignArbitrable
yarn deploy --network arbitrumSepolia --tags HomeGatewayToEthereum
```
The deployed addresses should be displayed to the screen after the deployment is complete. If you missed them, you can always go to the `deployments/<network>` directory and look for the respective file.
#### 4. Deploy a Devnet on Public Testnets
Same steps as above but append `Devnet` to the `--network` parameter.
#### Running Test Fixtures
**Shell 1: the node**
```bash
yarn hardhat node --tags Arbitration,VeaMock
```
**Shell 2: the test scripts**
```bash
yarn test --network localhost
```
#### 4. Verify the Source Code
This must be done for each network separately.
```bash
# explorer
yarn etherscan-verify --network <arbitrumSepolia|arbitrum|chiado|gnosischain|sepolia|mainnet>
yarn etherscan-verify-proxies
# sourcify
yarn sourcify --network <arbitrumSepolia|arbitrum|chiado|gnosischain|sepolia|mainnet>
```
## Ad-hoc procedures
### Populating the policy registry and courts
The policy registry and courts configuration can be found in `config/policies.*.json` and `config/courts.*.json`.
#### 1/ Export the registry data from V1
```bash
for network in mainnet gnosischain
do
yarn hardhat run scripts/getPoliciesV1.ts --network $network | tee config/policies.v1.$network.json
yarn hardhat run scripts/getCourtsV1.ts --network $network | tee config/courts.v1.$network.json
done
```
#### 2/ Import the data to V2 - Local Network
Shell 1:
```bash
yarn hardhat node --tags Arbitration
```
Shell 2:
```bash
yarn hardhat run scripts/populateCourts.ts --network localhost
yarn hardhat run scripts/populatePolicyRegistry.ts --network localhost
```
#### 3/ Import the data to V2 - Public Testnet
```bash
yarn hardhat run scripts/populateCourts.ts --network arbitrumSepolia
yarn hardhat run scripts/populatePolicyRegistry.ts --network arbitrumSepolia
```
### Generate deployment artifacts for existing contracts
#### Usage
```bash
scripts/generateDeploymentArtifact.sh <network> <address>
```
#### Example: WETH on Gnosis chain
```bash
scripts/generateDeploymentArtifact.sh gnosischain 0xf8d1677c8a0c961938bf2f9adc3f3cfda759a9d9 > deployments/gnosischain/WETH.json
```
### Push the contracts to a Tenderly project
Ensure that your `$TENDERLY_PROJECT` and `$TENDERLY_USERNAME` is set correctly in `.env`.
```bash
yarn tenderly-verify --network sepolia
yarn tenderly-verify --network arbitrumSepolia
```