1

Suppose I have two different contracts, and I implement an event in each one of them.

If I use the same event name in both contracts, will it make it more difficult (or even impossible) to filter the events of a specific contract?

Should I (or would I be better off) using a unique name for each event?

For all it matters, I am using web3.js from the client side.

Thank you!

2

If the two contracts don't inherit from each other and are deployed as separate contracts at separate addresses, it should not be a problem.

  • Thank you. What if a function in contract A calls a function in contract B? On the client side, the receipt logs appear to contain both events. If they have the same name, then the method that I use for reading a specific event becomes "pretty ugly", since it needs to rely on the order in which the events were emitted. At least that's the case in web3.js, when I parse the transaction receipt. Am I missing something here? – goodvibration Oct 19 '18 at 8:16
  • I think you should open a new question which includes the code you are using to get events – Henk Oct 19 '18 at 14:12

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.