Skip to content

Commit 7562f1b

Browse files
committed
fix(subgraph): correctly get nb of votes
1 parent 056d786 commit 7562f1b

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

subgraph/src/KlerosCore.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ export function handleDisputeCreation(event: DisputeCreation): void {
7575
court.save();
7676
createDisputeFromEvent(event);
7777
const roundInfo = contract.getRoundInfo(disputeID, ZERO);
78-
createRoundFromRoundInfo(disputeID, ZERO, court.feeForJuror, roundInfo);
78+
createRoundFromRoundInfo(disputeID, ZERO, roundInfo);
7979
const arbitrable = event.params._arbitrable.toHexString();
8080
updateArbitrableCases(arbitrable, ONE);
8181
updateCases(ONE, event.block.timestamp);
@@ -117,7 +117,7 @@ export function handleAppealDecision(event: AppealDecision): void {
117117
dispute.save();
118118
const feeForJuror = getFeeForJuror(dispute.court);
119119
const roundInfo = contract.getRoundInfo(disputeID, newRoundIndex);
120-
createRoundFromRoundInfo(disputeID, newRoundIndex, feeForJuror, roundInfo);
120+
createRoundFromRoundInfo(disputeID, newRoundIndex, roundInfo);
121121
}
122122

123123
export function handleDraw(event: DrawEvent): void {

subgraph/src/entities/Round.ts

+6-7
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,16 @@ import { Round } from "../../generated/schema";
55
export function createRoundFromRoundInfo(
66
disputeID: BigInt,
77
roundIndex: BigInt,
8-
feeForJuror: BigInt,
98
roundInfo: KlerosCore__getRoundInfoResult
109
): void {
1110
const roundID = `${disputeID.toString()}-${roundIndex.toString()}`;
1211
const round = new Round(roundID);
13-
round.disputeKit = roundInfo.value5.toString();
14-
round.tokensAtStakePerJuror = roundInfo.value0;
15-
round.totalFeesForJurors = roundInfo.value1;
16-
round.nbVotes = roundInfo.value1.div(feeForJuror);
17-
round.repartitions = roundInfo.value2;
18-
round.penalties = roundInfo.value3;
12+
round.disputeKit = roundInfo.getDisputeKitID.toString();
13+
round.tokensAtStakePerJuror = roundInfo.getPnkAtStakePerJuror();
14+
round.totalFeesForJurors = roundInfo.getTotalFeesForJurors();
15+
round.nbVotes = roundInfo.getNbVotes();
16+
round.repartitions = roundInfo.getRepartitions();
17+
round.penalties = roundInfo.getPnkPenalties();
1918
round.dispute = disputeID.toString();
2019
round.save();
2120
}

0 commit comments

Comments
 (0)