Developing a smart contract that interacts with ERC-721 tokens is simple, because we only have to make sure that users have a token ID associated with their products. Users will be able to interact with their tokens independently if they wish to do so. For our marketplace, we'll focus on creating the buy and sell functions to create and burn tokens. As usual, we'll also create multiple getters to extract the data from the smart contract for the user interface.
Let's start to create the e-commerce contract, which will have all the market logic in the same file, since it doesn't take up that much space:
- Define the variables needed for the smart contract, starting with the structs that you'll need, as shown in the following code:
/// @notice The main ecommerce contract to buy and sell ERC-721 tokens representing...