DEXes
Decentralised exchanges (DEXes) are blockchain protocols that function as peer-to-peer cryptocurrency marketplaces that facilitate direct transfers of value without the need for a trusted intermediary. The advent of DEXes has allowed cryptocurrency participants to execute trades and transfers in a permissionless way that aligns with the core values of decentralised finance (DeFi).
There are various components and mathematical formulas that create the foundational logic of the DEX. Below is a breakdown of these aspects.
Automated Market Maker (AMM) - An underlying SmartContract that operates on and serves as the engine for DEXes by using formulas to automate trading token pairs in an efficient way and provide liquidity for transactions with the use of liquidity providers.
Proactive Market Maker (PMM) - Developed in-house by DODO, it is a type of AMM that improves capital efficiency, lowers impermanent loss and reduces slippage for participants on the DEX. These protocols aggregate liquidity and gather accurate price data with the use of on-chain oracles. PMMs have the ability to make one-sided deposits and withdrawals, change the price curve whenever desired and can provide precise liquidity at any given price point.
Constant Product Market Maker (CPMM) - Introduced by Uniswap, this iteration of an AMM uses a specific formula to establish continual liquidity within the DEX. CPMMs utilise the mathematical function:
(Rx - △x)(Ry + (1-f)△y) = k
Within the formula, Rx and Ry represent the reserves of each token, f is the transaction fee, and k is the constant. This equation produces a range of prices for the two tokens in accordance with the available quantities of each particular token.
Constant Sum Market Makers (CSMM) - A variation of a CSMM, this formula creates the best possible outcome when attempting to minimize price impacts during trades, but has the drawback of not providing infinite liquidity. The equation is expressed with the following function:
(Rx - △x) + (Ry + (1 - f)△y) = k
Within the formula, Rx and Ry represent the reserves of each token, f is the transaction fee, and k is the constant. Although similar to CSMM, the formula plots a straight line when graphed as opposed to a concave curve on the CSMM graph. The downside is that this formula creates large arbitrage opportunities for traders to drain the liquidity if off-chain prices for the tokens aren’t in synchronisation. Due to this fact, this particular mode is very limited in its use case.
Constant Mean Market Makers (CMMM) - Made popular by Balancer, this type of AMM allows for more than the standard two assets (50:50 ratio) liquidity pool system. This formula is able to establish a balanced weight of up to eight different assets within a single pool. This equation can be expressed by the following simplified example:
(x * y * z)^(⅓) = k
Within the formula, x represents “token 1”, y is “token 2”, z is “token 3”, and k is the constant. The fraction within the formula will always be 1 divided by x, with x being the number of each token. In this example there are three tokens (x, y, z), thus (⅓).
Virtual Automated Market Makers (vAMM) - Launched by Perpetual Protocol, it essentially takes the CPMM model created by Uniswap and keeps all of the aspects of the formula, but changes the k (constant). In this formula k represents not the constant actual liquidity but rather a SmartContract that holds all of the assets that are backing this AMM variation. The “virtual'' component of the vAMM, refers to the fact that what is being swapped in the AMM is virtual synthetic assets, similar to derivatives.
Last updated