Fix/issues 303 314 578 7 - #921
Merged
Merged
Conversation
- Add ASSET_DECIMALS map with XLM (7), USDC (2), EURC (2), PHP (2) - Add getAssetDecimals() to retrieve decimals per asset - Add formatAmountOnBlur() to format amounts on blur event - Update getPrecisionError() to use asset-specific decimals - Enables proper decimal validation for different asset types
…nput - Add step attribute based on asset decimals - Add onBlur formatting to enforce precision - Update helper text to show max decimal places - Import getAssetDecimals and formatAmountOnBlur utilities
- Add step attribute for USDC (2 decimals) - Add onBlur formatting to enforce precision - Update helper text to show max decimal places - Import formatAmountOnBlur and getAssetDecimals utilities
- Add step attribute based on asset decimals - Add onBlur formatting to enforce precision - Update helper text to show max decimal places per asset - Support USDC (2), EURC (2), PHP (2) decimal precision - Import formatAmountOnBlur and getAssetDecimals utilities
- Add step attribute for USDC (2 decimals) - Add onBlur formatting to enforce precision - Update helper text to show max decimal places - Import formatAmountOnBlur and getAssetDecimals utilities
…thdraw - Add step attributes based on asset decimals - Add onBlur formatting for both deposit and withdraw inputs - Update helper text to show max decimal places - Import formatAmountOnBlur and getAssetDecimals utilities
- Change late fee base from remaining_debt to original loan.amount - Prevents late fees from compounding on themselves when principal is zero - Ensures 25% late fee cap is meaningful regardless of payment state - Stop accruing late fees once principal is fully paid
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.
Fix Multiple Issues: Late Fees, Score Deltas, Decimal Precision, Health Check
Summary
This PR addresses four issues across the backend and frontend:
Issue #303: Late Fee Compounding
Problem: Late fee cap (25% of principal) was ineffective when principal was zero, allowing fees to compound on themselves.
Solution: Changed late fee calculation to use original
loan.amount(principal) as the base instead of remaining debt. Late fees now stop accruing once principal is fully paid.Files:
contracts/loan_manager/src/lib.rsIssue #314: Hardcoded Score Deltas
Status: Already implemented ✓
Details: Score deltas are configurable via environment variables:
SCORE_DELTA_REPAY(default: 15)SCORE_DELTA_DEFAULT(default: 50)SCORE_DELTA_LATE(default: 5)Files:
backend/src/config/env.ts,backend/src/services/sorobanService.tsIssue #578: Decimal Precision Enforcement
Problem: Amount inputs didn't enforce decimal precision limits per asset type (XLM: 7, USDC: 2, EURC: 2, PHP: 2).
Solution:
ASSET_DECIMALSmap andgetAssetDecimals()utilityformatAmountOnBlur()to format amounts on blurstepattribute andonBlurformattingFiles:
frontend/src/app/utils/amount.tsfrontend/src/app/components/loan-wizard/StepAmountAsset.tsxfrontend/src/app/components/borrower/LoanRepaymentForm.tsxfrontend/src/app/components/remittance/RemittanceForm.tsxfrontend/src/app/[locale]/repay/[loanId]/page.tsxfrontend/src/app/[locale]/lend/LendPageClient.tsxIssue #7: Health Check Endpoint
Status: Already implemented ✓
Details: GET
/healthendpoint returns:Files:
backend/src/app.tsTesting
Closes #303
Closes #314
Closes #578
Closes #7