Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not emit events from AbstractTBTCDepositor #786

Merged
merged 1 commit into from
Feb 14, 2024
Merged

Conversation

pdyraga
Copy link
Member

@pdyraga pdyraga commented Feb 14, 2024

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 than DepositInitialized and DepositFinalized 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 - say DepositFinalized - when testing the contract whether the event was emitted, Hardhat will complain this event does not exist in the contract.

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
than DepositInitialized and DepositFinalized even though that is exactly what
happens :)
Copy link

Solidity API documentation preview available in the artifacts of the https://github.com/keep-network/tbtc-v2/actions/runs/7899785622 check.

@pdyraga pdyraga requested a review from nkuba February 14, 2024 10:50
@lukasz-zimnoch lukasz-zimnoch merged commit e3c317e into main Feb 14, 2024
38 checks passed
@lukasz-zimnoch lukasz-zimnoch deleted the no-events branch February 14, 2024 11:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants