XLS-66: Principal-only Vault/LoanBroker accounting under LendingProtocolV1_1 - #582
Open
Tapanito wants to merge 4 commits into
Open
XLS-66: Principal-only Vault/LoanBroker accounting under LendingProtocolV1_1#582Tapanito wants to merge 4 commits into
Tapanito wants to merge 4 commits into
Conversation
gregtatcam
requested changes
Jul 21, 2026
| 24. The `LoanBroker.LoanSequence` has reached its maximum value. (`tecMAX_SEQUENCE_REACHED`) | ||
|
|
||
| ##### 3.8.5.3 Protocol-Level Failures (`LendingProtocolV1_1`) | ||
|
|
Collaborator
There was a problem hiding this comment.
Should add updated check 14 since the interest is no longer tracked by AssetsTotal:
Vault.AssetsMaximum != 0 and Vault.AssetsTotal > Vault.AssetsMaximum (expected interest would exceed vault assets cap). (tecLIMIT_EXCEEDED)
4 tasks
gregtatcam
reviewed
Jul 22, 2026
| | `ShareMPTID` | No | Yes | `number` | `UINT192` | 0 | The identifier of the share MPTokenIssuance object. | | ||
| | `WithdrawalPolicy` | No | Yes | `string` | `UINT8` | `N/A` | Indicates the withdrawal strategy used by the Vault. | | ||
| | `Scale` | No | Yes | `number` | `UINT8` | 6 | The `Scale` specifies the power of 10 ($10^{\text{scale}}$) to multiply an asset's value by when converting it into an integer-based number of shares. | | ||
| | `LEVersion` | No | No | `number` | `UINT8` | 0 | Introduced by the `LendingProtocolV1_1` amendment. See [3.1.2.2](#3122-leversion-lendingprotocolv1_1). | |
Collaborator
There was a problem hiding this comment.
LEVersion sounds like it's a format version. Also sounds like the only reason for LE prefix is to disambiguate it from the existing Version. How about Generation or Revision?
mvadari
reviewed
Aug 4, 2026
| #### 3.8.6 State Changes | ||
|
|
||
| 1. Create the `Loan` object with computed fields (`TotalValueOutstanding`, `PeriodicPayment`, `ManagementFeeOutstanding`, `LoanScale`, etc.). | ||
| 2. Increment `AccountRoot(Borrower).OwnerCount` by `1`. |
Collaborator
There was a problem hiding this comment.
Suggested change
| 2. Increment `AccountRoot(Borrower).OwnerCount` by `3`. | |
| 1. In XLS-65.1, this was `2`. | |
| 1. In XLS-65.0, this was `1`. | |
mvadari
reviewed
Aug 4, 2026
Comment on lines
1129
to
1131
| 8. Directory linking: | ||
| - Add `LoanID` to the `OwnerDirectory` of the `LoanBroker` _pseudo-account_ (sets `LoanBrokerNode`). | ||
| - Add `LoanID` to the `OwnerDirectory` of the `Borrower` (sets `OwnerNode`). |
Collaborator
There was a problem hiding this comment.
Suggested change
| - Add `LoanID` to the `OwnerDirectory` of the `Borrower` (sets `OwnerNode`). | |
| 8. Directory linking: | |
| - Add `LoanID` to the `OwnerDirectory` of the `LoanBroker` _pseudo-account_ (sets `LoanBrokerNode`). | |
| - Add `LoanID` to the `OwnerDirectory` of the `Borrower` (sets `OwnerNode`). | |
| - Add `LoanID` to something else (added in `LendingProtocolV1_1`). |
mvadari
reviewed
Aug 4, 2026
|
|
||
| ## 3. Specification | ||
|
|
||
| ### 3.1 Ledger Entry: `Vault` |
Collaborator
There was a problem hiding this comment.
Suggested change
| ### 3.1 Amendments | |
| #### 3.1.1 `SingleAssetVault` | |
| Brief explanation, link to patch | |
| #### 3.1.2 `LendingProtocolV1_1` | |
| Brief explanation, link to patch | |
| ### 3.2 Ledger Entry: `Vault` |
mvadari
reviewed
Aug 4, 2026
|
|
||
| # Appendix | ||
|
|
||
| ## A-1 F.A.Q. |
Collaborator
There was a problem hiding this comment.
Suggested change
| ## A-1 Changelog | |
| ### A-1.1 `LendingProtocol`: released 2026-01-32 | |
| This amendment releases the feature | |
| ### A-1.2 `fixCleanup3_1_3`: released 2026-some-date | |
| This amendment makes XYZ minor changes | |
| ### A-1.3 `fixCleanup3_2_0`: released 2026-06-something | |
| This amendment makes ABC minor changes | |
| ## A-2 F.A.Q. |
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.
High Level Overview of Change
Defines the
LendingProtocolV1_1amendment path forLoanSet,LoanPay, andLoanManage(impair/unimpair/default) that makesVault.AssetsTotalandLoanBroker.DebtTotaltrack loan principal only, excluding interest. Pre-amendment behavior is kept unchanged as the fallback.As a consequence,
valueChange— the mechanism that reconcilesVault.AssetsTotal/LoanBroker.DebtTotalfor interest effects from late payments, overpayments, and early full repayments — is no longer used: since neither field tracks interest under the amendment, there is nothing left to reconcile.valueChangebecomes dead output; an amendment-only implementation would not need to compute it.Context of Change
Follows the documentation convention established in #570 (dedicated
Amendment-labeled subsections, e.g.##### 3.8.6.1 State Changes (LendingProtocolV1_1)), keeping the current spec text as the default and adding parallel, clearly separated sections for the amended Failure Conditions/State Changes rather than interleaving inline notes. This PR is independent of #570 (which addsVault.AssetsReservedfor pending loans) — it only reuses the same amendment name and formatting pattern.Changes by transaction:
LoanSet:Vault.AssetsTotalno longer increases byInterestDue;LoanBroker.DebtTotalincreases byPrincipalRequestedonly. Adds a matchingProtocol-Level Failures (LendingProtocolV1_1)subsection overriding theDebtMaximum/AssetsMaximum/CoverAvailablecap checks, which previously includedInterestDue.LoanPay:LoanBroker.DebtTotaldecreases byprincipalPaidonly;Vault.AssetsTotalincreases byinterestPaidonly.principalPaid/interestPaidcome from the same, unchangedPeriodicPayment/amortization logic in Appendix A-3 — no new machinery.LoanManage(impair/unimpair/default): collapses to a single, unifiedDefaultAmount = Loan.PrincipalOutstanding, used consistently forVaultLoss/DefaultCovered,LoanBroker.DebtTotal, andVault.LossUnrealized(impair/unimpair). Adds a matching failure-condition override for the impairment limit check. Includes a full worked numeric example (LoanSet→LoanPay→ default) comparing pre- and post-amendment trajectories, confirmingManagementFeeOutstandingstays excluded and theCoverRateMinimum/CoverRateLiquidationmechanics are unchanged in shape.Non-goals (intentionally out of scope, called out in the spec): no new Vault-level field: only
AssetsTotal,AssetsAvailable, andLossUnrealizedare touched; no amendment-transition/mixed-portfolio behavior; no change toLoan-level fields (TotalValueOutstandingetc., which still track interest independent of this amendment); no change to general impair philosophy beyond the impair/default consistency check.Type of Change