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()
.
Parameters | Type | Description |
---|---|---|
oldDistributor |
| Previous address of NFTXFeeDistributorV3. |
newDistributor |
| New address of NFTXFeeDistributorV3. |
FeeExclusion
Emitted by setFeeExclusion()
.
Parameters | Type | Description |
---|---|---|
feeExcluded |
| Address being excluded (or un-excluded). |
excluded |
| Whether the address is excluded from fees. |
NewEligibilityManager
Emitted by setEligibilityManager()
.
Parameters | Type | Description |
---|---|---|
oldEligManager |
| Previous address of NFTXEligibilityManager. |
newEligManager |
| New address of NFTXEligibilityManager. |
NewVault
Emitted by createVault()
.
Parameters | Type | Description |
---|---|---|
vaultId |
| ID of vault. |
vaultAddress |
| Contract address of vault. |
assetAddress |
| NFT collection address linked to vault. |
name |
| ERC20 vToken name. |
symbol |
| ERC20 vToken symbol. |
UpdateVaultFees
Emitted by setVaultFees()
. Fees are calculated in vToken, but paid in ETH. 1e16 = 0.01 vToken = 1%.
Parameters | Type | Description |
---|---|---|
vaultId |
| ID of vault. |
mintFee |
| New vault mint fee. |
redeemFee |
| New vault redeem fee. |
swapFee |
| New vault swap fee. |
DisableVaultFees
Emitted by disableVaultFees()
.
Parameters | Type | Description |
---|---|---|
vaultId |
| ID of vault. |
UpdateFactoryFees
Emitted by setFactoryFees()
. Fees are calculated in vToken, but paid in ETH. 1e16 = 0.01 vToken = 1%.
Parameters | Type | Description |
---|---|---|
mintFee |
| New factory mint fee. |
redeemFee |
| New factory redeem fee. |
swapFee |
| New factory swap fee. |
NewPremiumMax
Emitted by setPremiumMax()
. Fees are calculated in vToken, but paid in ETH. 1e16 = 0.01 vToken = 1%.
Parameters | Type | Description |
---|---|---|
premiumMax |
| New max premium fee. |
NewPremiumDuration
Emitted by setPremiumDuration()
. In seconds.
Parameters | Type | Description |
---|---|---|
premiumDuration |
| New premium duration. |
NewDepositorPremiumShare
Emitted by setDepositorPremiumShare()
. 1e16 = 1%.
Parameters | Type | Description |
---|---|---|
depositPremiumShare |
| New depositor share of premium fee. |
NewTwapInterval
Emitted by setTwapInterval()
.
Parameters | Type | Description |
---|---|---|
twapInterval |
| The time-weighted average price interval. For example, if the |
Write Functions
createVault
Creates a vault.
Parameters | Type | Description |
---|---|---|
name |
| ERC20 vToken name of vault. |
symbol |
| ERC20 vToken symbol for vault. |
assetAddress |
| Address of NFT contract. |
is1155 |
| Whether the NFT uses ERC1155. |
allowAllItems |
| Whether all NFT token IDs are eligible to enter. |
Return values | Type | Description |
---|---|---|
vaultId |
| 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%.
Parameters | Type | Description |
---|---|---|
vaultId |
| ID of vault. |
mintFee |
| New mint fee. |
redeemFee |
| New redeem fee. |
swapFee |
| New (NFT-to-NFT) swap fee. |
disableVaultFees
Revert vault to global/default fee settings.
Parameters | Type | Description |
---|---|---|
vaultId |
| ID of vault. |
Owner Functions
setFactoryFees
Sets global/default mint, redeem, and (NFT-to-NFT) swap fees. 1e16 = 1%.
Parameters | Type | Description |
---|---|---|
mintFee |
| New mint fee. |
redeemFee |
| New redeem fee. |
swapFee |
| New swap fee (for NFT-to-NFT swaps). |
setFeeDistributor
Sets address of NFTXFeeDistributorV3.
Parameters | Type | Description |
---|---|---|
feeDistributor_ |
| New address of NFTXFeeDistributorV3. |
setFeeExclusion
Sets whether an address is excluded from vault fees.
Parameters | Type | Description |
---|---|---|
excludedAddr |
| Address being set. |
excluded |
| Whether the address is excluded from vault fees. |
setEligibilityManager
Sets address of NFTXEligibilityManager.
Parameters | Type | Description |
---|---|---|
eligibilityManager_ |
| New address of NFTXEligibilityManager. |
setTwapInterval
Sets the TWAP interval duration. In seconds.
Name | Type | Description |
---|---|---|
twapInterval_ |
| New TWAP interval. |
setPremiumDuration
Sets the time it takes, in seconds, for premium fees to decay from premiumMax
to zero.
Parameters | Type | Description |
---|---|---|
premiumDuration_ |
| New duration. |
setPremiumMax
Sets the starting (max) premium fee.
Parameters | Type | Description |
---|---|---|
premiumMax_ |
| New max premium. 1e16 = 1%. |
setDepositorPremiumShare
Sets the portion of premium fee that goes to depositor.
Parameters | Type | Description |
---|---|---|
depositorPremiumShare_ |
| New depositor share. 1e16 = 1%. |
Read Functions
vaultFees
Returns the mint, redeem, and (NFT-to-NFT) swap fees for a vault.
Parameters | Type | Description |
---|---|---|
vaultId |
| ID of vault. |
Return values | Type | Description |
---|---|---|
mintFee |
| Mint fee. |
redeemFee |
| Redeem fee. |
swapFee |
| (NFT-to-NFT) swap fee. |
isLocked
Checks whether the NFTX protocol is locked (i.e., paused).
Parameters | Type | Description |
---|---|---|
lockId |
| The ID of the lock type. |
Return values | Type | Description |
---|---|---|
unnamed |
| Whether the lock type is active. |
vaultsForAsset
Returns addresses for all vaults that are linked to an NFT address.
Parameters | Type | Description |
---|---|---|
assetAddress |
| Address of NFT contract. |
Return values | Type | Description |
---|---|---|
unnamed |
| Array of vault addresses. |
allVaults
Returns addresses of all vaults.
Return values | Type | Description |
---|---|---|
unnamed |
| Array of all vault addresses. |
numVaults
Returns total number of NFTX V3 vaults.
Return values | Type | Description |
---|---|---|
unnamed |
| Number of vaults. |
vault
Returns the address of a vault.
Parameters | Type | Description |
---|---|---|
vaultId |
| ID of vault. |
Return values | Type | Description |
---|---|---|
unnamed |
| 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.
Parameters | Type | Description |
---|---|---|
pool |
| Address of AMM pool to check. |
Return values | Type | Description |
---|---|---|
priceX96 |
| TWAP represented as 96-bit FixedPoint. |
getVTokenPremium721
Returns premium fee for redeeming or swapping an ERC721 NFT from a vault.
Parameters | Type | Description |
---|---|---|
vaultId |
| ID of vault. |
tokenId |
| ID of NFT. |
Return values | Type | Description |
---|---|---|
premium |
| Premium fee. |
depositor |
| Address of NFT depositor. |
getVTokenPremium1155
Returns premium fee for redeeming or swapping for ERC1155 NFTs from a vault.
Parameters | Type | Description |
---|---|---|
vaultId |
| ID of vault. |
tokenId |
| ID of NFT. |
amount |
| Quantity of NFT. |
Return values | Type | Description |
---|---|---|
netPremium |
| Total premium fee to purchase |
premiums |
| Premium fees. |
depositors |
| Addresses of NFT depositors. |
Last updated