Refactor/dev 141 refactor generic message on notification system#189
Merged
LeonardoVieira1630 merged 6 commits intoOct 20, 2025
Conversation
Replace generic voting power messages with directional variants: - Split `generic.changed` into `generic.increased` and `generic.decreased` - Remove `generic.activity` (was used only for delta=0, now uses increased) This makes it immediately clear whether voting power went up or down, improving UX by removing ambiguity from the notification text. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
…r messages Update voting power trigger handler to: - Use directional messages (increased/decreased) based on delta sign - Include `address` in metadata for transfer and generic messages - Enable ENS name resolution in consumer services This fixes the issue where wallet addresses in transfer and generic voting power notifications were not being resolved to ENS names. Before: "⚡ Voting power changed for 0x1f3d...0591 in SCR!" After: "⚡ Voting power increased for gov.blockful.eth in SCR!" 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Update tests to: - Expect "increased" instead of "changed" for positive/zero deltas - Expect "decreased" for negative deltas - Add new test for decreased notification - Verify metadata includes address field for ENS resolution (transfer & generic) All 21 tests passing. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
pikonha
approved these changes
Oct 20, 2025
Previously, dispatcher was replacing address placeholders ({{address}},
{{delegator}}, etc.) with raw Ethereum addresses before messages reached
the consumer. This prevented ENS name resolution from occurring.
Changes:
- Remove address parameters from replacePlaceholders() calls in:
- vote-confirmation-trigger.service.ts
- voting-power-trigger.service.ts (5 notification types)
- voting-reminder-trigger.service.ts
- Fix metadata keys to match template placeholders:
- vote-confirmation: voterAccountId → address
- voting-reminder: voterAddress → address
- Update unit test assertions to verify placeholders and metadata
Now placeholders remain in messages sent to consumer, which resolves
them to ENS names (e.g., vitalik.eth) using metadata.addresses.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Fixed two issues in ENS name resolution:
1. Placeholder replacement only replaced first occurrence
- Changed from .replace() to regex with global flag
- Templates with multiple {{address}} now fully resolve
- Example: "vitalik.eth voted... vitalik.eth cast vote"
(instead of "vitalik.eth voted... {{address}} cast vote")
2. Lowercase addresses failed ENS lookup
- Added getAddress() to convert to EIP-55 checksum format
- Viem's getEnsName() requires proper checksum addresses
- Now handles addresses from database (stored as lowercase)
Files changed:
- SlackBotService: Use regex global replacement
- TelegramBotService: Use regex global replacement
- EnsResolverService: Add checksum conversion before lookup
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Updated test fixtures to use real Ethereum addresses with ENS names, enabling visual verification of ENS resolution with SEND_REAL_SLACK=true. Changes: - Updated test constants with real addresses: - p1: vitalik.eth (0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045) - p2: nick.eth (0x225f137127d9067788314bc7fcc1f36746a3c3B5) - p3: brantly.eth (0x983110309620d911731ac0932219af06091b6744) - p4: firefish.eth (0xb8c2C29ee19D8307cb7255e1Cd9CbDE883A267d5) - Updated MockEnsResolverService with real ENS mappings: - Added theblackbelt.eth for testing - Fixed test assertions to expect ENS names instead of raw addresses: - Delegation tests: expect "vitalik.eth" not "0xd8dA..." - Non-voting tests: expect "firefish.eth" not "nick.eth" - Voting power tests: avoid auto-delegation by using different addresses - Voting reminder tests kept with fake addresses to avoid auto-delegation scenarios in test logic All tests pass with ENS resolution working correctly. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
807ccc1
into
refactor/DEV-133_notification_system_slackUI
4 checks passed
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.
Summary
Improves voting power change notifications by making the direction clear (increased/decreased) and fixing ENS name resolution for wallet addresses.
Changes
1. Clearer Message Direction
Split generic messages into directional variants:
generic.increased- for positive deltasgeneric.decreased- for negative deltas2. ENS Resolution Fix
Added
addressfield to metadata for transfer and generic voting power messages, enabling ENS name resolution in consumer services.Root cause: Metadata wasn't including the wallet address, so the consumer couldn't resolve ENS names for these notification types.
Testing