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

function WETH() external view returns (address)

Address of WETH contract.

PERMIT2

function PERMIT2() external view returns (address)

Address of PERMIT2 contract.

nftxVaultFactory

function nftxVaultFactory() external view returns (address)

Address of NFTXVaultFactory contract.

inventoryStaking

function inventoryStaking() external view returns (address)

Address of NFTXInventoryStakingV3 contract.

BASE

uint256 constant BASE = 10 ** 18

Variables

universalRouter

function universalRouter() external view returns (address)

Address of NFTX's UniversalRouter contract.

paused

function paused() external view returns (bool)

Is the contract paused.

dustThreshold

function dustThreshold() external view returns (uint256)

The maximum vToken amount that constitutes "dust."

Events

Sell

event Sell(
    uint256 vaultId,
    uint256 count,
    uint256 ethReceived,
    address to,
    uint256 netRoyaltyAmount,
    uint256 wethFees
)

Emitted by sell721() and sell1155().

Swap (721)

event Swap(
    uint256 vaultId,
    uint256[] idsIn,
    uint256[] idsOut,
    uint256 ethSpent,
    address to
)

Emitted by swap721().

Swap (1155)

event Swap(
    uint256 vaultId,
    uint256[] idsIn,
    uint256[] amounts,
    uint256[] idsOut,
    uint256 ethSpent,
    address to
)

Emitted by swap1155().

Buy

event Buy(
    uint256 vaultId,
    uint256[] nftIds,
    uint256 ethSpent,
    address to,
    uint256 netRoyaltyAmount
)

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

DustReturned

event DustReturned(uint256 ethAmount, uint256 vTokenAmount, address to)

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

Paused

event Paused(bool status)

Emitted by pause().

NewUniversalRouter

event NewUniversalRouter(address universalRouter)

Emitted by setUniversalRouter().

NewDustThreshold

event NewDustThreshold(uint256 dustThreshold)

Emitted by setDustThreshold().

Write Functions

sell721

function sell721(
    uint256 vaultId,
    uint256[] calldata idsIn,
    bytes calldata executeCallData,
    address payable to,
    bool deductRoyalty
) external

Sells one or more ERC721 NFTs for ETH.

swap721

function swap721(
    uint256 vaultId,
    uint256[] calldata idsIn,
    uint256[] calldata idsOut,
    uint256 vTokenPremiumLimit,
    address payable to
) external payable

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

buyNFTsWithETH

function buyNFTsWithETH(
    uint256 vaultId,
    uint256[] calldata idsOut,
    bytes calldata executeCallData,
    address payable to,
    uint256 vTokenPremiumLimit,
    bool deductRoyalty
) external payable

Buys one or more NFTs with ETH.

buyNFTsWithERC20

function buyNFTsWithERC20(
    BuyNFTsWithERC20Params calldata params
) external

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

buyNFTsWithERC20WithPermit2

function buyNFTsWithERC20WithPermit2(
    BuyNFTsWithERC20Params calldata params,
    bytes calldata encodedPermit2
) external

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

sell1155

function sell1155(
    uint256 vaultId,
    uint256[] calldata idsIn,
    uint256[] calldata amounts,
    bytes calldata executeCallData,
    address payable to,
    bool deductRoyalty
) external

Sells one or more ERC1155 NFTs.

swap1155

function swap1155(
    uint256 vaultId,
    uint256[] calldata idsIn,
    uint256[] calldata amounts,
    uint256[] calldata idsOut,
    uint256 vTokenPremiumLimit,
    address payable to
) external payable

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

Owner Functions

pause

function pause(bool paused_) external

Pauses this contract.

setUniversalRouter

function setUniversalRouter(address universalRouter_) external

Sets address of NFTX Universal Router.

setDustThreshold

function setDustThreshold(uint256 dustThreshold_) external

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

Last updated