Catch no matching event errors while parsing logs
This commit is contained in:
parent
9c25a4c717
commit
35350ffdc7
@ -513,20 +513,34 @@ export class Indexer implements IndexerInterface {
|
|||||||
console.timeEnd('time:indexer#processBlockAfterEvents-dump_subgraph_state');
|
console.timeEnd('time:indexer#processBlockAfterEvents-dump_subgraph_state');
|
||||||
}
|
}
|
||||||
|
|
||||||
parseEventNameAndArgs (kind: string, logObj: any): any {
|
parseEventNameAndArgs (kind: string, logObj: any): { eventParsed: boolean, eventDetails: any } {
|
||||||
const { topics, data } = logObj;
|
const { topics, data } = logObj;
|
||||||
|
|
||||||
const contract = this._contractMap.get(kind);
|
const contract = this._contractMap.get(kind);
|
||||||
assert(contract);
|
assert(contract);
|
||||||
|
|
||||||
const logDescription = contract.parseLog({ data, topics });
|
let logDescription: ethers.utils.LogDescription;
|
||||||
|
try {
|
||||||
|
logDescription = contract.parseLog({ data, topics });
|
||||||
|
} catch (err) {
|
||||||
|
// Return if no matching event found
|
||||||
|
if ((err as Error).message.includes('no matching event')) {
|
||||||
|
log(`WARNING: Skipping event for contract ${kind} as no matching event found in the ABI`);
|
||||||
|
return { eventParsed: false, eventDetails: {} };
|
||||||
|
}
|
||||||
|
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
|
||||||
const { eventName, eventInfo, eventSignature } = this._baseIndexer.parseEvent(logDescription);
|
const { eventName, eventInfo, eventSignature } = this._baseIndexer.parseEvent(logDescription);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
eventName,
|
eventParsed: true,
|
||||||
eventInfo,
|
eventDetails: {
|
||||||
eventSignature
|
eventName,
|
||||||
|
eventInfo,
|
||||||
|
eventSignature
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user