Skip to content

fix: populate investor_projects via vault event polling - #498

Open
Netty-kun wants to merge 4 commits into
Heliobond:mainfrom
Netty-kun:fix/issue-337-notification-service-investor-projects-index-is
Open

fix: populate investor_projects via vault event polling#498
Netty-kun wants to merge 4 commits into
Heliobond:mainfrom
Netty-kun:fix/issue-337-notification-service-investor-projects-index-is

Conversation

@Netty-kun

Copy link
Copy Markdown

Overview

This PR fixes the notification service being a no-op in production by adding a second event poller. When vault_contract_id is set, the poller reads the configured vault contract, decodes Deposit and ProjectFunded events, and calls store.recordInvestment to populate the investor_projects index. This ensures getInvestorsForProject returns recipients and notifyInvestors is actually invoked on investment activity.

Related Issue

Closes #

Changes

🔌 Vault Event Poller

  • [MODIFY] notification-service/src/config.ts

    • vault_contract_id is now read from the environment and exposed on the config object.
    • Poller registration is conditional on this value being present.
  • [MODIFY] notification-service/src/types.ts

    • Add Deposit and ProjectFunded decoded event payload types.
    • Add a VaultEvent union to safely handle both event kinds.
  • [MODIFY] notification-service/src/listener.ts

    • Add pollVaultEvents, mirroring pollScoreChanges, that polls vault_contract_id, decodes matching vault events, and calls store.recordInvestment.
  • [MODIFY] notification-service/src/index.ts

    • When config.vault_contract_id is set, start the vault poller alongside the existing score poller.
  • [MODIFY] notification-service/src/listener.test.ts

    • Add integration coverage: vault events seeded only through the new poller result in a ScoreChanged event that reaches the investor.

Verification Results

npm test -- notification-service/src/listener.test.ts
✅ 1 passed (integration: vault events → investor_projects → ScoreChanged)

npm run build
✅ TypeScript compilation passes

Live acceptance check:
✅ vault_contract_id, when set, is used to poll and decode vault events
✅ Deposit/ProjectFunded events call store.recordInvestment
✅ investor_projects is populated and notifyInvestors receives recipients
Acceptance Criteria Status
vault_contract_id, when set, is used to poll and decode vault events ✅ Poller registered when config value present
A decoded Deposit/ProjectFunded event results in a call to store.recordInvestment ✅ Integration test verifies recordInvestment is invoked
Integration test: seeding only via the new vault listener (not recordInvestment called directly) results in a ScoreChanged event correctly notifying that investor ✅ Test passes — no direct recordInvestment calls

Closes #337

@drips-wave

drips-wave Bot commented Aug 31, 2026

Copy link
Copy Markdown

@Netty-kun Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

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.

notification-service: investor_projects index is never populated in production — vault Deposit/ProjectFunded events are never ingested

1 participant