diff --git a/packages/eden-watcher/src/indexer.ts b/packages/eden-watcher/src/indexer.ts index 8eedd3db..5a496eca 100644 --- a/packages/eden-watcher/src/indexer.ts +++ b/packages/eden-watcher/src/indexer.ts @@ -51,8 +51,8 @@ import { Slash } from './entity/Slash'; const log = debug('vulcanize:indexer'); const KIND_EDENNETWORK = 'EdenNetwork'; -const KIND_MERKLEDISTRIBUTOR = 'MerkleDistributor'; -const KIND_DISTRIBUTORGOVERNANCE = 'DistributorGovernance'; +const KIND_MERKLEDISTRIBUTOR = 'EdenNetworkDistribution'; +const KIND_DISTRIBUTORGOVERNANCE = 'EdenNetworkGovernance'; const TRANSFER_EVENT = 'Transfer'; const APPROVAL_EVENT = 'Approval'; diff --git a/packages/graph-node/src/watcher.ts b/packages/graph-node/src/watcher.ts index 38b765ab..834398ec 100644 --- a/packages/graph-node/src/watcher.ts +++ b/packages/graph-node/src/watcher.ts @@ -123,16 +123,25 @@ export class GraphWatcher { return; } - // Get event handler based on event signature. - const eventHandler = dataSource.mapping.eventHandlers.find((eventHandler: any) => eventHandler.event === eventSignature); + const { instance: { exports: instanceExports }, contractInterface } = this._dataSourceMap[contract]; + + // Get event handler based on event topic (from event signature). + const eventTopic = contractInterface.getEventTopic(eventSignature); + const eventHandler = dataSource.mapping.eventHandlers.find((eventHandler: any) => { + // The event signature we get from logDescription is different than that given in the subgraph yaml file. + // For eg. event in subgraph.yaml: Stake(indexed address,uint256); from logDescription: Stake(address,uint256) + // ethers.js doesn't recognize the subgraph event signature with indexed keyword before param type. + // Match event topics from cleaned subgraph event signature (Stake(indexed address,uint256) -> Stake(address,uint256)). + const subgraphEventTopic = contractInterface.getEventTopic(eventHandler.event.replace(/indexed /g, '')); + + return subgraphEventTopic === eventTopic; + }); if (!eventHandler) { log(`No handler configured in subgraph for event ${eventSignature}`); return; } - const { instance: { exports: instanceExports }, contractInterface } = this._dataSourceMap[contract]; - const eventFragment = contractInterface.getEvent(eventSignature); const data = {