feat(contract): filter events by notification type#73
Merged
Abd-Standard merged 1 commit intoJun 19, 2026
Merged
Conversation
Off-chain consumers could not selectively subscribe to specific notification categories because every event looked the same beyond its name. This adds a NotificationCategory (Group / Admin / Financial) published as a trailing, indexed topic on every emitted event so listeners and indexers can filter by category without decoding payloads. - Introduce NotificationCategory enum in base::events. - Attach the category as the last topic of every contract event. - Keep the change backward compatible: the event name remains the first topic and all pre-existing topics/data keep their positions; the new category topic is simply appended and ignored by existing listeners. - Add tests covering each category and a subscriber that filters by type.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Closes #68
Off-chain consumers could not selectively subscribe to specific notification categories because every event looked the same beyond its name. This introduces support for filtering events by notification type to reduce unnecessary processing.
What changed
NotificationCategoryenum (Group/Admin/Financial) inbase::events, published as an indexed event topic so consumers can subscribe to / filter by whole categories without decoding the payload.autoshare_logic.rsset the appropriate value:Group—AutoshareCreated,AutoshareUpdated,GroupActivated,GroupDeactivatedAdmin—ContractPaused,ContractUnpaused,AdminTransferredFinancial—Withdrawaltopic[0]) and prior topics/data are unaffected — they simply ignore the extra topic.tests/notification_test.rscovering each category, a subscriber that filters events by type, and a backward-compatibility shape assertion (event name first, original topics intact, category appended, data payload preserved).Verification
cargo test --workspace --all-features— all 94 tests pass.cargo fmt --all -- --check— clean.🤖 Generated with Claude Code