Skip to content

contracts(loan_manager): collateral seizure does not emit a LoanSeized event that matches the indexer parser format #667

@ogazboiz

Description

@ogazboiz

Join our community: https://t.me/+DOylgFv1jyJlNzM0

Description

The event indexer in backend/src/services/eventIndexer.ts has a parser for a Seized event. If the contract emits this event under a different name (e.g., CollateralSeized, LoanDefaulted with a sub-type, or a different topic structure), the parser will never match it and seized loans will not be reflected in the database.

A mismatch between the event name in contracts/loan_manager/src/events.rs and the parser key in eventIndexer.ts means seized collateral is invisible to the backend.

Expected Behavior

  1. Audit contracts/loan_manager/src/events.rs to confirm the exact event topic for collateral seizure
  2. Verify the event parser in eventIndexer.ts uses the same exact string as the contract emits
  3. Add an integration test that runs the full flow: seize collateral on a test contract, run the indexer, and verify the loan status in the DB is updated to Defaulted

Impact

Medium. If seized events are missed, defaulted loans show as still active in the UI and the borrower's credit score is never penalized.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions