Cash-Basis Vault
Adds the Vault LEVersion field and cash-basis interest recognition for Vaults created under LendingProtocolV1_1
- Author
- Vytautas Vito Tumas
- Created
- 2026-11-25
- Updated
- 2026-11-25
- Discussion
- XRPLF/XRPL-Standards/discussions/192
- Amendment
LendingProtocolV1_1- Patch of
- XLS-0065: Single Asset Tokenized Vault
65.4.3 Cash-Basis Vault¶
1. Abstract¶
Under LendingProtocolV1_1, VaultCreate records the accounting version of the new Vault in a LEVersion field. A Vault created under this amendment has LEVersion = 1 (CashBasis). A Vault created before it has no LEVersion, which means 0 (Legacy). The version is fixed at creation and never changes, so a Vault keeps the accounting it was created with even after a later amendment activates.
A CashBasis Vault recognises Loan interest when it is paid, not when the Loan is originated. Vault.AssetsTotal therefore excludes interest that has not been received. The Lending Protocol rules that produce this behaviour are specified in XLS-66.4.1. This patch states what they change on the Vault.
2. Motivation¶
A Legacy Vault adds the whole scheduled interest of a Loan to AssetsTotal at origination. The share price then includes interest that the Vault may never receive. A depositor who enters after origination pays for that interest, and a default writes it off again. Recognising interest when it is paid keeps AssetsTotal equal to the cash the Vault holds plus the principal it has lent.
The version has to be stored on the Vault, because the two methods give different values for the same Loan. A Vault cannot change method part way through the life of its Loans.
3. Specification¶
3.1 Ledger Entry: Vault¶
3.1.1 Fields¶
Add this field to parent §3.1.2:
| Field Name | Constant | Required | JSON Type | Internal Type | Default Value | Description |
|---|---|---|---|---|---|---|
LEVersion |
Yes | No | number |
UINT8 |
0 |
The accounting version of the Vault. Set by VaultCreate and never changed. |
LEVersion accepts:
| Name | Value | Description |
|---|---|---|
Legacy |
0 |
Instant interest recognition. Implied when the field is absent. Vaults created before this amendment. |
CashBasis |
1 |
Cash-basis interest recognition. Vaults created under this amendment. |
FixedPrecision |
2 |
Cash-basis recognition on a fixed precision grid. Defined by XLS-65.7.1. |
Later versions are numerically larger than earlier ones. A rule stated for "CashBasis or later" applies to every version from 1 up.
3.1.2 Invariants¶
LEVersion is immutable: if present it keeps its value, and if absent it stays absent, except when the transaction creates the entry. This is the LEVersion item of XLS-65.4.1.
Parent §3.1.10 invariant 11 changes. The LoanSet cap checks it names apply only to a Legacy Vault (§3.3).
3.1.3 Example JSON¶
{
"LedgerEntryType": "Vault",
"Account": "rKwvc1mgHLyHKY3yRUqVwffWtsxYb3QLWf",
"Asset": {
"currency": "USD",
"issuer": "r9cZ5oHbdL4Z9Maj6TdnfAos35nVzYuNds"
},
"AssetsAvailable": "90",
"AssetsTotal": "100",
"LEVersion": 1,
"LossUnrealized": "0",
"Owner": "rwhaYGnJMexktjhxAKzRwoCcQ2g6hvBDWu",
"Scale": 6,
"ShareMPTID": "00000001C752C42A1EBD6BF2403134F7CFD2F1D835AFD26E",
"WithdrawalPolicy": 1
}
3.2 Transaction: VaultCreate¶
3.2.1 State Changes¶
Extend parent §3.2.6 step 1:
SingleAssetVault:LEVersionis absent (Legacy).LendingProtocolV1_1: setLEVersion = 1(CashBasis), unless XLS-65.7.1 sets2.
3.3 Vault accounting under the Lending Protocol¶
The Lending Protocol transactions update the Vault differently by LEVersion. The version of the Vault decides which rule applies, not the amendments enabled when the transaction runs.
| Event | Legacy (LEVersion absent) |
CashBasis or later |
|---|---|---|
LoanSet |
AssetsAvailable decreases by the principal. AssetsTotal increases by the Loan's interest due. |
AssetsAvailable decreases by the principal. AssetsTotal is unchanged. |
LoanPay |
AssetsAvailable increases by the principal and interest paid. AssetsTotal changes by the change in the Loan's value. |
AssetsAvailable increases by the principal and interest paid. AssetsTotal increases by the interest paid. |
LoanManage impair / unimpair |
LossUnrealized changes by TotalValueOutstanding - ManagementFeeOutstanding. |
LossUnrealized changes by PrincipalOutstanding. |
LoanManage default |
AssetsTotal decreases by TotalValueOutstanding - ManagementFeeOutstanding, less the First-Loss Capital applied. |
AssetsTotal decreases by PrincipalOutstanding, less the First-Loss Capital applied. |
In both columns, a default increases AssetsAvailable by the First-Loss Capital applied. If the Loan was impaired, LossUnrealized decreases by the same exposure that impairment added. A LoanPay on an impaired Loan unimpairs it first, with the same exposure.
On a CashBasis Vault, AssetsTotal equals the Vault's cash plus the principal still on loan. Interest owed but not yet paid is not part of it, so it does not enter the share price.
The LoanSet cap checks of parent §3.1.10 invariant 11 apply only to a Legacy Vault:
SingleAssetVault,LegacyVault:LoanSetfails withtecLIMIT_EXCEEDEDwhenVault.AssetsMaximumis non-zero and eitherVault.AssetsTotal >= Vault.AssetsMaximumor the Loan's interest due exceedsVault.AssetsMaximum - Vault.AssetsTotal.LendingProtocolV1_1,CashBasisVault or later: neither check applies. Origination does not changeAssetsTotal, so it cannot push the Vault past its cap.
VaultDeposit still enforces AssetsMaximum on every Vault version.
4. Rationale¶
The version is stored rather than taken from the enabled amendments. A Vault's existing Loans were valued with one method, and switching method while they are outstanding would move AssetsTotal with no cash moving. Fixing the version at creation lets old and new Vaults coexist on the same ledger with each keeping a consistent history.
The LoanSet cap checks exist because instant recognition adds interest to AssetsTotal at origination. Under cash-basis recognition origination adds nothing to AssetsTotal, so there is nothing for those checks to bound.
5. Security Considerations¶
The share price of a CashBasis Vault no longer includes interest that has not been paid. A depositor no longer pays for interest that may be lost to a default. Interest paid later raises the share price for every holder of shares at that time.
Removing the LoanSet cap checks does not let a Loan add assets that were never deposited. AssetsTotal grows past AssetsMaximum only through interest actually received, which parent §3.1.10 invariant 11 already allows.
Because LEVersion is immutable, an Owner cannot change the accounting method of a Vault after depositors have joined.