Skip to content

Commit 8b11b62

Browse files
authored
Merge branch 'dev' into feat(web)/public-dashboards
2 parents 3a9825a + 50bcfb9 commit 8b11b62

File tree

17 files changed

+176
-86
lines changed

17 files changed

+176
-86
lines changed

subgraph/core-neo/subgraph.yaml

+10-10
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ dataSources:
88
name: KlerosCore
99
network: arbitrum-one
1010
source:
11-
address: "0xCd415C03dfa85B02646C7e2977F22a480c4354F1"
11+
address: "0x991d2df165670b9cac3B022f4B68D65b664222ea"
1212
abi: KlerosCore
13-
startBlock: 190274596
13+
startBlock: 272063254
1414
mapping:
1515
kind: ethereum/events
1616
apiVersion: 0.0.7
@@ -64,9 +64,9 @@ dataSources:
6464
name: PolicyRegistry
6565
network: arbitrum-one
6666
source:
67-
address: "0x26c1980120F1C82cF611D666CE81D2b54d018547"
67+
address: "0x553dcbF6aB3aE06a1064b5200Df1B5A9fB403d3c"
6868
abi: PolicyRegistry
69-
startBlock: 190274403
69+
startBlock: 272063037
7070
mapping:
7171
kind: ethereum/events
7272
apiVersion: 0.0.7
@@ -84,9 +84,9 @@ dataSources:
8484
name: DisputeKitClassic
8585
network: arbitrum-one
8686
source:
87-
address: "0xb7c292cD9Fd3d20De84a71AE1caF054eEB6374A9"
87+
address: "0x70B464be85A547144C72485eBa2577E5D3A45421"
8888
abi: DisputeKitClassic
89-
startBlock: 190274518
89+
startBlock: 272063168
9090
mapping:
9191
kind: ethereum/events
9292
apiVersion: 0.0.7
@@ -119,9 +119,9 @@ dataSources:
119119
name: EvidenceModule
120120
network: arbitrum-one
121121
source:
122-
address: "0xe62B776498F48061ef9425fCEf30F3d1370DB005"
122+
address: "0x48e052B4A6dC4F30e90930F1CeaAFd83b3981EB3"
123123
abi: EvidenceModule
124-
startBlock: 190274441
124+
startBlock: 272063086
125125
mapping:
126126
kind: ethereum/events
127127
apiVersion: 0.0.7
@@ -140,9 +140,9 @@ dataSources:
140140
name: SortitionModule
141141
network: arbitrum-one
142142
source:
143-
address: "0x614498118850184c62f82d08261109334bFB050f"
143+
address: "0x21A9402aDb818744B296e1d1BE58C804118DC03D"
144144
abi: SortitionModule
145-
startBlock: 190274557
145+
startBlock: 272063201
146146
mapping:
147147
kind: ethereum/events
148148
apiVersion: 0.0.7

subgraph/core/schema.graphql

