Skip to content

Commit ffa44a4

Browse files
committed
adds dnation functionality to vaultDeposit transaction
1 parent 71c23a3 commit ffa44a4

File tree

1 file changed

+25
-11
lines changed

1 file changed

+25
-11
lines changed

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

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -527,6 +527,13 @@ The `VaultDeposit` transaction adds Liqudity in exchange for vault shares.
527527
| `TransactionType` | Yes | `string` | `UINT16` | `61` | Transaction type. |
528528
| `VaultID` | Yes | `string` | `HASH256` | `N/A` | The ID of the vault to which the assets are deposited. |
529529
| `Amount` | Yes | `string` or `object` | `STAmount` | `N/A` | Asset amount to deposit. |
530+
| `Flags` | No | `number` | `UINT32` | 0 | Specifies additional flags for the transaction. |
531+
532+
### 6.1 Flags
533+
534+
| Flag Name | Flag Value | Description |
535+
| --------------- | :----------: | :------------------------------- |
536+
| `tfVaultDonate` | `0x00010000` | Donate the funds into the vault. |
530537

531538
### 6.2 Failure conditions
532539

@@ -542,43 +549,50 @@ The `VaultDeposit` transaction adds Liqudity in exchange for vault shares.
542549
3. The depositor does not have sufficient funds to make a deposit. (`tecINSUFFICIENT_FUNDS`)
543550
4. Adding the `Amount` to the `AssetsTotal` of the vault would exceed the `AssetsMaximum` (`tecLIMIT_EXCEEDED`)
544551

545-
5. The `Vault` `lsfVaultPrivate` flag is set and the `Account` is not `Vault.Owner`:
552+
5. `tfVaultDonate` flag is set and:
553+
1. `Account` submitting the transaction is not the vault owner. (`tecNO_PERMISSION`)
554+
2. `MPTokenIssuance(Vault.ShareMPTID).OutstandingAmount == 0`, the Vault is empty. (`tecNO_PERMISSION`)
555+
556+
6. The `Vault` `lsfVaultPrivate` flag is set and the `Account` is not `Vault.Owner`:
546557
1. If `Account` credentials are expired. (`tecEXPIRED`)
547558
2. If `Account` does not have valid credentials. (`tecNO_AUTH`)
548559

549-
6. If vault is insolvent, `Vault.AssetsTotal = 0` and `MPTokenIssuance(Vault.ShareMPTID).OutstandingAmount > 0`. (`tecLOCKED`)
560+
7. If vault is insolvent, `Vault.AssetsTotal = 0` and `MPTokenIssuance(Vault.ShareMPTID).OutstandingAmount > 0`. (`tecLOCKED`)
550561

551-
7. The `Vault.Asset` is `MPT`:
562+
8. The `Vault.Asset` is `MPT`:
552563
1. `MPTokenIssuance.lsfMPTCanTransfer` is not set (the asset is not transferable). (`tecNO_AUTH`)
553564
2. `MPTokenIssuance.lsfMPTLocked` flag is set (the asset is globally locked) (`tecLOCKED`)
554565
3. `MPToken(MPTokenIssuanceID, AccountID).lsfMPTLocked` flag is set (the asset is locked for the depositor). (`tecLOCKED`)
555566
4. `MPToken(MPTokenIssuanceID, AccountID).MPTAmount` < `Amount` (insufficient balance). (`tecINSUFFICIENT_FUNDS`)
556567

557-
8. The `Asset` is an `IOU`:
568+
9. The `Asset` is an `IOU`:
558569
1. `lsfDefaultRipple` flag is not set on either the issuer or the depositor. (`terNO_RIPPLE`)
559570
2. The `lsfGlobalFreeze` flag is set on the issuing account (the asset is frozen). (`tecFROZEN`)
560571
3. The `lsfHighFreeze` or `lsfLowFreeze` flag is set on the `RippleState` object between the Asset `Issuer` and the depositor. (`tecFROZEN`)
561572
4. The `RippleState` object `Balance` < `Amount` (insufficient balance). (`tecINSUFFICIENT_FUNDS`)
562573

563-
9. `Account` is not `Vault.Owner` and `Vault.lsfVaultDepositBlocked` flag is set (`tecNO_PERMISSION`)
574+
10. `Account` is not `Vault.Owner` and `Vault.lsfVaultDepositBlocked` flag is set (`tecNO_PERMISSION`)
575+
11. `Vault.AssetsTotal + Amount > Vault.AssetsMaximum`, deposit would exceed the maximum allowed amount. (`tecLIMIT_EXCEEDED`)
564576

565577
### 6.3 State Changes
566578

567579
1. If no `MPToken` object exists for the depositor, create one. For object details, see [2.1.6.2 `MPToken`](#2162-mptoken).
568580

569-
2. Increase the `MPTAmount` field of the share `MPToken` object of the `Account` by $\Delta_{share}$.
570-
3. Increase the `OutstandingAmount` field of the share `MPTokenIssuance` object by $\Delta_{share}$.
571-
4. Increase the `AssetsTotal` and `AssetsAvailable` of the `Vault` by `Amount`.
581+
2. If `tfVaultDonate` flag is **not** set:
582+
1. Increase the `MPTAmount` field of the share `MPToken` object of the `Account` by $\Delta_{share}$.
583+
2. Increase the `OutstandingAmount` field of the share `MPTokenIssuance` object by $\Delta_{share}$.
584+
585+
3. Increase the `AssetsTotal` and `AssetsAvailable` of the `Vault` by `Amount`.
572586

573-
5. If the `Vault.Asset` is `XRP`:
587+
4. If the `Vault.Asset` is `XRP`:
574588
1. Increase the `Balance` field of _pseudo-account_ `AccountRoot` by `Amount`.
575589
2. Decrease the `Balance` field of the depositor `AccountRoot` by `Amount`.
576590

577-
6. If the `Vault.Asset` is an `IOU`:
591+
5. If the `Vault.Asset` is an `IOU`:
578592
1. Increase the `RippleState` balance between the _pseudo-account_ `AccountRoot` and the `Issuer` `AccountRoot` by `Amount`.
579593
2. Decrease the `RippleState` balance between the depositor `AccountRoot` and the `Issuer` `AccountRoot` by `Amount`.
580594

581-
7. If the `Vault.Asset` is an `MPT`:
595+
6. If the `Vault.Asset` is an `MPT`:
582596
1. Increase the `MPToken.MPTAmount` by `Amount` of the _pseudo-account_ `MPToken` object for the `Vault.Asset`.
583597
2. Decrease the `MPToken.MPTAmount` by `Amount` of the depositor `MPToken` object for the `Vault.Asset`.
584598

0 commit comments

Comments
 (0)