NFT20Pair
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
0x7824948612d5F6d3dBC54d1c1173715B997403a1
on mainnet Ethereum.When creating new pairs NFT20Factory will instantiate a new instance of this contract (via a BeaconProxy) to represent the pair.
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.
- 2.
- 1.
- 3.
- 4.
- 3.
- 1.
- 2.
- 3.
- 4.
This contract conforms to IERC721Receiver and IERC1155Receiver in order to mint ERC20 pair tokens in exchange for ERC721/ERC1155 NFTs.
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.
Burns ERC20 tokens to redeem ERC721/ERC1155 tokens from the pool.
Parameter Name | Type | Description |
---|---|---|
_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.
Parameter Name | Type | Description |
---|---|---|
_ids | uint256[] | An array of tokenIds to deposit. |
_referral | address |
Swaps an ERC721 token for a different ERC721 token in the pool.
Parameter Name | Type | Description |
---|---|---|
_in | uint256 | tokenId to deposit. |
_out | uint256 | tokenId to withdraw. |
Swaps ERC1155 token(s) for different ERC115 token(s) in the pool.
Parameter Name | Type | Description |
---|---|---|
_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. |
Type | Description |
---|---|
address |
Returns the address of the ERC721/ERC1155 token held in this pair.
Type | Description |
---|---|
address | ERC721/ERC1155 contract address. |
Returns the type of NFT held in this pair, 721 for ERC721 or 1155 for ERC1155.
Type | Description |
---|---|
uint256 | 721 for ERC721 or 1155 for ERC1155. |
Returns the amount of ERC20 tokens to be issued per ERC721/ERC1155 deposit.
Type | Description |
---|---|
uint256 | amount of ERC20 tokens issued on deposit |
Last modified 1yr ago