+5
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ type Dispute @entity {
160160
disputeID: BigInt!
161161
court: Court!
162162
createdAt: BigInt
163+
transactionHash: String!
163164
arbitrated: Arbitrable!
164165
period: Period!
165166
ruled: Boolean!
@@ -180,6 +181,8 @@ type Dispute @entity {
180181
arbitrableChainId:BigInt
181182
externalDisputeId:BigInt
182183
templateId:BigInt
184+
rulingTimestamp:BigInt
185+
rulingTransactionHash:String
183186
}
184187

185188
type PeriodIndexCounter @entity {
@@ -303,6 +306,8 @@ type ClassicJustification @entity {
303306
choice: BigInt!
304307
votes: [ClassicVote!]! @derivedFrom(field: "justification")
305308
reference: String!
309+
transactionHash: String!
310+
timestamp: BigInt!
306311
}
307312

308313
type ClassicEvidenceGroup implements EvidenceGroup @entity {

subgraph/core/src/DisputeKitClassic.ts

+2
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ export function handleVoteCast(event: VoteCast): void {
6666
justification.localRound = currentLocalRoundID;
6767
justification.choice = choice;
6868
justification.reference = event.params._justification;
69+
justification.transactionHash = event.transaction.hash.toHexString();
70+
justification.timestamp = event.block.timestamp;
6971
justification.save();
7072
const currentRulingInfo = updateCountsAndGetCurrentRuling(
7173
currentLocalRoundID,

subgraph/core/src/KlerosCore.ts

+2
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,8 @@ export function handleRuling(event: Ruling): void {
184184
const dispute = Dispute.load(disputeID.toString());
185185
if (!dispute) return;
186186
dispute.ruled = true;
187+
dispute.rulingTransactionHash = event.transaction.hash.toHexString();
188+
dispute.rulingTimestamp = event.block.timestamp;
187189
dispute.save();
188190
const court = Court.load(dispute.court);
189191
if (!court) return;

subgraph/core/src/entities/Dispute.ts

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ export function createDisputeFromEvent(event: DisputeCreation): void {
2121
dispute.lastPeriodChange = event.block.timestamp;
2222
dispute.lastPeriodChangeBlockNumber = event.block.number;
2323
dispute.periodNotificationIndex = getAndIncrementPeriodCounter(dispute.period);
24+
dispute.transactionHash = event.transaction.hash.toHexString();
2425
const court = Court.load(courtID);
2526
if (!court) return;
2627
dispute.periodDeadline = event.block.timestamp.plus(court.timesPerPeriod[0]);

subgraph/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@kleros/kleros-v2-subgraph",
3-
"version": "0.9.1",
3+
"version": "0.10.1",
44
"license": "MIT",
55
"scripts": {
66
"update:core:arbitrum-sepolia-devnet": "./scripts/update.sh arbitrumSepoliaDevnet arbitrum-sepolia core/subgraph.yaml",

web/src/components/EvidenceCard.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import { getIpfsUrl } from "utils/getIpfsUrl";
1414
import { shortenAddress } from "utils/shortenAddress";
1515

1616
import { type Evidence } from "src/graphql/graphql";
17+
import { getTxnExplorerLink } from "src/utils";
1718

1819
import { hoverShortTransitionTiming } from "styles/commonStyles";
1920
import { landscapeStyle } from "styles/landscapeStyle";
@@ -226,7 +227,7 @@ const EvidenceCard: React.FC<IEvidenceCard> = ({
226227
const dashboardLink = `/dashboard/1/desc/all?address=${sender}`;
227228

228229
const transactionExplorerLink = useMemo(() => {
229-
return `${getChain(DEFAULT_CHAIN)?.blockExplorers?.default.url}/tx/${transactionHash}`;
230+
return getTxnExplorerLink(transactionHash ?? "");
230231
}, [transactionHash]);
231232

232233
return (

web/src/components/TxnHash.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import styled from "styled-components";
33

44
import NewTabIcon from "svgs/icons/new-tab.svg";
55

6-
import { DEFAULT_CHAIN, getChain } from "consts/chains";
6+
import { getTxnExplorerLink } from "src/utils";
77

88
import { ExternalLink } from "./ExternalLink";
99

@@ -23,7 +23,7 @@ interface ITxnHash {
2323
}
2424
const TxnHash: React.FC<ITxnHash> = ({ hash, variant }) => {
2525
const transactionExplorerLink = useMemo(() => {
26-
return `${getChain(DEFAULT_CHAIN)?.blockExplorers?.default.url}/tx/${hash}`;
26+
return getTxnExplorerLink(hash);
2727
}, [hash]);
2828

2929
return (

web/src/components/Verdict/DisputeTimeline.tsx

+45-6
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import React, { useMemo } from "react";
22
import styled, { useTheme } from "styled-components";
33

4-
import { responsiveSize } from "styles/responsiveSize";
5-
4+
import Skeleton from "react-loading-skeleton";
65
import { useParams } from "react-router-dom";
76

87
import { _TimelineItem1, CustomTimeline } from "@kleros/ui-components-library";
98

109
import CalendarIcon from "svgs/icons/calendar.svg";
1110
import ClosedCaseIcon from "svgs/icons/check-circle-outline.svg";
11+
import NewTabIcon from "svgs/icons/new-tab.svg";
1212

1313
import { Periods } from "consts/periods";
1414
import { usePopulatedDisputeData } from "hooks/queries/usePopulatedDisputeData";
@@ -19,9 +19,14 @@ import { DisputeDetailsQuery, useDisputeDetailsQuery } from "queries/useDisputeD
1919
import { useVotingHistory } from "queries/useVotingHistory";
2020

2121
import { ClassicRound } from "src/graphql/graphql";
22+
import { getTxnExplorerLink } from "src/utils";
23+
24+
import { responsiveSize } from "styles/responsiveSize";
2225

2326
import { StyledClosedCircle } from "components/StyledIcons/ClosedCircleIcon";
2427

28+
import { ExternalLink } from "../ExternalLink";
29+
2530
const Container = styled.div`
2631
display: flex;
2732
position: relative;
@@ -50,6 +55,18 @@ const StyledCalendarIcon = styled(CalendarIcon)`
5055
height: 14px;
5156
`;
5257

58+
const StyledNewTabIcon = styled(NewTabIcon)`
59+
margin-bottom: 2px;
60+
path {
61+
fill: ${({ theme }) => theme.primaryBlue};
62+
}
63+
:hover {
64+
path {
65+
fill: ${({ theme }) => theme.secondaryBlue};
66+
}
67+
}
68+
`;
69+
5370
const formatDate = (date: string) => {
5471
const options: Intl.DateTimeFormatOptions = { year: "numeric", month: "long", day: "numeric" };
5572
const startingDate = new Date(parseInt(date) * 1000);
@@ -67,6 +84,9 @@ const useItems = (disputeDetails?: DisputeDetailsQuery, arbitrable?: `0x${string
6784
const localRounds: ClassicRound[] = getLocalRounds(votingHistory?.dispute?.disputeKitDispute) as ClassicRound[];
6885
const rounds = votingHistory?.dispute?.rounds;
6986
const theme = useTheme();
87+
const txnExplorerLink = useMemo(() => {
88+
return getTxnExplorerLink(votingHistory?.dispute?.transactionHash ?? "");
89+
}, [votingHistory]);
7090

7191
return useMemo<TimelineItems | undefined>(() => {
7292
const dispute = disputeDetails?.dispute;
@@ -119,7 +139,11 @@ const useItems = (disputeDetails?: DisputeDetailsQuery, arbitrable?: `0x${string
119139
[
120140
{
121141
title: "Dispute created",
122-
party: "",
142+
party: (
143+
<ExternalLink to={txnExplorerLink} rel="noopener noreferrer" target="_blank">
144+
<StyledNewTabIcon />
145+
</ExternalLink>
146+
),
123147
subtitle: formatDate(votingHistory?.dispute?.createdAt),
124148
rightSided: true,
125149
variant: theme.secondaryPurple,
@@ -128,7 +152,7 @@ const useItems = (disputeDetails?: DisputeDetailsQuery, arbitrable?: `0x${string
128152
);
129153
}
130154
return;
131-
}, [disputeDetails, disputeData, localRounds, theme]);
155+
}, [disputeDetails, disputeData, localRounds, theme, rounds, votingHistory, txnExplorerLink]);
132156
};
133157

134158
interface IDisputeTimeline {
@@ -138,15 +162,30 @@ interface IDisputeTimeline {
138162
const DisputeTimeline: React.FC<IDisputeTimeline> = ({ arbitrable }) => {
139163
const { id } = useParams();
140164
const { data: disputeDetails } = useDisputeDetailsQuery(id);
165+
const { data: votingHistory } = useVotingHistory(id);
141166
const items = useItems(disputeDetails, arbitrable);
142167

168+
const transactionExplorerLink = useMemo(() => {
169+
return getTxnExplorerLink(disputeDetails?.dispute?.rulingTransactionHash ?? "");
170+
}, [disputeDetails]);
171+
143172
return (
144173
<Container>
145174
{items && <StyledTimeline {...{ items }} />}
146-
{disputeDetails?.dispute?.ruled && items && (
175+
{disputeDetails?.dispute?.ruled && (
147176
<EnforcementContainer>
148177
<StyledCalendarIcon />
149-
<small>Enforcement: {items.at(-1)?.subtitle}</small>
178+
<small>
179+
Enforcement:{" "}
180+
{disputeDetails.dispute.rulingTimestamp ? (
181+
<ExternalLink to={transactionExplorerLink} rel="noopener noreferrer" target="_blank">
182+
{formatDate(disputeDetails.dispute.rulingTimestamp)}
183+
</ExternalLink>
184+
) : (
185+
<Skeleton height={16} width={56} />
186+
)}{" "}
187+
/ {votingHistory?.dispute?.rounds.at(-1)?.court.name}
188+
</small>
150189
</EnforcementContainer>
151190
)}
152191
</Container>

web/src/hooks/queries/useDisputeDetailsQuery.ts

+2
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ const disputeDetailsQuery = graphql(`
3434
arbitrableChainId
3535
externalDisputeId
3636
templateId
37+
rulingTimestamp
38+
rulingTransactionHash
3739
}
3840
}
3941
`);

web/src/hooks/queries/useVotingHistory.ts

+3
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ const votingHistoryQuery = graphql(`
1212
dispute(id: $disputeID) {
1313
id
1414
createdAt
15+
transactionHash
1516
ruled
1617
rounds {
1718
nbVotes
@@ -29,6 +30,8 @@ const votingHistoryQuery = graphql(`
2930
... on ClassicVote {
3031
commited
3132
justification {
33+
transactionHash
34+
timestamp
3235
choice
3336
reference
3437
}

0 commit comments

Comments
 (0)