Do NFT marketplaces need their own Solidity contracts? Or can they rely on the contract of the NFTs they are selling?
I'm asking because I was following this tutorial, How to Build a Full Stack NFT Marketplace on Ethereum with Polygon and Next.js - [2021 Tutorial], and it adds a a contract for the marketplace.
It has functions like this which facilitate listing items.
contract NFTMarket is ReentrancyGuard {
...
function createMarketItem(
address nftContract,
uint256 tokenId,
uint256 price
) public payable nonReentrant {
require(price > 0, "Price must be at least 1 wei");
require(msg.value == listingPrice, "Price must be equal to listing price");
_itemIds.increment();
uint256 itemId = _itemIds.current();
idToMarketItem[itemId] = MarketItem(
itemId,
nftContract,
tokenId,
payable(msg.sender),
payable(address(0)),
price,
false
);
...
Why not just store this listing and sale information in a regular database? And then call functions on the NFT collection's original contract when ownership needs to be transferred?
The performance will be way better at scale, and most NFT marketplaces are not autonomous anyway.
Wondering if the tutorial is just making the arbitrary decision to manage everything on the blockchain, or if I'm missing something.