Skip to content

Commit b784ca9

Browse files
tractorssjaybuidl
authored andcommitted
feat(web): court-jump-indicator
1 parent 2b6d97a commit b784ca9

File tree

6 files changed

+14
-5
lines changed

6 files changed

+14
-5
lines changed

subgraph/core/schema.graphql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,7 @@ type Round @entity {
181181
penalties: BigInt!
182182
drawnJurors: [Draw!]! @derivedFrom(field: "round")
183183
dispute: Dispute!
184+
court: Court!
184185
feeToken: FeeToken
185186
}
186187

subgraph/core/src/KlerosCore.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ export function handleDisputeCreation(event: DisputeCreation): void {
7878
court.save();
7979
createDisputeFromEvent(event);
8080
const roundInfo = contract.getRoundInfo(disputeID, ZERO);
81-
createRoundFromRoundInfo(disputeID, ZERO, roundInfo);
81+
createRoundFromRoundInfo(KlerosCore.bind(event.address), disputeID, ZERO, roundInfo);
8282
const arbitrable = event.params._arbitrable.toHexString();
8383
updateArbitrableCases(arbitrable, ONE);
8484
updateCases(ONE, event.block.timestamp);
@@ -163,7 +163,7 @@ export function handleAppealDecision(event: AppealDecision): void {
163163
dispute.currentRound = roundID;
164164
dispute.save();
165165
const roundInfo = contract.getRoundInfo(disputeID, newRoundIndex);
166-
createRoundFromRoundInfo(disputeID, newRoundIndex, roundInfo);
166+
createRoundFromRoundInfo(KlerosCore.bind(event.address), disputeID, newRoundIndex, roundInfo);
167167
}
168168

169169
export function handleCourtJump(event: CourtJump): void {

subgraph/core/src/entities/Round.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import { BigInt } from "@graphprotocol/graph-ts";
2-
import { KlerosCore__getRoundInfoResultValue0Struct } from "../../generated/KlerosCore/KlerosCore";
2+
import { KlerosCore, KlerosCore__getRoundInfoResultValue0Struct } from "../../generated/KlerosCore/KlerosCore";
33
import { Round } from "../../generated/schema";
44

55
export function createRoundFromRoundInfo(
6+
contract: KlerosCore,
67
disputeID: BigInt,
78
roundIndex: BigInt,
89
roundInfo: KlerosCore__getRoundInfoResultValue0Struct
@@ -19,5 +20,7 @@ export function createRoundFromRoundInfo(
1920
round.repartitions = roundInfo.repartitions;
2021
round.penalties = roundInfo.pnkPenalties;
2122
round.dispute = disputeID.toString();
23+
const courtID = contract.disputes(disputeID);
24+
round.court = courtID.value0.toString();
2225
round.save();
2326
}

web/src/components/Verdict/DisputeTimeline.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ const useItems = (disputeDetails?: DisputeDetailsQuery, arbitrable?: `0x${string
8787
acc.push({
8888
title: `Jury Decision - Round ${index + 1}`,
8989
party: isOngoing ? "Voting is ongoing" : getVoteChoice(parsedRoundChoice, answers),
90-
subtitle: eventDate,
90+
subtitle: `${eventDate} / ${votingHistory?.dispute?.rounds.at(index)?.court.name}`,
9191
rightSided: true,
9292
variant: theme.secondaryPurple,
9393
Icon: icon !== "" ? icon : undefined,

web/src/hooks/queries/useVotingHistory.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ const votingHistoryQuery = graphql(`
1010
id
1111
rounds {
1212
nbVotes
13+
court {
14+
id
15+
name
16+
}
1317
}
1418
disputeKitDispute {
1519
localRounds {

web/src/pages/Cases/CaseDetails/Voting/VotingHistory.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,8 @@ const VotingHistory: React.FC<{ arbitrable?: `0x${string}`; isQuestion: boolean
133133
? "All jurors voted"
134134
: localRounds.at(currentTab)?.totalVoted.toString() +
135135
` vote${localRounds.at(currentTab)?.totalVoted.toString() === "1" ? "" : "s"} cast out of ` +
136-
rounds.at(currentTab)?.nbVotes}
136+
rounds.at(currentTab)?.nbVotes}{" "}
137+
- {rounds.at(currentTab)?.court.name}
137138
</p>
138139
</StyledBox>
139140
<StyledAccordion

0 commit comments

Comments
 (0)