NFTXVaultFactoryUpgradeableV3
NFTXVaultFactoryUpgradeableV3.sol
Factory contract for creating NFTX vaults, and also managing general protocol settings.
Table of Contents
Constants
MAX_DEPOSITOR_PREMIUM_SHARE
Max depositor premium fee share allowed. Set to 100%.
BEACON_CODE
Beacon proxy creation code.
Variables
feeDistributor
Address of NFTXFeeDistributorV3.
eligibilityManager
Address of NFTXEligibilityManager.
excludedFromFees
Which addresses are excluded from fees.
factoryMintFee
Global mint fee for vaults using default fee settings.
factoryRedeemFee
Global redeem fee for vaults using default fee settings.
factorySwapFee
Global (NFT-to-NFT) swap fee for vaults using default fee settings.
twapInterval
The time-weighted average price interval. For example, if the twapInterval
is set to 3600
seconds (1 hour), it would mean that you are interested in computing or observing the average price of an asset over the past hour.
premiumDuration
The time it takes for premium fees to decay from premiumMax
to zero. In seconds.
premiumMax
The starting (max) premium fee. 1e16 = 1%.
depositorPremiumShare
Portion of premium fee that goes to depositor. 1e16 = 1%.
Events
NewFeeDistributor
Emitted by setFeeDistributor()
.
oldDistributor
address
Previous address of NFTXFeeDistributorV3.
newDistributor
address
New address of NFTXFeeDistributorV3.
FeeExclusion
Emitted by setFeeExclusion()
.
feeExcluded
address
Address being excluded (or un-excluded).
excluded
bool
Whether the address is excluded from fees.
NewEligibilityManager
Emitted by setEligibilityManager()
.
oldEligManager
address
Previous address of NFTXEligibilityManager.
newEligManager
address
New address of NFTXEligibilityManager.
NewVault
Emitted by createVault()
.
vaultId
uint256
ID of vault.
vaultAddress
address
Contract address of vault.
assetAddress
address
NFT collection address linked to vault.
name
string
ERC20 vToken name.
symbol
string
ERC20 vToken symbol.
UpdateVaultFees
Emitted by setVaultFees()
. Fees are calculated in vToken, but paid in ETH. 1e16 = 0.01 vToken = 1%.
vaultId
uint256
ID of vault.
mintFee
address
New vault mint fee.
redeemFee
address
New vault redeem fee.
swapFee
string
New vault swap fee.
DisableVaultFees
Emitted by disableVaultFees()
.
vaultId
uint256
ID of vault.
UpdateFactoryFees
Emitted by setFactoryFees()
. Fees are calculated in vToken, but paid in ETH. 1e16 = 0.01 vToken = 1%.
mintFee
address
New factory mint fee.
redeemFee
address
New factory redeem fee.
swapFee
string
New factory swap fee.
NewPremiumMax
Emitted by setPremiumMax()
. Fees are calculated in vToken, but paid in ETH. 1e16 = 0.01 vToken = 1%.
premiumMax
uint256
New max premium fee.
NewPremiumDuration
Emitted by setPremiumDuration()
. In seconds.
premiumDuration
uint256
New premium duration.
NewDepositorPremiumShare
Emitted by setDepositorPremiumShare()
. 1e16 = 1%.
depositPremiumShare
uint256
New depositor share of premium fee.
NewTwapInterval
Emitted by setTwapInterval()
.
twapInterval
uint256
The time-weighted average price interval. For example, if the twapInterval
is set to 3600
seconds (1 hour), it would mean that you are interested in computing or observing the average price of an asset over the past hour.
Write Functions
createVault
Creates a vault.
name
string
ERC20 vToken name of vault.
symbol
string
ERC20 vToken symbol for vault.
assetAddress
address
Address of NFT contract.
is1155
bool
Whether the NFT uses ERC1155.
allowAllItems
bool
Whether all NFT token IDs are eligible to enter.
vaultId
uint256
ID of vault.
Privileged Functions
These functions can be called by vault contracts (on themselves) or by this contract's owner.
setVaultFees
Sets mint, redeem, and (NFT-to-NFT) swap fees for a vault. 1e16 = 1%.
vaultId
uint256
ID of vault.
mintFee
uint256
New mint fee.
redeemFee
uint256
New redeem fee.
swapFee
uint256
New (NFT-to-NFT) swap fee.
disableVaultFees
Revert vault to global/default fee settings.
vaultId
uint256
ID of vault.
Owner Functions
setFactoryFees
Sets global/default mint, redeem, and (NFT-to-NFT) swap fees. 1e16 = 1%.
mintFee
uint256
New mint fee.
redeemFee
uint256
New redeem fee.
swapFee
uint256
New swap fee (for NFT-to-NFT swaps).
setFeeDistributor
Sets address of NFTXFeeDistributorV3.
feeDistributor_
address
New address of NFTXFeeDistributorV3.
setFeeExclusion
Sets whether an address is excluded from vault fees.
excludedAddr
address
Address being set.
excluded
bool
Whether the address is excluded from vault fees.
setEligibilityManager
Sets address of NFTXEligibilityManager.
eligibilityManager_
address
New address of NFTXEligibilityManager.
setTwapInterval
Sets the TWAP interval duration. In seconds.
twapInterval_
uint32
New TWAP interval.
setPremiumDuration
Sets the time it takes, in seconds, for premium fees to decay from premiumMax
to zero.
premiumDuration_
uint256
New duration.
setPremiumMax
Sets the starting (max) premium fee.
premiumMax_
uint256
New max premium. 1e16 = 1%.
setDepositorPremiumShare
Sets the portion of premium fee that goes to depositor.
depositorPremiumShare_
uint256
New depositor share. 1e16 = 1%.
Read Functions
vaultFees
Returns the mint, redeem, and (NFT-to-NFT) swap fees for a vault.
vaultId
uint256
ID of vault.
mintFee
uint256
Mint fee.
redeemFee
uint256
Redeem fee.
swapFee
uint256
(NFT-to-NFT) swap fee.
isLocked
Checks whether the NFTX protocol is locked (i.e., paused).
lockId
uint256
The ID of the lock type.
unnamed
bool
Whether the lock type is active.
vaultsForAsset
Returns addresses for all vaults that are linked to an NFT address.
assetAddress
address
Address of NFT contract.
unnamed
address[]
Array of vault addresses.
allVaults
Returns addresses of all vaults.
unnamed
address
Array of all vault addresses.
numVaults
Returns total number of NFTX V3 vaults.
unnamed
bool
Number of vaults.
vault
Returns the address of a vault.
vaultId
uint256
ID of vault.
unnamed
address
Vault address.
computeVaultAddress
Returns a deterministic address based on an assetAddress
, name
, and symbol
.
getTwapX96
Returns the TWAP of the given pool, across the recent twapInterval
. The returned value is in UniswapV3's 96-bit fixed point representation.
pool
address
Address of AMM pool to check.
priceX96
uint256
TWAP represented as 96-bit FixedPoint.
getVTokenPremium721
Returns premium fee for redeeming or swapping an ERC721 NFT from a vault.
vaultId
uint256
ID of vault.
tokenId
uint256
ID of NFT.
premium
uint256
Premium fee.
depositor
uint256
Address of NFT depositor.
getVTokenPremium1155
Returns premium fee for redeeming or swapping for ERC1155 NFTs from a vault.
vaultId
uint256
ID of vault.
tokenId
uint256
ID of NFT.
amount
uint256
Quantity of NFT.
netPremium
uint256
Total premium fee to purchase amount
.
premiums
uint256[]
Premium fees.
depositors
uint256[]
Addresses of NFT depositors.
Last updated