Skip to content

Commit 8f203a0

Browse files
authored
Updates VaultWithdraw failure conditions (#411)
* Updates VaultWithdraw destination failure conditions. * fixes formatting errors * fixes erroneous unrealized loss subtraction from asset deposit
1 parent 573c2e7 commit 8f203a0

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

XLS-0065-single-asset-vault/README.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
category: Amendment
99
requires: [XLS-33](../XLS-0033-multi-purpose-tokens/README.md)
1010
created: 2024-04-12
11-
updated: 2025-10-13
11+
updated: 2025-11-17
1212
</pre>
1313

1414
# Single Asset Vault
@@ -283,9 +283,9 @@ The calculation depends on whether the vault is empty.
283283
- **Subsequent Deposits**: For all other deposits, shares are calculated proportionally. The resulting $\Delta_{shares}$ value is **rounded down** to the nearest integer.
284284
$$\Delta_{shares} = \frac{\Delta_{assets} \times \Gamma_{shares}}{\Gamma_{assets}}$$
285285

286-
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$).
286+
Because the share amount is rounded down, the actual assets taken from the depositor ($\Delta_{assets'}$) are recalculated.
287287

288-
$$\Delta_{assets'} = \frac{\Delta_{shares} \times (\Gamma_{assets} - \iota)}{\Gamma_{shares}}$$
288+
$$\Delta_{assets'} = \frac{\Delta_{shares} \times \Gamma_{assets}}{\Gamma_{shares}}$$
289289

290290
#### Vault State Update
291291

@@ -613,7 +613,9 @@ In sections below assume the following variables:
613613
- The shares `MPToken.MPTAmount` of the `Account` is less than $\Delta_{share}$ (attempt to withdraw more shares than owned).
614614
- `Vault.AssetsAvailable` < `Amount` (the vault has insufficient assets).
615615

616-
- The `Destination` account is specified and it does not have permission to receive the asset.
616+
- The `Destination` account is specified:
617+
- The account does not have permission to receive the asset.
618+
- The account does not have a `RippleState` or `MPToken` object for the asset.
617619

618620
##### 3.2.2.2 State Changes
619621

@@ -622,13 +624,13 @@ In sections below assume the following variables:
622624
- Increase the `Balance` field of the depositor `AccountRoot` by $\Delta_{asset}$.
623625

624626
- If the `Vault.Asset` is an `IOU`:
625-
- If the Depositor (or Destination) account does not have a `RippleState` object for the Vaults Asset, create the `RippleState` object.
627+
- If the Depositor account does not have a `RippleState` object for the Vaults Asset, create the `RippleState` object.
626628

627629
- Decrease the `RippleState` balance between the _pseudo-account_ `AccountRoot` and the `Issuer` `AccountRoot` by $\Delta_{asset}$.
628630
- Increase the `RippleState` balance between the depositor `AccountRoot` and the `Issuer` `AccountRoot` by $\Delta_{asset}$.
629631

630632
- If the `Vault.Asset` is an `MPT`:
631-
- If the Depositor (or Destination) account does not have a `MPToken` object for the Vaults Asset, create the `MPToken` object.
633+
- If the Depositor account does not have a `MPToken` object for the Vaults Asset, create the `MPToken` object.
632634

633635
- Decrease the `MPToken.MPTAmount` by $\Delta_{asset}$ of the _pseudo-account_ `MPToken` object for the `Vault.Asset`.
634636
- Increase the `MPToken.MPTAmount` by $\Delta_{asset}$ of the depositor `MPToken` object for the `Vault.Asset`.

0 commit comments

Comments
 (0)