VaultCreate

[Source]

Creates a new Vault ledger entry, an MPTokenIssuance ledger entry for the vault’s shares, and an AccountRoot for the vault’s pseudo-account.

Only the Vault Owner can initiate this transaction.

Note

Currently, the same account that creates the vault must also create other protocols, though this may change in the future.

(Requires the Single Asset Vault amendment )

Example VaultCreate JSON

{
  "TransactionType": "VaultCreate",
  "Account": "ra5nK24KXen9AHvsdFTKHSANinZseWnPcX",
  "Fee": "12",
  "Flags": 0,
  "LastLedgerSequence": 7108682,
  "Sequence": 8,
  "Data": "5468697320697320617262697472617279206D657461646174612061626F757420746865207661756C742E",
  "Asset": {
    "currency": "USD",
    "issuer": "rIssuer1234567890abcdef1234567890abcdef",
  },
  "AssetsMaximum": 0,
  "MPTokenMetadata": "5468697320697320617262697472617279206d657461646174612061626f757420746865204d50542073686172652e",
  "WithdrawalPolicy": "1",
  "DomainID": "77D6234D074E505024D39C04C3F262997B773719AB29ACFA83119E4210328776"
}

VaultCreate Fields

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

Field NameJSON TypeInternal TypeRequired?Description
DataStringBlobNoArbitrary vault metadata, in hex format, limited to 256 bytes.
AssetObjectIssueYesThe asset to be held in the vault. This can be XRP, a Fungible Token, or an MPT. If the asset is a Fungible Token, the transaction creates a trust line between the vault's pseudo-account and the issuer of the asset. If the asset is an MPT, the transaction creates an MPToken object for the vault's pseudo-account.
AssetsMaximumNumberUInt64NoThe maximum asset amount that can be held in a vault.
MPTokenMetadataStringBlobNoArbitrary metadata about the share MPToken, in hex format, limited to 1024 bytes. Use this field if the vault's asset is an MPT.
WithdrawalPolicyNumberUInt8NoIndicates the withdrawal strategy used by the vault. The default value is 0x0001, mapped to the string vaultStrategyFirstComeFirstServe. See WithdrawalPolicy.
DomainIDStringHash256NoThe PermissionedDomain object ID associated with the shares of this vault. If provided, the transaction creates a private vault, which restricts access to accounts with credentials in the specified Permissioned Domain.

VaultCreate Flags

VaultCreate transactions support additional values in the Flags field, as follows:

Flag NameValueDescription
tfVaultPrivate0x00010000Indicates that the vault is private. This flag can only be set when creating the vault.
tfVaultShareNonTransferable0x00020000Indicates the vault share is non-transferable. This flag can only be set when creating the vault.

WithdrawalPolicy

A WithdrawalPolicy defines the strategy for processing withdrawal requests from a vault. This policy governs how liquidity is removed. Currently, only one strategy is supported:

Policy NameValueDescription
vaultStrategyFirstComeFirstServe0x0001Requests are processed on a first-come, first-served basis. With this strategy, a depositor can redeem any amount of assets, provided they hold a sufficient number of shares.

Transaction Cost

Since the VaultCreate transaction creates a new AccountRoot object for a vault’s pseudo-account, it incurs a higher than usual transaction cost to deter ledger spam. Instead of the standard minimum of 0.00001 XRP, VaultCreate must destroy an incremental owner reserve, currently 0.2 XRP.

Error Cases

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

Error CodeDescription
tecNO_AUTHThe asset is an MPT and the lsfMPTCanTransfer flag is not set in the MPTokenIssuance object, meaning the vault cannot be created with a non-transferable MPT.
tecLOCKEDThe asset is an MPT and the lsfMPTLocked flag is set in the MPTokenIssuance object, meaning the asset is locked.
tecFROZENThe issuer has frozen the asset to be held in the vault.
tecOBJECT_NOT_FOUNDA ledger entry specified in the transaction does not exist. For example, the provided DomainID does not exist.
temMALFORMEDThe transaction was not validly formatted. For example, the Data field is larger than 256 bytes.
tecINSUFFICIENT_RESERVEThere is insufficient AccountRoot.Balance for the Owner Reserve.
terNO_RIPPLEThe issuer of the asset has not enabled the Default Ripple flag.
terNO_ACCOUNTThe issuer account of the vault's asset does not exist.
temDISABLEDEither the Single Asset Vault amendment is not enabled, a DomainID is provided and the Permissioned Domains amendment is not enabled, or the MPTokensV1 amendment is not enabled.