Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,10 @@ type LRequest @entity {
creationTx: Bytes!
"The hash of the transaction that solved this request."
resolutionTx: Bytes
"The tx hash of the challenge that raised the dispute."
txHashChallenge: Bytes
"The block timestamp of the challenge."
challengeTime: BigInt
}

type LRound @entity {
Expand Down Expand Up @@ -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 moment the requester's appeal became fully funded."
txHashAppealFundedRequester: Bytes
"The tx hash of the moment the challenger's appeal became fully funded."
txHashAppealFundedChallenger: Bytes
}

type LContribution @entity {
Expand Down
14 changes: 14 additions & 0 deletions src/LightGeneralizedTCRMapping.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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);
Expand Down
Loading