Skip to content

Commit 95fdc2e

Browse files
committed
adds VaultDepositBlock flag
1 parent 866caa4 commit 95fdc2e

File tree

1 file changed

+62
-28
lines changed

1 file changed

+62
-28
lines changed

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

Lines changed: 62 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -137,9 +137,10 @@ A vault has the following fields:
137137

138138
The `Vault` object supports the following flags:
139139

140-
| Flag Name | Flag Value | Modifiable? | Description |
141-
| ----------------- | :----------: | :---------: | :------------------------------------------: |
142-
| `lsfVaultPrivate` | `0x00010000` | `No` | If set, indicates that the vault is private. |
140+
| Flag Name | Flag Value | Modifiable? | Description |
141+
| ------------------------ | :----------: | :---------: | :-----------------------------------------------------: |
142+
| `lsfVaultPrivate` | `0x00010000` | `No` | If set, indicates that the vault is private. |
143+
| `lsfVaultDepositBlocked` | `0x00020000` | `No` | If set, indicates that deposits to a vault are blocked. |
143144

144145
### 2.3 Vault `_pseudo-account_`
145146

@@ -429,35 +430,55 @@ The transaction creates an `AccountRoot` object for the `_pseudo-account_`. Ther
429430

430431
The `VaultSet` updates an existing `Vault` ledger object.
431432

432-
### 4.1 Fields
433+
### 4.1. Fields
433434

434435
| Field Name | Required | JSON Type | Internal Type | Default Value | Description |
435436
| ----------------- | :------: | :-------: | :-----------: | :-----------: | :-------------------------------------------------------------------------------------------------------------------------------------- |
436437
| `TransactionType` | Yes | `string` | `Uint16` | `59` | The transaction type. |
437438
| `VaultID` | Yes | `string` | `Hash256` | `N/A` | The ID of the Vault to be modified. Must be included when updating the Vault. |
439+
| `Flags` | No | `number` | `UINT32` | 0 | Specifies the flags for the Vault. |
438440
| `Data` | No | `string` | `Blob` | | Arbitrary Vault metadata, limited to 256 bytes. |
439441
| `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`. |
440442
| `DomainID` | No | `string` | `Hash256` | | The `PermissionedDomain` object ID associated with the shares of this Vault. |
441443

442-
### 4.2 Failure Conditions
444+
### 4.2. Flags
443445

444-
1. `Vault` object with the specified `VaultID` does not exist on the ledger.
445-
2. The submitting account is not the `Owner` of the vault.
446-
3. The `Data` field is larger than 256 bytes.
447-
4. If `Vault.AssetsMaximum` > `0` AND `AssetsMaximum` > 0 AND:
448-
1. The `AssetsMaximum` < `Vault.AssetsTotal` (new `AssetsMaximum` cannot be lower than the current `AssetsTotal`).
449-
5. The `sfVaultPrivate` flag is not set and the `DomainID` is provided (Vault Owner is attempting to set a PermissionedDomain to a public Vault).
450-
6. The `PermissionedDomain` object does not exist with the provided `DomainID`.
451-
7. The transaction is attempting to modify an immutable field.
452-
8. The transaction does not specify any of the modifiable fields.
446+
| Flag Name | Flag Value | Description |
447+
| ----------------------- | :----------: | :------------------------------- |
448+
| `tfVaultDepositBlock` | `0x00010000` | Block deposits into the vault. |
449+
| `tfVaultDepositUnblock` | `0x00020000` | Unblock deposits into the vault. |
450+
451+
### 4.3. Failure Conditions
452+
453+
#### 4.3.1. Data Verification
454+
455+
1. `VaultID` is empty. (`temMALFORMED`)
456+
2. The `Data` field is larger than 256 bytes (`temMALFORMED`)
457+
3. `AssetsMaximum` is negative integer (`temMALFORMED`)
458+
4. The transaction does not specify any of the modifiable fields. (`temMALFORMED`)
459+
5. Both `tfVaultDepositBlock` and `tfVaultDepositUnblock` are set. (`temMALFORMED`)
453460

454-
### 4.3 State Changes
461+
#### 4.3.2. Protocol-Level Failures
462+
463+
1. `Vault` object with the specified `VaultID` does not exist on the ledger. (`tecNO_ENTRY`)
464+
2. The submitting account is not the `Owner` of the vault. (`tecNO_PERMISSION`)
465+
3. The `sfVaultPrivate` flag is not set and the `DomainID` is provided. (`tecNO_PERMISSION`)
466+
4. The `PermissionedDomain` object does not exist with the provided `DomainID`. (`tecNO_OBJECT_NOT_FOUND`)
467+
5. If `Vault.AssetsMaximum` > `0` AND `AssetsMaximum` > 0 AND:
468+
1. The `AssetsMaximum` < `Vault.AssetsTotal` (new `AssetsMaximum` cannot be lower than the current `AssetsTotal`). (`tecLIMIT_EXCEEDED`)
469+
6. `Vault.lsfVaultDepositBlocked` is set and `tfVaultDepositBlock` is set. (`tecNO_PERMISSION`)
470+
471+
### 4.4. State Changes
455472

