Repository navigation
Principal-only Vault/LoanBroker accounting #582
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Tapanito
wants to merge
43
commits into
master
Choose a base branch
from
tapanito/lending-cash-basis
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 15 commits
Commits
Show all changes
43 commits
Select commit
Hold shift + click to select a range
5480349
adds cash-based share valuation
Tapanito ec48162
adds Vault version
Tapanito 8edeab3
update the spec to not skip SLEVersion 1
Tapanito 4a1b926
Merge branch 'master' into tapanito/lending-cash-basis
Tapanito 50abc3b
docs: align cash-basis Vault/LoanBroker text with develop
Tapanito bf4ee3e
docs: restate XLS-65.1 and XLS-66.1 patches in XLS template format
Tapanito 87a5819
docs: address PR 582 review comments
Tapanito ece0e37
docs(XLS-65.1): treat absent LEVersion as 0
Tapanito 118f612
docs: align cash-basis patches with develop accounting
Tapanito f485760
Merge remote-tracking branch 'origin/master' into tapanito/lending-ca…
Tapanito 0632fff
docs: number the Amendments section as an Introduction subsection
Tapanito 1d0f16d
docs: consolidate the LendingProtocolV1_1 patches into one document p…
Tapanito e5db49c
Merge remote-tracking branch 'origin/master' into tapanito/lending-ca…
Tapanito 215f13a
docs: restore cash-basis LoanBroker and LoanManage details
Tapanito df735b0
docs: match Vault Constant column and LoanSet phase checks
Tapanito 07ae495
docs: correct valueChange scope and cross-ref VaultKind to XLS-65.1
Tapanito 7819e26
Merge origin/master into tapanito/lending-cash-basis
Tapanito 64b6528
Merge origin/master into tapanito/lending-cash-basis
Tapanito 19a240a
docs(XLS-66): leave closed-ended lending rules to XLS draft
Tapanito 40201e9
docs: format cash-basis patches and inline amendment behaviour
Tapanito 0c8d45c
docs: scope LEVersion immutability and label the Vault excerpt
Tapanito bb136b8
docs: make DefaultAmount principal-only for cash-basis Vaults in form…
Tapanito edce470
docs: note that formula 34 is principal-only when LEVersion is 1
Tapanito 4c2a50a
docs: point closed-ended LendingProtocolV1_1 checks at PR 587
Tapanito 85be555
docs: add CoverAvailable to formula 35 and vault_info LEVersion
Tapanito 58a3ea8
Merge remote-tracking branch 'origin/master' into tapanito/lending-ca…
Tapanito f2219ad
style: apply prettier to vault and lending specs
Tapanito fe59dfc
docs: drop patch-title prefixes and name parent amendments
Tapanito c0847b9
Merge remote-tracking branch 'origin/master' into tapanito/lending-ca…
Tapanito 8e22494
docs: state origination InterestDue recognition and patch-over-parent…
Tapanito 80dbd85
Merge branch 'master' into tapanito/lending-cash-basis
Tapanito 8a68652
docs(XLS-65): gate the VaultSet cap invariant on fixCleanup3_4_0
Tapanito 9542a81
Merge origin/master and number cash-basis as XLS-65.1.3
Tapanito 34f8b77
docs: fix DebtTotal valueChange, AssetsMaximum cap, and 66.1 requires
Tapanito 7840c9b
docs: match VaultCreate AssetsMaximum to the deposit cap
Tapanito 4d3ae67
docs(XLS-65): split LoanSet cap invariant for cash-basis Vaults
Tapanito 90d9c00
docs(XLS-66): bump updated date and label legacy accounting examples
Tapanito c7f12a4
docs(XLS-66): label first-loss default example as legacy
Tapanito 375a7b0
docs(XLS-66): gate remaining valueChange prose to legacy Vaults
Tapanito 3c259da
docs: call legacy Vault accounting instant interest recognition
Tapanito 08873e0
Move cash-basis accounting into 65.1.3 and 66.1.1 patches
Tapanito a3f9aa8
Merge remote-tracking branch 'origin/master' into HEAD
Tapanito 5f81ed4
docs(XLS-66.1.1): keep parent LoanSet check numbers, add test plan, p…
Tapanito File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,92 @@ | ||
| <pre> | ||
| xls: 65.1 | ||
| title: Single Asset Vault under LendingProtocolV1_1 | ||
| description: Records the changes the LendingProtocolV1_1 amendment makes to XLS-65 | ||
| author: Vytautas Vito Tumas <vtumas@ripple.com>, Aanchal Malhotra <amalhotra@ripple.com> | ||
| proposal-from: https://github.com/XRPLF/XRPL-Standards/discussions/192 | ||
| status: Draft | ||
| category: Amendment | ||
| requires: [XLS-65](../README.md) | ||
| created: 2026-09-04 | ||
| updated: 2026-09-07 | ||
| </pre> | ||
|
|
||
| # Single Asset Vault under `LendingProtocolV1_1` | ||
|
|
||
| ## 1. Abstract | ||
|
|
||
| This patch of [XLS-65](../README.md) records the changes the `LendingProtocolV1_1` amendment makes to the Single Asset Vault. The amendment is not yet live. The consolidated specification is the top-level [README.md](../README.md). | ||
|
|
||
| The amendment makes the following changes to XLS-65: | ||
|
|
||
| - **Vault Cash-Basis Accounting** — Adds a `LEVersion` field that selects the accounting model a Vault applies to `AssetsTotal`: Vaults created while the amendment is enabled use cash-basis accounting, in which `AssetsTotal` excludes uncollected interest and grows only as interest is collected in cash, and Vaults created before the amendment keep accrual-basis accounting, in which `AssetsTotal` includes interest as it accrues. | ||
|
|
||
| ## 2. Motivation | ||
|
|
||
| **Vault Cash-Basis Accounting.** Accrual-basis accounting credits a Vault with interest that a Borrower has not paid yet, so the share exchange rate reflects income the Vault has not received. A depositor can redeem shares at a rate inflated by interest that later defaults, and the loss falls on the depositors who remain. Cash-basis accounting removes that mismatch by recognising interest only when it is paid. | ||
|
|
||
| Existing Vaults cannot switch accounting models without changing the value of shares already issued, so the model has to be recorded per Vault rather than derived from the amendment state at the time of the transaction. | ||
|
|
||
| ## 3. Specification | ||
|
|
||
| ### 3.3 Vault Cash-Basis Accounting | ||
|
|
||
| #### 3.3.1 Ledger Entry: `Vault` | ||
|
|
||
| ##### 3.3.1.1 Fields | ||
|
|
||
| | Field Name | Constant | Required | Internal Type | Default Value | Description | | ||
| | ----------- | :------: | :------: | :-----------: | :-----------: | ---------------------------------------------------------------------------------------------------------------------- | | ||
| | `LEVersion` | Yes | No | `UINT8` | absent (`0`) | The accounting model the Vault applies to `AssetsTotal`. Absent is treated as `0` (accrual basis). Immutable once set. | | ||
|
|
||
| ##### 3.3.1.2 `LEVersion` | ||
|
|
||
| `LEVersion` selects the accounting model of the Vault: | ||
|
|
||
| - `LEVersion` absent (treated as `0`, accrual basis): `AssetsTotal` includes the interest accrued over the life of the connected Loans. This is the pre-amendment behaviour and continues to apply to every Vault created before the amendment was enabled. | ||
| - `LEVersion = 1` (cash basis): `AssetsTotal` excludes uncollected interest and increases only as interest is collected in cash. | ||
|
|
||
| The field is written once by `VaultCreate` and is immutable after creation. A Vault created while the amendment is enabled is always cash-basis, and a Vault created before it is always accrual-basis; neither can be converted to the other. | ||
|
|
||
| ##### 3.3.1.3 Invariants | ||
|
|
||
| - `Vault.LEVersion` is immutable once set. | ||
|
|
||
| Because `VaultCreate` is the only transaction that writes `LEVersion`, newly created Vaults have either an absent `LEVersion` or `LEVersion = 1`. | ||
|
|
||
| ##### 3.3.1.4 Example JSON | ||
|
|
||
| ```json | ||
| { | ||
| "LedgerEntryType": "Vault", | ||
| "LEVersion": 1, | ||
|
Tapanito marked this conversation as resolved.
Outdated
|
||
| "Asset": { | ||
| "currency": "USD", | ||
| "issuer": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn" | ||
| }, | ||
| "AssetsTotal": "1000", | ||
| "AssetsAvailable": "1000" | ||
| } | ||
| ``` | ||
|
|
||
| #### 3.3.2 Transaction: `VaultCreate` | ||
|
|
||
| ##### 3.3.2.1 Failure Conditions | ||
|
|
||
| No failure conditions are added or removed. `LEVersion` is not a transaction field and cannot be supplied by the submitter. | ||
|
Tapanito marked this conversation as resolved.
Outdated
|
||
|
|
||
| ##### 3.3.2.2 State Changes | ||
|
|
||
| When the amendment is enabled, the created `Vault` ledger entry has `LEVersion = 1`. When it is not enabled, the field is not written and the Vault is accrual-basis. | ||
|
|
||
| ## 4. Rationale | ||
|
|
||
| **Vault Cash-Basis Accounting.** The alternative to a per-entry version field is to derive the accounting model from the amendment state at the time each Loan transaction executes. That was rejected because it would silently change the share exchange rate of every existing Vault on the ledger at the moment the amendment activates. | ||
|
|
||
| `LEVersion` is a version number rather than a boolean flag so that a later accounting change can be expressed as a further version without another field. | ||
|
|
||
| ## 5. Security Considerations | ||
|
|
||
| **Vault Cash-Basis Accounting.** Cash-basis accounting reduces, but does not remove, the exposure of a depositor to an unpaid Loan: the Vault still carries the principal at face value until the Loan defaults or is impaired. `LossUnrealized` remains the mechanism for reporting an expected shortfall. | ||
|
|
||
| Because `LEVersion` is immutable, an implementation must read it from the `Vault` ledger entry rather than from the amendment state when computing the interest accounting of a Loan. Reading the amendment state instead would apply cash-basis rules to accrual-basis Vaults and misprice their shares. | ||
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.