Skip to content

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

Description

@abayomicornelius

Area

Notification Service / Reliability (Correctness)

Complexity

Hard

File(s)

notification-service/src/db.ts (recordInvestment, line 155); notification-service/src/listener.ts; notification-service/src/index.ts; notification-service/src/config.ts (vault_contract_id, line 30)

Problem

docs/NOTIFICATIONS.md states the investor_projects index is "built by monitoring Deposit events from the InvestmentVault" and ProjectFunded events. Store.recordInvestment exists to populate that table, but it is called only from pipeline.test.ts — nowhere in listener.ts or index.ts is there any code that polls the vault contract or decodes Deposit/ProjectFunded events. VAULT_CONTRACT_ID is accepted in config and documented in .env.example, but nothing in src/ actually reads config.vault_contract_id. In a real deployment this means getInvestorsForProject always returns [], so notifyInvestors is never invoked with any recipients — the notification system is a no-op end-to-end until investors are seeded some other way.

Scope

In:

  • A second poller (mirroring pollScoreChanges) against vault_contract_id that decodes Deposit/ProjectFunded events and calls recordInvestment.

Out:

  • Full investment-vault economics/share-accounting logic — only the identity linkage (investor <-> project) is needed here.

Acceptance Criteria

  • vault_contract_id, when set, is used to poll and decode vault events
  • A decoded Deposit/ProjectFunded event results in a call to store.recordInvestment
  • Integration test: seeding only via the new vault listener (not recordInvestment called directly) results in a ScoreChanged event correctly notifying that investor

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions