Im implementing a contract with imported subcontracts of my own. I'm trying to understand if I can receive the events emitted by the imported contracts, but since contracts can be inherit other ones or called all the information I'm searching for is a little bit fuzzed.

Are those events received in the main contract? Please be kind, I dont have much experience with the smart contract transactional model.



No, it's not possible. You can subscribe fo events only in two ways with web3js:

  1. web3.eth.subscribe('logs', { address: 'yourContractAddress' }) (https://web3js.readthedocs.io/en/v1.2.0/web3-eth-subscribe.html)

  2. myContract.events.allEvents or myContract.getPastEvents (https://web3js.readthedocs.io/en/v1.2.0/web3-eth-contract.html#events-allevents)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.