Skip to content

fix: send full repayment amount instead of one-tenth in buildUnsigned… - #1462

Open
extolkom wants to merge 7 commits into
LabsCrypt:mainfrom
extolkom:fix/1368-repayment-xdr-tenth-amount
Open

fix: send full repayment amount instead of one-tenth in buildUnsigned…#1462
extolkom wants to merge 7 commits into
LabsCrypt:mainfrom
extolkom:fix/1368-repayment-xdr-tenth-amount

Conversation

@extolkom

Copy link
Copy Markdown

Summary

Closes #1368

Fixes a critical bug where buildUnsignedRepaymentXdr in
frontend/src/app/utils/soroban.ts divided the repayment amount by
ten before building the XDR, allowing a borrower to have their loan
marked as fully repaid while only transferring 10% of the actual owed
amount.

Root cause

[exact line/description of the bug — e.g. "the function applied an incorrect stroop conversion, dividing by 10 where it should have used the correct decimal-precision constant"], found at
frontend/src/app/utils/soroban.ts:[line number].

Fix

[one-line description of the actual fix — e.g. "corrected the decimal conversion to match the pattern already used in [sibling function name], which converts amounts correctly"]

Scope

  • Only buildUnsignedRepaymentXdr and its direct conversion logic
    were touched — no other functions, no refactors
  • No changes to the function signature or parameters
  • Per the issue's own contributor note, this PR fixes only this one
    issue/function; no other bugs were introduced or fixed here

Tests added/updated

[test file path] — asserts that for a known input repayment amount,
the resulting XDR/on-chain value equals the full input amount, not
one-tenth of it.

Verification

  • npm run build[pass/fail]
  • npm run lint[pass/fail]
  • npm test[pass/fail summary]
  • Manually verified: [state what you personally checked — e.g. "for a 100 USDC repayment input, the built XDR now encodes 100 USDC, not 10 USDC, confirmed by decoding the resulting XDR"]
  • Branch rebased on latest origin/main

Notes for reviewers

This is a financial-precision fix, so I'd ask for a careful review of
the decimal-conversion logic specifically — [flag anything relevant, e.g. "confirm this is correct across all supported asset decimal precisions used in this contract, not just the one tested"]. Given
the severity (borrowers could clear loans while paying 10% of what's
owed), I'd treat this as a priority merge once verified.

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.

[Frontend] Repayment XDR sends only a tenth of the intended amount

1 participant