VaultDeposit

[Source]

Deposits a specified number of assets into a vault in exchange for shares.

For private vaults, the depositor must be authorized to interact with the vault’s shares and have credentials in the Permissioned Domain of the share.

Public vaults require no authorization, and anyone can deposit as long as they meet the asset type requirement and have sufficient funds.

Warning

A depositor cannot deposit assets into the vault if:

  • The asset is frozen for the depositor.
  • The vault is private and the depositor's credentials have expired.

Additionally, if the vault shares are frozen for the depositor, they cannot receive new shares.

If successful, the transaction moves the assets from the depositor's account to the vault's pseudo-account, issues the corresponding vault shares, and updates the vault’s balance.

(Requires the Single Asset Vault amendment )

Example VaultDeposit JSON

{
  "TransactionType": "VaultDeposit",
  "Account": "ra5nK24KXen9AHvsdFTKHSANinZseWnPcX",
  "Fee": "12",
  "Flags": 0,
  "LastLedgerSequence": 7108682,
  "Sequence": 8,
  "VaultID": "77D6234D074E505024D39C04C3F262997B773719AB29ACFA83119E4210328776",
  "Amount" : {
    "currency" : "TST",
    "issuer" : "rP9jPyP5kyvFRb6ZiRghAGw5u8SGAmU4bd",
    "value" : "2.5"
  }
}

VaultDeposit Fields

In addition to the common fields, VaultDeposit transactions use the following fields:

Field NameJSON TypeInternal TypeRequired?Description
VaultIDStringHash256YesThe unique identifier of the vault to which the asset is deposited.
AmountString/ObjectAmountYesThe asset and quantity to be deposited into the vault.

The deposited asset must match the vault’s designated asset for the transaction to succeed. Depending on the asset type, the following changes occur:

  • XRP: The vault’s pseudo-account balance increases, and the depositor’s balance decreases.
  • Fungible Token: The trust line balance between the vault's pseudo-account and the asset issuer is adjusted.
  • MPT: The MPToken.MPTAmount of both the depositor and the vault's pseudo-account is updated.

VaultDeposit Flags

There are no flags defined for VaultDeposit transactions.

Transfer Fees

A single asset vault does not apply the transfer fee to VaultDeposit transactions. Additionally, whenever a protocol moves assets from or to a vault, the transfer fee isn't charged.

Error Cases

Besides errors that can occur for all transactions, VaultDeposit transactions can result in the following transaction result codes:

Error CodeDescription
tecOBJECT_NOT_FOUNDOccurs if the Vault object with the provided VaultID does not exist on the ledger.
tecWRONG_ASSETOccurs if the asset of the vault does not match the asset being deposited.
tecINSUFFICIENT_FUNDSOccurs if the depositor does not have sufficient funds to make a deposit.
tecLIMIT_EXCEEDEDOccurs if the adding the Amount to the AssetTotal exceeds the AssetMaximum value.
tecNO_AUTHOccurs if the lsfVaultPrivate flag is set and the account depositing does not have credentials in the Permissioned Domain of the share.
tecFROZENOccurs if the asset is a Fungible Token and the lsfGlobalFreeze flag is set on the issuing account, meaning the asset is frozen.
tecFROZENOccurs if the asset is a Fungible Token and the lsfHighFreeze or lsfLowFreeze flag is set on the trust line between the asset issuer and the depositor.