Do not emit events from AbstractTBTCDepositor #786
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In all cases considered so far, the child contract emits its own events in the functions calling
_initializeDeposit
and_finalizeDeposit
. The events emitted by child contracts have the advantage of emitting decoded extra data in the parameters. We could emit events from the parent contract as well but they cost gas and we are emitting the same data in child contract events. Also, we sometimes need to be creative in child contracts and come up with other names thanDepositInitialized
andDepositFinalized
even though that is exactly what happens :)Also, lesson learned today: if there is a contract inheriting from
AbstractTBTCDepositor
and declaring an event with the same name - sayDepositFinalized
- when testing the contract whether the event was emitted, Hardhat will complain this event does not exist in the contract.