For the complete documentation index, see llms.txt. This page is also available as Markdown.

Locker

The vault at the center of NFTX v4 — custodies NFTs, mints collection tokens, and exposes deposit, redeem, and swap.

The Locker holds every deposited ERC-721 and issues a fungible ERC-20 collection token in return. It deliberately separates token storage from listing logic so that listing managers can be upgraded without migrating the NFTs themselves. Manager contracts must be approved for token access; when a vault is removed, those permissions are revoked.

Function signatures and parameter descriptions below come from the ILocker interface. Entry and exit (deposit / redeem) are feeless — fees live in the Listings and Hook layers.

Core vault operations

deposit

Takes approved ERC-721s from the caller and mints the ERC-20 equivalent (one collection token per NFT). The recipient overload sends the minted tokens to a different address.

function deposit(address _collection, uint[] calldata _tokenIds) external;
function deposit(address _collection, uint[] calldata _tokenIds, address _recipient) external;

Access: nonReentrant, whenNotPaused, collection must exist.

Parameter
Type
Description

_collection

address

The address of the token collection

_tokenIds

uint[]

The IDs of the tokens being deposited

_recipient

address

The address receiving the ERC-20 (recipient overload only)

For an ERC721-C collection that enforces royalties on NFTX, the collection's validator refuses this pull. Deposit through the Royalty Gate instead.

Returns: None.

redeem

Burns collection tokens and returns specific ERC-721s to the caller (or a recipient). Reverts if any requested token is an active listing rather than a floor item.

function redeem(address _collection, uint[] calldata _tokenIds) external;
function redeem(address _collection, uint[] calldata _tokenIds, address _recipient) external;

Access: nonReentrant, whenNotPaused, collection must exist.

Parameter
Type
Description

_collection

address

The address of the token collection

_tokenIds

uint[]

The IDs of the tokens being redeemed

_recipient

address

The address receiving the ERC-721s (recipient overload only)

Returns: None.

swap

Swaps a token held by the caller for a floor token in the vault in a single call — effectively a combined deposit and redeem, more gas-efficient than running both. The token being redeemed must be of floor value, not a listing.

Access: nonReentrant, whenNotPaused, collection must exist. Reverts if _tokenIdIn == _tokenIdOut or if _tokenIdOut is an active listing.

Parameter
Type
Description

_collection

address

The address of the token collection

_tokenIdIn

uint

The ID of the token being swapped in

_tokenIdOut

uint

The ID of the token being swapped out

Returns: None.

swapBatch

The batched form of swap — exchanges a set of tokens for an equal-sized set of floor tokens from the same collection in one call.

Access: nonReentrant, whenNotPaused, collection must exist. Reverts if the input and output arrays differ in length, or if any output token is an active listing.

Parameter
Type
Description

_collection

address

The address of the token collection

_tokenIdsIn

uint[]

The IDs of the tokens being swapped in

_tokenIdsOut

uint[]

The IDs of the tokens being swapped out

Returns: None.

Collection lifecycle

createCollection

Registers a collection and deploys its underlying CollectionToken clone. When a launch gate is set, the gate decides who may create a collection at the current stage; when unset, anyone can register a collection by paying the collectionCreationFee.

Access: payable, whenNotPaused, nonReentrant. Reverts if msg.value doesn't match the creation fee, if the collection already exists or was previously sunset, or if it isn't a valid ERC-721.

Parameter
Type
Description

_collection

address

The address of the token collection

_name

string

The name of the ERC-20 token

_symbol

string

The symbol for the ERC-20 token

Return
Type
Description

(unnamed)

address

The address of the ERC-20 token deployed

initializeCollection

Sets a base price and injects the collection's initial liquidity into the Uniswap V4 pool. Requires at least MINIMUM_TOKEN_IDS (10) NFTs; any unused collection-token headroom from _tokenSlippage is refunded to the caller.

