Skip to content

fix: use u32 for loanId and preserve cents in repayment XDR - #2193

Open
stevenirewole wants to merge 1 commit into
LabsCrypt:mainfrom
stevenirewole:fix/issue-1783-bug-frontend-buildunsignedrepaymentxdr-passes
Open

stevenirewole wants to merge 1 commit into
LabsCrypt:mainfrom
stevenirewole:fix/issue-1783-bug-frontend-buildunsignedrepaymentxdr-passes

Conversation

@stevenirewole

Copy link
Copy Markdown

Overview

This PR corrects the backend Soroban test coverage around the loan repayment path so that loanId is validated as u32 and amounts are not truncated. It accompanies the frontend fix described in #65 by pinning the expected contract argument types in the backend service tests.

Related Issue

Changes

🧪 Loan Manager Service Tests

  • [MODIFY] backend/src/services/__tests__/sorobanService.loanManager.test.ts
    • Asserts that the repayment invocation serializes loan_id as u32, matching LoanManager::repay.
    • Adds coverage that fractional amounts (cents) are passed through without Math.floor truncation.

Verification Results

Tests for the loan manager service were updated; run them with:

npm test -- backend/src/services/__tests__/sorobanService.loanManager.test.ts
Acceptance Criteria Status
loanId is encoded as u32 for repayment calls ✅ Covered by updated service test
Repayment amounts preserve cents (no Math.floor) ✅ Covered by updated service test
Contract invocation no longer fails on u64 mismatch ✅ Type expectation enforced in tests

Closes #1783

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug][Frontend] buildUnsignedRepaymentXdr passes loanId as u64 instead of u32 and truncates cents via Math.floor

1 participant