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!

1 Answer 1

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.

2
  • 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? Commented Oct 19, 2018 at 8:16
  • I think you should open a new question which includes the code you are using to get events
    – Henk
    Commented Oct 19, 2018 at 14:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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