MarketplaceUniversalRouterZap

MarketplaceUniversalRouterZap.sol

This contract is a marketplace zap that uses the NFTX Universal Router.

Table of Contents

Constants
Variables
Events
Public Write Functions
Owner Write Functions

Constants

WETH

Address of WETH contract.

PERMIT2

Address of PERMIT2 contract.

nftxVaultFactory

Address of NFTXVaultFactory contract.

inventoryStaking

Address of NFTXInventoryStakingV3 contract.

BASE

Variables

universalRouter

Address of NFTX's UniversalRouter contract.

paused

Is the contract paused.

dustThreshold

The maximum vToken amount that constitutes "dust."

Events

Sell

Emitted by sell721() and sell1155().

Parameters
Type
Description

vaultId

uint256

ID number of vault.

count

uint256

Total number of NFTs sold.

ethReceived

uint256

Amount of ETH received.

to

address

ETH proceeds receipient.

netRoyaltyAmount

uint256

Total royalty paid.

wethFees

uint256

WETH vault fees paid.

Swap (721)

Emitted by swap721().

Parameters
Type
Description

vaultId

uint256

ID of vault.

idsIn

uint256[]

NFT tokenIDs sent.

idsOut

uint256[]

NFT tokenIDs received.

ethSpent

uint256

Total ETH paid for swap.

to

address

Recipient that received NFT idsOut.

Swap (1155)

Emitted by swap1155().

Parameters
Type
Description

vaultId

uint256

ID number of vault.

idsIn

uint256[]

NFT tokenIDs sent.

amounts

uint256[]

Amounts of tokenIDs (sent and received).

idsOut

uint256[]

NFT tokenIDs received.

ethSpent

uint256

Amount of ETH paid for swap.

to

address

Recipient that received NFT idsOut.

Buy

Emitted by buyNFTsWithETH(), buyNFTsWithERC20() and buyNFTsWithERC20WithPermit2().

Parameters
Type
Description

vaultId

uint256

ID of vault.

nftIds

uint256[]

NFT token IDs.

ethSpent

uint256

Total ETH paid for purchase.

to

address

Recipient of NFTs.

netRoyaltyAmount

uint256

Total royalty paid, in ETH.

DustReturned

Emitted by buyNFTsWithETH(), buyNFTsWithERC20() and buyNFTsWithERC20WithPermit2().

Parameters
Type
Description

ethAmount

uint256

Amount of ETH dust returned.

vTokenAmount

uint256

Amount of vToken dust returned.

to

address

Recipient of dust.

Paused

Emitted by pause().

Parameters
Type
Description

status

bool

True if paused, false if un-paused.

NewUniversalRouter

Emitted by setUniversalRouter().

Parameters
Type
Description

universalRouter

address

New NFTX UniversalRouter address.

NewDustThreshold

Emitted by setDustThreshold().

Parameters
Type
Description

dustThreshold

uint256

New dust threshold amount.

Write Functions

sell721

Sells one or more ERC721 NFTs for ETH.

Parameters
Type
Description

vaultId

uint256

ID of vault that NFTs are being sold into.

idsIn

uint256[]

IDs of NFTs being sold.

executeCallData

address

Encoded swap data.

to

address

Recipient of ETH proceeds.

deductRoyalty

bool

Whether a royalty is deducted.

swap721

Swaps one or more ERC721 NFTs for one or more other ERC721 NFTs.

Parameters
Type
Description

vaultId

uint256

ID of vault that NFTs are being swapped out of.

idsIn

uint256[]

IDs of NFTs being sent to vault.

idsOut

uint256[]

IDs of NFTs exiting vault.

vTokenPremiumLimit

uint256

Max premium fee to be paid (in vToken).

to

address

Address that NFTs from vault are sent to.

msg.value

uint256

Amount of ETH to send.

buyNFTsWithETH

Buys one or more NFTs with ETH.

Parameters
Type
Description

vaultId

uint256

ID of vault holding desired NFTs.

idsOut

uint256[]

IDs of desired NFTs.

executeCallData

bytes

Encoded swap data.

to

address

Address that NFTs are sent to.

vTokenPremiumLimit

uint256

Max premium fee to be paid (measured in vToken despite payment being in ETH).

deductRoyalty

bool

Whether a royalty is deducted.

msg.value

uint256

Amount of ETH to send.

buyNFTsWithERC20

Purchases NFTs via NFTX's UniversalRouter and pay with any ERC20 supported by the NFTX AMM.

Parameters
Type
Description

params

BuyNFTsWithERC20Params

See table below.

BuyNFTsWithERC20Params
Type
Description

tokenIn

IERC20

Address of input token.

amountIn

uint256

Amount of input token.

vaultId

uint256

Vault ID of vToken holding desired NFTs.

idsOut

uint256

NFT token IDs to buy.

vTokenPremiumLimit

uint256

Max premium fee to be paid (measured in vToken).

executeToWETHCallData

bytes

Encoded call data for "ERC20 to WETH swap" for NFTX UniversalRouter's execute function.

executeToVTokenCallData

bytes

Encoded call data for "WETH to vToken swap" for NFTX Universal Router's execute function.

to

address

Recipient of purchased NFT IDs.

deductRoyalty

bool

Whether a royalty is deducted.

buyNFTsWithERC20WithPermit2

Buys one or more NFTs with ERC20, using Permit2 for token approval.

Parameters
Type
Description

params

BuyNFTsWithERC20Params

See table above.

encodedPermit2

bytes

Encoded Permit2 data:

sell1155

Sells one or more ERC1155 NFTs.

Parameters
Type
Description

vaultId

uint256

ID of vault to sell into.

idsIn

uint256[]

IDs of NFTs to sell.

amounts

uint256[]

Quantities of each NFT token ID to send.

executeCallData

bytes

Encoded swap data.

to

address

Address to receive ETH from sale.

deductRoyalty

bool

Whether a royalty is deducted.

swap1155

Swaps one or more ERC1155 NFTs for one or more other ERC1155 NFTs.

Parameters
Type
Description

vaultId

uint256

ID of vault being swapped into.

idsIn

uint256[]

IDs of NFTs being sent to vault.

amounts

uint256[]

Quantities of each NFT being sent.

idsOut

uint256[]

IDs of NFTs exiting the vault.

vTokenPremiumLimit

uint256

Max premium fee to be paid (in vToken).

to

address

Address that receives NFTs leaving the vault.

msg.value

uint256

Amount of ETH to send.

Owner Functions

pause

Pauses this contract.

Parameters
Type
Description

paused_

bool

True to pause, false to un-pause.

setUniversalRouter

Sets address of NFTX Universal Router.

Parameters
Type
Description

universalRouter_

address

New NFTX universal router address.

setDustThreshold

Sets (max) threshold for what is considered token dust.

Name
Type
Description

dustThreshold_

uint256

Max threshold for dust.

Last updated