# NFTXVaultUpgradeableV3

The NFTX vault implementation used by the vault beacon proxy (and therefore all vaults).&#x20;

## Table of Contents

<details>

<summary>Constants</summary>

[#base](#base "mention")\
[#weth](#weth "mention")\
[#crypto\_punks](#crypto_punks "mention")\
[#crypto\_kitties](#crypto_kitties "mention")\
[#assetaddress](#assetaddress "mention")\
[#vaultfactory](#vaultfactory "mention")\
[#vaultid](#vaultid "mention")\
[#is1155](#is1155 "mention")

</details>

<details>

<summary>Variables</summary>

[#manager](#manager "mention")\
[#eligibilitystorage](#eligibilitystorage "mention")\
[#allowallitems](#allowallitems "mention")\
[#enablemint](#enablemint "mention")\
[#enableredeem](#enableredeem "mention")\
[#enableswap](#enableswap "mention")\
[#tokendepositinfo](#tokendepositinfo "mention")\
[#depositinfo1155](#depositinfo1155 "mention")\
[#pointerindex1155](#pointerindex1155 "mention")

</details>

<details>

<summary>Events</summary>

[#vaultinit](#vaultinit "mention")\
[#managerset](#managerset "mention")\
[#eligibilitydeployed](#eligibilitydeployed "mention")\
[#enablemintupdated](#enablemintupdated "mention")\
[#enableredeemupdated](#enableredeemupdated "mention")\
[#enableswapupdated](#enableswapupdated "mention")\
[#minted](#minted "mention")\
[#redeemed](#redeemed "mention")\
[#swapped](#swapped "mention")\
[#premiumshared](#premiumshared "mention")\
[#feesdistributed](#feesdistributed "mention")\
[#vaultshutdown](#vaultshutdown "mention")

</details>

<details>

<summary>Public Write Functions</summary>

[#mint](#mint "mention")\
[#redeem](#redeem "mention")\
[#swap](#swap "mention")\
[#flashloan](#flashloan "mention")

</details>

<details>

<summary>Privileged Write Functions</summary>

[#finalizevault](#finalizevault "mention")\
[#setvaultmetadata](#setvaultmetadata "mention")\
[#setvaultfeatures](#setvaultfeatures "mention")\
[#setfees](#setfees "mention")\
[#disablevaultfees](#disablevaultfees "mention")\
[#deployeligibilitystorage](#deployeligibilitystorage "mention")\
[#setmanager](#setmanager "mention")

</details>

<details>

<summary>Owner Write Functions</summary>

[#rescuetokens](#rescuetokens "mention")\
[#shutdown](#shutdown "mention")

</details>

<details>

<summary>Read Functions</summary>

[#nftidat](#nftidat "mention")\
[#allholdings](#allholdings "mention")\
[#totalholdings](#totalholdings "mention")\
[#holdingscontains](#holdingscontains "mention")\
[#vaultfees](#vaultfees "mention")\
[#allvalidnfts](#allvalidnfts "mention")\
[#vtokentoeth](#vtokentoeth "mention")\
[#depositinfo1155](#depositinfo1155 "mention")\
[#version](#version "mention")

</details>

## Constants

#### BASE

```solidity
uint256 constant BASE = 10 ** 18
```

10^18.

#### WETH

```solidity
function WETH() external view returns (address)
```

WETH contract address.

#### CRYPTO\_PUNKS

```solidity
address constant CRYPTO_PUNKS = 0xb47e3cd837dDF8e4c57F05d70Ab865de6e193BBB
```

CryptoPunks contract address.

#### CRYPTO\_KITTIES

```solidity
address constant CRYPTO_KITTIES = 0x06012c8cf97BEaD5deAe237070F9587f8E7A266d
```

CryptoKitties contract address.

#### assetAddress

```solidity
function assetAddress() external view returns (address)
```

Contract address of NFT collection that can enter the vault.

#### vaultFactory

```solidity
function vaultFactory() external view returns (address)
```

Address of NFTX Vault Factory.

#### vaultId

```solidity
function vaultId() external view returns (uint256)
```

The vault's ID number.&#x20;

#### is1155

```solidity
function is1155() external view returns (bool)
```

Whether the vault is for an ERC1155 NFT.

## Variables

#### manager

```solidity
function manager() external view returns (address)
```

Address of vault manager.&#x20;

#### eligibilityStorage

```solidity
function eligibilityStorage() external view returns (address)
```

Address of Eligibility Storage.

#### allowAllItems

```solidity
function allowAllItems() external view returns (bool)
```

Whether all NFT tokenIDs are eligible to enter this vault.&#x20;

#### enableMint

```solidity
function enableMint() external view returns (bool)
```

Whether minting is enabled.&#x20;

#### enableRedeem

```solidity
function enableRedeem() external view returns (bool)
```

Whether redeeming is enabled.&#x20;

#### enableSwap

```solidity
function enableSwap() external view returns (bool)
```

Whether swapping is enabled.&#x20;

#### tokenDepositInfo

```solidity
function tokenDepositInfo(
    uint256 tokenId
) external view returns (uint48 timestamp, address depositor)
```

Timestamp and depositor address of each ERC721 deposit.

#### depositInfo1155

```solidity
function depositInfo1155(
    uint256 tokenId,
    uint256 index
) external view returns (uint256 qty, address depositor, uint48 timestamp)
```

Quantity, depositor address, and timestamp of each ERC1155 deposit.

#### pointerIndex1155

```solidity
function pointerIndex1155(uint256 tokenId) external view returns (uint256)
```

Pointer index of oldest DepositInfo1155 object, for each ERC1155 tokenID.

## Events

#### VaultInit

```solidity
event VaultInit(
    uint256 indexed vaultId,
    address assetAddress,
    bool is1155,
    bool allowAllItems
)
```

Emitted by `__NFTXVault_init` function.

<table><thead><tr><th width="199.33333333333331">Parameters</th><th width="138">Type</th><th>Description</th></tr></thead><tbody><tr><td>vaultId</td><td><code>uint256</code></td><td>ID of vault initialized.</td></tr><tr><td>assetAddress</td><td><code>address</code></td><td>NFT collection address associated with vault.</td></tr><tr><td>is1155</td><td><code>bool</code></td><td>Whether the NFT collection uses ERC1155.</td></tr><tr><td>allowAllItems</td><td><code>bool</code></td><td>Whether all tokenIDs are allowed into vault. </td></tr></tbody></table>

#### ManagerSet

```solidity
event ManagerSet(address manager)
```

Emitted by `setManager` function.

<table><thead><tr><th width="199.33333333333331">Parameters</th><th width="138">Type</th><th>Description</th></tr></thead><tbody><tr><td>manager</td><td><code>address</code></td><td>New vault manager address.</td></tr></tbody></table>

#### EligibilityDeployed

```solidity
event EligibilityDeployed(uint256 moduleIndex, address eligibilityAddr)
```

Emitted by `deployEligibilityStorage` function.

<table><thead><tr><th width="199.33333333333331">Parameters</th><th width="138">Type</th><th>Description</th></tr></thead><tbody><tr><td>moduleIndex</td><td><code>uint256</code></td><td>Eligibility module number.</td></tr><tr><td>eligibilityAddr</td><td><code>address</code></td><td>Address of eligibility contract just added.</td></tr></tbody></table>

#### EnableMintUpdated

```solidity
event EnableMintUpdated(bool enabled)
```

Emitted by `setVaultFeatures` function.

<table><thead><tr><th width="199.33333333333331">Parameters</th><th width="138">Type</th><th>Description</th></tr></thead><tbody><tr><td>enabled</td><td><code>bool</code></td><td>True if minting has just been enabled, false if minting has been disabled. </td></tr></tbody></table>

#### EnableRedeemUpdated

```solidity
event EnableRedeemUpdated(bool enabled)
```

Emitted by `setVaultFeatures` function.

<table><thead><tr><th width="199.33333333333331">Parameters</th><th width="138">Type</th><th>Description</th></tr></thead><tbody><tr><td>enabled</td><td><code>bool</code></td><td>True if redeeming has just been enabled, false if redeeming has been disabled. </td></tr></tbody></table>

#### EnableSwapUpdated

```solidity
event EnableSwapUpdated(bool enabled)
```

Emitted by `setVaultFeatures` function.

<table><thead><tr><th width="199.33333333333331">Parameters</th><th width="138">Type</th><th>Description</th></tr></thead><tbody><tr><td>enabled</td><td><code>bool</code></td><td>True if NFT-to-NFT swapping has just been enabled, false if it has been disabled. </td></tr></tbody></table>

#### Minted

```solidity
event Minted(
    uint256[] nftIds,
    uint256[] amounts,
    address to,
    address depositor
)
```

Emitted by `mint` function.

<table><thead><tr><th width="199.33333333333331">Parameters</th><th width="138">Type</th><th>Description</th></tr></thead><tbody><tr><td>nftIds</td><td><code>uint256[]</code></td><td>TokenIDs of NFTs added to vault.</td></tr><tr><td>amounts</td><td><code>uint256[]</code></td><td>Amounts of each NFT tokenID (for ERC1155). </td></tr><tr><td>to</td><td><code>address</code></td><td>Recipient address that vTokens were sent to. </td></tr><tr><td>depositor</td><td><code>address</code></td><td>Depositor address that should receive premiums for the <code>nftIds</code> deposited.</td></tr></tbody></table>

#### Redeemed

```solidity
event Redeemed(uint256[] specificIds, address to)
```

Emitted by `redeem` function.

<table><thead><tr><th width="199.33333333333331">Parameters</th><th width="138">Type</th><th>Description</th></tr></thead><tbody><tr><td>specificIds</td><td><code>uint256[]</code></td><td>TokenIDs of redeemed NFTs.</td></tr><tr><td>to</td><td><code>address</code></td><td>Recipient address that NFTs were sent to. </td></tr></tbody></table>

#### Swapped

```solidity
event Swapped(
    uint256[] nftIds,
    uint256[] amounts,
    uint256[] specificIds,
    address to,
    address depositor
)
```

Emitted by `swap` function.

<table><thead><tr><th width="199.33333333333331">Parameters</th><th width="138">Type</th><th>Description</th></tr></thead><tbody><tr><td>nftIds</td><td><code>uint256[]</code></td><td>TokenIDs of NFTs sent to vault.</td></tr><tr><td>amounts</td><td><code>uint256[]</code></td><td>Amounts for NFT token IDs that entered the vault, and also for NFT tokenIDs that exited the vault. </td></tr><tr><td>specificIds</td><td><code>uint256[]</code></td><td>TokenIDs of NFTs sent to recipient.</td></tr><tr><td>to</td><td><code>address</code></td><td>Recipient address that NFTs were sent to. </td></tr><tr><td>depositor</td><td><code>address</code></td><td>Depositor address that should receive premiums for the <code>nftIds</code> deposited.</td></tr></tbody></table>

#### PremiumShared

```solidity
event PremiumShared(address depositor, uint256 wethPremium)
```

Emitted by `redeem` and `swap` functions.

<table><thead><tr><th width="199.33333333333331">Parameters</th><th width="138">Type</th><th>Description</th></tr></thead><tbody><tr><td>depositor</td><td><code>address</code></td><td>NFT depositor who receives bulk of premium fee.</td></tr><tr><td>wethPremium</td><td><code>uint256</code></td><td>WETH premium fee amount (total shared).</td></tr></tbody></table>

#### FeesDistributed

```solidity
event FeesDistributed(uint256 wethFees)
```

Emitted by `mint`, `redeem` and `swap` functions.

<table><thead><tr><th width="199.33333333333331">Parameters</th><th width="138">Type</th><th>Description</th></tr></thead><tbody><tr><td>wethFees</td><td><code>uint256</code></td><td>WETH fee amount distributed.</td></tr></tbody></table>

#### VaultShutdown

```solidity
event VaultShutdown(
    address assetAddress,
    uint256 numItems,
    address recipient
)
```

Emitted by `shutdown`.

<table><thead><tr><th width="199.33333333333331">Parameters</th><th width="138">Type</th><th>Description</th></tr></thead><tbody><tr><td>assetAddress</td><td><code>address</code></td><td>NFT collection address of shutdown vault.</td></tr><tr><td>numItems</td><td><code>uint256</code></td><td>Number of NFTs in vault at time of shutdown.</td></tr><tr><td>recipient</td><td><code>address</code></td><td>Recipient address where vault NFTs were sent.</td></tr></tbody></table>

## Write Functions

#### mint

```solidity
function mint(
    uint256[] calldata tokenIds,
    uint256[] calldata amounts,
    address depositor,
    address to
) external payable returns (uint256 vTokensMinted)
```

Mints vault tokens in exchange for depositing NFTs. Mint fee is paid in ETH.

<table><thead><tr><th width="170.5">Parameters</th><th width="129">Type</th><th>Description</th></tr></thead><tbody><tr><td>tokenIds</td><td><code>uint256[]</code></td><td>Token IDs of NFTs being sent to vault.</td></tr><tr><td>amounts</td><td><code>uint256[]</code></td><td>Quantity of each NFT. Ignored for ERC721 vaults.</td></tr><tr><td>depositor</td><td><code>address</code></td><td>Address that should receive premium fees for <code>tokenIds</code>.</td></tr><tr><td>to</td><td><code>address</code></td><td>Address to receive minted vToken.</td></tr><tr><td><code>msg.value</code></td><td><code>uint256</code></td><td>Amount of ETH to send.</td></tr></tbody></table>

<table><thead><tr><th width="170.5">Return values</th><th width="129">Type</th><th>Description</th></tr></thead><tbody><tr><td>vTokensMinted</td><td><code>uint256</code></td><td>The amount of vTokens minted.</td></tr></tbody></table>

#### redeem

```solidity
function redeem(
    uint256[] calldata idsOut,
    address to,
    uint256 wethAmount,
    uint256 vTokenPremiumLimit,
    bool forceFees
) external payable returns (uint256 ethFees)
```

Redeems NFTs by burning vToken. Redeem fee is paid in ETH or WETH.

<table><thead><tr><th width="208.5">Parameters</th><th width="128">Type</th><th>Description</th></tr></thead><tbody><tr><td>idsOut</td><td><code>uint256[]</code></td><td>Token IDs of NFTs to redeem.</td></tr><tr><td>to</td><td><code>address</code></td><td>Address to receive redeemed NFTs.</td></tr><tr><td>wethAmount</td><td><code>uint256</code></td><td>Amount of WETH to send for fees. If set to zero, then ETH is used instead.</td></tr><tr><td>vTokenPremiumLimit</td><td><code>uint256</code></td><td>Max total premium fees (denominated in vToken) that the user is willing to pay. </td></tr><tr><td>forceFees</td><td><code>bool</code></td><td>Whether to enforce fees even if caller is set as excludedFromFees.</td></tr><tr><td><code>msg.value</code></td><td><code>uint256</code></td><td>Amount of ETH to send.</td></tr></tbody></table>

<table><thead><tr><th width="210.5">Return values</th><th width="129">Type</th><th>Description</th></tr></thead><tbody><tr><td>ethFees</td><td><code>uint256</code></td><td>Total fees paid (in WETH or ETH). </td></tr></tbody></table>

#### swap

```solidity
function swap(
    uint256[] calldata idsIn,
    uint256[] calldata amounts,
    uint256[] calldata idsOut,
    address depositor,
    address to,
    uint256 vTokenPremiumLimit,
    bool forceFees
) external payable returns (uint256 ethFees)
```

Swap one or more NFTs (`idsIn`) for other NFTs from the vault (`idsOut`). Swap fee is paid in ETH.

<table><thead><tr><th width="204.5">Parameters</th><th width="128">Type</th><th>Description</th></tr></thead><tbody><tr><td>idsIn</td><td><code>uint256[]</code></td><td>Token IDs of NFTs going to vault. </td></tr><tr><td>amounts</td><td><code>uint256[]</code></td><td>Quantity of each NFT going to vault. Ignored for ERC721.</td></tr><tr><td>idsOut</td><td><code>uint256[]</code></td><td>Token IDs of NFTs leaving vault.</td></tr><tr><td>depositor</td><td><code>address</code></td><td>Address that should receive premium fees for <code>idsIn</code>. </td></tr><tr><td>to</td><td><code>address</code></td><td>Address to receive NFTs from vault.</td></tr><tr><td>vTokenPremiumLimit</td><td><code>uint256</code></td><td>Max total premium fees (denominated in vToken) that the user is willing to pay. </td></tr><tr><td>forceFees</td><td><code>bool</code></td><td>Whether to enforce fees even if caller is set as excludedFromFees.</td></tr><tr><td><code>msg.value</code></td><td><code>uint256</code></td><td>Amount of ETH to send.</td></tr></tbody></table>

<table><thead><tr><th width="206.5">Return values</th><th width="128">Type</th><th>Description</th></tr></thead><tbody><tr><td>ethFees</td><td><code>uint256</code></td><td>Total fees paid (in WETH or ETH).</td></tr></tbody></table>

#### flashLoan

```solidity
function flashLoan(
    IERC3156FlashBorrowerUpgradeable receiver,
    address token,
    uint256 amount,
    bytes calldata data
) public returns (bool)
```

Performs a flash loan. New tokens are minted and sent to `receiver`, who is required to implement the `IERC3156FlashBorrower` interface. By the end of the flash loan, the receiver is expected to own `amount` of tokens and have them approved back to the token contract itself so they can be burned and distributed.

The fee required to execute a flash loan is paid in ETH and is the highest of the vault's mint, redeem, and swap fees. All ETH proceeds are sent to the vault's inventory stakers.&#x20;

<table><thead><tr><th width="174.5">Parameters</th><th width="242">Type</th><th>Description</th></tr></thead><tbody><tr><td>receiver</td><td><code>IERC3156FlashBorrowerUpgradeable</code></td><td>The receiver address of the flash loan.</td></tr><tr><td>token</td><td><code>address</code></td><td>The token to be flash loaned. Only <code>address(this)</code> is supported.</td></tr><tr><td>amount</td><td><code>uint256</code></td><td>The amount of tokens to be loaned. </td></tr><tr><td>data</td><td><code>bytes</code></td><td>An arbitrary data field that is passed to the receiver.</td></tr></tbody></table>

<table><thead><tr><th width="182.5">Return values</th><th width="237">Type</th><th>Description</th></tr></thead><tbody><tr><td><em>unnamed</em></td><td><code>bool</code></td><td><code>true</code> if the flash loan was successful.</td></tr></tbody></table>

## Privileged Functions

These functions can only be called by the vault manager or (if there is no vault manager) the contract owner.

#### finalizeVault

```solidity
function finalizeVault() external
```

Removes the vault manager.

#### setVaultMetadata

```solidity
function setVaultMetadata(
    string calldata name_,
    string calldata symbol_
) external
```

Sets the name and symbol of the vault's ERC20 vToken.&#x20;

<table><thead><tr><th width="206.5">Parameters</th><th width="122">Type</th><th>Description</th></tr></thead><tbody><tr><td>name_</td><td><code>string</code></td><td>New name.</td></tr><tr><td>symbol_</td><td><code>string</code></td><td>New symbol.</td></tr></tbody></table>

#### setVaultFeatures

```solidity
function setVaultFeatures(
    bool enableMint_,
    bool enableRedeem_,
    bool enableSwap_
) external
```

Sets minting, redeeming, and swapping as either on or off.

<table><thead><tr><th width="222.5">Parameters</th><th width="120">Type</th><th>Description</th></tr></thead><tbody><tr><td>enableMint_</td><td><code>bool</code></td><td>Whether minting is enabled.</td></tr><tr><td>enableRedeem_</td><td><code>bool</code></td><td>Whether redeeming is enabled.</td></tr><tr><td>enableSwap_</td><td><code>bool</code></td><td>Whether swapping is enabled.</td></tr></tbody></table>

#### setFees

```solidity
function setFees(
    uint256 mintFee_,
    uint256 redeemFee_,
    uint256 swapFee_
) external
```

Sets mint, redeem, and (NFT-to-NFT) swap fees. 1e16 = 1%.

<table><thead><tr><th width="210.5">Parameters</th><th width="120">Type</th><th>Description</th></tr></thead><tbody><tr><td>mintFee_</td><td><code>uint256</code></td><td>New mint fee.</td></tr><tr><td>redeemFee_</td><td><code>uint256</code></td><td>New redeem fee.</td></tr><tr><td>swapFee_</td><td><code>uint256</code></td><td>New swap fee (for NFT swaps).</td></tr></tbody></table>

#### disableVaultFees

```solidity
function disableVaultFees() external
```

Removes custom vault fee settings, reverting to the global/default vault fee settings.&#x20;

#### deployEligibilityStorage

```solidity
function deployEligibilityStorage(
    uint256 moduleIndex,
    bytes calldata initData
) external returns (address)
```

Deploys and initializes an eligibility module contract from the EligibilityManager.

<table><thead><tr><th width="210.5">Parameters</th><th width="120">Type</th><th>Description</th></tr></thead><tbody><tr><td>moduleIndex</td><td><code>uint256</code></td><td>Index of module to deploy.</td></tr><tr><td>initData</td><td><code>bytes</code></td><td>ABI encoded parameters for module.</td></tr></tbody></table>

<table><thead><tr><th width="210.5">Return values</th><th width="120">Type</th><th>Description</th></tr></thead><tbody><tr><td><em>unnamed</em></td><td><code>address</code></td><td>Address of deployed module. </td></tr></tbody></table>

#### setManager

```solidity
function setManager(address manager_) external
```

Sets the vault manager.&#x20;

<table><thead><tr><th width="210.5">Parameters</th><th width="120">Type</th><th>Description</th></tr></thead><tbody><tr><td>manager_</td><td><code>address</code></td><td>Address of new vault manager.</td></tr></tbody></table>

## Owner Functions

#### rescueTokens

```solidity
function rescueTokens(
    TokenType tt,
    address token,
    uint256[] calldata ids,
    uint256[] calldata amounts
) external
```

Rescues ERC20, ERC721, or ERC1155 tokens.

<table><thead><tr><th width="161.5">Parameters</th><th width="219">Type</th><th>Description</th></tr></thead><tbody><tr><td>tt</td><td><code>TokenType</code></td><td>Enum: <code>ERC20</code>, <code>ERC721</code>, or <code>ERC1155.</code></td></tr><tr><td>token</td><td><code>IERC20Upgradeable</code></td><td>Contract address of token to retrieve.</td></tr><tr><td>ids</td><td><code>uint256[]</code></td><td>Token IDs for ERC721 or ERC1155 NFTs. Ignored for ERC20.</td></tr><tr><td>amounts</td><td><code>uint256[]</code></td><td>Quantities for ERC1155 token IDs. Ignored for ERC20 and ERC721.</td></tr></tbody></table>

#### shutdown

```solidity
function shutdown(
    address recipient,
    uint256[] calldata tokenIds
) external
```

Shuts the vault down and sends its NFTs to `recipient`. This function is meant to be used by the DAO when a vault has lost liquidity, and the vToken is too dispersed for any one user to redeem. When this happens, one or more users can request a shutdown, which is initiated by the DAO. The DAO then sells the assets for ETH and distributes the ETH to the vToken holders.&#x20;

This function works for both ERC721 and ERC1155 vaults. For ERC1155, the total amount of each tokenID will be sent to the recipient.&#x20;

<table><thead><tr><th width="210.5">Parameters</th><th width="129">Type</th><th>Description</th></tr></thead><tbody><tr><td>recipient</td><td><code>address</code></td><td>Address to receives NFTs.</td></tr><tr><td>tokenIds</td><td><code>uint256[]</code></td><td>TokenIDs to send (should include all held by vault).</td></tr></tbody></table>

## Read Functions

#### nftIdAt

```solidity
function nftIdAt(
    uint256 holdingsIndex
) external view returns (uint256)
```

Retrieves the NFT token ID stored at a specified index in holdings.&#x20;

<table><thead><tr><th width="210.5">Parameters</th><th width="120">Type</th><th>Description</th></tr></thead><tbody><tr><td>holdingsIndex</td><td><code>uint256</code></td><td>Index position of holdings data to retrieve.</td></tr></tbody></table>

<table><thead><tr><th width="210.5">Return values</th><th width="120">Type</th><th>Description</th></tr></thead><tbody><tr><td><em>unnamed</em></td><td><code>uint256</code></td><td>NFT Token ID, if found.</td></tr></tbody></table>

#### allHoldings

```solidity
function allHoldings() external view returns (uint256[] memory)
```

Returns an array of all NFT token IDs held by the vault.&#x20;

<table><thead><tr><th width="210.5">Return values</th><th width="131">Type</th><th>Description</th></tr></thead><tbody><tr><td><em>unnamed</em></td><td><code>uint256[]</code></td><td>All token IDs in holdings.</td></tr></tbody></table>

#### totalHoldings

```solidity
function totalHoldings() external view returns (uint256)
```

Returns the number of distinct NFT token IDs in holdings.

<table><thead><tr><th width="210.5">Return values</th><th width="128">Type</th><th>Description</th></tr></thead><tbody><tr><td><em>unnamed</em></td><td><code>uint256[]</code></td><td>Number of distinct token IDs in holdings.</td></tr></tbody></table>

#### holdingsContains

```solidity
function holdingsContains(uint256 tokenId) external view returns (bool)
```

Returns whether an NFT tokenId is in the vault.

<table><thead><tr><th width="210.5">Return values</th><th width="128">Type</th><th>Description</th></tr></thead><tbody><tr><td><em>tokenId</em></td><td><code>uint256</code></td><td>NFT tokenID to check for.</td></tr></tbody></table>

<table><thead><tr><th width="210.5">Return values</th><th width="128">Type</th><th>Description</th></tr></thead><tbody><tr><td><em>unnamed</em></td><td><code>bool</code></td><td>Whether the tokenID is in the vault.</td></tr></tbody></table>

#### vaultFees

```solidity
function vaultFees()
    external
    view
    returns (uint256 mintFee, uint256 redeemFee, uint256 swapFee)
```

The mint, redeem, and swap fees.

<table><thead><tr><th width="210.5">Return values</th><th width="120">Type</th><th>Description</th></tr></thead><tbody><tr><td>mintFee</td><td><code>uint256</code></td><td>Mint fee.</td></tr><tr><td>redeemFee</td><td><code>uint256</code></td><td>Redeem fee.</td></tr><tr><td>swapFee</td><td><code>uint256</code></td><td>Swap fee, for NFT-to-NFT swaps.</td></tr></tbody></table>

#### allValidNFTs

```solidity
function allValidNFTs(
    uint256[] memory tokenIds
) external view returns (bool)
```

Checks whether all NFT Token IDs inputed are valid for minting vToken.

<table><thead><tr><th width="210.5">Parameters</th><th width="120">Type</th><th>Description</th></tr></thead><tbody><tr><td>tokenIds</td><td><code>uint256</code></td><td>Token IDs of NFTs to check.</td></tr></tbody></table>

<table><thead><tr><th width="210.5">Return values</th><th width="120">Type</th><th>Description</th></tr></thead><tbody><tr><td><em>unnamed</em></td><td><code>bool</code></td><td>Whether all the NFT tokenIDs are valid to enter.</td></tr></tbody></table>

#### vTokenToETH

```solidity
function vTokenToETH(
    uint256 vTokenAmount
) external view returns (uint256 ethAmount)
```

Calculate ETH amount corresponding to a given vToken amount, calculated via the TWAP from the NFTX AMM.

<table><thead><tr><th width="210.5">Parameters</th><th width="120">Type</th><th>Description</th></tr></thead><tbody><tr><td>vTokenAmount</td><td><code>uint256</code></td><td>Amount of vToken to calculate in ETH.</td></tr></tbody></table>

<table><thead><tr><th width="210.5">Return values</th><th width="120">Type</th><th>Description</th></tr></thead><tbody><tr><td>ethAmount</td><td><code>uint256</code></td><td>ETH amount that is equal in value to the vToken amount, based on TWAP.</td></tr></tbody></table>

#### depositInfo1155Length

```solidity
function depositInfo1155Length(
    uint256 tokenId
) external view returns (uint256)
```

Returns length of the `depositInfo1155` list for a given tokenID.

<table><thead><tr><th width="210.5">Parameters</th><th width="120">Type</th><th>Description</th></tr></thead><tbody><tr><td>tokenId</td><td><code>uint256</code></td><td>NFT tokenID to check.</td></tr></tbody></table>

<table><thead><tr><th width="210.5">Return values</th><th width="123">Type</th><th>Description</th></tr></thead><tbody><tr><td><em>unnamed</em></td><td><code>uint256</code></td><td>Length of <code>depositInfo1155[tokenId]</code>.</td></tr></tbody></table>

#### version

```solidity
function version() external pure returns (string memory)
```

Returns the version of this contract.

<table><thead><tr><th width="210.5">Return values</th><th width="125">Type</th><th>Description</th></tr></thead><tbody><tr><td><em>unnamed</em></td><td><code>string</code></td><td>Contract version.</td></tr></tbody></table>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.nftx.io/core-contracts/nftxvaultupgradeablev3.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
