Resolving Layer2’s liquidity fragmentation
13th August 2021
dAMM, an L2 AMM developed in collaboration between StarkWare and Loopring, aggregates liquidity in a single L1 liquidity pool and enforces logic with an L1 contract. This brings better capital efficiency and tremendous development flexibility, while enjoying L1 security.
Extension of functionality of dAMM – Cross-L2 Asynchronicity
dAMM’s functionality has been extended to enable a cross-L2 AMM, allowing the same liquidity pool to be used across multiple L2s asynchronously. This design supports the scaling of AMMs without liquidity fragmentation. Asynchronicity means the ability for one L2 to process dAMM transactions without mandatory communication with other L2s using AMM L1 liquidity pool. This asynchronicity is a core feature of dAMM, making shared AMMs practical for the first time. How do we achieve this? dAMM separates the liquidity pool from the pricing state. In such a design, the contract agrees to provide whatever price is offered by the state as long as it has enough liquidity to fulfill the quote. By decoupling funds and state, we assign each L2 its own dAMM state based on the same liquidity pool, so as to facilitate an asynchronous cross-L2 AMM.
The role of the participants is retained as per the original design. Uniquely, the new design supports multiple independent markets; some on L2 and some on L1 — all sharing the same AMM infrastructure and liquidity. Finally, with a small modification, we allow liquidity on L1 (e.g., trading on Uniswap/Sushiswap) to be used as dAMM liquidity. To do so, we allow L1 LP tokens (e.g., LP’s voucher tokens from UniSwap ETH/DAI pool) to be deposited directly to the corresponding liquidity pool on dAMM (e.g., ETH/DAI liquidity pool).
The advantages of dAMM upon extension are pretty straightforward, and they create a virtuous cycle:
- Since the AMM is available on multiple markets, it benefits from more trades
- More trades mean more fees
- More fees for the same liquidity mean better capital efficiency
- More liquidity means a better price
Impermanent loss: In an AMM, LPs take on the risk of an impermanent loss (IL). In dAMM, this risk is greater; in fact, its IL risk grows linearly with the number of markets to which the LPs are exposed. In an IL-neutral environment (e.g., Curve Pools), an LP would not expose to the risk much. For any other liquidity pool type, the LP’s IL risk could be high. To mitigate this issue, the maximum amount of IL that can be suffered by LPs will be limited by the dAMM smart contract, using a parameter we call the dAMM Health Factor.
Link to original article: https://medium.com/starkware/damm-decentralized-amm-59b329fb4cc3