Skip to content

Commit 6526305

Browse files
authored
Merge pull request #1422 from kleros/dev
Release
2 parents 7198e28 + a1f859e commit 6526305

File tree

101 files changed

+3056
-648
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

101 files changed

+3056
-648
lines changed

contracts/.env.example

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,26 @@
11
PRIVATE_KEY=0xabc123abc123abc123abc123abc123abc123abc123abc123abc123abc123abc1
2-
REPORT_GAS=true
2+
33
INFURA_API_KEY=ABC123ABC123ABC123ABC123ABC123ABC1
44

5+
# Testing
6+
REPORT_GAS=true
7+
58
# There seems to be a bug with hardhat-deploy's implementation of etherscan-verify
69
# If ETHERSCAN_API_KEY is set, it overrides any hardhat configuration.
710
ETHERSCAN_API_KEY_FIX=ABC123ABC123ABC123ABC123ABC123ABC1
811
ARBISCAN_API_KEY=ABC123ABC123ABC123ABC123ABC123ABC1
912
GNOSISSCAN_API_KEY=ABC123ABC123ABC123ABC123ABC123ABC1
1013

14+
# For the bots
15+
LOG_LEVEL=debug
16+
SUBGRAPH_URL=https://api.studio.thegraph.com/query/61738/kleros-v2-core-devnet/version/latest
17+
LOGTAIL_TOKEN_KEEPER_BOT=cqPqBofVC8nmA8EZdZGqqvUV
18+
LOGTAIL_TOKEN_RELAYER_BOT=41h8q5Z4gnz5yDx215eqcQ4r
19+
LOGTAIL_TOKEN_DISPUTOR_BOT=mSryyvYubviaMqKDWfBKAGsi
20+
HEARTBEAT_URL_KEEPER_BOT=https://uptime.betterstack.com/api/v1/heartbeat/jc23S8ZZzpf8KbzwxL1hoBp9
21+
HEARTBEAT_URL_RELAYER_BOT=https://uptime.betterstack.com/api/v1/heartbeat/eT6Trk6CddJV6fFBbqZNzyqC
22+
DISPUTES_TO_SKIP=
23+
1124
# Optionally for debugging
1225
# TENDERLY_USERNAME=your_username
1326
# TENDERLY_PROJECT=your_project

contracts/.npmignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,7 @@
11
# NOP, just force npm to disregard .gitignore
22
# https://docs.npmjs.com/cli/v9/using-npm/developers#keeping-files-out-of-your-package
3+
4+
.env*
5+
.flaskenv*
6+
!.env.project
7+
!.env.vault

contracts/README.md

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Smart contracts for Kleros v2
44

55
## Deployments
66

7-
Refresh the list of deployed contracts by running `./scripts/generateDeploymentsMarkdown.sh`.
7+
Refresh the list of deployed contracts by running `./scripts/generateDeploymentsMarkdown.sh` or `./scripts/populateReadme.sh`.
88

99
### Official Testnet
1010

@@ -57,7 +57,7 @@ Refresh the list of deployed contracts by running `./scripts/generateDeployments
5757
- [DisputeKitClassic: proxy](https://sepolia.arbiscan.io/address/0x9426F127116C3652A262AE1eA48391AC8F44D35b), [implementation](https://sepolia.arbiscan.io/address/0x692CC78F2570181FFB99297965FeAA8352ab12E8)
5858
- [DisputeResolver](https://sepolia.arbiscan.io/address/0xB8B36CC43f852f9F0484f53Eb38CaBBA28a81bF6)
5959
- [DisputeTemplateRegistry: proxy](https://sepolia.arbiscan.io/address/0x596D3B09E684D62217682216e9b7a0De75933391), [implementation](https://sepolia.arbiscan.io/address/0xc53b813ed94AaEb6F5518D60bf6a8109954bE3f6)
60-
- [Escrow](https://sepolia.arbiscan.io/address/0xdaf749DABE7be6C6894950AE69af35c20a00ABd9)
60+
- [Escrow](https://sepolia.arbiscan.io/address/0x10f7A6f42Af606553883415bc8862643A6e63fdA)
6161
- [EvidenceModule: proxy](https://sepolia.arbiscan.io/address/0x57fd453FB0d16f8ca174E7386102D7170E17Be09), [implementation](https://sepolia.arbiscan.io/address/0x05AD81f245209b7f91885fd96e57c9da90554824)
6262
- [KlerosCore: proxy](https://sepolia.arbiscan.io/address/0xA54e7A16d7460e38a8F324eF46782FB520d58CE8), [implementation](https://sepolia.arbiscan.io/address/0x91a373BBdE0532F86410682F362e2Cf685e95085)
6363
- [PNKFaucet](https://sepolia.arbiscan.io/address/0x7EFE468003Ad6A858b5350CDE0A67bBED58739dD)
@@ -214,6 +214,8 @@ yarn sourcify --network <arbitrumSepolia|arbitrum|chiado|gnosischain|sepolia|mai
214214

215215
### Populating the policy registry and courts
216216

217+
The policy registry and courts configuration can be found in `config/policies.*.json` and `config/courts.*.json`.
218+
217219
#### 1/ Export the registry data from V1
218220

219221
```bash
@@ -226,10 +228,6 @@ done
226228

