1

Instead of smart contracts that people deposit ETH into as offers to buy NFTs (ETH for NFT), how can a smart contract be designed so that two counterparties can deposit NFTs into the smart contract in a direct NFT for NFT trade?

  • Trader 1 would require the specific NFT #030 from SuperRare to be deposited in the smart contract
  • Trader 2 would expect NFT #052 from Rarible to be deposited in the smart contract
  • Once these conditions are met, the NFTs are swapped owners

Does a platform exist that supports this sort of NFT for NFT trade. if not, how to go about designing this smart contract, which language, things to consider, etc..

2 Answers 2

1

This is possible and you would do this with Solidity. You would use the ERC-721 functions which would require that both users approve the smart contract to transfer (via the ERC-721 approve function) and then it would execute the swap on behalf of the users

0

Does a platform exist that supports this sort of NFT for NFT trade? I haven't heard of anything like this, but it might exist. This type of trade is called an "escrow." Use search terms like "NFT escrow," to do market research. If there is a product like this existing, it's not game over! You can try to improve the app or launch on another chain that the product is not on.

How to go about designing this smart contract, which language, things to consider? You should probably use a more recent version of solidity to develop this. You can use OpenZeppelin to speed up development significantly. Make sure to use ERC1155Holder on your contracts so they can accept ERC1155 tokens. If you have the money, get your smart contract audited as well.

Resources

https://docs.openzeppelin.com/contracts/5.x/api/token/erc721 https://docs.openzeppelin.com/contracts/5.x/erc1155

// contracts/MyContract.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

import {ERC1155Holder} from "@openzeppelin/contracts/token/ERC1155/utils/ERC1155Holder.sol";

contract MyContract is ERC1155Holder {
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.