Vault

[Source]

A Vault object defines the state of a tokenized vault. It contains key details such as available assets, shares, total value, and other relevant information. You can create a Vault object with the VaultCreate transaction.

The Vault object is tracked in an Owner Directory owned by the Vault Owner account. Additionally, to facilitate Vault object lookup, the object is tracked in the OwnerDirectory of the vault's pseudo-account.

(Requires the Single Asset Vault amendment )

Example Vault JSON

{
  "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",
  },
  "AssetTotal": 1000000,
  "AssetAvailable": 800000,
  "LossUnrealized": 200000,
  "AssetMaximum": 0,
  "Share": {
    "TokenID": "ABCDEF1234567890ABCDEF1234567890ABCDEF1234567890ABCDEF1234567890",
    "Issuer": "rShareIssuer1234567890abcdef1234567890abcdef"
  },
  "WithdrawalPolicy": "0x0001"
}

Vault Fields

In addition to the common ledger entry fields, Vault entries have the following fields:

NameJSON TypeInternal TypeRequired?Description
LedgerEntryTypeStringUInt16YesLedger object type. The default value is 0x0081.
LedgerIndexStringUInt16YesThe unique identifier of the ledger object.
FlagsStringUInt32YesSet of bit-flags for this ledger object.
PreviousTxnIDStringHash256YesIdentifies the transaction ID that most recently modified this object.
PreviousTxnLgrSeqNumberUInt32YesThe sequence of the ledger that contains the transaction that most recently modified this object.
SequenceNumberUInt32YesThe transaction sequence number that created the vault.
OwnerNodeNumberUInt64YesIdentifies the page where this item is referenced in the owner's directory.
OwnerStringAccountIDYesThe account address of the Vault Owner.
AccountStringAccountIDYesThe address of the vault's pseudo-account.
DataStringBlobNoArbitrary metadata about the vault. Limited to 256 bytes.
AssetString/ObjectIssueYesThe asset of the vault. The vault supports XRP, Fungible Tokens, and MPTs.
AssetTotalNumberNumberYesThe total value of the vault.
AssetAvailableNumberNumberYesThe asset amount that is available in the vault.
LossUnrealizedNumberNumberYesThe potential loss amount that is not yet realized, expressed as the vault's asset. Only a protocol connected to the vault can modify this attribute.
AssetMaximumNumberNumberNoThe maximum asset amount that can be held in the vault. If set to 0, this indicates there is no cap.
ShareObjectMPTYesThe identifier of the share MPTokenIssuance object.
WithdrawalPolicyStringUInt8YesIndicates the withdrawal strategy used by the vault.

Vault Flags

Vault entries can have the followings flags:

Flag NameFlag ValueDescription
lsfVaultPrivate0x00010000If set, indicates that the vault is private. This flag can only be set when creating the vault.

Vault ID Format

The ID of a Vault entry is the SHA512-Half of the following values, concatenated in order:

  • The Vault space key 0x0056 (capital V).
  • The AccountID of the account submitting the VaultSet transaction (i.e., VaultOwner).
  • The transaction Sequence number. If the transaction used a Ticket, use the TicketSequence value.