NFTXVaultFactoryUpgradeableV3

NFTXVaultFactoryUpgradeableV3.sol

Factory contract for creating NFTX vaults, and also managing general protocol settings.

Table of Contents

Constants
Variables
Events
Public Write Functions
Privileged Write Functions
Owner Write Functions
Read Functions

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

address

Previous address of NFTXFeeDistributorV3.

newDistributor

address

New address of NFTXFeeDistributorV3.

FeeExclusion

Emitted by setFeeExclusion().

Parameters
Type
Description

feeExcluded

address

Address being excluded (or un-excluded).

excluded

bool

Whether the address is excluded from fees.

NewEligibilityManager

Emitted by setEligibilityManager().

Parameters
Type
Description

oldEligManager

address

Previous address of NFTXEligibilityManager.

newEligManager

address

New address of NFTXEligibilityManager.

NewVault

Emitted by createVault().

Parameters
Type
Description

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%.

Parameters
Type
Description

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().

Parameters
Type
Description

vaultId

uint256

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

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%.

Parameters
Type
Description

premiumMax

uint256

New max premium fee.

NewPremiumDuration

Emitted by setPremiumDuration(). In seconds.

Parameters
Type
Description

premiumDuration

uint256

New premium duration.

NewDepositorPremiumShare

Emitted by setDepositorPremiumShare(). 1e16 = 1%.

Parameters
Type
Description

depositPremiumShare

uint256

New depositor share of premium fee.

NewTwapInterval

Emitted by setTwapInterval().

Parameters
Type
Description

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.

Parameters
Type
Description

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.

Return values
Type
Description

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%.

Parameters
Type
Description

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.

Parameters
Type
Description

vaultId

uint256

ID of vault.

Owner Functions

setFactoryFees

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

Parameters
Type
Description

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.

Parameters
Type
Description

feeDistributor_

address

New address of NFTXFeeDistributorV3.

setFeeExclusion

Sets whether an address is excluded from vault fees.

Parameters
Type
Description

excludedAddr

address

Address being set.

excluded

bool

Whether the address is excluded from vault fees.

setEligibilityManager

Sets address of NFTXEligibilityManager.

Parameters
Type
Description

eligibilityManager_

address

New address of NFTXEligibilityManager.

setTwapInterval

Sets the TWAP interval duration. In seconds.

Name
Type
Description

twapInterval_

uint32

New TWAP interval.

setPremiumDuration

Sets the time it takes, in seconds, for premium fees to decay from premiumMax to zero.

Parameters
Type
Description

premiumDuration_

uint256

New duration.

setPremiumMax

Sets the starting (max) premium fee.

Parameters
Type
Description

premiumMax_

uint256

New max premium. 1e16 = 1%.

setDepositorPremiumShare

Sets the portion of premium fee that goes to depositor.

Parameters
Type
Description

depositorPremiumShare_

uint256

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

uint256

ID of vault.

Return values
Type
Description

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).

Parameters
Type
Description

lockId

uint256

The ID of the lock type.

Return values
Type
Description

unnamed

bool

Whether the lock type is active.

vaultsForAsset

Returns addresses for all vaults that are linked to an NFT address.

Parameters
Type
Description

assetAddress

address

Address of NFT contract.

Return values
Type
Description

unnamed

address[]

Array of vault addresses.

allVaults

Returns addresses of all vaults.

Return values
Type
Description

unnamed

address

Array of all vault addresses.

numVaults

Returns total number of NFTX V3 vaults.

Return values
Type
Description

unnamed

bool

Number of vaults.

vault

Returns the address of a vault.

Parameters
Type
Description

vaultId

uint256

ID of vault.

Return values
Type
Description

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.

Parameters
Type
Description

pool

address

Address of AMM pool to check.

Return values
Type
Description

priceX96

uint256

TWAP represented as 96-bit FixedPoint.

getVTokenPremium721

Returns premium fee for redeeming or swapping an ERC721 NFT from a vault.

Parameters
Type
Description

vaultId

uint256

ID of vault.

tokenId

uint256

ID of NFT.

Return values
Type
Description

premium

uint256

Premium fee.

depositor

uint256

Address of NFT depositor.

getVTokenPremium1155

Returns premium fee for redeeming or swapping for ERC1155 NFTs from a vault.

Parameters
Type
Description

vaultId

uint256

ID of vault.

tokenId

uint256

ID of NFT.

amount

uint256

Quantity of NFT.

Return values
Type
Description

netPremium

uint256

Total premium fee to purchase amount.

premiums

uint256[]

Premium fees.

depositors

uint256[]

Addresses of NFT depositors.

Last updated