Skip to content

feat(contract): filter events by notification type#73

Merged
Abd-Standard merged 1 commit into
Core-Foundry:mainfrom
shaaibu7:feat/event-notification-type-filtering
Jun 19, 2026
Merged

feat(contract): filter events by notification type#73
Abd-Standard merged 1 commit into
Core-Foundry:mainfrom
shaaibu7:feat/event-notification-type-filtering

Conversation

@shaaibu7

Copy link
Copy Markdown
Contributor

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

  • Add notification type metadata to emitted events: a new NotificationCategory enum (Group / Admin / Financial) in base::events, published as an indexed event topic so consumers can subscribe to / filter by whole categories without decoding the payload.
  • Update the event structure: the category is attached as the last topic of every contract event; the publish sites in autoshare_logic.rs set the appropriate value:
    • GroupAutoshareCreated, AutoshareUpdated, GroupActivated, GroupDeactivated
    • AdminContractPaused, ContractUnpaused, AdminTransferred
    • FinancialWithdrawal
  • Backward compatibility: the category is appended as a trailing topic, so the event name stays the first topic and all pre-existing topics/data keep their positions. Existing listeners that read the event name (topic[0]) and prior topics/data are unaffected — they simply ignore the extra topic.
  • Tests: new tests/notification_test.rs covering 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

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.
@Abd-Standard Abd-Standard merged commit 036702f into Core-Foundry:main Jun 19, 2026
0 of 2 checks passed
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.

[CI/CD] Add Automated Accessibility Checks for Frontend

2 participants