@@ -12,19 +12,12 @@ import {
1212 TokenAndETHShift as TokenAndETHShiftEvent ,
1313} from "../generated/KlerosCore/KlerosCore" ;
1414import { ZERO , ONE } from "./utils" ;
15- import {
16- createCourtFromEvent ,
17- getFeeForJuror ,
18- loadCourtWithLogs ,
19- } from "./entities/Court" ;
15+ import { createCourtFromEvent , getFeeForJuror } from "./entities/Court" ;
2016import {
2117 createDisputeKitFromEvent ,
2218 filterSupportedDisputeKits ,
2319} from "./entities/DisputeKit" ;
24- import {
25- createDisputeFromEvent ,
26- loadDisputeWithLogs ,
27- } from "./entities/Dispute" ;
20+ import { createDisputeFromEvent } from "./entities/Dispute" ;
2821import { createRoundFromRoundInfo } from "./entities/Round" ;
2922import {
3023 updateCases ,
@@ -41,6 +34,7 @@ import {
4134import { createDrawFromEvent } from "./entities/Draw" ;
4235import { createTokenAndEthShiftFromEvent } from "./entities/TokenAndEthShift" ;
4336import { updateArbitrableCases } from "./entities/Arbitrable" ;
37+ import { Court , Dispute } from "../generated/schema" ;
4438
4539function getPeriodName ( index : i32 ) : string {
4640 const periodArray = [ "evidence" , "commit" , "vote" , "appeal" , "execution" ] ;
@@ -54,7 +48,7 @@ export function handleCourtCreated(event: CourtCreated): void {
5448export function handleCourtModified ( event : CourtModified ) : void {
5549 const contract = KlerosCore . bind ( event . address ) ;
5650 const courtContractState = contract . courts ( event . params . _courtID ) ;
57- const court = loadCourtWithLogs ( event . params . _courtID . toString ( ) ) ;
51+ const court = Court . load ( event . params . _courtID . toString ( ) ) ;
5852 if ( ! court ) return ;
5953 court . hiddenVotes = courtContractState . value1 ;
6054 court . minStake = courtContractState . value2 ;
@@ -70,7 +64,7 @@ export function handleDisputeKitCreated(event: DisputeKitCreated): void {
7064}
7165
7266export function handleDisputeKitEnabled ( event : DisputeKitEnabled ) : void {
73- const court = loadCourtWithLogs ( event . params . _courtID . toString ( ) ) ;
67+ const court = Court . load ( event . params . _courtID . toString ( ) ) ;
7468 if ( ! court ) return ;
7569 const isEnable = event . params . _enable ;
7670 const disputeKitID = event . params . _disputeKitID . toString ( ) ;
@@ -85,7 +79,7 @@ export function handleDisputeCreation(event: DisputeCreation): void {
8579 const disputeID = event . params . _disputeID ;
8680 const disputeStorage = contract . disputes ( disputeID ) ;
8781 const courtID = disputeStorage . value0 . toString ( ) ;
88- const court = loadCourtWithLogs ( courtID ) ;
82+ const court = Court . load ( courtID ) ;
8983 if ( ! court ) return ;
9084 court . numberDisputes = court . numberDisputes . plus ( ONE ) ;
9185 court . save ( ) ;
@@ -99,7 +93,7 @@ export function handleDisputeCreation(event: DisputeCreation): void {
9993
10094export function handleNewPeriod ( event : NewPeriod ) : void {
10195 const disputeID = event . params . _disputeID . toString ( ) ;
102- const dispute = loadDisputeWithLogs ( disputeID ) ;
96+ const dispute = Dispute . load ( disputeID ) ;
10397 if ( ! dispute ) return ;
10498 dispute . period = getPeriodName ( event . params . _period ) ;
10599 dispute . lastPeriodChange = event . block . timestamp ;
@@ -109,7 +103,7 @@ export function handleNewPeriod(event: NewPeriod): void {
109103export function handleAppealDecision ( event : AppealDecision ) : void {
110104 const contract = KlerosCore . bind ( event . address ) ;
111105 const disputeID = event . params . _disputeID ;
112- const dispute = loadDisputeWithLogs ( disputeID . toString ( ) ) ;
106+ const dispute = Dispute . load ( disputeID . toString ( ) ) ;
113107 if ( ! dispute ) return ;
114108 const newRoundIndex = dispute . currentRoundIndex . plus ( ONE ) ;
115109 const roundID = `${ disputeID } -${ newRoundIndex . toString ( ) } ` ;
@@ -124,7 +118,7 @@ export function handleAppealDecision(event: AppealDecision): void {
124118export function handleDraw ( event : DrawEvent ) : void {
125119 createDrawFromEvent ( event ) ;
126120 const disputeID = event . params . _disputeID . toString ( ) ;
127- const dispute = loadDisputeWithLogs ( disputeID ) ;
121+ const dispute = Dispute . load ( disputeID ) ;
128122 if ( ! dispute ) return ;
129123 const contract = KlerosCore . bind ( event . address ) ;
130124 updateJurorStake (
@@ -164,9 +158,9 @@ export function handleTokenAndETHShift(event: TokenAndETHShiftEvent): void {
164158 updateRedistributedPNK ( tokenAmount , event . block . timestamp ) ;
165159 }
166160 updatePaidETH ( ethAmount , event . block . timestamp ) ;
167- const dispute = loadDisputeWithLogs ( disputeID ) ;
161+ const dispute = Dispute . load ( disputeID ) ;
168162 if ( ! dispute ) return ;
169- const court = loadCourtWithLogs ( dispute . court ) ;
163+ const court = Court . load ( dispute . court ) ;
170164 if ( ! court ) return ;
171165 updateJurorStake (
172166 jurorAddress ,
0 commit comments