MarketplaceUniversalRouterZap
MarketplaceUniversalRouterZap.sol
This contract is a marketplace zap that uses the NFTX Universal Router.
Table of Contents
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 |
| ID number of vault. |
count |
| Total number of NFTs sold. |
ethReceived |
| Amount of ETH received. |
to |
| ETH proceeds receipient. |
netRoyaltyAmount |
| Total royalty paid. |
wethFees |
| WETH vault fees paid. |
Swap (721)
Emitted by swap721()
.
Parameters | Type | Description |
---|---|---|
vaultId |
| ID of vault. |
idsIn |
| NFT tokenIDs sent. |
idsOut |
| NFT tokenIDs received. |
ethSpent |
| Total ETH paid for swap. |
to |
| Recipient that received NFT |
Swap (1155)
Emitted by swap1155()
.
Parameters | Type | Description |
---|---|---|
vaultId |
| ID number of vault. |
idsIn |
| NFT tokenIDs sent. |
amounts |
| Amounts of tokenIDs (sent and received). |
idsOut |
| NFT tokenIDs received. |
ethSpent |
| Amount of ETH paid for swap. |
to |
| Recipient that received NFT |
Buy
Emitted by buyNFTsWithETH()
, buyNFTsWithERC20()
and buyNFTsWithERC20WithPermit2()
.
Parameters | Type | Description |
---|---|---|
vaultId |
| ID of vault. |
nftIds |
| NFT token IDs. |
ethSpent |
| Total ETH paid for purchase. |
to |
| Recipient of NFTs. |
netRoyaltyAmount |
| Total royalty paid, in ETH. |
DustReturned
Emitted by buyNFTsWithETH()
, buyNFTsWithERC20()
and buyNFTsWithERC20WithPermit2()
.
Parameters | Type | Description |
---|---|---|
ethAmount |
| Amount of ETH dust returned. |
vTokenAmount |
| Amount of vToken dust returned. |
to |
| Recipient of dust. |
Paused
Emitted by pause()
.
Parameters | Type | Description |
---|---|---|
status |
| True if paused, false if un-paused. |
NewUniversalRouter
Emitted by setUniversalRouter()
.
Parameters | Type | Description |
---|---|---|
universalRouter |
| New NFTX UniversalRouter address. |
NewDustThreshold
Emitted by setDustThreshold()
.
Parameters | Type | Description |
---|---|---|
dustThreshold |
| New dust threshold amount. |
Write Functions
sell721
Sells one or more ERC721 NFTs for ETH.
Parameters | Type | Description |
---|---|---|
vaultId |
| ID of vault that NFTs are being sold into. |
idsIn |
| IDs of NFTs being sold. |
executeCallData |
| Encoded swap data. |
to |
| Recipient of ETH proceeds. |
deductRoyalty |
| Whether a royalty is deducted. |
swap721
Swaps one or more ERC721 NFTs for one or more other ERC721 NFTs.
Parameters | Type | Description |
---|---|---|
vaultId |
| ID of vault that NFTs are being swapped out of. |
idsIn |
| IDs of NFTs being sent to vault. |
idsOut |
| IDs of NFTs exiting vault. |
vTokenPremiumLimit |
| Max premium fee to be paid (in vToken). |
to |
| Address that NFTs from vault are sent to. |
|
| Amount of ETH to send. |
buyNFTsWithETH
Buys one or more NFTs with ETH.
Parameters | Type | Description |
---|---|---|
vaultId |
| ID of vault holding desired NFTs. |
idsOut |
| IDs of desired NFTs. |
executeCallData |
| Encoded swap data. |
to | address | Address that NFTs are sent to. |
vTokenPremiumLimit |
| Max premium fee to be paid (measured in vToken despite payment being in ETH). |
deductRoyalty | bool | Whether a royalty is deducted. |
|
| 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 |
| See table below. |
BuyNFTsWithERC20Params | Type | Description |
---|---|---|
tokenIn |
| Address of input token. |
amountIn |
| Amount of input token. |
vaultId |
| Vault ID of vToken holding desired NFTs. |
idsOut |
| NFT token IDs to buy. |
vTokenPremiumLimit |
| Max premium fee to be paid (measured in vToken). |
executeToWETHCallData |
| Encoded call data for "ERC20 to WETH swap" for NFTX UniversalRouter's |
executeToVTokenCallData |
| Encoded call data for "WETH to vToken swap" for NFTX Universal Router's |
to |
| 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 |
| See table above. |
encodedPermit2 |
| Encoded Permit2 data: |
sell1155
Sells one or more ERC1155 NFTs.
Parameters | Type | Description |
---|---|---|
vaultId |
| ID of vault to sell into. |
idsIn |
| IDs of NFTs to sell. |
amounts |
| Quantities of each NFT token ID to send. |
executeCallData |
| Encoded swap data. |
to |
| Address to receive ETH from sale. |
deductRoyalty |
| Whether a royalty is deducted. |
swap1155
Swaps one or more ERC1155 NFTs for one or more other ERC1155 NFTs.
Parameters | Type | Description |
---|---|---|
vaultId |
| ID of vault being swapped into. |
idsIn |
| IDs of NFTs being sent to vault. |
amounts |
| Quantities of each NFT being sent. |
idsOut |
| IDs of NFTs exiting the vault. |
vTokenPremiumLimit |
| Max premium fee to be paid (in vToken). |
to |
| Address that receives NFTs leaving the vault. |
|
| Amount of ETH to send. |
Owner Functions
pause
Pauses this contract.
Parameters | Type | Description |
---|---|---|
paused_ |
| True to pause, false to un-pause. |
setUniversalRouter
Sets address of NFTX Universal Router.
Parameters | Type | Description |
---|---|---|
universalRouter_ |
| New NFTX universal router address. |
setDustThreshold
Sets (max) threshold for what is considered token dust.
Name | Type | Description |
---|---|---|
dustThreshold_ |
| Max threshold for dust. |
Last updated