Single Asset Tokenized Vault
On-chain primitive for aggregating assets from depositors using Multi-Purpose-Tokens for ownership shares
- Authors
- Vytautas Vito Tumas, Aanchal Malhotra
- Created
- 2024-04-12
- Updated
- 2026-12-02
- Requires
- XLS-33
- Discussion
- XRPLF/XRPL-Standards/discussions/192
Amendment patches
Later amendments change this spec through the patches below. Sections they change are marked in the text.
-
XLS-65.1
Vault Withdrawal Limits and Clawback Clamp
fixCleanup3_1_3Final -
XLS-65.2
Vault Precision and Redemption Fixes
fixCleanup3_2_0Final -
XLS-65.3
Vault Freeze Checks
fixCleanup3_3_0Final -
XLS-65.4
LendingProtocolV1_1 Vault Changes
LendingProtocolV1_1Draft - XLS-65.4.1 Unmodifiable Vault Fields Draft
- XLS-65.4.2 Vault Deletion Memo Draft
- XLS-65.4.3 Cash-Basis Vault Draft
- XLS-65.4.4 Closed-Ended Vault Draft
-
XLS-65.5
Vault Accounting and Cap Invariants
fixCleanup3_4_0Final -
XLS-65.6
Vault Withdrawal Transfer Fee and Input Range Checks
fixCleanup3_5_0Draft -
XLS-65.7
LendingProtocolV1_2 Vault Changes
LendingProtocolV1_2Draft - XLS-65.7.1 Fixed Precision Vault Draft
- XLS-65.7.2 Vault Transactions in Batch Draft
Single Asset Vault¶
1. Abstract¶
A Single Asset Vault is a new on-chain primitive for aggregating assets from one or more depositors, and making the assets available for other on-chain protocols. The Single Asset Vault uses Multi-Purpose-Token to represent ownership shares of the Vault. A Vault may be open-ended, with ongoing deposits and withdrawals, or closed-ended, with fixed Subscription, Investment, and Redemption phases. The Vault serves diverse purposes, such as lending markets, aggregators, yield-bearing tokens, asset management, etc. The Single Asset Vault decouples the liquidity provision functionality from the specific protocol logic.
2. Motivation¶
The Single Asset Vault is an on-chain object that aggregates assets from one or more depositors and represents ownership through shares. Other protocols, such as the Lending Protocol, can access these assets via the vault, whether or not they generate yield. Currently, other protocols must be created by the same Account that created the Vault. However, this may change in the future.
The specification introduces a new Vault ledger entry, which contains key details such as available assets, shares, total value, and other relevant information.
2.1. Transactions¶
The specification includes the following transactions:
Vault Management:
VaultCreate: Creates a new Vault object.VaultSet: Updates an existing Vault object.VaultDelete: Deletes an existing Vault object.
Asset Management:
VaultDeposit: Deposits a specified number of assets into the Vault in exchange for shares.VaultWithdraw: Withdraws a specified number of assets from the Vault in exchange for shares.
Additionally, an issuer can perform a Clawback operation:
VaultClawback: Allows the issuer of an IOU or MPT to claw back funds from the vault, as outlined in the Clawback documentation.
2.2. Vault Ownership and Management¶
A Single Asset Vault is owned and managed by an account called the Vault Owner. The account is reponsible for creating, updating and deleting the Vault object.
2.3. Access Control¶
A Single Asset Vault can be either public or private. Any depositor can deposit and redeem liquidity from a public vault, provided they own sufficient shares. In contrast, access to private shares is controlled via Permissioned Domains, which use on-chain Credentials to manage access to the vault. Only depositors with the necessary credentials can deposit assets to a private vault. To prevent Vault Owner from locking away depositor funds, any shareholder can withdraw funds. Furthermore, the Vault Owner has an implicit permission to deposit and withdraw assets to and from the Vault. I.e. they do not have to have credentials in the Permissioned Domain.
2.4. Yield Bearing Shares¶
Shares represent the ownership of a portion of the vault's assets. On-chain shares are represented by a Multi-Purpose Token. When creating the vault, the Vault Owner can configure the shares to be non-transferable. Non-transferable shares cannot be transferred to any other account -- they can only be redeemed. If the vault is private, shares can be transferred and used in other DeFi protocols as long as the receiving account is authorized to hold the shares. The vault's shares may be yield-bearing, depending on the protocol connected to the vault, meaning that a holder may be able to withdraw more (or less) liquidity than they initially deposited.
2.5. Vault Kinds¶
Under LendingProtocolV1_1, a Vault is either open-ended or closed-ended. The kind is chosen at creation (VaultKind) and cannot change afterward.
An open-ended Vault is the original Single Asset Vault. Depositors may deposit and withdraw whenever the other Vault rules allow. It has no subscription window, no investment lock-up, and no redemption date. Absence of VaultKind, or VaultKind = 0, means open-ended.
A closed-ended Vault is a fixed-term fund. It raises capital for a limited period, holds that capital for a fixed investment term, then opens for redemption. Once investment has begun, new deposits are rejected and withdrawals are blocked until redemption starts. The schedule is set at creation by two immutable timestamps:
SubscriptionDate— last moment of fundraising. After it, the Vault enters investment and the pool size is fixed.RedemptionDate— first moment of wind-down. From then on, depositors may withdraw again; new deposits remain closed.
Between those dates the Vault is in Investment: capital stays in place so a connected protocol (for example the Lending Protocol) can deploy a known amount for a known term. The current phase is derived from the parent ledger close time; it is not a stored field. Open-ended Vaults have no phase. The closed-ended lifecycle, field rules, and deposit/withdraw gates are specified in XLS-65.4.4.
2.6. Terminology¶
- Vault: A ledger entry for aggregating liquidity and providing this liquidity to one or more accessors.
- Asset: The currency of a vault. It is either XRP, a Fungible Token or a Multi-Purpose Token.
- Share: Shares represent the depositors' portion of the vault's assets. Shares are a Multi-Purpose Token created by the pseudo-account of the vault.
- Open-ended Vault: A Vault with no fixed fundraising or lock-up schedule. Deposit and withdraw timing follow only the other Vault rules.
- Closed-ended Vault: A Vault with immutable
SubscriptionDateandRedemptionDate, moving through Subscription, Investment, and Redemption. - Subscription: The fundraising phase of a closed-ended Vault. Deposits and withdrawals are both allowed.
- Investment: The lock-up phase. Deposits and withdrawals are both rejected so deployed capital stays in place.
- Redemption: The wind-down phase. Withdrawals are allowed again; deposits remain rejected.
2.7. Actors¶
- Vault Owner: An account responsible for creating and deleting The Vault.
- Depositor: An entity that deposits and withdraws assets to and from the vault.
2.8. Connecting to the Vault¶
A protocol connecting to a Vault must track its debt. Furthermore, the updates to the Vault state when funds are removed or added back must be handled in the transactors of the protocol. For an example, please refer to the Lending Protocol specification.
2.9. Amendments¶
SingleAssetVault(featureSingleAssetVault): the original vault amendment. It introduced theVaultledger entry and the vault transactions; that behaviour is the parent of the patches below.fixCleanup3_1_3, as described in XLS-65.1:- checks a share-denominated
VaultWithdrawagainst the destination's trust-line limit at the asset value of the shares, and clamps a zero-AmountVaultClawbacktoVault.AssetsAvailable
- checks a share-denominated
fixCleanup3_2_0, as described in XLS-65.2:- rounds
VaultDepositto the posterior Vault precision, waivesLossUnrealizedfor a sole shareholder, empties the Vault exactly on a full redemption, waiveslsfMPTCanTransferon withdrawal, and recordsReferenceHoldingon the share issuance
- rounds
fixCleanup3_3_0, as described in XLS-65.3:- replaces the
VaultDepositandVaultWithdrawfreeze checks with checks on the depositor or submitter, the pseudo-account, and the destination
- replaces the
LendingProtocolV1_1, as described in XLS-65.4:- 65.4.1 Unmodifiable Vault Fields: makes
Sequence,OwnerNode,Owner,WithdrawalPolicy,ScaleandLEVersionimmutable on the Vault once set - 65.4.2 Vault Deletion Memo: adds an optional
MemoDatafield toVaultDeletethat, if present, must be 1–256 bytes - 65.4.3 Cash-Basis Vault: adds
LEVersion; Vaults created under the amendment recognise Loan interest when it is paid, and are not subject to theLoanSetcap checks - 65.4.4 Closed-Ended Vault: adds the
ClosedEndedvault kind withSubscriptionDateandRedemptionDate, and phase-gatesVaultDepositandVaultWithdrawon such vaults
- 65.4.1 Unmodifiable Vault Fields: makes
fixCleanup3_4_0, as described in XLS-65.5:- admits one unit of rounding slack in the
LossUnrealizedinvariant and in IOU accounting and state-change deltas forVaultDeposit,VaultWithdrawandVaultClawback, requiresLossUnrealizedto be non-negative, and narrowsVaultSetcap enforcement to transactions that supplyAssetsMaximumor otherwise change the cap - truncates the shares burned by
VaultWithdrawandVaultClawback, addsCredentialIDsand private-Vault domain checks to third-partyVaultWithdraw, and refuses a pseudo-account as withdrawal destination or clawback holder
- admits one unit of rounding slack in the
fixCleanup3_5_0, as described in XLS-65.6:- charges the asset transfer fee on third-party
VaultWithdraw, rejects an unrepresentableAssetsMaximum, and refuses aVaultClawbackagainst a missing holder
- charges the asset transfer fee on third-party
LendingProtocolV1_2, as described in XLS-65.7:- 65.7.1 Fixed Precision Vault: fixes one precision grid per new Vault, adds
AssetsDeployedandYieldUnrealized, derivesAssetsTotal, and bounds optional inflows by capacity - 65.7.2 Vault Transactions in Batch: allows the Vault transactions as
Batchinner transactions
- 65.7.1 Fixed Precision Vault: fixes one precision grid per new Vault, adds
3. Specification¶
3.1. Ledger Entry: Vault¶
The Vault ledger entry describes the state of the tokenized vault.
3.1.1. Object Identifier¶
The key of the Vault object is the result of SHA512-Half of the following values concatenated in order:
- The
Vaultspace key0x0056(capital V) - The
AccountIDof the account submitting theVaultCreatetransaction, i.e.VaultOwner. - The transaction
Sequencenumber. If the transaction used a Ticket, use theTicketSequencevalue.
3.1.2. Fields¶
A vault has the following fields:
| Field Name | Constant | Required | JSON Type | Internal Type | Default Value | Description |
|---|---|---|---|---|---|---|
LedgerEntryType |
No | Yes | string |
UINT16 |
0x0084 |
Ledger object type. |
LedgerIndex |
No | Yes | string |
UINT16 |
N/A |
Ledger object identifier. |
Flags |
Yes | Yes | string |
UINT32 |
0 | Ledger object flags. |
PreviousTxnID |
No | Yes | string |
HASH256 |
N/A |
Identifies the transaction ID that most recently modified this object. |
PreviousTxnLgrSeq |
No | Yes | number |
UINT32 |
N/A |
The sequence of the ledger that contains the transaction that most recently modified this object. |
Sequence |
No | Yes | number |
UINT32 |
N/A |
The transaction sequence number that created the vault. |
OwnerNode |
No | Yes | number |
UINT64 |
N/A |
Identifies the page where this item is referenced in the owner's directory. |
Owner |
No | Yes | string |
AccountID |
N/A |
The account address of the Vault Owner. |
Account |
No | Yes | string |
AccountID |
N/A |
The address of the Vaults pseudo-account. |
Data |
Yes | No | string |
BLOB |
None | Arbitrary metadata about the Vault. Limited to 256 bytes. |
Asset |
No | Yes | string or object |
ISSUE |
N/A |
The asset of the vault. The vault supports XRP, IOU and MPT. |
AssetsTotal |
No | Yes | number |
NUMBER |
0 | The total value of the vault. LendingProtocolV1_1: on a CashBasis Vault it excludes interest not yet paid (XLS-65.4.3). LendingProtocolV1_2: on a FixedPrecision Vault it is derived from AssetsAvailable + AssetsDeployed (XLS-65.7.1). |
AssetsAvailable |
No | Yes | number |
NUMBER |
0 | The asset amount that is available in the vault. |
LossUnrealized |
No | Yes | number |
NUMBER |
0 | The potential loss amount that is not yet realized expressed as the vaults asset. |
AssetsMaximum |
Yes | No | number |
NUMBER |
0 | The maximum asset amount that can be held in the vault. Zero value 0 indicates there is no cap. |
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 | No | number |
UINT8 |
0 | 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. Stored only when non-zero; absent for XRP and MPT. VaultCreate defaults it to 6 for an IOU. |
LEVersion |
Yes | No | number |
UINT8 |
0 | LendingProtocolV1_1: accounting version of the Vault, set at creation. Absent or 0 is Legacy, 1 is CashBasis (XLS-65.4.3), 2 is FixedPrecision (XLS-65.7.1). |
AssetsDeployed |
No | No | string |
NUMBER |
0 | LendingProtocolV1_2: principal lent out by a FixedPrecision Vault (XLS-65.7.1). |
YieldUnrealized |
No | No | string |
NUMBER |
0 | LendingProtocolV1_2: scheduled interest owed to a FixedPrecision Vault and not yet received (XLS-65.7.1). |
VaultKind |
Yes | No | number |
UINT8 |
0 | LendingProtocolV1_1: Vault kind. Absent or 0 is open-ended; 1 is closed-ended. |
SubscriptionDate |
Yes | Conditional | number |
UINT32 |
N/A |
LendingProtocolV1_1: End of Subscription and start of Investment; required for a closed-ended Vault. |
RedemptionDate |
Yes | Conditional | number |
UINT32 |
N/A |
LendingProtocolV1_1: Start of Redemption; required for a closed-ended Vault. |
3.1.2.1. Vault Kind and Phase Derivation¶
VaultKind selects the lifecycle. Under LendingProtocolV1_1:
- Absent or
0(OpenEnded): the Vault behaves as before this amendment. It has no phase (NoPhase).SubscriptionDateandRedemptionDatemust be absent. 1(ClosedEnded): the Vault is a fixed-term fund. Both dates are required and immutable. Deposits are allowed only through the end of Subscription; withdrawals are blocked for the whole Investment interval and allowed again from Redemption onward.
VaultCreate rejects an unknown VaultKind. Other logic that encounters a future, unknown kind already stored on the ledger treats it as OpenEnded and therefore as NoPhase.
The phase is not stored. For a closed-ended Vault it is derived from the parent ledger close time, now:
| Condition | Phase |
|---|---|
now <= SubscriptionDate |
Subscription |
SubscriptionDate < now < RedemptionDate |
Investment |
now >= RedemptionDate |
Redemption |
SubscriptionDate is the last second of Subscription. RedemptionDate is the first second of Redemption. Investment is the open interval between them. See XLS-65.4.4 for the full closed-ended rules.
3.1.3. Flags¶
The Vault object supports the following flags:
| Flag Name | Flag Value | Modifiable? | Description |
|---|---|---|---|
lsfVaultPrivate |
0x00010000 |
No | If set, indicates that the vault is private. |
3.1.4. Ownership¶
The Vault objects are stored in the ledger and tracked in an Owner Directory owned by the account submitting the VaultCreate transaction. To find the Vault from the vault shares, the pseudo-account that issues the shares has a VaultID field pointing back to the Vault.
3.1.5. Reserves¶
VaultCreate increases the Vault Owner's OwnerCount by 3:
- The
Vaultobject itself. - The pseudo-account
AccountRoot. - The Vault Owner's
MPTokenfor the vault shares.
The share MPTokenIssuance and the pseudo-account's holding of Vault.Asset are counted on the pseudo-account, not the Vault Owner.
VaultDelete decreases the Vault Owner's OwnerCount by 2 for the Vault and the pseudo-account. It also deletes the Vault Owner's share MPToken, if one exists.
3.1.6. Deletion¶
Deletion Transactions: VaultDelete (§3.4).
Deletion Conditions (§3.4.3.2 items 3 to 6, and §3.1.9 item 10):
Vault.AssetsAvailableis zero.Vault.AssetsTotalis zero.MPTokenIssuance(Vault.ShareMPTID).OutstandingAmountis zero (no outstanding shares remain).- The pseudo-account's
OwnerDirectorycontains no objects after cleanup.
Account Deletion Blocker: TODO: content pass.
3.1.7. Pseudo-Account¶
An AccountRoot entry holds the XRP, IOU or MPT deposited into the vault. It also acts as the issuer of the vault's shares. The pseudo-account follows the XLS-64 specification for pseudo accounts. The AccountRoot object is created when creating the Vault object.
SingleAssetVault: What the pseudo-account owns is not checked.fixCleanup3_5_0: The pseudo-account may own only its shareMPTokenIssuance, its holding ofVault.Asset, and theLoanBrokerentries of this Vault (XLS-65.6).
3.1.8. Freeze/Lock¶
The issuer of the Vaults asset may enact a freeze either through a Global Freeze for IOUs or locking MPT. When the vaults asset is frozen, it can only be withdrawn by specifying the Destination account as the Issuer of the asset. Similarly, a frozen asset may not be deposited into a vault. Furthermore, when the asset of a vault is frozen, the shares corresponding to the asset may not be transferred.
3.1.9. Invariants¶
Vault.AssetsAvailable >= 0.Vault.AssetsTotal >= 0.Vault.AssetsMaximum >= 0.Vault.AssetsAvailable <= Vault.AssetsTotal.-
SingleAssetVault:Vault.LossUnrealized <= (Vault.AssetsTotal - Vault.AssetsAvailable).fixCleanup3_4_0: IfVault.Assetis anIOU,Vault.LossUnrealized <= (Vault.AssetsTotal - Vault.AssetsAvailable) + 1 unitat the scale ofVault.AssetsTotal. ForXRPandMPTthe comparison remains strict<=.LendingProtocolV1_2: For a Vault withLEVersion2,Vault.LossUnrealized <= Vault.AssetsDeployedreplaces both rules above (XLS-65.7.1).
-
SingleAssetVault: The check does not apply.fixCleanup3_4_0:Vault.LossUnrealized >= 0, for every asset type.
- If
MPTokenIssuance(Vault.ShareMPTID).OutstandingAmount == 0:Vault.AssetsTotal == 0andVault.AssetsAvailable == 0.LendingProtocolV1_2: for a Vault withLEVersion2, alsoVault.AssetsDeployed == 0. - The
MPTokenIssuanceidentified byVault.ShareMPTIDmust exist, and itsOutstandingAmountmust not exceed itsMaximumAmount.VaultCreateleavesMaximumAmountabsent (§3.1.10.2.1), in which case the bound is the protocol maximum0x7FFFFFFFFFFFFFFF. - On creation,
Vault.AssetsTotal,Vault.AssetsAvailable,Vault.LossUnrealizedand the shareMPTokenIssuance.OutstandingAmountare all zero. The share issuance hasIssuer == Vault.Account, andAccountRoot(Vault.Account)is a pseudo-account whoseVaultIDpoints to the new vault. OnlyVaultCreatemay create aVault. - Only
VaultDeletemay delete aVault. It must also delete the shareMPTokenIssuance, and the deleted vault must haveAssetsTotal == 0,AssetsAvailable == 0and no outstanding shares. - There is no invariant requiring
Vault.AssetsTotal <= Vault.AssetsMaximumto hold on every modification of the entry, becauseVault.AssetsTotalgrows with accrued interest and interest is not a deposit. The cap is instead enforced per transaction, by the checks in items 12 and 13 and byLoanSet(see the Lending Protocol §3.8.5.2):SingleAssetVault:LoanSetfails whenVault.AssetsMaximumis non-zero and eitherVault.AssetsTotal >= Vault.AssetsMaximumorVault.AssetsTotal + InterestDue > Vault.AssetsMaximum.LendingProtocolV1_1: thoseLoanSetchecks apply only to a Vault withoutLEVersion(Legacy). On a Vault withLEVersion1 or later, origination does not changeAssetsTotaland the checks do not apply (XLS-65.4.3).
VaultDepositfails whenVault.AssetsMaximumis non-zero and the post-depositVault.AssetsTotalexceeds it.-
SingleAssetVault:VaultSetfails whenVault.AssetsMaximumis non-zero andVault.AssetsTotalexceeds it.fixCleanup3_4_0:VaultSetfails whenVault.AssetsMaximumis non-zero,Vault.AssetsTotalexceeds it, and the transaction suppliesAssetsMaximumor the cap otherwise changes. A cap already exceeded by accrued interest no longer blocks aVaultSetthat omitsAssetsMaximumand does not otherwise change the cap.
-
SingleAssetVault:Vault.Asset,Vault.AccountandVault.ShareMPTIDare immutable once set.LendingProtocolV1_1:Vault.Sequence,Vault.OwnerNode,Vault.Owner,Vault.WithdrawalPolicy,Vault.Scale,Vault.LEVersion,Vault.VaultKind,Vault.SubscriptionDate,Vault.RedemptionDate,Vault.Asset,Vault.AccountandVault.ShareMPTIDare immutable once set. IfVault.LEVersion,Vault.VaultKind,Vault.SubscriptionDateorVault.RedemptionDateis absent, it remains absent, except when the transaction creates the entry.
Vault.LossUnrealizedmay only be changed byLoanManageandLoanPay. Every other transaction that modifies the entry must leave it unchanged.- A
Vaultis modified only by a transaction type that declares a vault privilege —VaultCreate,VaultSet,VaultDelete,VaultDeposit,VaultWithdraw,VaultClawback,LoanSet,LoanPayandLoanManage— and at most oneVaultis modified per transaction.LoanManagehasMayModifyVaultand may succeed without modifying one; each other listed transaction hasMustModifyVaultand must create, modify or delete one. LendingProtocolV1_1: A closed-ended Vault has bothSubscriptionDateandRedemptionDate, and180 <= RedemptionDate - SubscriptionDate < 946708560.LendingProtocolV1_2: A Vault withLEVersion2 also satisfies the invariants of XLS-65.7.1 §3.3.2.
3.1.10. Vault Shares¶
Shares represent the portion of the Vault assets a depositor owns. Vault Owners set the currency code of the share and whether the token is transferable during the vault's creation. These two values are immutable. The share is represented by a Multi-Purpose Token. The MPT is issued by the vault's pseudo-account.
3.1.10.1. Scale¶
The Scale field enables the vault to accurately represent fractional asset values using integer-only MPT shares, which prevents the loss of value from decimal truncation. It defines a scaling factor, calculated as \(10^{\text{Scale}}\), that converts a decimal asset amount into a corresponding whole number of shares. For example, with a Scale of 6, a deposit of 20.3 assets is multiplied by \(10^6\) and credited as 20,300,000 shares.
As a general rule, all calculations involving MPTs are executed with a precision of a single MPT, treating them as indivisible units. If a calculation results in a fractional amount, it will be rounded up, down or to the nearest whole number depending on the context. Crucially, the rounding direction is determined by the protocol and is not controlled by the transaction submitter, which may lead to unexpected results.
3.1.10.1.1. IOU¶
When a vault holds an IOU, the Scale is configurable by the Vault Owner at the time of the vault's creation. The value can range from 0 to a maximum of 18, with a default of 6. This flexibility allows issuers to set a level of precision appropriate for their specific token.
SingleAssetVault: the maximum is 18.LendingProtocolV1_2: for a Vault created withLEVersion2, the maximum is 10 (XLS-65.7.1).
3.1.10.1.2. XRP¶
When a vault holds XRP, the Scale is fixed at 0. This aligns with XRP's native structure, where one share represents one drop (the smallest unit of XRP), and one XRP equals 1,000,000 drops. Therefore, a deposit of 10 XRP to an empty Vault will result in the issuance of 10,000,000 shares (\(10 \times 10^6\)).
3.1.10.1.3. MPT¶
When a vault holds MPT, its Scale is fixed at 0. This creates a 1-to-1 relationship between deposited MPT units and the shares issued (for example, depositing 10 MPTs to an empty Vault issues 10 shares). The value of a single MPT is determined at the issuer's discretion. If an MPT is set to represent a large value, the vault owner and the depositor must be cautious. Since only whole MPT units are used in calculations, any value that is not a multiple of a single MPT's value may be lost due to rounding during a transaction.
3.1.10.2. MPTokenIssuance¶
The MPTokenIssuance object represents the share on the ledger. It is created and deleted together with the Vault object.
3.1.10.2.1. MPTokenIssuance Values¶
| Field | Description | Value |
|---|---|---|
Issuer |
The AccountID of the Vault's pseudo-account. | pseudo-account ID |
MaximumAmount |
Not set, so the number of shares that can be issued is bounded only by the protocol maximum. | absent |
TransferFee |
The fee paid to transfer the shares. | 0 |
MPTokenMetadata |
Arbitrary metadata about the share MPT, in hex format. | - |
AssetScale |
Represents orders of magnitude between the standard and the MPT unit. For IOUs it is set to Vault.Scale, otherwise it is 0. |
Vault.Scale |
DomainID |
The PermissionedDomain of a private Vault, if VaultCreate supplied one. |
DomainID or absent |
ReferenceHolding |
fixCleanup3_2_0: the ID of the pseudo-account's holding of Vault.Asset (XLS-65.2). Absent for XRP. |
holding ID or absent |
VaultCreate omits MaximumAmount on the share issuance rather than storing an explicit cap. The number of shares in issue is therefore bounded by the protocol maximum for an MPTokenIssuance, 0x7FFFFFFFFFFFFFFF, as defined in XLS-33 §3.1.2.4.
3.1.10.2.2. Flags¶
The following flags are set based on whether the shares are transferable and if the vault is public or private.
| Condition | Transferable | Non-Transferable |
|---|---|---|
| Public Vault | lsfMPTCanEscrow lsfMPTCanTradelsfMPTCanTransfer |
No Flags |
| Private Vault | lsfMPTCanEscrowlsfMPTCanTradelsfMPTCanTransferlsfMPTRequireAuth |
lsfMPTRequireAuth |
3.1.10.3. MPToken¶
The MPToken object represents the amount of shares held by a depositor. It is created when the account deposits liquidity into the vault and is deleted when a depositor redeems (or transfers) all shares.
3.1.10.3.1. MPToken Values¶
The MPToken values should be set as per the MPT specification.
| Condition | Transferable | Non-Transferable |
|---|---|---|
| Public Vault | No Flags | lsfMPTAuthorized |
| Private Vault | lsfMPTAuthorized |
lsfMPTAuthorized |
3.1.11. Exchange Algorithm¶
Exchange Algorithm refers to the logic that is used to exchange assets into shares and shares into assets. This logic is executed when depositing or redeeming liquidity. A Vault comes with the default exchange algorithm, which is detailed below.
3.1.11.1. Unrealized Loss¶
A well-informed depositor may learn of an incoming loss and redeem their shares early, causing the remaining depositors to bear the full loss. To discourage such behaviour, we introduce a concept of "paper loss," captured by the Vault object's LossUnrealized attribute. The "paper loss" captures a potential loss the vault may experience and thus temporarily decreases the vault value. Only a protocol connected to the Vault may increase or decrease the LossUnrealized attribute; for the Lending Protocol that means LoanManage and LoanPay alone.
The "paper loss" temporarily decreases the vault value. A malicious depositor may take advantage of this to deposit assets at a lowered price and withdraw them once the price increases.
Consider a vault with a total value of $1.0m and total shares of $1.0m. Assume the "paper loss" for the vault is $900k. The new exchange rate is as follows:
\[ exchangeRate = \frac{AssetsTotal - LossUnrealized}{SharesTotal} \]
\[ exchangeRate = \frac{1,000,000 - 900,000}{1,000,000} = 0.1 \]
After the "paper loss" is cleared, the new effective exchange rate would be as follows:
\[ exchangeRate = \frac{AssetsTotal}{SharesTotal} \]
\[ exchangeRate = \frac{1,000,000}{1,000,000} = 1.0 \]
A depositor could deposit $100k assets at a 0.1 exchange rate and get 1.0m shares. Once the "paper loss" is cleared, their shares would be worth $1.0m.
To account for this problem, the Vault must use two different exchange rate models: one for depositing assets and one for withdrawing them.
3.1.11.2. Exchange Rate Algorithms¶
This section details the algorithms used to calculate the exchange between assets and shares for deposits, redemptions, and withdrawals.
The following are the key variables used in the calculations:
- \(\Gamma_{assets}\): The total balance of assets held within the vault.
- \(\Gamma_{shares}\): The total number of shares currently issued by the vault.
- \(\Delta_{assets}\): The amount of assets being deposited, withdrawn, or redeemed.
- \(\Delta_{shares}\): The number of shares being issued or burned.
- \(\iota\): The vault's total unrealized loss.
- \(\sigma\): The scaling factor derived from
Scale, used to convert fractional assets into integer shares.
3.1.11.2.1. Deposit¶
The deposit function calculates the number of shares a user receives for their assets.
Calculation Logic
The calculation depends on whether the vault is empty.
-
Initial Deposit: For the first deposit into an empty vault, shares are calculated using a scaling factor, \(\sigma = 10^{\text{Scale}}\), to properly represent fractional assets as whole numbers. \[\Delta_{shares} = \Delta_{assets} \times \sigma\]
-
Subsequent Deposits: For all other deposits, shares are calculated proportionally. The resulting \(\Delta_{shares}\) value is rounded down to the nearest integer. \[\Delta_{shares} = \frac{\Delta_{assets} \times \Gamma_{shares}}{\Gamma_{assets}}\]
Because the share amount is rounded down, the actual assets taken from the depositor (\(\Delta_{assets'}\)) are recalculated.
\[\Delta_{assets'} = \frac{\Delta_{shares} \times \Gamma_{assets}}{\Gamma_{shares}}\]
SingleAssetVault: \(\Delta_{assets}\) is the depositedAmount.fixCleanup3_2_0: \(\Delta_{assets}\) isAmountrounded toward zero at the scale of the posteriorVault.AssetsTotal(XLS-65.2).fixCleanup3_4_0: \(\Delta_{assets'}\) is further rounded down at that scale, without recomputing \(\Delta_{shares}\) (XLS-65.5).
3.1.11.2.1.1. Vault State Update¶
The vault's totals are updated with the final calculated amounts.
- New Total Assets: \(\Gamma_{assets} \leftarrow \Gamma_{assets} + \Delta_{assets'}\)
- New Total Shares: \(\Gamma_{shares} \leftarrow \Gamma_{shares} + \Delta_{shares}\)
3.1.11.2.2. Redeem¶
The redeem function calculates the asset payout for a user burning a specific number of shares.
Calculation Logic
The amount of assets a user receives is calculated by finding the proportional value of their shares relative to the vault's total holdings, accounting for any unrealized loss (\(\iota\)).
\[\Delta_{assets} = \frac{\Delta_{shares} \times (\Gamma_{assets} - \iota)}{\Gamma_{shares}}\]
Vault State Update
The vault's totals are reduced after the redemption.
- New Total Assets: \(\Gamma_{assets} \leftarrow \Gamma_{assets} - \Delta_{assets}\)
- New Total Shares: \(\Gamma_{shares} \leftarrow \Gamma_{shares} - \Delta_{shares}\)
3.1.11.2.3. Withdraw¶
The withdraw function handles a request for a specific amount of assets, which involves a two-step process to determine the final payout.
First, the requested asset amount (\(\Delta_{assets_requested}\)) is converted into the equivalent number of shares to burn, based on the vault's real value.
\[\Delta_{shares} = \frac{\Delta_{assets_requested} \times \Gamma_{shares}}{(\Gamma_{assets} - \iota)}\]
This calculated \(\Delta_{shares}\) amount is rounded to a whole number:
SingleAssetVault: rounded to the nearest whole number.fixCleanup3_4_0: truncated (rounded down), so the payout never exceeds the requested amount (XLS-65.5).fixCleanup3_5_0: whenVaultWithdrawcharges a transfer fee, \(\Delta_{assets_requested}\) is the requested amount plus that fee (XLS-65.6).
Next, the rounded number of shares from Step 1 is used to calculate the final asset payout (\(\Delta_{assets_out}\)), using the same logic as a redemption.
\[\Delta_{assets_out} = \frac{\Delta_{shares} \times (\Gamma_{assets} - \iota)}{\Gamma_{shares}}\]
Due to the rounding in Step 1, this final payout may differ slightly from the user's requested amount.
Vault State Update
The vault's totals are reduced by the final calculated amounts.
- New Total Assets: \(\Gamma_{assets} \leftarrow \Gamma_{assets} - \Delta_{assets_out}\)
- New Total Shares: \(\Gamma_{shares} \leftarrow \Gamma_{shares} - \Delta_{shares}\)
3.1.11.3. Withdrawal Policy¶
Withdrawal policy controls the logic used when removing liquidity from a vault. Each strategy has its own implementation, but it can be used in multiple vaults once implemented. Therefore, different vaults may have different withdrawal policies. The specification introduces the following options:
3.1.11.3.1. first-come-first-serve¶
The First Come, First Serve strategy treats all requests equally, allowing a depositor to redeem any amount of assets provided they have a sufficient number of shares.
3.1.12. Transfer Fees¶
The Vault does not apply the Transfer Fee to VaultDeposit, VaultClawback or vault share transfers made by the Vault transactions. Furthermore, whenever a protocol moves assets from or to a Vault, the Transfer Fee must not be charged.
SingleAssetVault:VaultWithdrawdoes not charge the transfer fee.fixCleanup3_5_0:VaultWithdrawcharges the asset's transfer fee when the destination differs from the submitter and neither is the asset issuer (XLS-65.6).
3.1.13. RPC Name¶
TODO: content pass.
3.1.14. Example JSON¶
{
"LedgerEntryType": "Vault",
"Account": "rKwvc1mgHLyHKY3yRUqVwffWtsxYb3QLWf",
"Asset": {
"currency": "USD",
"issuer": "r9cZ5oHbdL4Z9Maj6TdnfAos35nVzYuNds"
},
"AssetsAvailable": "100",
"AssetsMaximum": "1000000",
"AssetsTotal": "100",
"Flags": 0,
"LossUnrealized": "0",
"Owner": "rwhaYGnJMexktjhxAKzRwoCcQ2g6hvBDWu",
"OwnerNode": "0",
"PreviousTxnID": "1484794AE38DBB7C6F4E0B7536CC560B418135BEDB0F8904349F7F8A3B496826",
"PreviousTxnLgrSeq": 6,
"Scale": 6,
"Sequence": 5,
"ShareMPTID": "00000001C752C42A1EBD6BF2403134F7CFD2F1D835AFD26E",
"WithdrawalPolicy": 1
}
3.2. Transaction: VaultCreate¶
The VaultCreate transaction creates a new Vault object.
3.2.1. Fields¶
| Field Name | Required | JSON Type | Internal Type | Default Value | Description |
|---|---|---|---|---|---|
TransactionType |
Yes | string |
UINT16 |
65 |
The transaction type (ttVAULT_CREATE). |
Flags |
Yes | number |
UINT32 |
0 | Specifies the flags for the Vault. |
Data |
No | string |
BLOB |
Arbitrary Vault metadata, limited to 256 bytes. | |
Asset |
Yes | string or object |
ISSUE |
N/A |
The asset (XRP, IOU or MPT) of the Vault. |
AssetsMaximum |
No | number |
NUMBER |
0 | The maximum asset amount that can be held in a vault. |
MPTokenMetadata |
No | string |
BLOB |
Arbitrary metadata about the share MPT, in hex format, limited to 1024 bytes. |
|
WithdrawalPolicy |
No | number |
UINT8 |
1 |
Indicates the withdrawal strategy used by the Vault. Only 1 (vaultStrategyFirstComeFirstServe) is accepted. |
DomainID |
No | string |
HASH256 |
The PermissionedDomain object ID associated with the shares of this Vault. |
|
Scale |
No | 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. Accepted only for an IOU asset. |
VaultKind |
No | number |
UINT8 |
0 | LendingProtocolV1_1: 0 is open-ended and 1 is closed-ended. |
SubscriptionDate |
Conditional | number |
UINT32 |
N/A |
LendingProtocolV1_1: End of Subscription and start of Investment; required for a closed-ended Vault. |
RedemptionDate |
Conditional | number |
UINT32 |
N/A |
LendingProtocolV1_1: Start of Redemption; required for a closed-ended Vault. |
3.2.1.1. WithdrawalPolicy¶
The type indicates the withdrawal strategy supported by the vault. The following values are supported:
| Strategy Name | Value | Description |
|---|---|---|
vaultStrategyFirstComeFirstServe |
0x0001 |
Requests are processed on a first-come-first-serve basis. |
3.2.2. Flags¶
| Flag Name | Flag Value | Description |
|---|---|---|
tfVaultPrivate |
0x00010000 |
Indicates that the vault is private. It can only be set during Vault creation. |
tfVaultShareNonTransferable |
0x00020000 |
Indicates the vault share is non-transferable. It can only be set during Vault creation. |
3.2.3. Transaction Fee¶
VaultCreate uses the standard transaction fee. The pseudo-account it creates is paid for through the Vault Owner's reserve (§3.1.5).
3.2.4. Failure Conditions¶
3.2.4.1. Data Verification¶
- The
MPTokensV1amendment is not enabled. (temDISABLED) DomainIDis present and thePermissionedDomainsamendment is not enabled. (temDISABLED)-
SingleAssetVault:VaultKind,SubscriptionDateorRedemptionDateis present. (temDISABLED)LendingProtocolV1_1: The check does not apply.
Flagshas a bit set other thantfVaultPrivateandtfVaultShareNonTransferable. (temINVALID_FLAG)Datais present and is empty or longer than 256 bytes. (temMALFORMED)WithdrawalPolicyis present and is not1(vaultStrategyFirstComeFirstServe). (temMALFORMED)DomainIDis present and is zero. (temMALFORMED)DomainIDis present andtfVaultPrivateis not set. (temMALFORMED)AssetsMaximumis present and negative. (temMALFORMED)-
SingleAssetVault: The check does not apply.fixCleanup3_5_0:AssetsMaximumis present and cannot be represented as an amount ofAsset(XLS-65.6). (temMALFORMED)
MPTokenMetadatais present and is empty or longer than 1024 bytes. (temMALFORMED)Scaleis present andAssetisXRPor anMPT. (temMALFORMED)-
SingleAssetVault:Scaleis greater than 18. (temMALFORMED)LendingProtocolV1_2: When the new Vault will haveLEVersion2,Scaleis greater than 10 (XLS-65.7.1). (temMALFORMED)
LendingProtocolV1_1:VaultKindhas an unrecognized value. (temMALFORMED)LendingProtocolV1_1:VaultKindis absent orOpenEnded, butSubscriptionDateorRedemptionDateis present. (temMALFORMED)LendingProtocolV1_1:VaultKindisClosedEnded, but either date is absent. (temMALFORMED)LendingProtocolV1_1:VaultKindisClosedEndedandSubscriptionDate + 180 > RedemptionDateorRedemptionDate >= SubscriptionDate + 946708560. (temMALFORMED)
The sums in check 17 must be computed without 32-bit overflow.
3.2.4.2. Protocol-Level Failures¶
- A holding of
Assetcannot be added:Assetis anIOUand its issuer account does not exist. (terNO_ACCOUNT)Assetis anIOUand its issuer does not havelsfDefaultRippleset. (terNO_RIPPLE)Assetis anMPTand itsMPTokenIssuancedoes not exist. (tecOBJECT_NOT_FOUND)Assetis anMPTandlsfMPTCanTransferis not set on itsMPTokenIssuance. (tecNO_AUTH)
Assetis issued by a pseudo-account, for example the shares of another Vault. (tecWRONG_ASSET)Assetis frozen for the Vault Owner:- For an
IOU, a global freeze or a freeze on the owner's trust line. (tecFROZEN) - For an
MPT, a global or individual lock. (tecLOCKED)
- For an
DomainIDis present and thePermissionedDomainit names does not exist. (tecOBJECT_NOT_FOUND)- The pseudo-account address derived for the new Vault is already in use. (
terADDRESS_COLLISION) LendingProtocolV1_1:VaultKindisClosedEndedandSubscriptionDateis not strictly after the parent ledger close time. (tecEXPIRED)LendingProtocolV1_1:VaultKindisClosedEndedandRedemptionDateis not strictly after the parent ledger close time. (tecEXPIRED)LendingProtocolV1_2: When the new Vault will haveLEVersion2,AssetsMaximumis not exactly representable on the Vault's base grid (XLS-65.7.1). (tecPRECISION_LOSS)- The Vault Owner's balance before the fee does not cover the reserve for the new objects (§3.1.5). (
tecINSUFFICIENT_RESERVE)
3.2.5. State Changes¶
- Create a new
Vaultledger object.Scaleis the transaction'sScale, or 6 when absent, for anIOU; 0 forXRPandMPT. It is stored only when non-zero.WithdrawalPolicyis the transaction's value, or1when absent.FlagsislsfVaultPrivateiftfVaultPrivateis set, otherwise 0.SingleAssetVault:VaultKind,SubscriptionDate, andRedemptionDateare absent.LendingProtocolV1_1: IfVaultKind == ClosedEnded, store all three fields; otherwise leave all three absent.SingleAssetVault:LEVersionis absent.LendingProtocolV1_1:LEVersionis1(XLS-65.4.3), or2under XLS-65.7.1.
- Create a new
MPTokenIssuanceledger object for the vault shares, issued by the pseudo-account, and assign its MPTID toVault.ShareMPTID. Its values are as in §3.1.10.2.- If the
DomainIDis provided:MPTokenIssuance(Vault.ShareMPTID).DomainID = DomainID(Set the Permissioned Domain ID).
- Create an
MPTokenobject for the Vault Owner to hold Vault Shares. IftfVaultPrivateis set, the pseudo-account authorizes it (lsfMPTAuthorized). -
SingleAssetVault:ReferenceHoldingis absent.fixCleanup3_2_0:ReferenceHoldingis the ID of the pseudo-account's holding created in step 4 or 5 (XLS-65.2).
- If the
-
Create a new
AccountRootpseudo-account object withVaultIDset to the new Vault's ID. -
If
Vault.Assetis anIOU:- Create a
RippleStateobject between the pseudo-accountAccountRootandIssuerAccountRoot.
- Create a
-
If
Vault.Assetis anMPT:- Create
MPTokenobject for the pseudo-account for theAsset.MPTokenIssuance.
- Create
-
Add the
Vaultto the Vault Owner's owner directory and increase the Vault Owner'sOwnerCountby 3 (§3.1.5).
3.2.6. Invariants¶
- A newly created vault has zero
AssetsTotal,AssetsAvailable,LossUnrealizedand outstanding shares. - The share
MPTokenIssuance.IssuerequalsVault.Account, and that account is a pseudo-account whoseVaultIDpoints to the new vault. - Only
VaultCreatemay create aVault; it must create rather than update one. LendingProtocolV1_1: A newly created closed-ended Vault has both phase dates and satisfies180 <= RedemptionDate - SubscriptionDate < 946708560.LendingProtocolV1_2: A newly created Vault withLEVersion2 also has zeroAssetsDeployedandYieldUnrealized.
3.2.7. Example JSON¶
{
"TransactionType": "VaultCreate",
"Account": "rwhaYGnJMexktjhxAKzRwoCcQ2g6hvBDWu",
"Fee": "10",
"Sequence": 5,
"Flags": 0,
"Asset": {
"currency": "USD",
"issuer": "r9cZ5oHbdL4Z9Maj6TdnfAos35nVzYuNds"
},
"AssetsMaximum": "1000000",
"Scale": 6,
"Data": "5468697320697320617262697472617279206D657461646174612061626F757420746865207661756C742E"
}
3.3. Transaction: VaultSet¶
The VaultSet updates an existing Vault ledger object.
3.3.1. Fields¶
| Field Name | Required | JSON Type | Internal Type | Default Value | Description |
|---|---|---|---|---|---|
TransactionType |
Yes | string |
UINT16 |
66 |
The transaction type (ttVAULT_SET). |
VaultID |
Yes | string |
HASH256 |
N/A |
The ID of the Vault to be modified. Must be included when updating the Vault. |
Data |
No | string |
BLOB |
Arbitrary Vault metadata, limited to 256 bytes. | |
AssetsMaximum |
No | number |
NUMBER |
The maximum asset amount that can be held in a vault. The value cannot be lower than the current AssetsTotal unless the value is 0. |
|
DomainID |
No | string |
HASH256 |
The PermissionedDomain object ID associated with the shares of this Vault. |
3.3.2. Transaction Fee¶
TODO: content pass.
3.3.3. Failure Conditions¶
3.3.3.1. Data Verification¶
- The
VaultIDfield is zero. (temMALFORMED) - The
Datafield, if provided, is empty or exceeds 256 bytes. (temMALFORMED) - The
AssetsMaximumfield, if provided, is negative. (temMALFORMED) - None of
Data,AssetsMaximum, orDomainIDare provided (nothing to update). (temMALFORMED)
3.3.3.2. Protocol-Level Failures¶
- The
Vaultobject with the specifiedVaultIDdoes not exist on the ledger. (tecNO_ENTRY) - The submitting account is not the
Ownerof the vault. (tecNO_PERMISSION) -
SingleAssetVault: The check does not apply.fixCleanup3_5_0: TheAssetsMaximumfield is supplied and cannot be represented as an amount ofVault.Asset(XLS-65.6). (tecPRECISION_LOSS)
- The
DomainIDfield is provided and the vault does not havelsfVaultPrivateset. (tecNO_PERMISSION) - The
DomainIDfield is provided, is non-zero, and the referencedPermissionedDomainobject does not exist. (tecOBJECT_NOT_FOUND) -
SingleAssetVault: The check does not apply.LendingProtocolV1_2: TheAssetsMaximumfield is supplied and is not exactly representable at the Vault's scale. This applies to every Vault, whatever itsLEVersion(XLS-65.7.1). (tecPRECISION_LOSS)
- The
AssetsMaximumfield is supplied, is non-zero, and is less than the currentVault.AssetsTotal. (tecLIMIT_EXCEEDED) - The resulting
Vault.AssetsMaximumis non-zero and the currentVault.AssetsTotalexceeds it. (tecINVARIANT_FAILED)SingleAssetVault: This applies to everyVaultSet, including one that supplies neitherAssetsMaximumnor any other change to the cap.fixCleanup3_4_0: This applies only when the transaction suppliesAssetsMaximumor otherwise changes the cap. AVaultSetthat omitsAssetsMaximumand leaves the cap unchanged succeeds even when accrued interest has pushedVault.AssetsTotalpast the cap.
3.3.4. State Changes¶
- Update the mutable fields
DataandAssetsMaximumin theVaultledger object, if provided. - If
DomainIDis provided and non-zero: setMPTokenIssuance(Vault.ShareMPTID).DomainID = DomainID. - If
DomainIDis provided and is zero: removeDomainIDfromMPTokenIssuance(Vault.ShareMPTID).
3.3.5. Invariants¶
VaultSetmust not change the vault pseudo-account's asset balance.VaultSetmust not changeVault.AssetsTotalorVault.AssetsAvailable.VaultSetmust not changeMPTokenIssuance(Vault.ShareMPTID).OutstandingAmount.-
SingleAssetVault: IfVault.AssetsMaximum > 0:Vault.AssetsTotal <= Vault.AssetsMaximum.fixCleanup3_4_0: This is checked only if the transaction suppliesAssetsMaximumor otherwise changes the cap.
3.3.6. Example JSON¶
{
"TransactionType": "VaultSet",
"Account": "rwhaYGnJMexktjhxAKzRwoCcQ2g6hvBDWu",
"Fee": "10",
"Sequence": 6,
"VaultID": "2DE64CA41250EF3CB7D2B127D6CEC31F747492CAE2BD1628CA02EA1FFE7475B3",
"AssetsMaximum": "2000000"
}
3.4. Transaction: VaultDelete¶
The VaultDelete transaction deletes an existing vault object.
3.4.1. Fields¶
| Field Name | Required | JSON Type | Internal Type | Default Value | Description |
|---|---|---|---|---|---|
TransactionType |
Yes | string |
UINT16 |
67 |
Transaction type (ttVAULT_DELETE in rippled). |
VaultID |
Yes | string |
HASH256 |
N/A |
The ID of the vault to be deleted. |
MemoData |
No | string |
BLOB |
N/A |
A hexadecimal-encoded opaque reason for the deletion. When present, the decoded value must be 1–256 bytes. Requires LendingProtocolV1_1. |
3.4.2. Transaction Fee¶
TODO: content pass.
3.4.3. Failure Conditions¶
3.4.3.1. Data Verification¶
- The
VaultIDfield is zero. (temMALFORMED) -
SingleAssetVault: TheMemoDatafield is present. (temDISABLED)LendingProtocolV1_1: The check does not apply.
-
LendingProtocolV1_1: TheMemoDatafield is present and is empty or longer than 256 bytes. (temMALFORMED)
3.4.3.2. Protocol-Level Failures¶
- The
Vaultobject with theVaultIDdoes not exist on the ledger. (tecNO_ENTRY) - The submitting account is not the
Ownerof the vault. (tecNO_PERMISSION) Vault.AssetsAvailableis greater than zero. (tecHAS_OBLIGATIONS)Vault.AssetsTotalis greater than zero. (tecHAS_OBLIGATIONS)MPTokenIssuance(Vault.ShareMPTID).OutstandingAmountis greater than zero (outstanding shares remain). (tecHAS_OBLIGATIONS)- The pseudo-account's
OwnerDirectorystill contains objects after cleanup (unexpected obligations remain). (tecHAS_OBLIGATIONS)
3.4.4. State Changes¶
- Delete the
MPTokenorRippleStateobject corresponding to the vault's holding of the asset, if one exists. - Delete the vault owner's
MPTokenfor vault shares, if one exists. - Delete the
MPTokenIssuanceobject for the vault shares. - Delete the
AccountRootobject of the pseudo-account, and itsDirectoryNodeobjects. - Remove the
Vaultobject from theVault.Owner'sDirectoryNodeand decrementOwnerCountby 2. - Delete the
Vaultobject.
3.4.5. Invariants¶
- Only a
VaultDeletetransaction may delete aVaultobject; onlyVaultDeletemay succeed without an after-state for the vault. VaultDeletemust also delete the shareMPTokenIssuance.- At deletion:
Vault.AssetsTotal == 0,Vault.AssetsAvailable == 0, andMPTokenIssuance(Vault.ShareMPTID).OutstandingAmount == 0.
3.4.6. Example JSON¶
{
"TransactionType": "VaultDelete",
"Account": "rwhaYGnJMexktjhxAKzRwoCcQ2g6hvBDWu",
"Fee": "10",
"Sequence": 7,
"VaultID": "2DE64CA41250EF3CB7D2B127D6CEC31F747492CAE2BD1628CA02EA1FFE7475B3"
}
3.5. Transaction: VaultDeposit¶
The VaultDeposit transaction adds Liqudity in exchange for vault shares.
3.5.1. Fields¶
| Field Name | Required | JSON Type | Internal Type | Default Value | Description |
|---|---|---|---|---|---|
TransactionType |
Yes | string |
UINT16 |
68 |
Transaction type (ttVAULT_DEPOSIT). |
VaultID |
Yes | string |
HASH256 |
N/A |
The ID of the vault to which the assets are deposited. |
Amount |
Yes | string or object |
STAmount |
N/A |
Asset amount to deposit. |
3.5.2. Transaction Fee¶
TODO: content pass.
3.5.3. Failure Conditions¶
3.5.3.1. Data Verification¶
- The
VaultIDfield is zero. (temMALFORMED) - The
Amountfield is zero or negative. (temBAD_AMOUNT)
3.5.3.2. Protocol-Level Failures¶
The checks below are evaluated in the order listed.
- The
Vaultobject with theVaultIDdoes not exist on the ledger. (tecNO_ENTRY) -
SingleAssetVault: The check does not apply.LendingProtocolV1_1: The Vault is closed-ended and the parent ledger close time is greater thanVault.SubscriptionDate. (tecEXPIRED)
-
The
Amountasset does not matchVault.Asset. (tecWRONG_ASSET) -
If
Vault.Assetis anMPT:- The
lsfMPTCanTransferflag is not set in theMPTokenIssuanceobject (the asset is not transferable). (tecNO_AUTH)
- The
-
Freeze checks:
SingleAssetVault:- The asset is frozen for the depositor, including a global freeze or lock:
- For an
IOU. (tecFROZEN) - For an
MPT. (tecLOCKED)
- For an
- The vault shares are locked for the depositor. (
tecLOCKED)
- The asset is frozen for the depositor, including a global freeze or lock:
fixCleanup3_3_0: The asset is globally frozen, the depositor is individually frozen unless it is the issuer, or the pseudo-account is individually frozen. The shares are not checked (XLS-65.3).- For an
IOU. (tecFROZEN) - For an
MPT. (tecLOCKED)
- For an
-
If the vault has
lsfVaultPrivateset and the depositor is not the vault owner:- No
PermissionedDomainis configured onMPTokenIssuance(Vault.ShareMPTID). (tecNO_AUTH) - The depositor is not a valid member of the permissioned domain. (
tecNO_AUTH) An expired credential is not a failure here, because the transaction deletes it.
- No
-
The depositor does not have a required authorized holding for the vault asset (e.g., missing
MPTokenfor a restrictedMPT). (tecNO_AUTH) -
SingleAssetVault: The check does not apply.fixCleanup3_2_0: TheAmount, rounded toward zero at the posteriorVault.AssetsTotalscale, is zero (XLS-65.2). (tecPRECISION_LOSS)
- The depositor has insufficient balance to cover the deposit (the rounded amount under
fixCleanup3_2_0). (tecINSUFFICIENT_FUNDS) -
SingleAssetVault: The check does not apply.fixCleanup3_2_0:Vault.Assetis anIOU, the depositor is not its issuer, and theAmountrounds to zero at the scale of the depositor's balance. (tecPRECISION_LOSS)
- The computed number of shares for the deposit is zero. (
tecPRECISION_LOSS) fixCleanup3_4_0: The deposit rounds down to zero at the posteriorVault.AssetsTotalscale, i.e. a non-zero \(\Delta_{asset}\) that would credit the vault nothing at that scale, as described in XLS-65.5. (tecPRECISION_LOSS)fixCleanup3_4_0:Vault.Assetis anIOUand debiting \(\Delta_{asset}\) would leave the depositor's stored balance unchanged. (tecPRECISION_LOSS)- Arithmetic overflow during share calculation. (
tecPATH_DRY) LendingProtocolV1_2: On a Vault withLEVersion2, the deposit would leave the Vault coarsened or outside its Open zone (XLS-65.7.1). (tecLIMIT_EXCEEDED)Vault.AssetsMaximumis non-zero and adding the deposited amount toVault.AssetsTotalwould exceed it. (tecLIMIT_EXCEEDED)
3.5.4. State Changes¶
- If no share
MPTokenobject exists for the depositor, create one. For private vaults, theMPTokenis created only after domain authorization is verified. - Increase the
MPTAmountfield of the depositor's shareMPTokenby \(\Delta_{share}\). - Increase the
OutstandingAmountfield of the shareMPTokenIssuanceby \(\Delta_{share}\). -
Increase
Vault.AssetsTotalandVault.AssetsAvailableby \(\Delta_{asset}\). -
If
Vault.AssetisXRP:- Increase the
Balancefield of the pseudo-accountAccountRootby \(\Delta_{asset}\). - Decrease the
Balancefield of the depositorAccountRootby \(\Delta_{asset}\).
- Increase the
-
If
Vault.Assetis anIOU:- Increase the
RippleStatebalance between the pseudo-accountAccountRootand theIssuerAccountRootby \(\Delta_{asset}\). - Decrease the
RippleStatebalance between the depositorAccountRootand theIssuerAccountRootby \(\Delta_{asset}\).
- Increase the
-
If
Vault.Assetis anMPT:- Increase the
MPToken.MPTAmountof the pseudo-accountMPTokenforVault.Assetby \(\Delta_{asset}\). - Decrease the
MPToken.MPTAmountof the depositorMPTokenforVault.Assetby \(\Delta_{asset}\).
- Increase the
Note: \(\Delta_{asset}\) is the actual asset amount transferred, which may be slightly less than the requested
Amountdue to scale rounding for IOU assets.
SingleAssetVault: The vault accounting increases and both asset-balance moves use that same \(\Delta_{asset}\). Where the depositor is the issuer of a non-XRPVault.Assetit holds no balance of the asset — the transfer creates the asset at the issuer instead — so only the vault accounting fields and the vault's asset balance move. This is the issuer exception of invariant 2 below.fixCleanup3_4_0: For anIOU, the persisted vault accounting deltas and the persisted asset-balance deltas may differ from each other by at most one unit at the comparison scale in XLS-65.5. ForXRPandMPTthey remain equal.
3.5.5. Invariants¶
- The vault pseudo-account's asset balance must increase by a positive amount not exceeding the transaction
Amount. -
SingleAssetVault: Unless the depositor is the asset issuer, the depositor's asset balance must decrease by the same amount as the vault increases.fixCleanup3_4_0: Unless the depositor is the asset issuer, for anIOUthe comparison admits one unit at the comparison scale. ForXRPandMPTit remains exact. The issuer exemption is unchanged.
- The depositor's share
MPToken.MPTAmountmust increase by a positive amount. - The increase in
MPTokenIssuance(Vault.ShareMPTID).OutstandingAmountmust equal the increase in the depositor's share balance. -
SingleAssetVault:Vault.AssetsTotalandVault.AssetsAvailablemust each increase by the vault's asset balance increase.fixCleanup3_4_0: For anIOU, each comparison admits one unit at the comparison scale. ForXRPandMPTit remains exact.
-
SingleAssetVault: IfVault.AssetsMaximumis non-zero,Vault.AssetsTotal <= Vault.AssetsMaximumafter the deposit.fixCleanup3_4_0: Unchanged. The cap remains a deposit invariant; the amendment only narrowsVaultSetcap enforcement.
LendingProtocolV1_1: A deposit succeeds only when the Vault phase isSubscriptionorNoPhase.
3.5.6. Example JSON¶
{
"TransactionType": "VaultDeposit",
"Account": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
"Fee": "10",
"Sequence": 12,
"VaultID": "2DE64CA41250EF3CB7D2B127D6CEC31F747492CAE2BD1628CA02EA1FFE7475B3",
"Amount": {
"currency": "USD",
"issuer": "r9cZ5oHbdL4Z9Maj6TdnfAos35nVzYuNds",
"value": "100"
}
}
3.6. Transaction: VaultWithdraw¶
The VaultWithdraw transaction withdraws assets in exchange for the vault's shares.
3.6.1. Fields¶
| Field Name | Required | JSON Type | Internal Type | Default Value | Description |
|---|---|---|---|---|---|
TransactionType |
Yes | string |
UINT16 |
69 |
Transaction type (ttVAULT_WITHDRAW). |
VaultID |
Yes | string |
HASH256 |
N/A |
The ID of the vault from which assets are withdrawn. |
Amount |
Yes | number |
STAmount |
0 | The exact amount of Vault asset to withdraw. |
Destination |
No | string |
AccountID |
Empty | An account to receive the assets. It must be able to receive the asset. |
DestinationTag |
No | number |
UINT32 |
Empty | Arbitrary tag identifying the reason for the withdrawal to the destination. |
CredentialIDs |
No | array |
VECTOR256 |
Empty | fixCleanup3_4_0: credentials of the submitter used where the destination requires deposit authorization (XLS-65.5). |
- If
Amountis the Vaults asset, calculate the share cost using the Withdraw formula. - If
Amountis the Vaults share, calculate the assets amount using the Redeem formula.
In sections below assume the following variables:
- \(\Gamma_{share}\) - the total number of shares issued by the vault.
-
\(\Gamma_{asset}\):
SingleAssetVault:Vault.AssetsTotal - Vault.LossUnrealized.fixCleanup3_2_0: if the withdrawer is the sole outstanding shareholder, theLossUnrealizeddeduction is waived and \(\Gamma_{asset}\) =Vault.AssetsTotal, since the sole holder is entitled to the vault's full realized and unrealized value (XLS-65.2).
-
\(\Delta_{asset}\) - the change in the total amount of assets after a deposit, withdrawal, or redemption.
- \(\Delta_{share}\) - che change in the total amount of shares after a deposit, withdrawal, or redemption.
3.6.2. Transaction Fee¶
TODO: content pass.
3.6.3. Failure Conditions¶
3.6.3.1. Data Verification¶
- The
VaultIDfield is zero. (temMALFORMED) - The
Amountfield is zero or negative. (temBAD_AMOUNT) - The
Destinationfield, if provided, is zero. (temMALFORMED) -
SingleAssetVault:CredentialIDsis present. (temDISABLED)fixCleanup3_4_0:CredentialIDsis present and theCredentialsamendment is not enabled. (temDISABLED)CredentialIDsis empty, too long, or contains a zero or duplicate ID. (temMALFORMED)
3.6.3.2. Protocol-Level Failures¶
"Destination" below is the Destination field if provided, otherwise the submitting Account.
- The
Vaultobject with theVaultIDdoes not exist on the ledger. (tecNO_ENTRY) -
SingleAssetVault: The check does not apply.LendingProtocolV1_1: The Vault is closed-ended andSubscriptionDate < parent ledger close time < RedemptionDate. (tecTOO_SOON)
- The
Amountasset is neitherVault.Assetnor the vault share (Vault.ShareMPTID). (tecWRONG_ASSET) - The asset cannot be transferred from the pseudo-account to the destination:
- For an
MPT:- The
MPTokenIssuancedoes not exist. (tecOBJECT_NOT_FOUND) lsfMPTCanTransferis not set. (tecNO_AUTH)SingleAssetVault:lsfMPTCanTransferis checked.fixCleanup3_2_0:lsfMPTCanTransferis not checked (XLS-65.2).
- The
- For an
IOU: rippling is disabled on both the pseudo-account's and the destination's trust line to the issuer, or the line is absent and the issuer lackslsfDefaultRipple. (terNO_RIPPLE)
- For an
fixCleanup3_4_0:CredentialIDsis present and a listed credential does not exist, does not have the submitter as its subject, or has not been accepted (XLS-65.5). (tecBAD_CREDENTIALS)fixCleanup3_4_0: The destination is a pseudo-account. (tecPSEUDO_ACCOUNT)- The
Destinationaccount, if specified, does not exist on the ledger. (tecNO_DST) - The
Destinationaccount, if specified, requires a destination tag but none is provided. (tecDST_TAG_NEEDED) - The
Destinationaccount, if specified, requires deposit authorization and the sender is not authorized. (tecNO_PERMISSION) Vault.Assetis anIOU, the destination is neither the submitter nor the issuer, and the amount exceeds the room left under the destination's trust-line limit to the issuer. A destination with no trust line has no room. (tecNO_LINE) ForXRPandMPTthis check always passes.SingleAssetVault: The check uses the transaction'sAmount. WhenAmountis in shares it is anMPTamount, so the check always passes.fixCleanup3_1_3: WhenAmountis in shares, the check uses the asset amount the shares convert to (XLS-65.1).
- The destination account does not have a required authorized holding for the vault asset. (
tecNO_AUTH) fixCleanup3_4_0: The destination is the submitter, it has no holding of the asset, and a holding cannot be added (XLS-65.5):- For an
IOU, the issuer account does not exist. (terNO_ACCOUNT) - For an
IOU, the issuer lackslsfDefaultRipple. (terNO_RIPPLE) - For an
MPT, theMPTokenIssuancedoes not exist. (tecOBJECT_NOT_FOUND) - For an
MPT,lsfMPTCanTransferis not set. (tecNO_AUTH)
- For an
fixCleanup3_4_0: The Vault haslsfVaultPrivateset, the destination is neither the submitter nor the asset issuer, and the submitter or the destination is not a member of the permissioned domain:- The membership check fails. (
tecNO_AUTH) - The credential check fails. (The credential failure code. TODO: content pass.)
- The membership check fails. (
- Freeze checks:
SingleAssetVault:- The asset is frozen for the destination, including a global freeze or lock:
- For an
IOU. (tecFROZEN) - For an
MPT. (tecLOCKED)
- For an
- The vault shares are locked for the submitting account. (
tecLOCKED)
- The asset is frozen for the destination, including a global freeze or lock:
fixCleanup3_3_0: Unless the destination is the asset issuer: the asset is globally frozen; the pseudo-account is individually frozen; the submitter is individually frozen and the destination is not the submitter; or the destination is deep frozen. The shares are not checked (XLS-65.3).- For an
IOU. (tecFROZEN) - For an
MPT. (tecLOCKED)
- For an
- The computed share amount for the withdrawal is zero. (
tecPRECISION_LOSS) LendingProtocolV1_2: On a Vault withLEVersion2, the withdrawal redeems every outstanding share whileVault.AssetsDeployedis non-zero (XLS-65.7.1). (tecHAS_OBLIGATIONS)fixCleanup3_4_0: The withdrawal would move shares while moving no assets: a non-zero \(\Delta_{asset}\) that leaves the storedVault.AssetsTotalunchanged at its precision, or that rounds down to zero at the posteriorVault.AssetsTotalscale, as described in XLS-65.5. A fixed-share withdrawal whose pre-transactionVault.AssetsTotal == Vault.LossUnrealizedis exempt and may redeem shares for zero assets. (tecPRECISION_LOSS)- There is insufficient liquidity to fill the request:
- The submitter holds fewer shares than \(\Delta_{share}\). (
tecINSUFFICIENT_FUNDS) Vault.AssetsAvailableis less than the computed \(\Delta_{asset}\). (tecINSUFFICIENT_FUNDS)fixCleanup3_4_0: Unless the withdrawal redeems every outstanding share, this is also checked against \(\Delta_{asset}\) before it is rounded at the posterior scale, so a withdrawal that is both too large and too small to represent fails withtecINSUFFICIENT_FUNDSrather than the rounding failure of item 17 (XLS-65.5).
- The submitter holds fewer shares than \(\Delta_{share}\). (
fixCleanup3_5_0: A transfer fee applies and reduces a non-zero \(\Delta_{asset}\) to zero for the destination (XLS-65.6). (tecPRECISION_LOSS)- Arithmetic overflow during share/asset calculation. (
tecPATH_DRY) fixCleanup3_4_0: The destination is not the submitter,CredentialIDsis present, and a listed credential has expired. The expired credentials are deleted, and the deletions are kept even though the transaction fails. (tecEXPIRED) This is checked when the assets are transferred, after the other checks (XLS-65.5).
3.6.4. State Changes¶
- Decrease the
MPToken.MPTAmountof the submitter's shareMPTokenby \(\Delta_{share}\). - Decrease the
OutstandingAmountof the shareMPTokenIssuanceby \(\Delta_{share}\). - If the submitter is not the vault owner and their share
MPToken.MPTAmountreaches zero, delete theMPTokenobject. -
Decrease
Vault.AssetsTotalandVault.AssetsAvailableby \(\Delta_{asset}\).SingleAssetVault: This applies to every withdrawal.fixCleanup3_2_0: When the withdrawal redeems every outstanding share, \(\Delta_{asset}\) isVault.AssetsAvailable, andVault.AssetsTotalandVault.AssetsAvailableare set to zero (XLS-65.2).LendingProtocolV1_2: A Vault withLEVersion2 is not set to zero. The full-redemption payout ofVault.AssetsAvailableis applied through the balance update of XLS-65.7.1, which then derivesVault.AssetsTotal.
-
If
Vault.AssetisXRP:- Decrease the
Balancefield of the pseudo-accountAccountRootby \(\Delta_{asset}\). - Increase the
Balancefield of the destinationAccountRootby \(\Delta_{asset}\).
- Decrease the
-
If
Vault.Assetis anIOU:- If the destination does not have a
RippleStateobject for the vault asset, create one. - Decrease the
RippleStatebalance between the pseudo-accountAccountRootand theIssuerAccountRootby \(\Delta_{asset}\). - Increase the
RippleStatebalance between the destinationAccountRootand theIssuerAccountRootby \(\Delta_{asset}\).
- If the destination does not have a
-
If
Vault.Assetis anMPT:- If the destination does not have an
MPTokenobject for the vault asset, create one. - Decrease the
MPToken.MPTAmountof the pseudo-accountMPTokenforVault.Assetby \(\Delta_{asset}\). - Increase the
MPToken.MPTAmountof the destinationMPTokenforVault.Assetby \(\Delta_{asset}\).
- If the destination does not have an
Note: "destination" is the
Destinationfield if provided, otherwise the submittingAccount.
SingleAssetVault: The vault accounting decreases and both asset-balance moves use that same \(\Delta_{asset}\). Where the destination is the issuer of a non-XRPVault.Assetit holds no balance of the asset — the transfer destroys the asset at the issuer instead — so only the vault accounting fields and the vault's asset balance move. This is the issuer exception of invariant 2 below.fixCleanup3_2_0: For anIOU, an unrepresentable sub-ULP remainder may remain between vault outflow and destination inflow (XLS-65.2).fixCleanup3_4_0: For anIOU, the persisted vault accounting deltas and the persisted asset-balance deltas may differ from each other by at most one unit at the comparison scale in XLS-65.5. ForXRPandMPTthey remain equal. That one unit and the sub-ULP remainder above are alternative tolerances, not cumulative: the vault-to-destination comparison is satisfied by either.fixCleanup3_5_0: When a transfer fee applies, the destination receives \(\Delta_{asset}\) less the fee (XLS-65.6).
3.6.5. Invariants¶
-
SingleAssetVault: The vault pseudo-account's asset balance must decrease by a positive amount.fixCleanup3_4_0: A fixed-share withdrawal may instead move zero assets when the pre-transactionVault.AssetsTotal == Vault.LossUnrealized.
- Unless the destination is the asset issuer, the destination's asset balance must increase. The zero-asset exception in invariant 1 may leave the destination balance unchanged.
fixCleanup3_2_0: For anIOU, the destination's rounded increase may be zero when its trust line sits at a coarser scale (XLS-65.2).
-
SingleAssetVault: The vault outflow and destination inflow must match in magnitude.fixCleanup3_2_0: For anIOU, an unrepresentable sub-ULP remainder at the destination scale is also accepted.fixCleanup3_4_0: For anIOU, the comparison is also satisfied when the two magnitudes agree within one unit at the comparison scale. That tolerance and the sub-ULP remainder are alternatives, not cumulative. ForXRPandMPTit remains exact.fixCleanup3_5_0: When a transfer fee applies, the expected inflow is the outflow less the fee, and the sub-ULP remainder is not accepted (XLS-65.6).
- The submitter's share
MPToken.MPTAmountmust decrease by a positive amount. - The decrease in
MPTokenIssuance(Vault.ShareMPTID).OutstandingAmountmust equal the decrease in the submitter's share balance. -
SingleAssetVault:Vault.AssetsTotalandVault.AssetsAvailablemust each decrease by the vault's asset balance decrease.fixCleanup3_4_0: For anIOU, each comparison admits one unit at the comparison scale. ForXRPandMPTit remains exact.
LendingProtocolV1_1: A withdrawal does not succeed while the Vault phase isInvestment.- When
Destinationnames an account other than the submitter, the submitter's asset balance must not change, apart from the transaction fee.
3.6.6. Example JSON¶
{
"TransactionType": "VaultWithdraw",
"Account": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
"Fee": "10",
"Sequence": 13,
"VaultID": "2DE64CA41250EF3CB7D2B127D6CEC31F747492CAE2BD1628CA02EA1FFE7475B3",
"Amount": {
"currency": "USD",
"issuer": "r9cZ5oHbdL4Z9Maj6TdnfAos35nVzYuNds",
"value": "50"
}
}
3.7. Transaction: VaultClawback¶
The VaultClawback transaction performs a Clawback from the Vault, exchanging the shares of an account. It has two uses:
- Asset clawback. The issuer of
Vault.Assetclaws back the asset from aHolder's position. Conceptually, the transaction performsVaultWithdrawon behalf of theHolder, sending the funds to the issuer. IfVault.AssetsAvailablecannot cover the requested amount, the transaction performs a partial Clawback, up toVault.AssetsAvailable. - Share burn. The Vault Owner burns all of a
Holder's shares when the Vault has outstanding shares but no assets.
The transfer fee is not charged.
3.7.1. Fields¶
| Field Name | Required | JSON Type | Internal Type | Default Value | Description |
|---|---|---|---|---|---|
TransactionType |
Yes | string |
UINT16 |
70 |
Transaction type (ttVAULT_CLAWBACK). |
VaultID |
Yes | string |
HASH256 |
N/A |
The ID of the vault from which assets are withdrawn. |
Holder |
Yes | string |
AccountID |
N/A |
The account ID from which to clawback the assets. |
Amount |
No | string or object |
STAmount |
0 | The amount to claw back, in Vault.Asset, or in vault shares for a share burn. A zero amount claws back all of the Holder's shares. When absent, it is a zero amount of vault shares if the submitter is the Vault Owner, and a zero amount of Vault.Asset otherwise. |
3.7.2. Transaction Fee¶
TODO: content pass.
3.7.3. Failure Conditions¶
3.7.3.1. Data Verification¶
- The
VaultIDfield is zero. (temMALFORMED) - The
Amountfield, if provided, is negative. (temBAD_AMOUNT) - The
Amountfield, if provided, isXRP. (temMALFORMED)
3.7.3.2. Protocol-Level Failures¶
- The
Vaultobject with theVaultIDdoes not exist on the ledger. (tecNO_ENTRY) -
SingleAssetVault: The check does not apply.fixCleanup3_5_0: TheHolderaccount does not exist (XLS-65.6). (terNO_ACCOUNT)
-
SingleAssetVault: The check does not apply.fixCleanup3_4_0: TheHolderis a pseudo-account (XLS-65.5). (tecPSEUDO_ACCOUNT)
Amountis absent,Vault.Assetis notXRP, and the asset issuer is the Vault Owner, so the intended use is ambiguous. (tecWRONG_ASSET)- If
Amountis in vault shares:- The submitter is not the Vault Owner. (
tecNO_PERMISSION) - The Vault has no outstanding shares, or
Vault.AssetsTotalorVault.AssetsAvailableis non-zero. (tecNO_PERMISSION) Amountis non-zero and is not equal to theHolder's share balance. (tecLIMIT_EXCEEDED)
- The submitter is not the Vault Owner. (
- If
Amountis inVault.Asset:Vault.AssetisXRP. (tecNO_PERMISSION)- The submitter is not the asset issuer. (
tecNO_PERMISSION) - The
Holderis the submitter. (tecNO_PERMISSION) - If
Vault.Assetis anMPT:- The
MPTokenIssuancedoes not exist. (tecOBJECT_NOT_FOUND) lsfMPTCanClawbackis not set. (tecNO_PERMISSION)
- The
- If
Vault.Assetis anIOU: the issuer does not havelsfAllowTrustLineClawbackset, or haslsfNoFreezeset. (tecNO_PERMISSION)
Amountis in neitherVault.Assetnor vault shares. (tecWRONG_ASSET)LendingProtocolV1_2: On a Vault withLEVersion2, the clawback would burn every outstanding share whileVault.AssetsDeployedis non-zero (XLS-65.7.1). (tecHAS_OBLIGATIONS)fixCleanup3_4_0: The clawback would burn shares while moving no assets: a non-zero \(\Delta_{asset}\) that leaves the storedVault.AssetsTotalunchanged at its precision, or that rounds down to zero at the posteriorVault.AssetsTotalscale, as described in XLS-65.5. A clawback against an already-empty vault is unaffected, because its \(\Delta_{asset}\) is zero to begin with. (tecPRECISION_LOSS)- \(\Delta_{share}\) is zero: the
Holderholds no shares, or the clawback rounds to zero shares. (tecPRECISION_LOSS) - Arithmetic overflow during share/asset calculation. (
tecPATH_DRY)
3.7.4. State Changes¶
\(\Delta_{share}\) and \(\Delta_{asset}\) are derived as follows:
- Share burn. \(\Delta_{share}\) is the
Holder's share balance and \(\Delta_{asset}\) is zero. - Asset clawback.
- If
Amountis zero, \(\Delta_{share}\) is theHolder's share balance and \(\Delta_{asset}\) is its value under the Redeem formula. IfAmountis non-zero, \(\Delta_{share}\) isAmountconverted with the Withdraw formula, and \(\Delta_{asset}\) is the redeem value of \(\Delta_{share}\). - If \(\Delta_{asset}\) exceeds
Vault.AssetsAvailable, \(\Delta_{asset}\) becomesVault.AssetsAvailable. \(\Delta_{share}\) is then recomputed from it with the withdraw formula, truncated to whole shares, and \(\Delta_{asset}\) is recomputed from that \(\Delta_{share}\).SingleAssetVault: This step does not apply to a zeroAmount.fixCleanup3_1_3: This step applies to a zeroAmounttoo (XLS-65.1).
-
SingleAssetVault: Shares from a non-zeroAmountare rounded to the nearest whole share, and \(\Gamma_{asset}\) isVault.AssetsTotal - Vault.LossUnrealized.fixCleanup3_4_0: Shares are truncated, and \(\Gamma_{asset}\) isVault.AssetsTotalwhen theHolderis the sole shareholder. \(\Delta_{asset}\) is rounded down at the posterior scale (XLS-65.5).
- If
Then:
-
Decrease
Vault.AssetsTotalandVault.AssetsAvailableby \(\Delta_{asset}\). -
Update the
MPTokenobject for theVault.ShareMPTIDof theHolderAccountRoot:- Decrease the
MPToken.MPTAmountby \(\Delta_{share}\). - If
MPToken.MPTAmount == 0and theHolderis not the Vault Owner, delete the object.
- Decrease the
-
Update the
MPTokenIssuanceobject for theVault.ShareMPTID:- Decrease the
OutstandingAmountfield of the shareMPTokenIssuanceobject by \(\Delta_{share}\).
- Decrease the
-
If \(\Delta_{asset}\) is greater than zero, transfer it from the pseudo-account to the submitter (the asset issuer):
- If the
Vault.Assetis anIOU, decrease theRippleStatebalance between the pseudo-accountAccountRootand theIssuerAccountRootby \(\Delta_{asset}\). - If the
Vault.Assetis anMPT, decrease theMPToken.MPTAmountof the pseudo-accountMPTokenforVault.Assetby \(\Delta_{asset}\).
- If the
SingleAssetVault: The vault accounting decreases and the vault asset-balance decrease use that same amount.fixCleanup3_4_0: For anIOU, the persisted vault accounting deltas and the persisted vault asset-balance delta may differ from each other by at most one unit at the comparison scale in XLS-65.5. ForMPTthey remain equal.
3.7.5. Invariants¶
- The vault pseudo-account's asset balance must decrease, unless the Vault was already empty.
-
SingleAssetVault:Vault.AssetsTotalandVault.AssetsAvailablemust each decrease by the vault's asset balance decrease.fixCleanup3_4_0: For anIOU, each comparison admits one unit at the comparison scale. ForXRPandMPTit remains exact.
- The holder's share
MPToken.MPTAmountmust decrease by a positive amount. - The decrease in
MPTokenIssuance(Vault.ShareMPTID).OutstandingAmountmust equal the decrease in the holder's share balance. - The transaction must be submitted by the asset issuer, or by the Vault Owner when the Vault had outstanding shares and zero
AssetsTotalandAssetsAvailablebefore the transaction.
3.7.6. Example JSON¶
{
"TransactionType": "VaultClawback",
"Account": "r9cZ5oHbdL4Z9Maj6TdnfAos35nVzYuNds",
"Fee": "10",
"Sequence": 21,
"VaultID": "2DE64CA41250EF3CB7D2B127D6CEC31F747492CAE2BD1628CA02EA1FFE7475B3",
"Holder": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
"Amount": {
"currency": "USD",
"issuer": "r9cZ5oHbdL4Z9Maj6TdnfAos35nVzYuNds",
"value": "10"
}
}
3.8. Transaction: Payment¶
The Single Asset Vault does not introduce new Payment transaction fields. However, it adds additional failure conditions and state changes when transferring Vault shares.
3.8.1. Fields¶
The Single Asset Vault does not introduce or modify any Payment transaction fields. Refer to the existing Payment transaction fields.
3.8.2. Transaction Fee¶
The fee for this transaction does not change.
3.8.3. Failure Conditions¶
3.8.3.1. Data Verification¶
None.
3.8.3.2. Protocol-Level Failures¶
-
If
Payment.Amountis aVaultshare AND:- The
VaultlsfVaultPrivateflag is set and thePayment.Destinationaccount is not a member of the permissioned domain specified atMPTokenIssuance(Vault.ShareMPTID).DomainID. -
The
VaulttfVaultShareNonTransferableflag is set. -
If the
Vault.AssetisMPT:MPTokenIssuance.lsfMPTCanTransferis not set (the asset is not transferable).MPTokenIssuance.lsfMPTLockedflag is set (the asset is globally locked).MPToken(MPTokenIssuanceID, AccountID).lsfMPTLockedflag is set (the asset is locked for the payer).MPToken(MPTokenIssuanceID, AccountID).lsfMPTLockedflag is set (the asset is locked for thepseudo-account).MPToken(MPTokenIssuanceID, Destination).lsfMPTLockedflag is set (the asset is locked for the destination account).
-
If the
Vault.Assetis anIOU:- The
lsfGlobalFreezeflag is set on the issuing account (the asset is frozen). - The
lsfHighFreezeorlsfLowFreezeflag is set on theRippleStateobject between the AssetIssuerand the payer account. - The
lsfHighFreezeorlsfLowFreezeflag is set on theRippleStateobject between the AssetIssuerand the destination account. - The
lsfHighFreezeorlsfLowFreezeflag is set on theRippleStateobject between the AssetIssuerand thepseudo-account.
- The
- The
TODO: content pass. (The result code of each failure above.)
3.8.4. State Changes¶
- If
MPTokenobject for shares does not exist for the destination account, create one.
3.8.5. Example JSON¶
A payment of vault shares:
{
"TransactionType": "Payment",
"Account": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
"Destination": "rNGHoQwNG753zyfDrib4qDvvswbrtmV8Es",
"Fee": "10",
"Sequence": 14,
"Amount": {
"mpt_issuance_id": "00000001C752C42A1EBD6BF2403134F7CFD2F1D835AFD26E",
"value": "1000000"
}
}
3.9. RPC: vault_info¶
This RPC retrieves the Vault ledger entry and the IDs associated with it.
3.9.1. Request Fields¶
The Vault is identified either by vault_id, or by owner and seq together. Exactly one of the two forms must be used. The standard ledger_hash and ledger_index fields select the ledger.
| Field Name | Required | JSON Type | Description |
|---|---|---|---|
vault_id |
Conditional | string |
The object ID of the Vault, as a hex string. |
owner |
Conditional | string |
The Vault Owner's address. Used together with seq. |
seq |
Conditional | number |
The Sequence (or TicketSequence) of the VaultCreate transaction. Used with owner. |
ledger_hash |
No | string |
The hash of the ledger to use. |
ledger_index |
No | string or number |
The ledger index of the ledger to use, or a shortcut such as validated. |
3.9.2. Response Fields¶
| Field Name | Always Present? | JSON Type | Description |
|---|---|---|---|
vault |
Yes | object |
Root object representing the vault. |
vault.Account |
Yes | string |
The pseudo-account ID of the vault. |
vault.Asset |
Yes | object |
Object representing the asset held in the vault. |
vault.Asset.currency |
Yes | string |
Currency code of the asset stored in the vault. |
vault.Asset.issuer |
No | string |
Issuer address of the asset. |
vault.AssetsAvailable |
Yes | string |
Amount of assets currently available for withdrawal. |
vault.AssetsTotal |
Yes | string |
Total amount of assets in the vault. |
vault.Flags |
No | number |
Bit-field flags associated with the vault. |
vault.LedgerEntryType |
Yes | string |
Ledger entry type, always "Vault". |
vault.LossUnrealized |
No | string |
Unrealized loss associated with the vault. |
vault.Owner |
Yes | string |
ID of the Vault Owner account. |
vault.OwnerNode |
No | string |
Identifier for the owner node in the ledger tree. |
vault.PreviousTxnID |
Yes | string |
Transaction ID of the last modification to this vault. |
vault.PreviousTxnLgrSeq |
Yes | number |
Ledger sequence number of the last transaction modifying this vault. |
vault.Sequence |
Yes | number |
Sequence number of the vault entry. |
vault.ShareMPTID |
No | string |
Multi-purpose token ID associated with this vault. |
vault.WithdrawalPolicy |
No | number |
Policy defining withdrawal conditions. |
vault.index |
Yes | string |
Unique index of the vault ledger entry. |
vault.shares |
Yes | object |
Object containing details about issued shares. |
vault.shares.Flags |
No | number |
Bit-field flags associated with the shares issuance. |
vault.shares.Issuer |
Yes | string |
The ID of the Issuer of the Share. It will always be the pseudo-account ID. |
vault.shares.LedgerEntryType |
Yes | string |
Ledger entry type, always "MPTokenIssuance". |
vault.shares.OutstandingAmount |
Yes | string |
Total outstanding shares issued. |
vault.shares.OwnerNode |
No | string |
Identifier for the owner node of the shares. |
vault.shares.PreviousTxnID |
Yes | string |
Transaction ID of the last modification to the shares issuance. |
vault.shares.PreviousTxnLgrSeq |
Yes | number |
Ledger sequence number of the last transaction modifying the shares issuance. |
vault.shares.Sequence |
Yes | number |
Sequence number of the shares issuance entry. |
vault.shares.index |
Yes | string |
Unique index of the shares ledger entry. |
vault.shares.mpt_issuance_id |
No | string |
The ID of the MPTokenIssuance object. It will always be equal to vault.ShareMPTID. |
vault.Scale |
No | number |
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. Absent when zero. |
vault.LEVersion |
No | number |
LendingProtocolV1_1: accounting version of the Vault (XLS-65.4.3). |
vault.AssetsDeployed |
No | string |
LendingProtocolV1_2: principal lent out (XLS-65.7.1). |
vault.YieldUnrealized |
No | string |
LendingProtocolV1_2: scheduled interest owed and not yet received (XLS-65.7.1). |
vault.VaultKind |
No | number |
LendingProtocolV1_1: Vault kind; absent means open-ended and 1 means closed-ended. |
vault.SubscriptionDate |
No | number |
LendingProtocolV1_1: End of Subscription and start of Investment; present only for closed-ended Vaults. |
vault.RedemptionDate |
No | number |
LendingProtocolV1_1: Start of Redemption; present only for closed-ended Vaults. |
The standard ledger_entry RPC returns the same Vault ledger object. Under LendingProtocolV1_1, its object may therefore include VaultKind, SubscriptionDate, and RedemptionDate with the same meanings and presence rules: all three are present for a closed-ended Vault, while their collective absence means open-ended.
3.9.3. Failure Conditions¶
invalidParams: neithervault_idalone nor bothownerandseqare given;vault_idis not a hex string; orseqis not a positive 32-bit integer.actMalformed:owneris not a valid address.entryNotFound: the Vault, or its shareMPTokenIssuance, does not exist in the selected ledger, orvault_idis zero.- Standard ledger selection errors apply if
ledger_hashorledger_indexreference an unavailable ledger.
3.9.4. Example Request¶
{
"method": "vault_info",
"params": [
{
"vault_id": "2DE64CA41250EF3CB7D2B127D6CEC31F747492CAE2BD1628CA02EA1FFE7475B3",
"ledger_index": "validated"
}
]
}
3.9.5. Example Response¶
Vault holding an IOU:
"result" :
{
"ledger_current_index" : 7,
"status" : "success",
"validated" : false,
"vault" :
{
"Account" : "rKwvc1mgHLyHKY3yRUqVwffWtsxYb3QLWf",
"Asset" :
{
"currency" : "IOU",
"issuer" : "r9cZ5oHbdL4Z9Maj6TdnfAos35nVzYuNds"
},
"AssetsAvailable" : "100",
"AssetsTotal" : "100",
"Flags" : 0,
"LedgerEntryType" : "Vault",
"LossUnrealized" : "0",
"Owner" : "rwhaYGnJMexktjhxAKzRwoCcQ2g6hvBDWu",
"OwnerNode" : "0",
"PreviousTxnID" : "1484794AE38DBB7C6F4E0B7536CC560B418135BEDB0F8904349F7F8A3B496826",
"PreviousTxnLgrSeq" : 6,
"Sequence" : 5,
"ShareMPTID" : "00000001C752C42A1EBD6BF2403134F7CFD2F1D835AFD26E",
"WithdrawalPolicy" : 1,
"index" : "2DE64CA41250EF3CB7D2B127D6CEC31F747492CAE2BD1628CA02EA1FFE7475B3",
"shares" :
{
"DomainID" : "3B61A239626565A3FBEFC32863AFBF1AD3325BD1669C2C9BC92954197842B564",
"Flags" : 0,
"Issuer" : "rKwvc1mgHLyHKY3yRUqVwffWtsxYb3QLWf",
"LedgerEntryType" : "MPTokenIssuance",
"OutstandingAmount" : "100",
"OwnerNode" : "0",
"PreviousTxnID" : "1484794AE38DBB7C6F4E0B7536CC560B418135BEDB0F8904349F7F8A3B496826",
"PreviousTxnLgrSeq" : 6,
"Sequence" : 1,
"index" : "F84AE266C348540D7134F1A683392C3B97C3EEFDE9FEF6F2055B3B92550FB44A",
"mpt_issuance_id" : "00000001C752C42A1EBD6BF2403134F7CFD2F1D835AFD26E"
},
"Scale": 6,
}
}
Vault holding an MPT:
{
"LedgerEntryType": "Vault",
"LedgerIndex": "E123F4567890ABCDE123F4567890ABCDEF1234567890ABCDEF1234567890ABCD",
"Flags": "0",
"PreviousTxnID": "9A8765B4321CDE987654321CDE987654321CDE987654321CDE987654321CDE98",
"PreviousTxnLgrSeq": 12345678,
"Sequence": 1,
"OwnerNode": 2,
"Owner": "rEXAMPLE9AbCdEfGhIjKlMnOpQrStUvWxYz",
"Account": "rPseudoAcc1234567890abcdef1234567890abcdef",
"Data": "5468697320697320617262697472617279206D657461646174612061626F757420746865207661756C742E",
"Asset": {
"currency": "USD",
"issuer": "rIssuer1234567890abcdef1234567890abcdef",
"value": "1000"
},
"AssetsTotal": 1000000,
"AssetsAvailable": 800000,
"LossUnrealized": 200000,
"AssetsMaximum": 0,
"Share": {
"mpt_issuance_id": "0000012FFD9EE5DA93AC614B4DB94D7E0FCE415CA51BED47",
"value": "1"
},
"ShareTotal": 5000,
"WithdrawalPolicy": "0x0001",
"Scale": 0
}
Vault holding XRP:
{
"result": {
"ledger_hash": "6FFF56DF92D54D01EE3D5487787F4430D66F89C6BC74B00C276262A0207B2FAD",
"ledger_index": 6,
"status": "success",
"validated": true,
"vault": {
"Account": "rBVxExjRR6oDMWCeQYgJP7q4JBLGeLBPyv",
"Asset": {
"currency": "XRP"
},
"AssetsAvailable": "0",
"AssetsTotal": "0",
"Flags": 0,
"LedgerEntryType": "Vault",
"LossUnrealized": "0",
"Owner": "rwhaYGnJMexktjhxAKzRwoCcQ2g6hvBDWu",
"OwnerNode": "0",
"PreviousTxnID": "25C3C8BF2C9EE60DFCDA02F3919D0C4D6BF2D0A4AC9354EFDA438F2ECDDA65E4",
"PreviousTxnLgrSeq": 5,
"Sequence": 4,
"ShareMPTID": "00000001732B0822A31109C996BCDD7E64E05D446E7998EE",
"WithdrawalPolicy": 1,
"index": "C043BB1B350FFC5FED21E40535609D3D95BC0E3CE252E2F69F85BE0157020A52",
"shares": {
"DomainID": "3B61A239626565A3FBEFC32863AFBF1AD3325BD1669C2C9BC92954197842B564",
"Flags": 56,
"Issuer": "rBVxExjRR6oDMWCeQYgJP7q4JBLGeLBPyv",
"LedgerEntryType": "MPTokenIssuance",
"OutstandingAmount": "0",
"OwnerNode": "0",
"PreviousTxnID": "25C3C8BF2C9EE60DFCDA02F3919D0C4D6BF2D0A4AC9354EFDA438F2ECDDA65E4",
"PreviousTxnLgrSeq": 5,
"Sequence": 1,
"index": "4B25BDE141E248E5D585FEB6100E137D3C2475CEE62B28446391558F0BEA23B5",
"mpt_issuance_id": "00000001732B0822A31109C996BCDD7E64E05D446E7998EE"
},
"Scale": 0
}
}
}
3.10. RPC: vault_list (Clio-only)¶
This RPC retrieves all Vaults created for a given asset. The asset can be XRP, an IOU, or an MPT.
Given an asset, this handler scans all Vault ledger objects and returns those whose Asset field matches the request. For each matching vault found, a summary is returned containing the vault ID, pseudo-account, owner, total assets, total shares, status, and flags.
The matching strategy depends on the asset type:
MPT: Returns allVaultobjects whoseAsset.mpt_issuance_idequals the providedmpt_issuance_id.IOU: Returns allVaultobjects whoseAsset.currencyandAsset.issuermatch the provided values.XRP: Returns allVaultobjects whoseAsset.currencyis"XRP".
3.10.1. Request Fields¶
| Field Name | Required | JSON Type | Description |
|---|---|---|---|
asset |
Yes | string or object |
The asset to search for. Supports three formats: XRP — { "currency": "XRP" }; IOU — { "currency": "<code>", "issuer": "<address>" }; MPT — { "mpt_issuance_id": "<UINT192 hex>" }. |
ledger_hash |
No | string |
A 20-byte hex string for the ledger version to use. |
ledger_index |
No | string or number |
The ledger index of the ledger to use, or a shortcut string to choose a ledger automatically. |
limit |
No | number |
Limit the number of Vaults returned. Min 10, max 400, default 200. |
marker |
No | string |
Value from a previous paginated response. Resume retrieving data where that response left off. |
3.10.2. Response Fields¶
| Field Name | Always Present? | JSON Type | Description |
|---|---|---|---|
asset |
Yes | string or object |
The asset provided in the request, echoed back. |
ledger_hash |
Yes | string |
The identifying hash of the ledger version used to generate this response. |
ledger_index |
Yes | number |
The ledger index of the ledger version used to generate this response. |
validated |
Yes | boolean |
If true, the information comes from a validated ledger version. |
limit |
Yes | number |
The limit used in the request (after clamping). |
marker |
No | string |
Server-defined value indicating the response is paginated. Pass this to the next call to resume where this left off. |
vaults |
Yes | array |
Array of vault summary objects. |
vaults[].vault_id |
Yes | string |
Unique index of the Vault ledger entry (hex). |
vaults[].account |
Yes | string |
The address of the Vault's pseudo-account. |
vaults[].owner |
Yes | string |
The account address of the Vault Owner. |
vaults[].total_assets |
Yes | string |
The total value of the vault (AssetsTotal). |
vaults[].total_shares |
Yes | number |
Total outstanding shares issued (OutstandingAmount from the share MPTokenIssuance). |
vaults[].status |
Yes | string |
Status of the vault. "active" if flags are 0, otherwise "modified". |
vaults[].flags |
Yes | number |
Bit-field flags associated with the vault. |
3.10.3. Failure Conditions¶
invalidParams: Theassetfield is missing, malformed, or not a valid asset object.entryNotFound: The asset references a ledger object that does not exist. This applies when the asset is anMPTand theMPTokenIssuanceobject identified bympt_issuance_iddoes not exist, or the asset is anIOUand theissueraccount does not exist in the specified ledger.- Standard ledger selection errors apply if
ledger_hashorledger_indexreference an unavailable ledger.
Note: If the specified asset is valid and exists on the ledger, but no Vaults have been created for it, the response returns an empty
vaultsarray. This is not an error condition.
3.10.4. Example Request (MPT)¶
{
"method": "vault_list",
"params": [
{
"asset": {
"mpt_issuance_id": "00000001C752C42A1EBD6BF2403134F7CFD2F1D835AFD26E"
},
"limit": 50
}
]
}
3.10.5. Example Response (MPT)¶
{
"result": {
"asset": {
"mpt_issuance_id": "00000001C752C42A1EBD6BF2403134F7CFD2F1D835AFD26E"
},
"ledger_hash": "6FFF56DF92D54D01EE3D5487787F4430D66F89C6BC74B00C276262A0207B2FAD",
"ledger_index": 6,
"validated": true,
"limit": 50,
"vaults": [
{
"vault_id": "2DE64CA41250EF3CB7D2B127D6CEC31F747492CAE2BD1628CA02EA1FFE7475B3",
"account": "rKwvc1mgHLyHKY3yRUqVwffWtsxYb3QLWf",
"owner": "rwhaYGnJMexktjhxAKzRwoCcQ2g6hvBDWu",
"total_assets": "100",
"total_shares": 100,
"status": "active",
"flags": 0
},
{
"vault_id": "C043BB1B350FFC5FED21E40535609D3D95BC0E3CE252E2F69F85BE0157020A52",
"account": "rBVxExjRR6oDMWCeQYgJP7q4JBLGeLBPyv",
"owner": "rwhaYGnJMexktjhxAKzRwoCcQ2g6hvBDWu",
"total_assets": "500",
"total_shares": 500,
"status": "active",
"flags": 0
}
]
}
}
3.10.6. Example Request (IOU)¶
{
"method": "vault_list",
"params": [
{
"asset": {
"currency": "USD",
"issuer": "r9cZ5oHbdL4Z9Maj6TdnfAos35nVzYuNds"
},
"limit": 20
}
]
}
3.10.7. Example Response (IOU)¶
{
"result": {
"asset": {
"currency": "USD",
"issuer": "r9cZ5oHbdL4Z9Maj6TdnfAos35nVzYuNds"
},
"ledger_hash": "AB12CD34EF5678901234567890ABCDEF1234567890ABCDEF1234567890ABCDEF",
"ledger_index": 42,
"validated": true,
"limit": 20,
"vaults": [
{
"vault_id": "A1B2C3D4E5F6A1B2C3D4E5F6A1B2C3D4E5F6A1B2C3D4E5F6A1B2C3D4E5F6A1B2",
"account": "rPqR7tSzR8v1M3K2pNqL5xW9Y4Z6A8B0CD",
"owner": "rwhaYGnJMexktjhxAKzRwoCcQ2g6hvBDWu",
"total_assets": "1000.50",
"total_shares": 1000500000,
"status": "active",
"flags": 0
}
]
}
}
3.10.8. Example Request (XRP)¶
{
"method": "vault_list",
"params": [
{
"asset": {
"currency": "XRP"
},
"limit": 100
}
]
}
3.10.9. Example Response (XRP)¶
{
"result": {
"asset": {
"currency": "XRP"
},
"ledger_hash": "6FFF56DF92D54D01EE3D5487787F4430D66F89C6BC74B00C276262A0207B2FAD",
"ledger_index": 6,
"validated": true,
"limit": 100,
"vaults": [
{
"vault_id": "C043BB1B350FFC5FED21E40535609D3D95BC0E3CE252E2F69F85BE0157020A52",
"account": "rBVxExjRR6oDMWCeQYgJP7q4JBLGeLBPyv",
"owner": "rwhaYGnJMexktjhxAKzRwoCcQ2g6hvBDWu",
"total_assets": "10000000",
"total_shares": 10000000,
"status": "active",
"flags": 0
}
]
}
}
4. Rationale¶
4.1. A pseudo-account holds the assets¶
Assets on the XRP Ledger must be held by an account, and a ledger object cannot hold them directly. The Vault therefore holds its assets in a pseudo-account that follows XLS-64. No one can sign for that account, so assets leave it only through the Vault transactions.
4.2. Shares are Multi-Purpose Tokens¶
Issuing shares as an MPT from the pseudo-account makes them first-class assets that other ledger protocols can hold and transfer, while the Vault Owner can still make them non-transferable or restrict them to a Permissioned Domain. Share holders remain subject to the compliance controls of the underlying asset (A.3).
4.3. Scale converts fractional assets to whole shares¶
MPT amounts are integers. Scaling asset amounts by \(10^{Scale}\) before converting them to shares keeps fractional asset values without losing value to truncation.
4.4. Unrealized loss lowers the share price before the loss is realized¶
If a loss were reflected only when it is realized, an informed depositor could redeem early and leave the remaining depositors to bear it. LossUnrealized lowers the value of a share for withdrawals as soon as a loss is expected. Deposits use a separate exchange rate, so that a depositor cannot buy shares at the lowered price and profit when the loss is cleared (§3.1.11.1).
4.5. The protocol chooses the rounding direction¶
Share and asset conversions round in the direction the protocol specifies for each operation, not a direction the submitter chooses (§3.1.10.1).
4.6. Both Withdraw and Redeem forms exist¶
VaultWithdraw accepts either an asset amount or a share amount, so that users do not have to compute the exchange rate off-chain (A.1).
4.7. Withdrawal is not gated by Permissioned Domain membership¶
A depositor whose credentials expire or are revoked can still redeem the shares they hold, so a private Vault cannot lock a depositor's funds by removing their access (A.2).
5. Security Considerations¶
Closed-ended Vaults intentionally lock depositor capital during Investment: VaultWithdraw is rejected after Subscription and before Redemption. Depositors must inspect the immutable SubscriptionDate and RedemptionDate before depositing. VaultClawback remains available throughout Investment so an issuer's compliance controls are not blocked by the depositor withdrawal gate. See XLS-65.4.4 for the full lifecycle and threat analysis.
Appendix¶
Appendix A: FAQ¶
A.1 Why does the specification allow both Withdraw and Redeem and not just one of them?¶
We chose this design in order to reduce the amount of off-chain math required to be implemented by XRPL users and/or developers
A.2 Why can any account that holds Vaults shares submit a VaultWithdraw transaction?¶
The VaultWithdraw transaction does not respect the permissioned domain rules. In other words, any account that holds the shares of the Vault can withdraw them.
The decision was made to avoid a situation where a depositor deposits assets to a private vault to then have their access revoked by invalidating their credentials, and thus loosing access to their funds.
A.3 How can a depositor transfer shares to another account?¶
Vault shares are a first-class assets, meaning that they can be transfered and used in other on-ledger protocols that support MPTokens. However, the payee (or the receiver) of the shares must have permissions to hold the shares and the assset that the shares represent. For example, if the shares are for a private Vault containing USDC the destination account must be in the permissioned domain of the Vault, and have permissions to hold USDC.
In addion, any compliance mechanisms applied to USDC will also apply to the share. For example, if the Issuer of USDC freezes the Trustline of the payee, then the payee will not be able to receive any shares representing USDC.
A.4 What is the difference between the VaultOwner and the pseudo-account?¶
XRP Ledger is an account based blockchain. That means that assets (XRP, IOU and MPT) must be held by an account. The Vault Object (or any other object, such as the AMM) cannot hold assets directly. Therefore, a pseudo-account is created that holds the assets on behalf of that object. The pseudo-account is a stand-alone account, that cannot receive funds, it cannot send transactions, it is there to only hold assets. So for example, when a depositor deposits assets into a vault, in reality this transaction moves the assets from the depositor account to the pseudo-account. Furthermore, the Vault pseudo-account is the Issuer of the Vault shares.
A.5 Do VaultDeposit or VaultWithdraw transactions charge transfer fees?¶
VaultDeposit never charges a transfer fee.
SingleAssetVault:VaultWithdrawdoes not charge a transfer fee either.fixCleanup3_5_0:VaultWithdrawcharges the asset's transfer fee when the destination differs from the submitter and neither is the asset issuer (XLS-65.6). Withdrawing to oneself, or to or from the issuer, stays free of the fee.
Appendix B: Changelog¶
- XLS-65.1:
fixCleanup3_1_3. Trust-line limit check for share-denominated withdrawals, and the zero-Amountclawback clamp. - XLS-65.2:
fixCleanup3_2_0. Deposit rounding, sole-shareholder waiver, exact full redemption, withdrawallsfMPTCanTransferwaiver,ReferenceHolding, and invariant comparison scale. - XLS-65.3:
fixCleanup3_3_0. Deposit and withdrawal freeze checks. - XLS-65.4:
LendingProtocolV1_1Vault changes: 65.4.1 Unmodifiable Vault Fields, 65.4.2 Vault Deletion Memo, 65.4.3 Cash-Basis Vault, and 65.4.4 Closed-Ended Vault. - XLS-65.5:
fixCleanup3_4_0. Admits one unit of rounding slack for IOU accounting invariants and for the matchingVaultDeposit,VaultWithdrawandVaultClawbackstate-change deltas, requiresLossUnrealizedto be non-negative, and narrowsVaultSetcap enforcement to transactions that supplyAssetsMaximumor otherwise change the cap. Also truncates burned shares, addsVaultWithdrawcredential and domain checks, and refuses pseudo-account destinations and holders. - XLS-65.6:
fixCleanup3_5_0. Withdrawal transfer fee,AssetsMaximumrange checks, and missing-holder clawback. - XLS-65.7:
LendingProtocolV1_2Vault changes: 65.7.1 Fixed Precision Vault and 65.7.2 Vault Transactions in Batch.