Automated market makers are a true public good in crypto, enabling genuinely decentralized trading 24/7 and supporting the wider DeFi ecosystems. But they’re not without a host of problems, writes digital economist and academic Christos A. Makridis.
The decentralized finance (DeFi) market has surged since 2021, growing from just over $20 billion to nearly $160 billion as of March 2022, compared with a rise in the total cryptocurrency market from $433 billion to $2.5 trillion over the same period.
While the recent crypto washout in the wake of the collapse of Terra’s LUNA and UST has caused the market value of DeFi to fall almost all the way back down to $60 billion, there is still optimism in the crypto community and the market value will largely return for major crypto assets in the months and years ahead.
The rise of DeFi has been thanks largely to the presence of liquidity made possible through automated market makers (AMM). Whereas centralized exchanges function as a custodian of their customers’ funds and function as a matchmaker for demand and supply, decentralized exchanges (DEX) do not have a custodian.
Instead, peer-to-peer trading, as it was initially designed, is facilitated through a traditional AMM mechanism that says the product of any two assets must always equal some constant. In other words, if Bitcoin and Ether holders put $100 worth in a pool, then the product of the two assets always has to equal $100. If, however, a holder buys more Bitcoin, then the price of Bitcoin rises, and the other side provides more Bitcoin so that the equation balances. The hope is that the pool has many liquidity providers so that there is never a situation where the price of an asset rises so fast that there is insufficient liquidity to facilitate a trade at a reasonable price.
AMMs have played an integral role in creating liquidity in the overall market. The latest research by Gordon Liao, head of research at Uniswap Labs, and Dan Robinson, head of research at Paradigm, shows that “Uniswap v3 has around 2X greater market depth on average for spot ETH-dollar pairs,” relative to their centralized exchange counterparts, such as Binance and Coinbase.
Here, liquidity is measured using market depth, which refers to how much one asset can be traded for another asset at a given price level. One reason for greater market depth is that AMMs can unlock a more diverse set of passive capital and institutional investors who have different risk profiles.
Since the inception of Uniswap, other AMM designs have emerged, recognizing that the product of two tokens, X and Y, always equaling a constant, K, is not always the most efficient trading strategy — i.e., x*y = K — as Haseeb Qureshi, managing partner at Dragonfly Capital, pointed out in 2020. When a buyer purchases large quantities of X, they can experience slippage, which is when buying a token drives the price up before the order finishes executing it (or selling it drives the price down). Slippage can be costly, especially during times of high trading.
To attract greater liquidity and avoid high slippage rates, DEXs have begun to offer extreme incentives for people to stake tokens in exchange for governance rights (and often a slice of protocol revenue), leading to the “curve wars,” which is a label for the ongoing race to offer better terms of trade. The race to offer better conditions may have some unintended consequences on creating mercenary capital, but the requirement of staking tokens in exchange for governance rights has also created much good.
“Curve wars are representative of the fact that governance has some value… being able to govern how a protocol distributes its incentives even within its own protocol is very powerful: If you force people to commit to make a decision about something in governance, you can create powerful feedback loops,” Kain Warwick, founder of Synthetix, tells Magazine. Warwick has been called affectionately the “father of modern agriculture” for his role in popularizing yield farming.
“Giving away ownership of a protocol in the early part of its lifecycle to the people who provide feedback and test it is incredibly powerful… It is a tool you just don’t have in the traditional startup world. We are witnessing a renaissance of decentralized finance strategies.”
Although there are many comparative advantages that DEXs hold over centralized exchanges, most notably greater security and opportunities for community building among token holders, AMMs are imperfect. One of the major limitations to AMMs is the phenomenon of “front running,” which happens when another user places a similar trade as a prospective buyer, but sells it immediately after. Because the transactions are public, and the buyer has to wait until they can get added to the blockchain, others can view them and potentially place bids. Front runners are not trying to execute the trade; rather, they are simply identifying transactions and bidding on them to drive up the price so that they can sell back and earn a profit.
By “sandwiching” the original bid from a buyer with a new bid, the speculator has the effect of extracting value from the transaction. In practice, miners are often the catalysts behind front running, leading to the term “miner extractable value” (MEV), referring to the rents that a third party can extract from the original transaction. These sandwich attacks have largely been automated and implemented by bots, accounting for the bulk of MEV. In an academic paper, Andreas Park, professor of finance at the University of Toronto, said:
“The intrinsic transparency of blockchain operations create a challenge: an attacker can ‘sandwich’ any trade by submitting a transaction that gets processed before the original one and that the attacker reverses after.”
Unfortunately, these attacks are driven by an incentive problem inherent in second-generation blockchains. “Validators may not have sufficiently strong incentives to monitor private pools because this reduces their MEV, so the execution risk for users who join these private pools goes up,” Agostino Capponi, an associate professor of industrial engineering and operations research at Columbia University, explains to Magazine.
Capponi, together with co-authors, elaborate on this in a recent working paper that points out how private pools do not solve this front-running risk or reduce transaction fees — other solutions are required. Capponi continues, “Frontrunning attacks not only lead to financial losses for traders of the DeFi ecosystem, but also congest the network and decrease the aggregate value of blockchain stakeholders.”
I’m working on a long post on the history of frontrunning Synthetix. Even as I wrap it up the community is debating what is likely to happen once exchanges are enabled on OΞ. One of the things I love most about Synthetix is our commitment to progress even under low information.
— kain.eth (✨🔴_🔴✨) (@kaiynne) March 23, 2021
Front running can also affect liquidity provision. Price oracles — or mechanisms for providing information on prices — play an essential role in ensuring adequate liquidity exists in the market. If the latest prices are not reflected “on-chain,” then users could front run the price with trades and earn a profit. For example, suppose that the latest price of ETH is not reflected on an exchange, which has it lower. Then, a user could buy ETH at its true price but sell it for potentially more, thereby earning a profit.
While price oracles help ensure adequate liquidity, no amount of liquidity can solve the core issue that transactions on-chain need to be as current as possible. Warwick explains:
“Price oracles do not directly help because they are pushing information on-chain. If you can front run a change in an AMM, you can front run an oracle update, too. Any transaction sequencing is going to introduce the potential for front running.”
That is a challenge that Warwick has personal experience with: In 2019, Synthetix lost billions (technically if not in practice) as a result of an oracle pricing error. Although the funds were returned, the incident demonstrates how costly errors can be.
Look no further than last week when an oracle pricing error on the Mirror Protocol on Luna Classic led to another exploit. Validators on Terra Classic were reporting a price of $0.000122 for both Luna Classic (LUNC) and the newly-launched LUNA when the new LUNA should have been at $9.32. Although the error was eventually fixed — resulting from an outdated version of the oracle software — the “exploiter got away with well over $30 million.”
Challenging business models
AMMs were a revolutionary quantitative mechanism for enabling peer-to-peer trading because they instantaneously settle transactions after they are confirmed and included on the blockchain, and they allow any user to contribute liquidity and any buyer to trade tokens.
However, AMMs have largely relied on expectations of future growth to drive their valuations; the revenue from transaction fees is not only small but also fundamentally linked to the liquidity providers — not the exchange. That is, while Uniswap could take the fees as revenue, the way the smart contracts are written is such that the revenue goes directly to the liquidity providers.
Given that APRs from trade fees might be low, especially in newer AMMs, DEXs rely on offering their governance token for incentives, requiring a high price valuation to onboard and retain liquidity providers. These providers are often “mercenary capital” — going wherever the short-run return is higher. Black swan events, as well as volatility in the market, can damage AMMs beyond repair. For example, volatility in the exchange rate across tokens can lead to a liquidity freeze, according to Capponi and Ruizhe Jia, a Ph.D. candidate at Columbia University.
The reality of the Uniswap business model is not an indictment; it creates incredible value, as evident by recent estimates of its daily trading volume of around $131 million. Rather, that it does not produce revenue is a function of its business model and actually makes Uniswap more of a public good for people in the DeFi community than anything else.
“[AMMs] offer an integral service but don’t adequately capture the value they provide through their token… the current models simply do not provide a transition from pre-revenue speculation to postmoney sustainability,” according to Eric Waisanen and Ethan Wood, co-founders of Hydro Finance, in their April white paper.
Emerging business models
Front running is a problem in large part because pending transactions are generally visible, so a bot can detect it, pay a higher gas fee, and thus, the miner processes the transaction first and impacts market pricing.
One way to avoid this is by hiding the transactions. The use of zero-knowledge proofs and other privacy-preserving solutions is becoming increasingly popular because it is thought to minimize front running and MEV attacks by obfuscating the size and time of transactions that are submitted and verified.
Hydro Finance is a relatively new project being built on the Secret Network, a privacy-preserving blockchain with “smart contracts that contain encrypted inputs, outputs, and state…. an encrypted mempool,” according to the Network.
Hydro is trying to decouple itself from the permanent reliance on external liquidity providers by growing its own treasury of Protocol Owned Liquidity, and it also codifies buy-pressure through the inflation of the assets that it supports. Instead of giving all of the trading fees to the liquidity providers, the DAO controls the revenue, and the liquidity providers receive the DRO token.
“AMM’s, in their current form, are impractical but necessary services upon which the growth of DeFi is reliant. It is imperative that we evolve them past their inceptive shortcomings for the ethos of freedom and decentralization in finance to mature,” co-founder Waisanen says.
Although AMMs have been absolutely integral to the expansion of the DeFi community to date, new business models may be required to sustain the community going forward. The curve wars that were observed in 2021 are unsustainable in the long run because there is not enough demand for different tokens. Ultimately, the value of a token comes down to the value of the community, which requires a core team to lead and direct traffic. Time will tell how current challenges to the problems plaguing AMMs fare, but one lesson is clear: The DeFi community will need to apply best practices from business to make sustainable and scalable organizations succeed.