Skip to content

Commit 810c009

Browse files
committed
fix(subgraph): fix-incorrect-registry-counters
1 parent a22895a commit 810c009

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

subgraph/src/Curate.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,17 +84,17 @@ export function handleRequestSubmitted(event: RequestSubmitted): void {
8484
item.latestRequester = ensureUser(event.transaction.from.toHexString()).id;
8585
item.latestRequestResolutionTime = ZERO;
8686
item.latestRequestSubmissionTime = event.block.timestamp;
87+
item.save();
8788

8889
let newStatus = getExtendedStatus(item.status, item.disputed);
8990

9091
if (itemInfo.value1.equals(ONE)) {
9192
registry.numberOfPending = registry.numberOfPending.plus(ONE);
93+
registry.save();
9294
} else {
9395
updateCounters(prevStatus, newStatus, event.address);
9496
}
9597

96-
registry.save();
97-
item.save();
9898
createRequestFromEvent(event);
9999
}
100100

subgraph/src/entities/Request.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,7 @@ export function createRequestFromEvent(event: RequestSubmitted): void {
1414
log.error(`Item for graphItemID {} not found.`, [graphItemID]);
1515
return;
1616
}
17-
let registry = Registry.load(event.address.toHexString());
18-
if (!registry) {
19-
log.error(`Registry at address {} not found`, [event.address.toHexString()]);
20-
return;
21-
}
17+
2218
const requestIndex = item.numberOfRequests.minus(ONE);
2319
const requestID = graphItemID + "-" + requestIndex.toString();
2420
const request = new Request(requestID);
@@ -27,7 +23,7 @@ export function createRequestFromEvent(event: RequestSubmitted): void {
2723
request.arbitratorExtraData = curate.getArbitratorExtraData();
2824
request.requester = ensureUser(event.transaction.from.toHexString()).id;
2925
request.item = item.id;
30-
request.registry = registry.id;
26+
request.registry = event.address.toHexString();
3127
request.registryAddress = event.address;
3228
request.resolutionTime = ZERO;
3329
request.disputeOutcome = NONE;

0 commit comments

Comments
 (0)