Skip to content

Commit a6beea5

Browse files
authored
Merge branch 'dev' into fix(web)--appeal-tab-issues
2 parents a8b9dc5 + aaa07c5 commit a6beea5

File tree

12 files changed

+278
-44
lines changed

12 files changed

+278
-44
lines changed

contracts/.env.example

+14-1
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/README.md.template

+197
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+
```

contracts/config/courts.v2.testnet.json

+12-12
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@
88
"feeForJuror": "10000000000000",
99
"jurorsForCourtJump": "511",
1010
"timesPerPeriod": [
11-
28800,
12-
28800,
13-
28800,
14-
28800
11+
43200,
12+
43200,
13+
43200,
14+
43200
1515
]
1616
},
1717
{
@@ -23,10 +23,10 @@
2323
"feeForJuror": "10000000000000",
2424
"jurorsForCourtJump": "30",
2525
"timesPerPeriod": [
26-
28800,
27-
28800,
28-
28800,
29-
28800
26+
43200,
27+
43200,
28+
43200,
29+
43200
3030
]
3131
},
3232
{
@@ -38,10 +38,10 @@
3838
"feeForJuror": "10000000000000",
3939
"jurorsForCourtJump": "63",
4040
"timesPerPeriod": [
41-
28800,
42-
28800,
43-
28800,
44-
28800
41+
43200,
42+
43200,
43+
43200,
44+
43200
4545
]
4646
}
4747
]

web/src/components/CasesDisplay/CasesListHeader.tsx

+9-13
Original file line numberDiff line numberDiff line change
@@ -6,25 +6,23 @@ import { responsiveSize } from "styles/responsiveSize";
66

77
const Container = styled.div`
88
display: flex;
9-
justify-content: space-between;
10-
gap: calc(15vw + (40 - 15) * (min(max(100vw, 375px), 1250px) - 375px) / 875);
119
width: 100%;
1210
height: 100%;
11+
justify-content: space-between;
1312
`;
1413

1514
const CasesData = styled.div`
16-
display: flex;
17-
align-items: center;
18-
justify-content: space-around;
19-
width: 100%;
20-
margin-left: ${responsiveSize(0, 33)};
21-
flex-wrap: wrap;
22-
padding: 0 3%;
23-
gap: ${responsiveSize(24, 48, 300)};
15+
display: grid;
16+
flex: 1;
17+
grid-template-columns: repeat(4, ${responsiveSize(100, 130, 900)});
18+
column-gap: ${responsiveSize(2, 12, 900)};
19+
justify-content: space-between;
20+
margin-right: 8px;
2421
`;
2522

2623
const CaseTitle = styled.div`
2724
display: none;
25+
width: ${responsiveSize(270, 345, 900)};
2826
margin-left: 32px;
2927
gap: 36px;
3028
label {
@@ -42,9 +40,7 @@ const CaseTitle = styled.div`
4240
)}
4341
`;
4442

45-
const StyledLabel = styled.label`
46-
margin-left: ${responsiveSize(4, 8, 300, 900)};
47-
`;
43+
const StyledLabel = styled.label``;
4844

4945
const tooltipMsg =
5046
"Users have an economic interest in serving as jurors in Kleros: " +

web/src/components/DisputeCard/DisputeInfo.tsx

+6-3
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ const Container = styled.div<{ isList: boolean; isOverview?: boolean }>`
2727
() => css`
2828
gap: 0;
2929
height: 100%;
30+
flex: 1;
3031
`
3132
)}
3233
`};
@@ -56,9 +57,11 @@ const RestOfFieldsContainer = styled.div<{ isList?: boolean; isOverview?: boolea
5657
css`
5758
${landscapeStyle(
5859
() => css`
59-
flex-direction: row;
60-
gap: ${responsiveSize(4, 24, 300, 900)};
61-
justify-content: space-around;
60+
display: grid;
61+
grid-template-columns: repeat(4, ${responsiveSize(100, 130, 900)});
62+
column-gap: ${responsiveSize(2, 12, 900)};
63+
justify-content: space-between;
64+
align-items: center;
6265
`
6366
)}
6467
`};

web/src/components/DisputeCard/PeriodBanner.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
import React from "react";
22
import styled, { Theme } from "styled-components";
33
import { Periods } from "consts/periods";
4+
import { responsiveSize } from "styles/responsiveSize";
45

56
const Container = styled.div<Omit<IPeriodBanner, "id">>`
67
height: ${({ isCard }) => (isCard ? "45px" : "100%")};
7-
width: auto;
8+
width: ${({ isCard }) => (isCard ? "auto" : responsiveSize(60, 80, 900))};
89
border-top-right-radius: 3px;
910
border-top-left-radius: 3px;
1011
display: flex;

web/src/components/DisputeCard/index.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ const ListTitle = styled.div`
6868
height: 100%;
6969
justify-content: start;
7070
align-items: center;
71-
width: calc(30vw + (40 - 30) * (min(max(100vw, 300px), 1250px)- 300px) / 950);
71+
width: ${responsiveSize(240, 300, 900)};
7272
`;
7373

7474
export const getPeriodEndTimestamp = (

web/src/components/StyledSkeleton.tsx

+12-4
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,13 @@ const StyledSkeletonDisputeListItem = styled(Skeleton)`
3232
height: 62px;
3333
`;
3434

35-
const StyledSkeletonEvidenceCard = styled(Skeleton)`
36-
height: 146px;
37-
width: 76vw;
35+
const StyledSkeletonEvidenceContainer = styled.div`
36+
width: 100%;
37+
span {
38+
width: 100%;
39+
height: 146px;
40+
display: flex;
41+
}
3842
`;
3943

4044
export const SkeletonDisputeCard = () => (
@@ -45,4 +49,8 @@ export const SkeletonDisputeCard = () => (
4549

4650
export const SkeletonDisputeListItem = () => <StyledSkeletonDisputeListItem />;
4751

48-
export const SkeletonEvidenceCard = () => <StyledSkeletonEvidenceCard />;
52+
export const SkeletonEvidenceCard = () => (
53+
<StyledSkeletonEvidenceContainer>
54+
<Skeleton />
55+
</StyledSkeletonEvidenceContainer>
56+
);

0 commit comments

Comments
 (0)