Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

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

オープン 初心者向け
#2,002 コメント 5 件 リアクション 0 件 担当者 1 名 GitHub で見る

メンテナーはふだん 3 日以内に返信

@goodness-cpu がすでに取り組んでいます。

2026年10月21日 から。

  • #2185 @goodness-cpu による — オープン

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
78/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
rust

調査の方向性

contracts/loan_manager/src/lib.rs の LoanManager::refinance_loan(2284~2295行付近)から始め、approve_loan(1244~1246行付近)および389行と673行の利息計上処理と比較してください。異なる期間で借り換えを行い、その後の利息計上と延滞料が発生するタイミングを確認する単体テストを追加してください。新しい期間、残額、猶予期間の動作がissueの説明と一致したら完了です。

索引モデルが issue の本文から書いたものです。

説明

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.

主要言語
TypeScript
スター
22
フォーク
313
平均マージ
4日 16時間
マージ済み PR(30日)
92

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

LabsCrypt/remitlend のほかの issue

LabsCrypt/remitlend の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。