Skip to content

Commit

Permalink
update: handle event
Browse files Browse the repository at this point in the history
  • Loading branch information
radzionc committed Oct 6, 2023
1 parent e29fc0f commit 1ed1db5
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions indexers/enterprise/src/collectors/events/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,15 @@ class EnterpriseEventCollector implements Runnable {
: undefined;
},
onEvent: (event) => {
console.log('Detected event: ', event);
if (event.contract === 'enterprise-factory' && event.action === 'instantiate_dao') {
if (event.payload['dao_address']) {
this.enterpriseAddresses.push(event.payload['dao_address']);
if (event.contract === 'enterprise-factory') {
const isDaoCreatinEvent = ['instantiate_dao', 'create_dao'].includes(event.action);
if (!isDaoCreatinEvent) return;

console.log('Detected dao creation event: ', event);
const daoAddress = event.payload['dao_address'] || event.payload['_contract_address'];
if (daoAddress) {
console.log('Added dao address: ', daoAddress);
this.enterpriseAddresses.push(daoAddress);
}
}
},
Expand Down

0 comments on commit 1ed1db5

Please sign in to comment.