Compare to centralized exchanges, AMM provides cryptocurrency investors with another choice. Users no longer need to custody virtual assets in the exchange accounts, or rely on the application of a certain exchange, or face issues arising from the lack of fair and transparent rules in the centralized exchanges. Project developers can create trading pairs on the chain without a review. AMM was pioneered by the Bancor project launched in 2017, followed by such projects as Uniswap, Balancer, Curve and Mooniswap. The boom in AMM projects reflects the recognition of users and the market towards this model, and the endless stream of promising projects is also a signal of its great potential and a huge market. However, there are also some problems.
All AMM models have limitations. Price changes determined in advance by formulas cannot keep close track of market dynamics. Automated trading is just a supplement to human traders, not a substitute.
Although traditional centralized exchanges have been criticized, the order book-based matching mechanism has stood the test of more than 100 years, and behind the technology are profound insights into human nature. It’s a matter of common sense to chase profits at lower costs, so people always tend to sell their tokens at a price higher than the market price and buy tokens at a lower price, rather than trading directly at the market price. It’s also human nature to be capricious. People often regret their past decisions, and trading intentions of both buyers and sellers may change, leading to many pending orders and order revocations in reality. The order book, which is consistent with human nature, should not and will not be abandoned.
Combining AMM with an order book, OneSwap is nothing different from a centralized exchange in terms of experience, while assimilating the advantages of AMM. Many intellects have already realized the importance of limit orders, and even launched similar projects. As indicated by the explosive growth of these projects, time is ripe.
So how does OneSwap win the competition?
This article focuses on what OneSwap does from a technical perspective. According to the position of the order book, decentralized exchanges are divided into those for on-chain matching and those for off-chain matching. In the versatile ecosystem with many Ethereum projects and abundant assets, Ethereum is the preferred operating environment for OneSwap. The lack of resources on the chain and the competition between transactions have given rise to off-chain matching, and only the essential data can be put on the chain, compromising decentralization. In turn, on-chain matching consumes more GAS, which means higher transaction costs, but the rules are more transparent and decentralized. Considering all the above, OneSwap chose on-chain matching.
So, the developers need to deal with three tasks:
First, combine AMM and an order book using the contract language and data structure with many restrictions.
Secondly, reduce GAS consumption and save costs for users.
Third, improve the security of the contract.
OneSwap’s great efforts in response to the above issues have proven to be fruitful. Most of these attempts are universal and can provide some reference for other contract developers in the community. We will provide more details in the following articles in this series.