It seemed to me not very difficult, but still let's analyze.
What is this decentralized exchange:
Target. This can be your own blockchain or smart contract on another blockchain. Responsibilities include accepting orders (order, order) for buying / selling, their matching (matching, matching)...