NFT20Pair is an ERC20 token contract representing a pool of ERC721/ERC1155 NFT tokens. It allows users to deposit their ERC721/ERC1155 tokens in exchange for corresponding ERC20 tokens, and vice versa. Users may also use this contract to trade their ERC721/ERC1155 tokens for other tokens in the pool.
The currently deployed base (logic) contract can be found at
0xc53d0a52358ff0f0e4dfe93a1f0c84d2b17e68df on mainnet Ethereum.
You should never interact with this base contract directly, and should instead use NFT20Factory.nftToToken() to find the deployed contract for the pair you wish to use.
- General Deposit Behavior
- View Methods
Sending ERC721/ERC1155 tokens directly to a pair address will result in the transfer of the corresponding ERC20 pair tokens to the sender upon receipt.
In general, you must approve the pair contract address to transfer the relevant tokens on your behalf before calling these methods.
function withdraw(uint256 calldata _tokenIds,uint256 calldata amounts,address receipient) external
Burns ERC20 tokens to redeem ERC721/ERC1155 tokens from the pool.
|_tokenIds||uint256||An array of tokenIds to withdraw.|
|amounts||uint256||The amount of each token in _tokenIds to withdraw.|
|receipient||address||Address where ERC721/ERC1155 tokens should be transfered to.|
Deposits multiple ERC721 tokens in exchange for the pair’s ERC20 token in one transaction.
|_ids||uint256||An array of tokenIds to deposit.|
|_referral||address||Referring address to recieve the fee.|
Swaps an ERC721 token for a different ERC721 token in the pool.
|_in||uint256||tokenId to deposit.|
|_out||uint256||tokenId to withdraw.|
function swap1155(uint256 calldata in_ids,uint256 calldata in_amounts,uint256 calldata out_ids,uint256 calldata out_amounts) external
Swaps ERC1155 token(s) for different ERC115 token(s) in the pool.
|_in_ids||uint256||An array of tokenIds to deposit.|
|_in_amounts||uint256||An array of amounts of tokens to deposit.|
|_out_ids||uint256||An array of tokenIds to withdraw.|
|_out_amounts||uint256||An array of amounts of tokens to withdraw.|
Returns the factory contract that created this pair.
|address||Factory contract address.|
Returns the address of the ERC721/ERC1155 token held in this pair.
|address||ERC721/ERC1155 contract address.|
Returns the type of NFT held in this pair, 721 for ERC721 or 1155 for ERC1155.
|uint256||721 for ERC721 or 1155 for ERC1155.|
Returns the amount of ERC20 tokens to be issued per ERC721/ERC1155 deposit.
|uint256||amount of ERC20 tokens issued on deposit|