@@ -12,6 +12,7 @@ import {
1212 MaxSlashingCutSet ,
1313 DisputeCancelled ,
1414 DisputePeriodSet ,
15+ LegacyDisputeCreated ,
1516} from '../types/HorizonDisputeManager/HorizonDisputeManager'
1617import { createOrLoadGraphNetwork } from './helpers/helpers'
1718
@@ -32,6 +33,7 @@ const STATUS_CANCELLED = 'Cancelled'
3233const TYPE_SINGLE_QUERY = 'SingleQuery'
3334const TYPE_INDEXING = 'Indexing'
3435const TYPE_CONFLICTING = 'Conflicting'
36+ const TYPE_LEGACY = 'Legacy'
3537
3638// This handles Single query and Conflicting disputes
3739export function handleQueryDisputeCreated ( event : QueryDisputeCreated ) : void {
@@ -42,6 +44,7 @@ export function handleQueryDisputeCreated(event: QueryDisputeCreated): void {
4244 dispute . deposit = event . params . tokens
4345 dispute . isLegacy = false
4446 dispute . createdAt = event . block . timestamp . toI32 ( )
47+ dispute . cancellableAt = event . params . cancellableAt . toI32 ( )
4548 dispute . status = STATUS_UNDECIDED
4649 dispute . tokensSlashed = BIGDECIMAL_ZERO
4750 dispute . tokensRewarded = BIGINT_ZERO
@@ -80,6 +83,7 @@ export function handleIndexingDisputeCreated(event: IndexingDisputeCreated): voi
8083 dispute . deposit = event . params . tokens
8184 dispute . isLegacy = false
8285 dispute . createdAt = event . block . timestamp . toI32 ( )
86+ dispute . cancellableAt = event . params . cancellableAt . toI32 ( )
8387 dispute . status = STATUS_UNDECIDED
8488 dispute . tokensSlashed = BigDecimal . fromString ( '0' )
8589 dispute . tokensBurned = BigDecimal . fromString ( '0' )
@@ -91,6 +95,27 @@ export function handleIndexingDisputeCreated(event: IndexingDisputeCreated): voi
9195 dispute . save ( )
9296}
9397
98+ export function handleLegacyDisputeCreated ( event : LegacyDisputeCreated ) : void {
99+ let allocation = Allocation . load ( event . params . allocationId . toHexString ( ) ) !
100+ let id = event . params . disputeId . toHexString ( )
101+ let dispute = new Dispute ( id )
102+ dispute . subgraphDeployment = allocation . subgraphDeployment
103+ dispute . fisherman = event . params . fisherman . toHexString ( )
104+ dispute . deposit = BigInt . fromString ( '0' )
105+ dispute . isLegacy = true
106+ dispute . createdAt = event . block . timestamp . toI32 ( )
107+ dispute . cancellableAt = 0 // Legacy disputes are not cancellable
108+ dispute . status = STATUS_UNDECIDED
109+ dispute . tokensSlashed = BigDecimal . fromString ( '0' )
110+ dispute . tokensBurned = BigDecimal . fromString ( '0' )
111+ dispute . tokensRewarded = BigInt . fromString ( '0' )
112+ dispute . type = TYPE_LEGACY
113+ dispute . indexer = event . params . indexer . toHexString ( )
114+ dispute . allocation = allocation . id
115+ dispute . closedAt = 0
116+ dispute . save ( )
117+ }
118+
94119export function handleDisputeAccepted ( event : DisputeAccepted ) : void {
95120 let id = event . params . disputeId . toHexString ( )
96121 let dispute = Dispute . load ( id ) !
0 commit comments