Review feedback from @gregtatcam

- Add a comment explaining the formula in LoanManage::owedToVault
- Make owedToVault static
This commit is contained in:
Ed Hennis
2025-11-22 21:46:00 -05:00
parent 1c38bbdf45
commit f8ee979ff4

View File

@@ -114,9 +114,20 @@ LoanManage::preclaim(PreclaimContext const& ctx)
return tesSUCCESS;
}
Number
static Number
owedToVault(SLE::ref loanSle)
{
// Spec section 3.2.3.2, defines the default amount as
//
// DefaultAmount = (Loan.PrincipalOutstanding + Loan.InterestOutstanding)
//
// Loan.InterestOutstanding is not stored directly on ledger.
// It is computed as
//
// Loan.TotalValueOutstanding - Loan.PrincipalOutstanding -
// Loan.ManagementFeeOutstanding
//
// Add that to the original formula, and you get this:
return loanSle->at(sfTotalValueOutstanding) -
loanSle->at(sfManagementFeeOutstanding);
}