Skip to content

Commit 8c48d81

Browse files
chore: update subgraph notification schema
1 parent 2321845 commit 8c48d81

File tree

5 files changed

+5
-17
lines changed

5 files changed

+5
-17
lines changed

subgraph/schema.graphql

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,6 @@ type Dispute @entity {
157157
periodDeadline: BigInt! # uint256j
158158
periodNotificationIndex: BigInt!
159159
lastPeriodChangeTs: BigInt!
160-
users: [User!]!
161160
lastPeriodChangeBlock: BigInt!
162161
lastPeriodChangeBlockNumber: BigInt!
163162
rounds: [Round!]! @derivedFrom(field: "dispute")
@@ -193,7 +192,7 @@ type Draw @entity(immutable: true) {
193192
dispute: Dispute!
194193
round: Round!
195194
juror: User!
196-
voteID: BigInt!
195+
voteIDNum: BigInt!
197196
vote: Vote @derivedFrom(field: "draw")
198197
drawNotificationIndex: BigInt
199198
}

subgraph/src/KlerosCore.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -134,14 +134,13 @@ export function handleNewPeriod(event: NewPeriod): void {
134134
counter.counter = BigInt.fromI32(0);
135135
}
136136
dispute.periodNotificationIndex = counter.counter;
137-
const contract = KlerosCore.bind(event.address);
138-
const courtContractState = contract.getTimesPerPeriod(BigInt.fromString(dispute.court));
139-
dispute.periodDeadline = event.block.timestamp.plus(courtContractState[event.params._period]);
140137
counter.counter = counter.counter.plus(ONE);
141138
counter.save();
142139
dispute.lastPeriodChangeBlockNumber = event.block.number;
143140
if (newPeriod !== "execution") {
144-
dispute.periodDeadline = event.block.timestamp.plus(court.timesPerPeriod[event.params._period]);
141+
const contract = KlerosCore.bind(event.address);
142+
const courtContractState = contract.getTimesPerPeriod(BigInt.fromString(dispute.court));
143+
dispute.periodDeadline = event.block.timestamp.plus(courtContractState[event.params._period]);
145144
} else {
146145
dispute.periodDeadline = BigInt.fromU64(U64.MAX_VALUE);
147146
}

subgraph/src/entities/Dispute.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ export function createDisputeFromEvent(event: DisputeCreation): void {
1717
dispute.currentRuling = ZERO;
1818
dispute.tied = true;
1919
dispute.overridden = false;
20-
dispute.users = [];
2120
dispute.lastPeriodChangeTs = event.block.timestamp;
2221
dispute.lastPeriodChangeBlock = event.block.timestamp;
2322
dispute.lastPeriodChangeBlockNumber = event.block.number;

subgraph/src/entities/Draw.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,6 @@ export function createDrawFromEvent(event: DrawEvent): void {
2727
draw.dispute = disputeID;
2828
draw.round = roundID;
2929
draw.juror = event.params._address.toHexString();
30-
draw.voteID = voteID;
30+
draw.voteIDNum = voteID;
3131
draw.save();
3232
}

subgraph/src/entities/User.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,6 @@ export function addUserActiveDispute(id: string, disputeID: string): void {
3535
return;
3636
}
3737
user.disputes = user.disputes.concat([disputeID]);
38-
const dispute = Dispute.load(disputeID);
39-
if (!dispute) {
40-
log.error("Dispute {} not found", [disputeID]);
41-
return;
42-
} else {
43-
dispute.users.push(id);
44-
dispute.save();
45-
}
46-
4738
user.activeDisputes = user.activeDisputes.plus(ONE);
4839
user.totalDisputes = user.totalDisputes.plus(ONE);
4940
user.save();

0 commit comments

Comments
 (0)