Access: nonReentrant, whenNotPaused, collection must exist. Reverts if the collection is already initialized or fewer than 10 token IDs are supplied.

Parameter
Type
Description

_collection

address

The address of the collection

_eth

uint

The amount of ETH-equivalent (native) tokens to commit

_tokenIds

uint[]

An array of NFTs the caller is depositing as liquidity

_tokenSlippage

uint

Additional collection-token headroom; any unused portion is refunded

_sqrtPriceX96

uint160

The initial price of the token position

Returns: None.

setCollectionTokenMetadata

Lets the contract owner update a collection token's name and symbol — a safety valve for tokens created with malformed, unintelligible, or offensive metadata.

Access: onlyOwner, collection must exist.

Parameter
Type
Description

_collection

address

The collection address

_name

string

The new name for the token

_symbol

string

The new symbol for the token

Returns: None.

sunsetCollection

Permanently removes a collection from the platform. This is important during a shutdown so that holders can't keep listing assets into a vault that's being wound down. It's callable only by the Collection Shutdown contract.

Access: collection must exist; only callable by the configured CollectionShutdown contract. Flags the collection as sunset to block re-registration.

Parameter
Type
Description

_collection

address

The address of the collection

Returns: None.

Listings registry and views

collectionToken

Returns the deployed CollectionToken for a collection (the zero address if the collection has none).

Parameter
Type
Description

_collection

address

The collection address

Return
Type
Description

(unnamed)

ICollectionToken

The collection's ERC-20 token

isListing

Checks across every authorised Listings contract whether a given token is currently an active listing.

Parameter
Type
Description

_collection

address

The collection address of the listing

_tokenId

uint

The tokenId of the listing

Return
Type
Description

(unnamed)

bool

Whether the listing exists (true) or not (false)

listingsAt / listingsLength

Enumerate the authorised Listings contracts. listingsLength returns the count; listingsAt returns the contract at a given index (reverts if out of range).

Parameter
Type
Description

_index

uint

The index of the listings contract to retrieve

Return
Type
Description

IListings

IListings

The listings contract at the given index

uint

uint

The count of registered listings contracts

addListings / removeListings

Register or de-register an authorised Listings contract.

Access: onlyOwner. addListings reverts on the zero address or a duplicate; removeListings reverts if the contract isn't registered.

Parameter
Type
Description

_listings_

address

The address of the Listings contract to register / de-register

Returns: None.

Manager operations

unbackedDeposit

Mints underlying collection tokens and hands them to an approved manager, trusting the manager not to break the backing count.

Access: approved managers only, nonReentrant, whenNotPaused, collection must exist.

Parameter
Type
Description

_collection

address

The address of the token collection

_amount

uint

The amount of ERC-20 tokens to mint

Returns: None.

withdrawToken

Lets an approved manager withdraw an ERC-721 from the Locker.

Access: approved managers only.

Parameter
Type
Description

_collection

address

The collection address

_tokenId

uint

The tokenId to withdraw

_recipient

address

The address to receive the token

Returns: None.

Administration

All of the following are onlyOwner.

setCollectionShutdownContract

Sets the ICollectionShutdown contract — the only contract permitted to call sunsetCollection.

Parameter
Type
Description

_collectionShutdown

address payable

The new contract address

setImplementation

Sets the INFTXV4Hook implementation used by the Locker.

Parameter
Type
Description

_implementation

address

The new INFTXV4Hook address

Fees, gate, and pausing

Function
Parameter
Description

setCollectionCreationFee

_collectionCreationFee (uint)

The new collection creation fee, in ETH

setCollectionCreationFeeRecipient

_collectionCreationFeeRecipient (address)

The address that receives the creation fee (reverts on zero address)

setLaunchGate

_launchGate (address)

The launch gate to consult; pass address(0) to detach it and make launches unrestricted

pause

_paused (bool)

Pause (true) or unpause (false) all Locker activity

Last updated

Was this helpful?