Hey guys,
I have a factory contract which instantiates other contracts, and I need to watch out for events on those new instantiated contracts. I am currently doing this in my cloud code, however as far as I understand, every tablename has to be different, so after instantiating the first contract, I will not be able to create more events to watch.
As per this answer: Unable to save multiple contract addresses/events to a single table
@cryptokid has suggested writing new table-names in another table, and then proccessing new events using jobs. I am wondering how exactly to do this in a dynamic manner??
Also , it is mentioned to use âcore_addEventsSyncâ to sync all events in the same table. I didnât really understand this part. When exactly am I supposed to use the following syntax:
Moralis.Cloud.run(âcoreservices_addEventSyncâ, options, { useMasterKey: true });
Am I supposed to use it after the âwatchContractEventâ function or is there another way to use it? Also, if I use âcore_addEventsSyncâ, does that mean that I no longer have to use jobs to process events or do I still have to do that?
Thanks!
NOTE: The contract factory will be creating new instances of the contract automatically, so I would require everything to take place. dynamically in cloud code.