Zap
Atomic ETH ↔ NFT and ETH ↔ collection-token flows in a single call.
NFTXZap bundles ETH wrapping, Uniswap V4 swaps, and Locker/Listings interactions into single transactions — so a user can go straight from ETH to an NFT (or back) without juggling intermediate steps. It uses delta-based accounting and reentrancy guards to prevent donation-stealing.
Signatures and descriptions below come from the INFTXZap interface. Every entry point is nonReentrant; the ETH-in flows are payable.
buyNFTWithETH
Buys listed NFTs with ETH in one transaction. Flow: ETH → flETH.deposit() → swap flETH → collection token → listings.fillListings() → NFT to user.
function buyNFTWithETH(address _collection, uint[][] calldata _tokenIdsOut, uint _minTokensReceived, uint _maxETHSpent) external payable returns (uint ethSpent_);_collection
address
The NFT collection address
_tokenIdsOut
uint[][]
Token IDs to buy, grouped by listing owner (gas optimization)
_minTokensReceived
uint
Minimum tokens from the initial ETH→token swap (slippage protection); set from expected swap output, not listing cost
_maxETHSpent
uint
Hard cap on realised ETH spend; reverts ExcessiveInput above it. Pass msg.value to opt out. Combined with FillListingsParams.maxSpend, protects against sandwich griefing via upward modifyListings front-runs
ethSpent_
uint
The ETH spent, after refunds
sellNFTForETH
Sells floor NFTs for ETH in one transaction. Flow: NFT → locker.deposit() → swap collection token → flETH → flETH.withdraw() → ETH to user.
For an ERC721-C collection that enforces royalties on NFTX, the deposit leg is refused; sell through the Royalty Gate's sellNFTsForETH instead.
function sellNFTForETH(address _collection, uint[] calldata _tokenIds, uint _minETHReceived) external returns (uint ethReceived_);_collection
address
The NFT collection address
_tokenIds
uint[]
Token IDs to sell
_minETHReceived
uint
Minimum ETH to receive (slippage protection)
ethReceived_
uint
The ETH received
redeemFloorWithETH
Redeems specific floor NFTs by buying the tokens with ETH and redeeming them. Flow: ETH → swap → collection token → locker.redeem(tokenIds) → NFTs to user.
_collection
address
The NFT collection address
_tokenIds
uint[]
Specific token IDs to redeem from the Locker
_maxETHSpent
uint
Maximum ETH to spend (slippage protection)
ethSpent_
uint
The ETH spent
Token swaps
Convenience swaps between ETH and a collection token, without touching NFTs.
buyTokensWithETH
_collection, _minTokensReceived
tokensReceived_ — collection tokens received
sellTokensForETH
_collection, _tokenAmount, _minETHReceived
ethReceived_ — ETH received
sellTokensForETHWithPermit2
as above, plus Permit2 _deadline, _nonce, _signature
ethReceived_ — ETH received, pulling tokens via a Permit2 signature (no separate approval tx)
Last updated
Was this helpful?