From d8ed3e823f46bb041da23a8c9962836f8abb4313 Mon Sep 17 00:00:00 2001 From: kemuru <102478601+kemuru@users.noreply.github.com> Date: Fri, 24 Apr 2026 19:39:20 +0200 Subject: [PATCH 1/2] feat: tx hashes --- schema.graphql | 8 ++++++++ src/LightGeneralizedTCRMapping.ts | 14 ++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/schema.graphql b/schema.graphql index ba94bad..b628a0d 100644 --- a/schema.graphql +++ b/schema.graphql @@ -263,6 +263,10 @@ type LRequest @entity { creationTx: Bytes! "The hash of the transaction that solved this request." resolutionTx: Bytes + "The hash of the transaction that challenged this request. Null if never challenged." + txHashChallenge: Bytes + "The block timestamp when this request was challenged. More accurate than falling back to the challenger's earliest evidence timestamp." + challengeTime: BigInt } type LRound @entity { @@ -305,6 +309,10 @@ type LRound @entity { appealed: Boolean! "When this round was appealed, if it was appealed" appealedAt: BigInt + "The tx hash of the contribution that fully funded the requester's appeal in this round. Only set for appeal rounds (roundID > 0)." + txHashAppealFundedRequester: Bytes + "The tx hash of the contribution that fully funded the challenger's appeal in this round. Only set for appeal rounds (roundID > 0)." + txHashAppealFundedChallenger: Bytes } type LContribution @entity { diff --git a/src/LightGeneralizedTCRMapping.ts b/src/LightGeneralizedTCRMapping.ts index b1eeb85..be41755 100644 --- a/src/LightGeneralizedTCRMapping.ts +++ b/src/LightGeneralizedTCRMapping.ts @@ -448,11 +448,23 @@ export function handleContribution(event: Contribution): void { event.params._roundID, ); + // Capture the previous fully-funded state so we can detect the transition + // from "partially funded" → "fully funded" and record the tx that caused it. + let wasFullyFundedRequester = round.hasPaidRequester; + let wasFullyFundedChallenger = round.hasPaidChallenger; + round.amountPaidRequester = roundInfo.value1[REQUESTER_CODE]; round.amountPaidChallenger = roundInfo.value1[CHALLENGER_CODE]; round.hasPaidRequester = roundInfo.value2[REQUESTER_CODE]; round.hasPaidChallenger = roundInfo.value2[CHALLENGER_CODE]; round.feeRewards = roundInfo.value3; + + if (!wasFullyFundedRequester && round.hasPaidRequester) { + round.txHashAppealFundedRequester = event.transaction.hash; + } + if (!wasFullyFundedChallenger && round.hasPaidChallenger) { + round.txHashAppealFundedChallenger = event.transaction.hash; + } } if (event.params._side === 1) { @@ -515,6 +527,8 @@ export function handleRequestChallenged(event: Dispute): void { request.challenger = requestInfo.value4[2]; request.numberOfRounds = BigInt.fromI32(2); request.disputeID = event.params._disputeID; + request.txHashChallenge = event.transaction.hash; + request.challengeTime = event.block.timestamp; let newRoundID = requestID + '-1'; // When a dispute is created, the new round is always id 1 let newRound = buildNewRound(newRoundID, request.id, event.block.timestamp); From 367f3936d9d0846e2347ba82afb393f3e9b62b1e Mon Sep 17 00:00:00 2001 From: kemuru <102478601+kemuru@users.noreply.github.com> Date: Fri, 24 Apr 2026 19:55:54 +0200 Subject: [PATCH 2/2] chore: comment tweaks --- schema.graphql | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/schema.graphql b/schema.graphql index b628a0d..1ab2c76 100644 --- a/schema.graphql +++ b/schema.graphql @@ -263,9 +263,9 @@ type LRequest @entity { creationTx: Bytes! "The hash of the transaction that solved this request." resolutionTx: Bytes - "The hash of the transaction that challenged this request. Null if never challenged." + "The tx hash of the challenge that raised the dispute." txHashChallenge: Bytes - "The block timestamp when this request was challenged. More accurate than falling back to the challenger's earliest evidence timestamp." + "The block timestamp of the challenge." challengeTime: BigInt } @@ -309,9 +309,9 @@ type LRound @entity { appealed: Boolean! "When this round was appealed, if it was appealed" appealedAt: BigInt - "The tx hash of the contribution that fully funded the requester's appeal in this round. Only set for appeal rounds (roundID > 0)." + "The tx hash of the moment the requester's appeal became fully funded." txHashAppealFundedRequester: Bytes - "The tx hash of the contribution that fully funded the challenger's appeal in this round. Only set for appeal rounds (roundID > 0)." + "The tx hash of the moment the challenger's appeal became fully funded." txHashAppealFundedChallenger: Bytes }