Skip to content

Loan lifecycle scheduled jobs: default detection, interest accrual, yield distribution #134

Description

@Josue19-08

🔖 Title

Loan lifecycle scheduled jobs: default detection, interest accrual, yield distribution


📄 Description

src/jobs/ already has blockchain-indexer, transaction-status-checker, and loan-payment-reminder as BullMQ repeatable jobs. Missing pieces for a complete loan lifecycle: automatic default marking once the grace period elapses, accrued-interest calculation, and yield distribution to liquidity providers.


✅ Tasks to complete

  • loan-default-detector job — daily scan for loans past grace period, mark as defaulted and trigger on-chain default flow
  • interest-accrual job — periodic accrued interest calculation and persistence per active loan
  • yield-distribution job — periodic yield distribution to LPs based on pool performance
  • Queue + processor + module for each, following the existing pattern in src/jobs/
  • Idempotency safeguards (avoid double-processing on retry)
  • Unit tests per processor
  • Integration tests for full job execution against test data
  • Logging/observability for job runs

📚 Documentation/context for AI

(This link never should removed)
https://github.com/TrustUp-app/TrustUp-API/tree/main/docs


🗒️ Additional notes

Follow the existing BullMQ repeatable-job pattern used by blockchain-indexer/transaction-status-checker/loan-payment-reminder — do not introduce @nestjs/schedule @Cron decorators, which are not used elsewhere in this repo.

Metadata

Metadata

Assignees

No one assigned

    Labels

    GrantFox OSSIssue tracked in GrantFox OSSMaybe RewardedIssue may be eligible for a GrantFox rewardThird CampaignCampaign: Third Campaign

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions