Skip to content

Commit 47bf789

Browse files
Merge pull request #297 from graphprotocol/juanmardefago/horizon-dispute-period
feat: added DisputePeriodSet handler
2 parents 6fc84e1 + 2173931 commit 47bf789

File tree

4 files changed

+13
-0
lines changed

4 files changed

+13
-0
lines changed

schema.graphql

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,8 @@ type GraphNetwork @entity(immutable: false) {
225225
fishermanRewardCut: Int!
226226
"Maximum Penalty to Indexer on successful disputes for indexing disputes. Percentage of the indexer's stake snapshot (own stake plus delegated). In parts per million"
227227
maxSlashingCut: Int!
228+
"Dispute period in seconds"
229+
disputePeriod: BigInt!
228230

229231
# Bridge totals (Only available on L1 networks)
230232
"Total amount of GRT deposited to the L1 gateway. Note that the actual amount claimed in L2 might be lower due to tickets not redeemed."

src/mappings/helpers/helpers.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -781,6 +781,7 @@ export function createOrLoadGraphNetwork(
781781
graphNetwork.fishermanRewardPercentage = 0
782782
graphNetwork.fishermanRewardCut = 0
783783
graphNetwork.maxSlashingCut = 0
784+
graphNetwork.disputePeriod = BigInt.fromI32(0)
784785

785786
graphNetwork.totalGRTDeposited = BigInt.fromI32(0)
786787
graphNetwork.totalGRTDepositedConfirmed = BigInt.fromI32(0)

src/mappings/horizonDisputeManager.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import {
1111
FishermanRewardCutSet,
1212
MaxSlashingCutSet,
1313
DisputeCancelled,
14+
DisputePeriodSet,
1415
} from '../types/HorizonDisputeManager/HorizonDisputeManager'
1516
import { createOrLoadGraphNetwork } from './helpers/helpers'
1617

@@ -195,3 +196,10 @@ export function handleMaxSlashingCutSet(event: MaxSlashingCutSet): void {
195196
graphNetwork.save()
196197
}
197198

199+
// Handles DisputePeriodSet events
200+
export function handleDisputePeriodSet(event: DisputePeriodSet): void {
201+
let graphNetwork = createOrLoadGraphNetwork(event.block.number, event.address)
202+
graphNetwork.disputePeriod = event.params.disputePeriod
203+
graphNetwork.save()
204+
}
205+

subgraph.template.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -562,6 +562,8 @@ dataSources:
562562
handler: handleFishermanRewardCutSet
563563
- event: MaxSlashingCutSet(uint32)
564564
handler: handleMaxSlashingCutSet
565+
- event: DisputePeriodSet(uint64)
566+
handler: handleDisputePeriodSet
565567
- kind: ethereum/contract
566568
name: Curation
567569
network: {{network}}

0 commit comments

Comments
 (0)