227229
#### 2/ Import the data to V2 - Local Network
228230

229-
:warning: By default this script populates from `*.mainnet.json`. To populate from `*.gnosischain.json`, set the variable `USE_GNOSIS` to true inside [scripts/populateCourts.ts](scripts/populateCourts.ts).
230-
231-
:warning: It is possible to switch to testnet-friendly court parameters by setting the variable `TESTING_PARAMETERS` to true inside [scripts/populateCourts.ts](scripts/populateCourts.ts).
232-
233231
Shell 1:
234232

235233
```bash

contracts/README.md.template

Lines changed: 197 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,197 @@
1+
# @kleros/kleros-v2-contracts
2+
3+
Smart contracts for Kleros v2
4+
5+
## Deployments
6+
7+
Refresh the list of deployed contracts by running `./scripts/generateDeploymentsMarkdown.sh` or `./scripts/populateReadme.sh`.
8+
9+
$deployments
10+
11+
## Getting Started
12+
13+
### Install the Dependencies
14+
15+
```bash
16+
yarn install
17+
```
18+
19+
### Run Tests
20+
21+
```bash
22+
yarn test
23+
```
24+
25+
### Compile the Contracts
26+
27+
```bash
28+
yarn build
29+
```
30+
31+
### Run Linter on Files
32+
33+
```bash
34+
yarn lint
35+
```
36+
37+
### Fix Linter Issues on Files
38+
39+
```bash
40+
yarn fix
41+
```
42+
43+
### Deploy Instructions
44+
45+
**NOTICE:** the commands below work only if you are inside the `contracts/` directory.
46+
47+
#### 0. Set the Environment Variables
48+
49+
Copy `.env.example` file as `.env` and edit it accordingly.
50+
51+
```bash
52+
cp .env.example .env
53+
```
54+
55+
The following env vars are required:
56+
57+
- `PRIVATE_KEY`: the private key of the deployer account used for the testnets.
58+
- `MAINNET_PRIVATE_KEY`: the private key of the deployer account used for Mainnet.
59+
- `INFURA_API_KEY`: the API key for infura.
60+
61+
The ones below are optional:
62+
63+
- `ETHERSCAN_API_KEY`: to verify the source of the newly deployed contracts on **Etherscan**.
64+
- `ARBISCAN_API_KEY`: to verify the source of the newly deployed contracts on **Arbitrum**.
65+
- `GNOSISSCAN_API_KEY`: to verify the source of the newly deployed contracts on **Gnosis chain**.
66+
67+
#### 1. Update the Constructor Parameters (optional)
68+
69+
If some of the constructor parameters (such as the Meta Evidence) needs to change, you need to update the files in the `deploy/` directory.
70+
71+
#### 2. Deploy to a Local Network
72+
73+
The complete deployment is multi-chain, so a deployment to the local network can only simulate either the Home chain or the Foreign chain.
74+
75+
**Shell 1: the node**
76+
77+
```bash
78+
yarn hardhat node --tags nothing
79+
```
80+
81+
**Shell 2: the deploy script**
82+
83+
```bash
84+
yarn deploy --network localhost --tags <Arbitration|VeaMock|ForeignGatewayOnEthereum|HomeGateway>
85+
```
86+
87+
#### 3. Deploy to Public Testnets
88+
89+
```bash
90+
# ArbitrumSepolia to Chiado
91+
yarn deploy --network arbitrumSepolia --tags Arbitration
92+
yarn deploy --network arbitrumSepolia --tags HomeArbitrable
93+
yarn deploy --network chiado --tags ForeignGatewayOnGnosis
94+
yarn deploy --network chiado --tags KlerosLiquidOnGnosis
95+
yarn deploy --network chiado --tags ForeignArbitrable
96+
yarn deploy --network arbitrumSepolia --tags HomeGatewayToGnosis
97+
98+
# Sepolia
99+
yarn deploy --network sepolia --tags ForeignGatewayOnEthereum
100+
yarn deploy --network sepolia --tags ForeignArbitrable
101+
yarn deploy --network arbitrumSepolia --tags HomeGatewayToEthereum
102+
```
103+
104+
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.
105+
106+
#### 4. Deploy a Devnet on Public Testnets
107+
108+
Same steps as above but append `Devnet` to the `--network` parameter.
109+
110+
#### Running Test Fixtures
111+
112+
**Shell 1: the node**
113+
114+
```bash
115+
yarn hardhat node --tags Arbitration,VeaMock
116+
```
117+
118+
**Shell 2: the test scripts**
119+
120+
```bash
121+
yarn test --network localhost
122+
```
123+
124+
#### 4. Verify the Source Code
125+
126+
This must be done for each network separately.
127+
128+
```bash
129+
# explorer
130+
yarn etherscan-verify --network <arbitrumSepolia|arbitrum|chiado|gnosischain|sepolia|mainnet>
131+
yarn etherscan-verify-proxies
132+
133+
# sourcify
134+
yarn sourcify --network <arbitrumSepolia|arbitrum|chiado|gnosischain|sepolia|mainnet>
135+
136+
```
137+
138+
## Ad-hoc procedures
139+
140+
### Populating the policy registry and courts
141+
142+
The policy registry and courts configuration can be found in `config/policies.*.json` and `config/courts.*.json`.
143+
144+
#### 1/ Export the registry data from V1
145+
146+
```bash
147+
for network in mainnet gnosischain
148+
do
149+
yarn hardhat run scripts/getPoliciesV1.ts --network $network | tee config/policies.v1.$network.json
150+
yarn hardhat run scripts/getCourtsV1.ts --network $network | tee config/courts.v1.$network.json
151+
done
152+
```
153+
154+
#### 2/ Import the data to V2 - Local Network
155+
156+
Shell 1:
157+
158+
```bash
159+
yarn hardhat node --tags Arbitration
160+
```
161+
162+
Shell 2:
163+
164+
```bash
165+
yarn hardhat run scripts/populateCourts.ts --network localhost
166+
yarn hardhat run scripts/populatePolicyRegistry.ts --network localhost
167+
```
168+
169+
#### 3/ Import the data to V2 - Public Testnet
170+
171+
```bash
172+
yarn hardhat run scripts/populateCourts.ts --network arbitrumSepolia
173+
yarn hardhat run scripts/populatePolicyRegistry.ts --network arbitrumSepolia
174+
```
175+
176+
### Generate deployment artifacts for existing contracts
177+
178+
#### Usage
179+
180+
```bash
181+
scripts/generateDeploymentArtifact.sh <network> <address>
182+
```
183+
184+
#### Example: WETH on Gnosis chain
185+
186+
```bash
187+
scripts/generateDeploymentArtifact.sh gnosischain 0xf8d1677c8a0c961938bf2f9adc3f3cfda759a9d9 > deployments/gnosischain/WETH.json
188+
```
189+
190+
### Push the contracts to a Tenderly project
191+
192+
Ensure that your `$TENDERLY_PROJECT` and `$TENDERLY_USERNAME` is set correctly in `.env`.
193+
194+
```bash
195+
yarn tenderly-verify --network sepolia
196+
yarn tenderly-verify --network arbitrumSepolia
197+
```

0 commit comments

Comments
 (0)