NFTXVaultUpgradeableV3
NFTXVaultUpgradeableV3.sol
The NFTX vault implementation used by the vault beacon proxy (and therefore all vaults).
Table of Contents
Constants
BASE
10^18.
WETH
WETH contract address.
CRYPTO_PUNKS
CryptoPunks contract address.
CRYPTO_KITTIES
CryptoKitties contract address.
assetAddress
Contract address of NFT collection that can enter the vault.
vaultFactory
Address of NFTX Vault Factory.
vaultId
The vault's ID number.
is1155
Whether the vault is for an ERC1155 NFT.
Variables
manager
Address of vault manager.
eligibilityStorage
Address of Eligibility Storage.
allowAllItems
Whether all NFT tokenIDs are eligible to enter this vault.
enableMint
Whether minting is enabled.
enableRedeem
Whether redeeming is enabled.
enableSwap
Whether swapping is enabled.
tokenDepositInfo
Timestamp and depositor address of each ERC721 deposit.
depositInfo1155
Quantity, depositor address, and timestamp of each ERC1155 deposit.
pointerIndex1155
Pointer index of oldest DepositInfo1155 object, for each ERC1155 tokenID.
Events
VaultInit
Emitted by __NFTXVault_init
function.
ManagerSet
Emitted by setManager
function.
EligibilityDeployed
Emitted by deployEligibilityStorage
function.
EnableMintUpdated
Emitted by setVaultFeatures
function.
EnableRedeemUpdated
Emitted by setVaultFeatures
function.
EnableSwapUpdated
Emitted by setVaultFeatures
function.
Minted
Emitted by mint
function.
Redeemed
Emitted by redeem
function.
Swapped
Emitted by swap
function.
PremiumShared
Emitted by redeem
and swap
functions.
FeesDistributed
Emitted by mint
, redeem
and swap
functions.
VaultShutdown
Emitted by shutdown
.
Write Functions
mint
Mints vault tokens in exchange for depositing NFTs. Mint fee is paid in ETH.
redeem
Redeems NFTs by burning vToken. Redeem fee is paid in ETH or WETH.
swap
Swap one or more NFTs (idsIn
) for other NFTs from the vault (idsOut
). Swap fee is paid in ETH.
flashLoan
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.
Privileged Functions
These functions can only be called by the vault manager or (if there is no vault manager) the contract owner.
finalizeVault
Removes the vault manager.
setVaultMetadata
Sets the name and symbol of the vault's ERC20 vToken.
setVaultFeatures
Sets minting, redeeming, and swapping as either on or off.
setFees
Sets mint, redeem, and (NFT-to-NFT) swap fees. 1e16 = 1%.
disableVaultFees
Removes custom vault fee settings, reverting to the global/default vault fee settings.
deployEligibilityStorage
Deploys and initializes an eligibility module contract from the EligibilityManager.
setManager
Sets the vault manager.
Owner Functions
rescueTokens
Rescues ERC20, ERC721, or ERC1155 tokens.
shutdown
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.
This function works for both ERC721 and ERC1155 vaults. For ERC1155, the total amount of each tokenID will be sent to the recipient.
Read Functions
nftIdAt
Retrieves the NFT token ID stored at a specified index in holdings.
allHoldings
Returns an array of all NFT token IDs held by the vault.
totalHoldings
Returns the number of distinct NFT token IDs in holdings.
holdingsContains
Returns whether an NFT tokenId is in the vault.
vaultFees
The mint, redeem, and swap fees.
allValidNFTs
Checks whether all NFT Token IDs inputed are valid for minting vToken.
vTokenToETH
Calculate ETH amount corresponding to a given vToken amount, calculated via the TWAP from the NFTX AMM.
depositInfo1155Length
Returns length of the depositInfo1155
list for a given tokenID.
version
Returns the version of this contract.
Last updated