Skip to content

contracts(loan_manager): no event emitted for loan cancellation/rejection, indexer cannot track cancelled loans #656

@ogazboiz

Description

@ogazboiz

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

Description

LoanStatus in contracts/loan_manager/src/lib.rs includes Cancelled and Rejected statuses. However, the events.rs file does not appear to emit a LoanCancelled or LoanRejected event when a loan moves into these terminal states.

The backend indexer in eventIndexer.ts only tracks events that are emitted by the contract. Without LoanCancelled and LoanRejected events, the indexer cannot update loan status in the database. Borrowers would see their cancelled or rejected loans still showing as Pending in the UI indefinitely.

Expected Behavior

Emit events for all loan status transitions, including:

  • LoanCancelled { loan_id, borrower, cancelled_at_ledger }
  • LoanRejected { loan_id, borrower, rejected_at_ledger, reason }

Then add parsers for these events in backend/src/services/eventIndexer.ts.

Impact

Medium. Borrowers cannot see their loan was rejected or cancelled in the UI. They may keep trying to interact with a loan that is in a terminal state.

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