PMM in Details
It is self-evident that the price of an asset should change depending on the asset supply. When developing the PMM algorithm, the DODO Team observed two major properties of crypto markets. These properties are:
- Most of the liquidity is concentrated around the mid-market price, i.e. the price changes non-linearly with respect to the inventory.
- There is liquidity even if the price deviates far from the mid-market price, but it is very limited.
The DODO Team therefore introduced a nonlinear equation for the price curve to make the depth distribution more consistent with the market, and more flexible as well.
The equation for the price P is as follows:
where
- is the initial "guide price"
- is the "slippage factor"
- denotes the current token supply
- denotes the equilibrium supply (which can be interpreted as the exposure you are willing to hold)
- is used to indicate how much the current token supply has shifted compared to the equilibrium state.
Note that "equilibrium" does not mean that both tokens in a pool are worth the same. What constitutes an "equilibrium" is subjective, and anyone can set what they think is the equilibrium. Under this formula:
- When , this curve is exactly the same bonding curve as AMM.
- When , this curve concentrates liquidity more around the price than an AMM.
- When , this curve becomes a straight line, and the price remains fixed.
In token pairs, the two tokens have different names based on how they are used. They are known as base or quote tokens, abbreviated as and (respectively). Base tokens are those tokens whose price is expressed in terms of the other (quote) token. For example, in the ETH-USDC trading pair, the price of 1 ETH (the base token) is expressed as an amount of USDC tokens (the quote token).
Despite their conceptual differences, base and quote tokens have equal status in this system, i.e. they are symmetric. So, in case there is an undersupply of quote tokens, we can replace the multiplication in the price curve equation with division, as follows:
Therefore, the PMM price curve corresponds to the formula :
Which is determined by the following rule:
If , then
If , then
Otherwise, .