SUMMARY
We are designing an AMM to fight the problem of high order flow toxicity. The idea is to make it easy for non-arbitrage traders to execute large deals by gradually taking or making liquidity. The AMM is optimized for passive liquidity provision, with features such as: dynamic fees, automatic positioning and concentration of liquidity, fully internal price discovery, and options to contribute one-way or two-way liquidity in a single token of LP’s choice.
The main mechanism can be called a double-sided Dutch auction. In the absence of swaps, both sides of the liquidity distribution are moved closer to the mid-price, with liquidity getting more concentrated around that price. Each swap expands the bid-ask spread and flattens the distribution of liquidity.
The protocol in three pictures
Let’s say Alice wants to buy some ETH for USDT. The protocol initially positions all available liquidity as follows:
All prices in the picture above are after fees. Alice can buy the first unit of ETH at askP or sell at bidP. If she takes all liquidity between prices askP and P’, she will pay a weighted average of prices in this range (which will be closer to askP since the distribution of ETH liquidity is declining in price).
After Alice’s swap, the synthetic order book looks as follows:
Dashed red and green lines show the liquidity position before the swap, shaded areas show the liquidity position once the swap is executed.
According to the protocol:
(i) the ask price immediately moves to P’,
(ii) the mid-price, which is not always exactly in the middle between the bid and ask prices, immediately travels the same distance as askP,
(iii) the opposite side of the book is flattened, so that its height matches that of the ask side at the new ask price, and
(iv) the bid price stays the same.
Note that we flatten the USDT liquidity and do not move it right away in the direction of the new mid-price. Instead, we will do this gradually over time. This ensures that LPs make profits on quick roundtrip transactions, such as, say, an uninformed purchase of ETH followed by an arbitrage sale of ETH. Similarly, this approach prevents attacks in which a trader buys one asset to inflate its price and then buys the other asset cheaply. Since the opposite side of the book is flattened and only moves gradually over time, the attacker would have to bear the full cost of the attack but then compete for its benefits with arbitrageurs over multiple blocks.
The last figure shows the behavior of the protocol over time. Each block, the following two transformation are applied to the book:
Hatched areas show the positions of ETH and USDT liquidity at the end of the previous block, shaded areas show the positions at the beginning of the current block.
The bid-ask spread contracts at some rate (shrinkage), and the concentration of liquidity increases at some other rate (growth).
So spreads shrink and liquidity gets concentrated over time. Each swap expands the spread and flattens liquidity. In equilibrium, the two forces will be offsetting each other. For example, if trading volume is low, liquidity will get concentrated and the spread will shrink, attracting new traders. The new swaps will then flatten the liquidity distribution and expand the spread.
For more details and equilibrium analysis, see our Medium post: Low Toxicity AMM — Trader’s Perspective | by Alexander Nezlobin | Aug, 2022 | Medium
QUESTIONS:
- Did we miss anything? What attacks come to mind that the current iteration of the algorithm can be susceptible to?
- Do the economics of algorithm make sense?
- The list of main features is available at: Designing a Low-Toxicity Automated Market Maker | by Alexander Nezlobin | Aug, 2022 | Medium. Did we miss anything important?
- We are developing these ideas further, thinking through the LP incentives and applications to other markets, such as NFT and mean-reverting pairs. If you have ideas/questions/suggestions, please comment here or reach us at [email protected].