NFTX is a protocol for (A) wrapping similar-value NFTs into fungible ERC20 "vTokens" and (B) incentivizing liquid markets for those vTokens, which, in turn, creates liquid markets for the NFTs. Every vToken contract also acts as a vault for holding its respective NFTs, allowing the terms "vToken" and "vault" to be used interchangeably. vTokens are backed 1:1 by NFTs, so if there are 100 CryptoPunks in the PUNK vault, there is 100 PUNK in circulation.
When a user buys an NFT on NFTX, the exchange goes ETH —> vToken -> NFT, meaning that the user sends ETH, it is wrapped and traded for vToken via the AMM, and then the vToken is burned for the NFT, which is sent back to the user after deducting a redeem fee in ETH. Alternatively, when a user sells an NFT on NFTX, the exchange goes NFT -> vToken -> ETH, meaning that the user sends their NFT to the vault in return for one newly minted vToken. Then, the vToken is sold for WETH, which is sent back to the user after deducting a mint fee. Vaults charge fees in ETH when a user buys, sells, or swaps an NFT, and AMM pools charge fees in vToken or WETH for each vToken-WETH trade. All fees generated go to inventory and liquidity providers. Inventory staking and liquidity provision are the two ways to earn yield with vTokens on NFTX. Inventory staking only requires staking vToken/NFTs and is designed to incentivize more NFT deposits and, therefore, greater diversity of NFTs for end-users. Inventory stakers receive 20% of ETH from vault fees. Alternatively, for liquidity providers (LPs), the experience is similar to LPing on Uniswap V3. However, LPs on NFTX can earn 80% of the ETH vault fees on top of their AMM trade fees.
NFT owners must remember that if they deposit an NFT into an NFTX vault, they may never get it back. When an NFT gets sent to a vault, the owner effectively gives up ownership in return for one vToken, which grants them ownership of any NFT in the vault, but not necessarily the NFT they deposited (if someone else took it first). Vaults are designed to attract the most affordable layer of "floor" NFTs to get deposited to create a fungible primitive, vTokens, that can power a range of DeFi/NFT use cases.
Vault Creation & Management
Creating a vToken/vault can be done using the Vault Factory contract. Each vault gets linked to an ERC721 or ERC1155 collection. By default, vaults are set to "allow all items," meaning any NFT tokenID from their linked collection is eligible for minting. If "allow all items" is not turned on, the vault requires an eligibility module to declare which token IDs are valid. Some eligibility modules are a simple list or range of numbers. Others are more complicated and use custom logic or Merkle trees, such as the 4-digit ENS "NNNN" vault (on NFTX V2).
Each vault, upon creation, has its "manager" set to its creator's address. Vault managers can modify vault settings and call permissioned functions. They can also remove themselves as manager by calling the finalizeVault function. Typically, vaults should only be considered ready for public use after the vault manager has given up their control by finalizing the vault.
Minting, Redeeming, Swapping
The three primary vault operations are minting, redeeming, and swapping. Minting is when a user sends one or more NFTs to a vault and receives newly minted vToken. Redeeming is when a user burns vToken and receives one or more NFTs. Swapping is when a user swaps NFTs in their wallet for NFTs from a vault. All three vault operations have percentage-based fees paid in ETH, determined using the vToken's TWAP. For example, if a user swaps a CryptoPunk from their wallet for a CryptoPunk in the PUNK vault, and the swap fee is 3%, then the user is required to pay 3% of the cost of 1 PUNK vToken in ETH, which the fee distributor passes on as vault fees for inventory stakers and LPs. The global/default vault fees are 3% mint, 3% redeem, and 3% swap, but it is also possible for vaults to have custom fee settings.
Buying & Selling (and Swapping)
When a user buys an NFT from NFTX with ETH, behind the scenes, most of the ETH is used to purchase one vToken, and then that vToken is burned in return for one NFT from the vault. The remainder of the ETH is sent to the fee distributor as the vault's redeem fee. When a user sells an NFT on NFTX, behind the scenes, the NFT is used to mint one vToken, then that vToken is sold for WETH, a small portion of the WETH is sent as a mint fee, and the remaining amount is returned to the seller. As described above, it is also possible for a user to swap an NFT in their wallet for an NFT in a vault. During an NFT swap, no vTokens are bought, sold, minted, or burned—the NFT in the wallet is swapped with the NFT in the vault, and a swap fee is paid in ETH.
NFTX V3 has its own AMM that is a fork of Uniswap V3 and which pairs vTokens with WETH. There are two fee tiers for vToken AMM pools: 0.3% and 3%. Like UniV3, NFTX AMM fees are paid in the paired tokens (i.e., vTokens and WETH). LPs who provide liquidity on NFTX in the 0.3% fee pools also receive vault fees (i.e., fees from mints, redeems, and NFT swaps) as part of claiming AMM fees. Vault fees for LPs are distributed using the built-in fee distribution for AMM pools, meaning that LPs providing deeper liquidity earn a larger portion of vault fees—just like how AMM fees are distributed.
vTokens can also be used for inventory staking, which is when a user stakes vToken to earn a portion of vault fees. Vault fees are split 80/20 between liquidity providers (using the 0.3% fee pools) and inventory stakers. Unlike LPs, who claim ETH vault fees along with their vToken and ETH AMM fees, inventory stakers only claim ETH vault fees. Inventory staking aims to increase the number of NFTs in a vault from which buyers and swappers can choose. Inventory staking also allows stakers to earn yield from vTokens without taking on IL (impermanent loss) risk or actively managing an LP position.
On-ramping & Off-ramping
The process of creating or increasing an inventory or liquidity position on NFTX is referred to as on-ramping, and the reverse is called off-ramping. Inventory stakers can on-ramp by depositing NFTs or vToken, and LPs can on-ramp by depositing NFTs + ETH or vToken + ETH. When a user on-ramps using NFTs instead of vToken, behind the scenes, the NFTs are first used to mint vToken. Minting like this, as a means of on-ramping, does not charge a mint fee. Likewise, when an inventory staker off-ramps, they can choose NFTs or vToken, and when an LP off-ramps, they can choose NFTs + ETH or vToken + ETH. When an inventory provider or LP off-ramps to NFTs (or NFTs + ETH), the NFTs are redeemed behind the scenes using vToken, but no redeem fee is charged.
Positions & Timelocks
Inventory staking positions are represented using ERC721 "xNFTs" implemented in the NFTX InventoryStaking contract. LP positions are implemented using a modified version of UniV3's NonfungiblePositionManager. Both inventory and liquidity positions incur "timelocks" when they are created that prohibit them from being unstaked/withdrawn. The liquidity timelock duration is two days, and the inventory timelock duration is three days—unless the staker/LP has opted for a 1-hour timelock on the condition that they cannot off-ramp or on-ramp using NFTs. The primary purpose of timelocks is to deter users from circumventing vault fees (for buys, sells, and swaps) by on-ramping with one asset type (or token ID) and immediately off-ramping with another.
When on-ramping into an inventory or liquidity positions, users can receive a 1-hour timelock (as opposed to 2 or 3 days) if they on-ramp using vToken and if they are okay to off-ramp back to vToken when finished (instead of NFTs). If users prefer to have the option of off-ramping to vToken or NFTs, then they can choose to enforce a full (2 or 3-day) timelock when on-ramping with just vToken.
Most positions allow the owner to override the timelock by paying an early withdrawal fee. The early withdrawal fee is paid in vToken, begins at 10%, and goes down linearly to zero over the duration of the timelock. Early withdrawal is supported for all positions except inventory positions during the first hour after they have been created or increased. Early withdrawal fees paid by inventory stakers are used to increase the vToken backing of all inventory positions (i.e., the vTokenShares for each inventory position end up being worth more vToken). Early withdrawal fees paid in vToken by liquidity providers get distributed to LPs (in the 0.3% pool) as AMM fees, which remaining LPs can then claim.
Users who wish to retrieve an NFT from a vault (by redeeming or swapping) must pay a "premium fee" if the NFT was recently minted into the vault. The premium fee is paid in ETH, begins at 500% (of 1 vToken), and decays to zero over 10 hours. Of the proceeds, 90% is given to the address that sold/swapped the NFT into the vault or deposited the NFT as part of inventory staking or LPing. The remaining 10% is distributed as regular vault fees.