Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

[Bug][Contract] LoanManager refinance_loan fails to update term_ledgers and reset interest_residual

Đang mở Phù hợp với người mới
#2,002 5 bình luận 0 reaction 1 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 5 ngày

@goodness-cpu đang làm issue này rồi.

Từ ngày 21/10/2026.

  • #2185 của @goodness-cpu — đang mở

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
78/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
rust
Lĩnh vực
backend, blockchain

Hướng nghiên cứu

Bắt đầu tại contracts/loan_manager/src/lib.rs, ở LoanManager::refinance_loan khoảng dòng 2284–2295, rồi so sánh với approve_loan khoảng dòng 1244–1246 và các luồng tính lãi ở dòng 389 và 673. Thêm một bài kiểm thử đơn vị thực hiện tái cấp vốn với kỳ hạn khác và kiểm tra việc tính lãi tiếp theo cùng thời điểm áp dụng phí trả chậm; hoàn tất khi hành vi của kỳ hạn mới, số dư còn lại và thời gian ân hạn khớp với mô tả issue.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

bug contracts good first issue smart-contract Stellar Wave
Issue #122

LoanManager refinance_loan Fails to Update term_ledgers and Reset interest_residual

  • Title: [Bug][Contract] LoanManager refinance_loan fails to update term_ledgers and reset interest_residual
  • Labels: bug, contracts, smart-contract, good first issue
  • Location: contracts/loan_manager/src/lib.rs:2284-2295
  • Description:
    In LoanManager::refinance_loan, when resetting the loan state for the new term (loan.amount = new_amount; loan.due_date = current_ledger.checked_add(new_term)...;), loan.term_ledgers is never updated to new_term, loan.interest_residual is not reset to 0, and loan.last_late_fee_ledger is set to loan.due_date instead of loan.due_date + grace_period_ledgers (compare with approve_loan at lines 1244-1246). Because accrue_interest (line 389) and accrue_late_fee (line 673) divide by loan.term_ledgers, a loan refinanced into a different term length continues accruing interest and late fees using the old term_ledgers denominator.
  • Impact:
    Refinancing a loan to a longer or shorter new_term miscalculates all subsequent interest and late fee accruals, and starts accruing late fees before the grace period has elapsed.
  • Suggested Fix:
    In refinance_loan (around line 2290), set loan.term_ledgers = new_term;, loan.interest_residual = 0;, and loan.last_late_fee_ledger = loan.due_date.checked_add(Self::grace_period_ledgers(&env)).expect("grace period overflow");. Add a unit test refinancing a loan with a different new_term and verifying subsequent interest accrual.

Ngôn ngữ chính
TypeScript
Star
22
Fork
313
Merge trung bình
5 ngày 1 giờ
Pull request đã merge (30 ngày)
78

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của LabsCrypt/remitlend

Tất cả issue của LabsCrypt/remitlend

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.