Redeem vault shares for assets. The amount of assets received depends on the exchange rate, which adjusts based on the vault’s total assets and any unrealized losses.
The VaultWithdraw transaction does not respect the Permissioned Domain rules. In other words, any account that holds the shares of the vault can redeem them. This is to avoid a situation where a depositor deposits assets to a private vault to then have their access revoked by invalidating their credentials, and thus losing access to their funds.
A depositor cannot redeem liquidity if the trust line between the pseudo-account and the issuer of the vault asset is frozen, or the MPToken is locked.
A withdrawal whose destination is the issuer of the vault asset is never blocked by a freeze, not even a global freeze. When you withdraw to your own account, you are both the sender and the destination: for a trust line asset, a regular freeze does not block the withdrawal but a deep freeze does, and for an MPT any lock blocks it.
Requires the fixCleanup3_3_0 amendment. Loading...
Requires the SingleAssetVault amendment. Loading...
{
"TransactionType": "VaultWithdraw",
"Account": "rGFBE8WA2ZKfqGGB7CFkLusVt7hsVT4r8H",
"Amount": {
"mpt_issuance_id": "000000016E1417CA9DFD23400B05E43FDE5BB8D8FFA817CA",
"value": "5"
},
"Destination": "rGFBE8WA2ZKfqGGB7CFkLusVt7hsVT4r8H",
"Fee": "12",
"Flags": 0,
"Sequence": 200380,
"VaultID": "A7B7B3ED3F5BD8E58C9064278EB29519CD6475D87A4517707DE108E65AE9C08C",
}In addition to the common fields, VaultWithdraw transactions use the following fields:
| Field Name | JSON Type | Internal Type | Required? | Description |
|---|---|---|---|---|
VaultID | String | Hash256 | Yes | The unique identifier of the vault to which the assets are deposited. |
Amount | Number | Amount | Yes | The exact amount of vault asset to withdraw or vault share to redeem. |
Destination | String | AccountID | No | An account to receive the assets. This account must be able to receive the vault asset or the transaction fails. |
DestinationTag | Number | UInt32 | No | Arbitrary tag identifying the reason for the withdrawal to the destination. |
There are two ways to specify the transaction Amount field:
| Specify Assets | Specify Shares | |
|---|---|---|
|
|
There are no flags defined for VaultWithdraw transactions.
A single asset vault does not apply the transfer fee to VaultWithdraw transactions. Additionally, whenever a protocol moves assets from or to a vault, the Transfer Fee must not be charged.
Besides errors that can occur for all transactions, VaultWithdraw transactions can result in the following transaction result codes:
| Error Code | Description |
|---|---|
tecNO_ENTRY | The Vault object with the provided VaultID does not exist on the ledger. |
tecOBJECT_NOT_FOUND | A ledger entry specified in the transaction does not exist. |
tecNO_PERMISSION | The destination account specified does not have permission to receive the asset. |
tecWRONG_ASSET | The unit of Amount is neither a share or asset of the vault. |
tecINSUFFICIENT_FUNDS | There is insufficient liquidity in the vault to fill the request. |
tecFROZEN | The vault asset is frozen globally for the vault's pseudo-account, or deep frozen for the destination. A freeze on the sender also causes this error when Destination is another account. A regular freeze on the destination alone does not cause this error. Requires the fixCleanup3_3_0 amendment. Loading... |
tecLOCKED | The MPT vault asset is locked globally for the vault's pseudo-account, for the sender, or for the destination account. Unlike a trust line freeze, an MPT lock also blocks a withdrawal to the sender's own account. Requires the fixCleanup3_3_0 amendment. Loading... |
temMALFORMED | The transaction is not validly formatted. For example, the VaultID is not provided. |
temDISABLED | The Single Asset Vault amendment is not enabled. |
temBAD_AMOUNT | The Amount field of the transaction is invalid. For example, the provided amount is set to 0. |
tecNO_AUTH | The asset is a non-transferable MPT. |