fix: send full repayment amount instead of one-tenth in buildUnsigned… - #1462
Open
extolkom wants to merge 7 commits into
Open
fix: send full repayment amount instead of one-tenth in buildUnsigned…#1462extolkom wants to merge 7 commits into
extolkom wants to merge 7 commits into
Conversation
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.