Skip to content

xls-66: fix equation (23) to include managementFee_overpayment#495

Open
Tapanito wants to merge 2 commits into
masterfrom
tapanito/fix-overpayment-principal-formula
Open

xls-66: fix equation (23) to include managementFee_overpayment#495
Tapanito wants to merge 2 commits into
masterfrom
tapanito/fix-overpayment-principal-formula

Conversation

@Tapanito

@Tapanito Tapanito commented Mar 11, 2026

Copy link
Copy Markdown
Collaborator

High Level Overview of Change

Problem

Equation (23) stated:

principalPortion = overpaymentAmount - overpaymentInterest_net - overpaymentFee

This is incorrect. overpaymentInterest_net is the vault's share of the overpayment interest — the management fee has been netted out of it (formula 21), but the management fee is still a real cash outflow that leaves the overpayment amount and goes to the broker. The original formula effectively leaked the management fee into the principal reduction, overstating it.

The accompanying note ("The management fee has already been deducted from overpaymentInterest_net, so it does not appear as a separate term") compounded the error by providing a justification for the wrong formula.

Fix

The correct money conservation identity is:

overpaymentAmount = principalPortion + overpaymentInterest_net + managementFee_overpayment + overpaymentFee

Substituting formula (21) confirms this reduces to principalPortion = overpaymentAmount - overpaymentInterest_gross - overpaymentFee — no double subtraction. Equation (23) is updated accordingly and the incorrect note is removed.

This is already consistent with Appendix A-3.2.3 and the rippled implementation in LendingHelpers.cpp:

.trackedPrincipalDelta = overpayment - roundedOverpaymentInterest
                       - roundedOverpaymentManagementFee
                       - overpaymentFee,

Context of Change

Type of Change

  • New XLS Draft
  • XLS Update (changes to an existing XLS)
  • XLS Status Change (e.g., Draft → Final, Draft → Stagnant)
  • Process/Meta (changes to CONTRIBUTING.md, XLS-1, templates, etc.)
  • Infrastructure (CI, workflows, scripts, website)
  • Documentation (README updates, typo fixes)

@Tapanito Tapanito requested review from mvadari and ximinez March 11, 2026 09:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant