Traditional DEXs and Market Maker model
Unlike centralized exchanges, Decentralized Exchanges (DEXs) typically do not use order books. Trade executions are usually automatic on most DEXs (including Curve, Uniswap and Balancer), and do not require the matching of bid and ask orders from individuals. These DEXs are organized by Constant Product Market Maker (CPMM), which hold reserves of assets (cryptocurrencies) contributed by liquidity providers. Individual liquidity providers supply tokens into different liquidity pools to enable trading between cryptocurrencies. Each time a trader swaps one token for another, he/she must pay a swap fee, which is then distributed pro-rata among the liquidity providers of that liquidity pool.
For the liquidity pools involving just two assets, the mechanism of CPMM is relatively simple. Each swap is achieved with a scalar function that computes how much of one asset is required to exchange for a certain amount of the other, and vice versa. Thus, two-asset trades involves only one scalar quantity: how much you propose to put forward (or equivalently, how much you propose to receive).
This is also known as Constant Product Formula (x*y=k), where x and y are the reserves of Token A and Token B respectively in a Token A/Token B liquidity pool. The constant, k, must remain the same. In order to withdraw any given amount of Token A, one must deposit a corresponding amount of Token B, while ensuring k remains unchanged before fees.
As an illustration in below graph, when the price of Y falls, it means that the reserve of Y is getting bigger (more Y is needed to maintain the initial value). And when the price of Y rises, it means that the reserve of Y is reducing (Y is now worth more, so the pool needs less of it to maintain the initial value).
As Constant Product Market Maker (CPMM) model is first widely used model in the DEXs since the invention, it is also known as Traditional AMM model.
With the CPMM model, liquidity providers are required to support trading across the entire price range (from 0 to ∞). While liquidity is distributed uniformly along the entire Constant Product Formula curve, only a small subset of assets around the current price are actually used for trading. As such, most of the liquidity in a pool sit idle, leading to low capital efficiency.
Having low capital efficiency means that only a small portion of assets are used to create profit for the liquidity providers, while traders suffer from high price slippage and less-than-ideal swap prices due to thin liquidity around the swap price. In practice, individual traders often buy or sell large amount of tokens at once, with every token costing more than the previous one. This difference between the current market price and the expected fill price is called price impact.