Summary
The macro extracts events by walking the AST of impl block methods looking for abi::emit() calls. This misses events emitted by:
- Helper functions outside the impl block
- Trait default implementations (e.g.,
OwnableUpgradeable::transfer_ownership emits OwnershipTransferred)
Possible Solution
Add an emits attribute to manually register events on trait impl blocks:
#[contract(expose = [owner, transfer_ownership, renounce_ownership],
emits = [
(events::OwnershipTransferred::OWNERSHIP_TRANSFERRED, events::OwnershipTransferred),
(events::OwnershipTransferred::OWNERSHIP_RENOUNCED, events::OwnershipTransferred),
])]
impl OwnableUpgradeable for TestBridge { ... }
Each tuple is (topic_path, EventType) where topic can be a const path or string literal.
Summary
The macro extracts events by walking the AST of impl block methods looking for
abi::emit()calls. This misses events emitted by:OwnableUpgradeable::transfer_ownershipemitsOwnershipTransferred)Possible Solution
Add an
emitsattribute to manually register events on trait impl blocks:Each tuple is
(topic_path, EventType)where topic can be a const path or string literal.