From 746a147e83f4432946034c0e976c5b7b009d535b Mon Sep 17 00:00:00 2001 From: Vito Tumas <5780819+Tapanito@users.noreply.github.com> Date: Mon, 17 Nov 2025 14:16:48 +0100 Subject: [PATCH 1/3] Updates VaultWithdraw destination failure conditions. --- XLS-0065-single-asset-vault/README.md | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/XLS-0065-single-asset-vault/README.md b/XLS-0065-single-asset-vault/README.md index 8797b33e..ed52cc44 100644 --- a/XLS-0065-single-asset-vault/README.md +++ b/XLS-0065-single-asset-vault/README.md @@ -8,7 +8,7 @@ category: Amendment requires: [XLS-33](../XLS-0033-multi-purpose-tokens/README.md) created: 2024-04-12 - updated: 2025-10-13 + updated: 2025-11-17 # Single Asset Vault @@ -613,7 +613,9 @@ In sections below assume the following variables: - The shares `MPToken.MPTAmount` of the `Account` is less than $\Delta_{share}$ (attempt to withdraw more shares than owned). - `Vault.AssetsAvailable` < `Amount` (the vault has insufficient assets). -- The `Destination` account is specified and it does not have permission to receive the asset. +- The `Destination` account is specified: + - The account does not have permission to receive the asset. + - The account does not have a `RippleState` or `MPToken` object for the asset. ##### 3.2.2.2 State Changes @@ -622,13 +624,13 @@ In sections below assume the following variables: - Increase the `Balance` field of the depositor `AccountRoot` by $\Delta_{asset}$. - If the `Vault.Asset` is an `IOU`: - - If the Depositor (or Destination) account does not have a `RippleState` object for the Vaults Asset, create the `RippleState` object. + - If the Depositor account does not have a `RippleState` object for the Vaults Asset, create the `RippleState` object. - Decrease the `RippleState` balance between the _pseudo-account_ `AccountRoot` and the `Issuer` `AccountRoot` by $\Delta_{asset}$. - Increase the `RippleState` balance between the depositor `AccountRoot` and the `Issuer` `AccountRoot` by $\Delta_{asset}$. - If the `Vault.Asset` is an `MPT`: - - If the Depositor (or Destination) account does not have a `MPToken` object for the Vaults Asset, create the `MPToken` object. + - If the Depositor account does not have a `MPToken` object for the Vaults Asset, create the `MPToken` object. - Decrease the `MPToken.MPTAmount` by $\Delta_{asset}$ of the _pseudo-account_ `MPToken` object for the `Vault.Asset`. - Increase the `MPToken.MPTAmount` by $\Delta_{asset}$ of the depositor `MPToken` object for the `Vault.Asset`. From 2858b642101645fa103a79f931bb4e521e75bce1 Mon Sep 17 00:00:00 2001 From: Vito <5780819+Tapanito@users.noreply.github.com> Date: Mon, 17 Nov 2025 14:26:12 +0100 Subject: [PATCH 2/3] fixes formatting errors --- XLS-0065-single-asset-vault/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/XLS-0065-single-asset-vault/README.md b/XLS-0065-single-asset-vault/README.md index ed52cc44..b0d423ee 100644 --- a/XLS-0065-single-asset-vault/README.md +++ b/XLS-0065-single-asset-vault/README.md @@ -614,8 +614,8 @@ In sections below assume the following variables: - `Vault.AssetsAvailable` < `Amount` (the vault has insufficient assets). - The `Destination` account is specified: - - The account does not have permission to receive the asset. - - The account does not have a `RippleState` or `MPToken` object for the asset. + - The account does not have permission to receive the asset. + - The account does not have a `RippleState` or `MPToken` object for the asset. ##### 3.2.2.2 State Changes From 83803d7f0a0f874fdf6e6edf5690586777945be0 Mon Sep 17 00:00:00 2001 From: Vito <5780819+Tapanito@users.noreply.github.com> Date: Tue, 18 Nov 2025 16:54:57 +0100 Subject: [PATCH 3/3] fixes erroneous unrealized loss subtraction from asset deposit --- XLS-0065-single-asset-vault/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/XLS-0065-single-asset-vault/README.md b/XLS-0065-single-asset-vault/README.md index b0d423ee..391ba3a3 100644 --- a/XLS-0065-single-asset-vault/README.md +++ b/XLS-0065-single-asset-vault/README.md @@ -283,9 +283,9 @@ The calculation depends on whether the vault is empty. - **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. This step ensures the user isn't overcharged and that the new shares are valued against the vault's real assets, accounting for any unrealized loss ($\iota$). +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} - \iota)}{\Gamma_{shares}}$$ +$$\Delta_{assets'} = \frac{\Delta_{shares} \times \Gamma_{assets}}{\Gamma_{shares}}$$ #### Vault State Update