Skip to content

fix: resolve #455 #296 #355 #352 in contracts and backend indexer#704

Merged
ogazboiz merged 2 commits intoLabsCrypt:mainfrom
umuewu:codex/fix-455-296-355-352
Apr 26, 2026
Merged

fix: resolve #455 #296 #355 #352 in contracts and backend indexer#704
ogazboiz merged 2 commits intoLabsCrypt:mainfrom
umuewu:codex/fix-455-296-355-352

Conversation

@umuewu
Copy link
Copy Markdown
Contributor

@umuewu umuewu commented Apr 26, 2026

Description

This PR bundles fixes for loan approval liquidity accounting, lending pool share pricing query exposure, and backend multi-contract event indexing so pool/portfolio views stay accurate.

Closes #455
Closes #296
Closes #355
Closes #352

Changes proposed

What were you told to do?

Implement and submit one PR that addresses four open issues: the loan-manager outstanding liquidity check, RemittanceNFT cooldown cleanup on burn, lending-pool share-accounting gaps, and backend event indexing across LoanManager/LendingPool/RemittanceNFT.

What did I do?

LoanManager liquidity commitment tracking

  • Added DataKey::TotalOutstanding(token) tracking in contracts/loan_manager/src/lib.rs.
  • Updated approve_loan() to enforce pool_balance - total_outstanding >= loan.amount before approval.
  • Incremented outstanding on approval and decremented it on full repayment/default paths.
  • Updated refinance logic to adjust outstanding deltas and apply liquidity checks against available uncommitted balance.
  • Added regression test for back-to-back approvals that exceed pool capacity once prior approved loans are accounted for.

LendingPool/API surface and indexer coverage

  • Added get_share_price(token) in contracts/lending_pool/src/lib.rs (scaled fixed-point quote for share valuation).
  • Extended backend event-indexer webhook event support to include LendingPool and RemittanceNFT event types.
  • Updated EventIndexer to accept multiple contracts (contractConfigs/contractIds) and fetch events across all configured contract IDs.
  • Updated indexerManager to wire LOAN_MANAGER_CONTRACT_ID, LENDING_POOL_CONTRACT_ID, and REMITTANCE_NFT_CONTRACT_ID into one multi-contract indexer configuration.

RemittanceNFT burn cooldown issue

  • Verified burn_internal() already removes DataKey::TransferCooldown(user) in current codebase, so no additional code change was required in this branch.

Check List (Check all the applicable boxes)

  • My code follows the code style of this project.
  • This PR does not contain plagiarized content.
  • The title and description of the PR is clear and explains the approach.
  • I am making a pull request against the main branch (left side).
  • My commit messages styles matches our requested structure.
  • My code additions will fail neither code linting checks nor unit test.
  • I am only making changes to files I was requested to.

Screenshots / Testing Evidence

Per request, tests were not run in this task. Formatting applied to touched backend TypeScript files via Prettier. Rust formatter (cargo fmt) was unavailable in this shell environment.

umuewu added 2 commits April 26, 2026 14:21
…dex/fix-455-296-355-352

# Conflicts:
#	contracts/lending_pool/src/lib.rs
#	contracts/loan_manager/src/lib.rs
@ogazboiz ogazboiz merged commit df73776 into LabsCrypt:main Apr 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment