A trading and matching engine is a set of functions that use different types of algorithms to create and close orders. An algorithm could focus on completing the orders with the higher price or those that were executed earlier. It depends on the preferences of the developers. Because we'll work with smart contracts and ERC20 tokens, our engine will focus on completing the orders as quickly as they come, since it will be the users that close the orders, given that the frontend is where most of the logic will be.
We can't process large amounts of information on smart contracts since gas is expensive, so we let the React application take control of the trading to save people's funds.
Let's start by planning the functions that we'll need so that we have a solid foundation when we create the contracts and the frontend...