Slippage, Trust, and MuesliSwap: Analyzing Cardano's DEX Controversy

Today we shift our attention to MuesliSwap, a decentralized exchange operating on Cardano. On Monday, 6 August, a community member by the handle “Bobcorn” reported on Twitter about a strange incident while using the MuesliSwap platform. He tried to sell a token and received less ada than anticipated. The user interface on MuesliSwap’s website displayed a higher token price than what he ultimately received.

Before we delve deeper, it’s essential to understand the difference between Automated Market Makers (AMMs) and order book DEXs and the concept of slippage and its implications for traders. An order book DEX allows users to list buy and sell orders, with trades executed based on price matches between buyers and sellers. In this system, users usually receive their expected outcomes, but the issue of low liquidity can emerge, leading to potential wide bid-ask spreads or unfulfilled orders.

On the other hand, AMMs have become the dominant type of DEX in recent years. Prominent examples include Uniswap on Ethereum and both Minswap and SundaeSwap on Cardano. AMMs function using liquidity pools. Typically, a liquidity pool consists of two paired assets aiming to maintain a balance. Take, for example, a pool composed of ADA and BADA. Users can begin trading these assets after the creation of this pool and the provision of initial ADA and BADA liquidity. The initial balance of these assets determines their relative price. If we provided 100 ADA and 50 BADA to our pool, the initial price ratio would be 2 ADA for 1 BADA (100 divided by 50).

However, it’s crucial to understand how trading affects the pool’s balance and pricing. If a trader wants to obtain 1 BADA from the pool and pays 2 ADA in exchange, the balance in the pool shifts to 102 ADA and 49 BADA. The next unit of BADA is now priced at 2.08 ADA. This 0.08 ADA increment, or 4% price rise, illustrates the concept of slippage: the price “slipped” upwards by 4%.

Issues arise when two users attempt to interact with the same liquidity pool simultaneously. Let’s call the two users Alice and Bob. They both seek 1 BADA for 2 ADA, as displayed on the DEX interface. Alice submits her transaction first due to Bob’s immensely long spending password. With the pool’s altered balance (102-49) post-Alice’s transaction, Bob’s anticipated 2 ADA per BADA rate becomes outdated, causing the transaction to fail.

To mitigate such failures, traders can specify a slippage tolerance. DEX interfaces allow users to set a percentage, indicating the maximum price variation they’d accept. For Bob, setting a 4% slippage would’ve made his trade successful. While higher slippage increases the likelihood of trade execution, it may also mean a less favorable rate for the buyer. However, it’s crucial to note that even with high slippage settings, users should receive the best available price, not necessarily the worst price the set slippage allows. Slippage typically impacts low liquidity pairs the most; greater liquidity means individual trades influence the overall balance less.

Here is where we come back to MuesliSwap. Users like Bobcorn, Cardano Paul, and others reported that the orders they set with a specific slippage % would always end up with the maximum slippage affecting the trade regardless of the actual available liquidity. This means an order placed with a 10% slippage would always use that total 10%, even if the trade’s real slippage was 3%. Consequently, users who set their slippage to 10% to ensure their trade’s execution would always receive the worst price.

It’s important to understand how AMM DEXs handle orders. The Cardano blockchain utilizes the eUTXO model. Unlike Ethereum and other account-based blockchains, which maintain a global state, Cardano processes all transactions concurrently. While the eUTXO model offers various advantages, it also poses unique challenges. For instance, DEXs typically require access to a global state to function correctly. Due to Cardano’s concurrency, most DEXs employ a permissioned batcher system that matches buy and sell orders, ordering them before they are submitted and executed on-chain.

Evidence suggests that MuesliSwap’s batchers retained the difference between the actual and set slippage as a tip, sometimes amounting to hundreds of ada. The MuesliSwap team faced significant scrutiny, and after some back and forth, they admitted that the users were right; batchers did retain the slippage difference. In their defense, this practice was not a secret, as evidenced by a MuesliSwap blog post from two years prior, where the team explained the profit margin incentive for batchers:

Once two matching orders are found, the matchmaker initiates the exchange via the smart contract, with the possibility of keeping the remaining profit margin as an incentive.

That explanation wasn’t enough to appease the community. MuesliSwap acknowledged that their website’s UI was misleading, causing users to activate a setting that permitted batchers to capitalize on incorrect configurations.

On 10 August 2023, MuesliSwap provided a detailed explanation of the situation:

The issue revolves around the matchmaker premium feature, initially mislabeled as advanced slippage (with a warning), which allowed matchmakers to prioritize specific orders by offering a premium.This feature has been integral to MuesliSwap, since it allows users to prioritize their orders during times of high trading volumes. However, this feature also caused confusion among many new users and led to profits for a wallet belonging to the matchmaker.

MuesliSwap messed up. The exact amount of ada lost by users remains a mystery, but the team is working on a thorough analysis. They have committed to refunding impacted users, although these users must claim the refund on a yet-to-be-developed website. Many had hoped for an automatic refund, and whether this will be done in the future has to be seen. It is vital to notice that the MuesliSwap team has not disclosed the identity of the individual who ran the batcher. The incident caused many to lose trust in the team, especially how communication was handled. It will be interesting to see if and how they will win back that trust.

Coindesk article about MuesliSwap

8 Likes

Thanks, great article!

2 Likes

Sad, but the problem seems inevitable from the design. This AMM DEX with permissioned batchers design, is flawed in my opinion. It recreates the MEV problem that plagues Ethereum’s “Robbery Forrest”. The only difference is that you substitute batchers for Ethereum block producers.

Cardano-Swaps seems like the better design direction.

3 Likes

yes, please everybody pour your love and attention upon cardano-swaps :heart_eyes:

cc @zhekson … where has @fallen-icarus been lately? :thinking:

3 Likes

We also need Djed fixed to properly fulfil the promise of cardano-swaps.

3 Likes

I’ve wondered before and most intently back in April, as I do today, why this project is not getting any support from IOG or the Cardano Foundation to finish the pending Proof of Concept, if not to carry this idea forward into a commercially useful pilot:

I suspect the lack of support could be deliberate because the conventional AMM liquidity model promotes Cardano’s Total Value Locked (TVL) as a competitive measure of “success” vs. other blockchains. In the case of “atomic” swaps, no value is locked… therefore the bean-counters of the world would see this advance towards robust, safe and fair DEX as a net loss. :sweat:

3 Likes

I loved this quote from the cardano-swaps old README.md file:

If Cardano-Swaps reaches mass adoption, won’t TVL on Cardano go down?

Yes. Yes it will. TVL is a silly metric. It is a measure of who can be most inefficient with DeFi capital.

I don’t know why they removed that brilliant comment from their README. It really highlights the capital efficiency benefits.

I really hope that is not the case but you could be right. There is so much hype about such metrics especially from Boomer analysts like James from “Invest Answers”.

Cardano-swaps also solves the problem of allowing you to continue staking whilst providing liquidity in the form of a placed market order. Moreover it solves this problem in a totally decentralised manner where each user maintains individual control of their staking key.

2 Likes