456473
1. Update mutable fields in the `Vault` ledger object.
457474
2. If `DomainID` is provided:
458475
1. Set `MPTokenIssuance(Vault.ShareMPTID).DomainID = DomainID` (Set the Permissioned Domain).
476+
3. If `tfVaultDepositBlock` is provided:
477+
1. Set `Vault.Flags |= lsfVaultDepositBlocked` flag (Block Deposits).
478+
4. If `tfVaultDepositUnblock` is provided:
479+
1. Set `Vault.Flags &= ~lsfVaultDepositBlocked` flag (Unblock Deposits).
459480

460-
### 4.4 Invariants
481+
### 4.5. Invariants
461482

462483
**TBD**
463484

@@ -509,22 +530,35 @@ The `VaultDeposit` transaction adds Liqudity in exchange for vault shares.
509530

510531
### 6.2 Failure conditions
511532

512-
1. `Vault` object with the `VaultID` does not exist on the ledger.
513-
2. The asset type of the vault does not match the asset type the depositor is depositing.
514-
3. The depositor does not have sufficient funds to make a deposit.
515-
4. Adding the `Amount` to the `AssetsTotal` of the vault would exceed the `AssetsMaximum`.
516-
5. The `Vault` `lsfVaultPrivate` flag is set and the `Account` depositing the assets does not have credentials in the permissioned domain of the share.
533+
#### 6.2.1. Data Verification
534+
535+
1. `VaultID` is has a zero value. (`temMALFORMED`)
536+
2. `Amount` is less or equal to zero. (`temBAD_AMOUNT`)
537+
538+
#### 6.2.2. Protocol-Level Failures
539+
540+
1. `Vault` object with the `VaultID` does not exist on the ledger. (`tecNO_ENTRY`)
541+
2. `Amount.Asset` does not match the asset type of the vault. (`tecWRONG_ASSET`)
542+
3. The depositor does not have sufficient funds to make a deposit. (`tecINSUFFICIENT_FUNDS`)
543+
4. Adding the `Amount` to the `AssetsTotal` of the vault would exceed the `AssetsMaximum` (`tecLIMIT_EXCEEDED`)
544+
545+
5. The `Vault` `lsfVaultPrivate` flag is set and the `Account` is not `Vault.Owner`:
546+
1. If `Account` credentials are expired. (`tecEXPIRED`)
547+
2. If `Account` does not have valid credentials. (`tecNO_AUTH`)
517548

518549
6. The `Vault.Asset` is `MPT`:
519-
1. `MPTokenIssuance.lsfMPTCanTransfer` is not set (the asset is not transferable).
520-
2. `MPTokenIssuance.lsfMPTLocked` flag is set (the asset is globally locked).
521-
3. `MPToken(MPTokenIssuanceID, AccountID).lsfMPTLocked` flag is set (the asset is locked for the depositor).
522-
4. `MPToken(MPTokenIssuanceID, AccountID).MPTAmount` < `Amount` (insufficient balance).
550+
1. `MPTokenIssuance.lsfMPTCanTransfer` is not set (the asset is not transferable). (`tecNO_AUTH`)
551+
2. `MPTokenIssuance.lsfMPTLocked` flag is set (the asset is globally locked) (`tecLOCKED`)
552+
3. `MPToken(MPTokenIssuanceID, AccountID).lsfMPTLocked` flag is set (the asset is locked for the depositor). (`tecLOCKED`)
553+
4. `MPToken(MPTokenIssuanceID, AccountID).MPTAmount` < `Amount` (insufficient balance). (`tecINSUFFICIENT_FUNDS`)
523554

524555
7. The `Asset` is an `IOU`:
525-
1. The `lsfGlobalFreeze` flag is set on the issuing account (the asset is frozen).
526-
2. The `lsfHighFreeze` or `lsfLowFreeze` flag is set on the `RippleState` object between the Asset `Issuer` and the depositor.
527-
3. The `RippleState` object `Balance` < `Amount` (insufficient balance).
556+
1. `lsfDefaultRipple` flag is not set on either the issuer or the depositor. (`terNO_RIPPLE`)
557+
2. The `lsfGlobalFreeze` flag is set on the issuing account (the asset is frozen). (`tecFROZEN`)
558+
3. The `lsfHighFreeze` or `lsfLowFreeze` flag is set on the `RippleState` object between the Asset `Issuer` and the depositor. (`tecFROZEN`)
559+
4. The `RippleState` object `Balance` < `Amount` (insufficient balance). (`tecINSUFFICIENT_FUNDS`)
560+
561+
8. `Account` is not `Vault.Owner` and `Vault.lsfVaultDepositBlocked` flag is set (`tecNO_PERMISSION`)
528562

529563
### 6.3 State Changes
530564

0 commit comments

Comments
 (0)