fix: send full repayment amount instead of one-tenth in buildUnsigned… - #1462
Merged
ogazboiz merged 2 commits intoAug 7, 2026
Merged
Conversation
ogazboiz
requested changes
Aug 3, 2026
ogazboiz
left a comment
Contributor
There was a problem hiding this comment.
the core fix is exactly right (soroban.ts:84 really does send one tenth of the repayment) and the XDR-decoding test is a proper behavioral test. two stray backend changes block the merge:
- drop the backend/.prettierrc change (endOfLine lf -> auto changes the repo formatting convention for everyone).
- drop the backend/src/middleware/pauseGuard.ts change: main already has AppError.serviceUnavailable (landed with #1569) and your version loses the ErrorCode.SERVICE_UNAVAILABLE code.
- rebase so the PR touches only frontend/src/app/utils/soroban.ts and its test, and fill in the template placeholders left in the PR body.
once trimmed this is a priority merge, it's a critical financial bug with green CI. if you want to keep contributing, join us on Telegram: https://t.me/+DOylgFv1jyJlNzM0
extolkom
force-pushed
the
fix/1368-repayment-xdr-tenth-amount
branch
from
August 6, 2026 22:34
c8489d4 to
9d815f0
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #1368
Fixes a critical bug where
buildUnsignedRepaymentXdrinfrontend/src/app/utils/soroban.tsdivided the repayment amount byten 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 atfrontend/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
buildUnsignedRepaymentXdrand its direct conversion logicwere touched — no other functions, no refactors
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][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"]origin/mainNotes 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"]. Giventhe severity (borrowers could clear loans while paying 10% of what's
owed), I'd treat this as a priority merge once verified.