DEXes: The story so far and where we are headed

Chainflip
11 min readJun 18, 2021

--

It’s hard to remember a time when swapping assets via DeFi wasn’t the norm. The crypto world in 2021 looks totally different to how it did just 18 months ago, before these instruments really found product-market fit. Given so much has happened over the last few years, I’d like to take some time to muse about the past, present and future of Decentralised Exchanges (DEXes): early iterations; the birth of AMMs (and the different types); and finally, an educated guess on the future of DEXes and how cross chain AMMs could further develop the space.

There’s no doubt that DEXes have taken crypto by storm, with multiple contenders vying to absorb as much liquidity and volume as possible. Innovation in the most popular DEX model, the Automated Market Maker (AMM) has been arguably the hottest topic in DeFi for a number of years, but this hasn’t always been the case, particularly if we take a look at the first DEX iterations.

Early DEXes

The first DEXes were a long way from the capital-efficient liquidity holes that we see today. AMMs didn’t exist at all prior to Bancor’s launch in 2018. In fact, every DEX before that mimicked the model of a centralised exchange and implemented an on-chain Central Limit Order Book (CLOB).

EtherDelta and OasisDEX were two of the first on-chain CLOBs. In fact, the only way to purchase MKR in 2016 was with ETH via a clunky dapp. Back then gas fees were not much of an issue, but the latency involved in making or taking positions meant that these exchanges were not particularly practical for anyone who was much more than a hobbyist, as you had no guarantee that your action would succeed. Your position cancellation might be too late, or you might have been beaten to a particular trade by someone else.

Early innovations in the CLOB model like IDEX took a slightly different approach by having an on-chain deposit contract and (in later iterations) an off-chain order book. IDEX reached a much larger audience (and attracted much more liquidity) than earlier bites at the apple. Whilst the experience of using IDEX was leaps and bounds ahead of EtherDelta, rising gas costs made using the marketplace progressively more expensive, and latency still plagued the user experience.

The Entrance of Constant Function Market Makers

Uniswap’s Constant Product Market Maker (CPMM)

The idea of an AMM was originally floated by Vitalik in 2016. Bancor and later Uniswap were the first projects to put their hat in the ring, with Uniswap launching in late 2018. Before getting into the rise of the different types of AMM based DEXes, it is important to remember exactly what an AMM is and why they established such an astonishing product market fit.

The acronym AMM stands for Automated Market Maker, which can be broadly defined as a simplistic model that prices two assets against each other with a very simple formula that states that the product between the two asset quantities has to be equal to a constant.

The resulting user experience is quite comparable to what users would typically experience through an OTC broker. The role of traditional market makers changed in this model, with algorithmic traders having no advantage for liquidity provision compared to the general market, enabling anyone to become a simplistic market maker. This has proven to be very popular, though quite capital inefficient. Algorithmic traders instead turned to arbitrage and front-running as alternative strategies in these AMM heavy markets.

This type of AMM, which is the one Uniswap popularized to mainstream adoption, are called CPMM or constant product market makers. After Uniswap’s rise, a legion of new types of AMMs came into existence, modifying the formula for various purposes and thus adapting the relationship between the assets being quoted.

Curve.fi hybrid CPMM and CSMM

An example of one of these modifications is the Curve.fi protocol, which uses a hybrid model of Uniswap’s CPMM with another type of algorithm called CSMM or constant sum market maker. As the name implies, it uses a pricing formula where the sum of the asset quantities have to be equal to an invariant number.

This allows it to have a pricing curve that is much more suited for stablecoin swapping, as it is reasonable to think that the trading range of both assets will be much smaller than with non-stablecoin pairs as they always float around the 1 USD mark.

The graphic below shows the functions mentioned above:

Balancer CMMM

Balancer is another AMM protocol that entered the space with an innovative use case for AMMs, which has allowed for the creation of custom pools where more than two assets could be paired together within the same pool.

The multi asset pricing and the customizable fee feature of Balancer paved the way for even more AMM innovations and a push to make these liquidity protocols more flexible for users and more secure and cheaper for LP’s. The number of functions that one can come up with is truly unlimited, and we have seen a push for other hybrid models with oracles, like what DODO has created with the PMM model.

Why have AMMs crushed the competition in the DEX space?

If we take a look at the advantages that AMMs might have against other type of market making tools we find the following:

User experience: One of the most powerful truths AMMs revealed to the space is something people seemed to have forgotten since the early Shapeshift days: Crypto is complicated and users want an intuitive and seamless experience. Adoption of new decentralised tools is achieved only if they save typical users time.

Regarding this argument, AMMs have been without any doubt the easiest way to onboard users to decentralised liquidity markets. The fact that there is no complex graphical interface to see or switch to, no complicated order-book to read, no type of limit/market order to think about and no unpredictable wait times for the order to get matched is something that has been understated when explaining the sudden growth. The only steps a user must know is how to connect their web3 wallet and choose the pair they want to swap. UX is crucial.

Cost: DEXes that rely on AMMs have little to no operating costs, once the protocol is deployed with its smart contracts there is no need to pay anyone or anything to run it, even gas fees are paid by the protocol’s users. From a cost efficiency perspective, there is really no competition here.

Price Quoting: One of the most powerful features that CFMMs provide is that they always quote you a price for any asset, no matter who is asking or the market conditions. This is something that professional market makers can’t do, they rely on differentiating as fast and accurately as possible informed orders from uninformed orders and quoting based on that information. In reality, this is a byproduct of LPs in AMMs currently not able to alter the nature of their supplied liquidity at all, but is seen as an advantage for traders nonetheless.

Simplicity: AMMs are a very simple design, with a level playing field for all participants. With limited operating parameters, users have a very simple and convenient user experience, and this simplicity also makes integrations straightforward, which makes them highly composable with other Dapps.

Providing liquidity: Because the price quoting on an AMM is always determined by the constant function, there is no need for algo-trading firms or specialised hedge funds to provide liquidity, any user can provide liquidity by simply adding pairs to the existing pools. No software, no trading strategy and no minimum amounts required. Of course, the tradeoff that must be made for this to occur is that current AMMs are very capital inefficient and most retail LPs do not fully understand their risk profile when LPing.

What is the future of AMMs?

We think the innovation in AMMs has been and will continue to be a driving force to attract liquidity in DeFi, with improvements that will allow LP’s to get better returns on their investments, flexible fee structures and manage their liquidity positions to reduce experienced impermanent loss.

The tricky question here is to guess how these market making tools will evolve. UNI V3 has now been deployed for more than a month and it already offers a substantial evolution to the concept, with most major AMM projects now implementing some version of so-called Concentrated Liquidity Provision. The company behind the world’s biggest DEX has made several improvements that surprised a lot of crypto investors in the space.

Concentrated Liquidity Provision: The most novel feature of UNI V3 is the possibility for liquidity providers to dynamically decide the price range where they want to provide liquidity.

This allows LP’s to concentrate their liquidity around ranges where they believe their capital will be more efficient.

If an LP decides to allocate his entire liquidity to a narrow range price around the market price, he will obviously earn more fees compared to another LP that decided to allocate in another less traded price range.

Because the LP’s will effectively battle against each other to provide liquidity around the market price and create dynamic strategies, price impact and slippage will be much better for end users. The obvious downside of this feature is that the role of liquidity provider has been effectively professionalized (which is actually just how things used to be prior to the rise of AMMs), with retail LPs at a serious disadvantage against more traditional market makers that will have dedicated strategies based on prices and market conditions.

This range order system is so effective that professional market making firms update their range orders extremely frequently to offer the best prices to end users and earn the most in LP fees. By connecting their market making to normal order books, this is a very low risk way of bringing accurately priced liquidity in near real-time to the DeFi AMM marketplace.

Flexible Fees: Like many of the DEXs out there, Uniswap had a constant swap fee of 30 bps disregarding the type of pool. They have now introduced a fee tier of 5 bps, the standard 30 bps and 100 bps, this allows LPs to adjust the risk they are taking in certain pools by changing the fee structure.

Oracles: Price inquiries are much faster and cheaper which means that the performance of TWAP oracles should be enhanced.

The flexible fee structure and the improved TWAP oracles are nice developments but the real take here is the concentrated liquidity feature. Central Limit Order books have long been the trading method for the last decade for the vast majority of financial assets out there and the reason is simple, it is much more efficient for market makers. UNI V3 concentrated liquidity is none other than a combination of a traditional CLOB type of market making and a classic AMM. This strikes a perfect balance between efficient capital allocation and a fast and convenient user experience that is also highly composable in the DeFi ecosystem.

Like any new feature or protocol design in DeFi, we can expect this new V3 to set a gold rush that will lead other DEXs just like Curve.fi very recently to improve and come up with new types of AMMs.

The Cross-Chain Future:

Cross-chain protocols like Chainflip will most likely bring a new set of AMM designs to the space, as the number of platforms grows, we will see cross chain AMMs starting to pull apart as an independent category within the market making field.

The main reason we think this will occur is the ongoing new challenges that these products face compared to ERC-20 DEXs, this will require a different design from traditional AMMs. One of the most notable differences is the fact that swaps do not occur within the same transaction execution like in ERC-20 DEXs, which opens the door to many options as to how to deal with the inflow/outflow of orders and consequently how prices are determined.

Another interesting point is obviously the challenge of dealing with different blocktimes; because swaps are performed between two assets that don’t belong to the same blockchain, depending on the type of assets involved, difference in blocktimes could introduce drastic price shifts and make arbitrage difficult without introducing batching, delays, or other mitigating strategies.

An interesting feature that can be leveraged in cross chain AMMs is the batching mechanism: something impossible with platforms like Uniswap due to the agent-initiated atomic execution of individual swaps. The possibility of waiting for a certain number of transactions on both sides of the same pair to allow a subset of those to cancel each other out is a tool that can reduce slippage.

Additionally, the fact that the Chainflip State Chain has a lower blocktime and close to feeless compared to the rest of the supported chains effectively means that in a Chainflip V3 style AMM, LPs would be able to update their liquidity ranges much faster and cheaper than in protocols like Uniswap.

This makes the job for liquidity providers much more interesting, enabling the use of strategies that they possibly couldn’t do on ERC-20 DEXs, and overall this means that slippage can be optimised for users, which should ultimately be the end goal for these protocols.

Last but not least, with UNI V3 already surpassing UNI V2 in fees generated, some early conclusions can be drawn to reflect on the potential meaning of a concentrated liquidity feature for cross chain protocols like Chainflip. The capital efficiency of V3 from a TVL/Volume ratio is a topic particularly important to cross chain DEXs; V3 needs 4–5 times less liquidity in the pools to enable similar volumes so far. This effectively means that protocols with their own validator network that need to assure a secure validator collateral to TVL ratio, could potentially have 4–5 times more volume without undercollaterizing the system.

Concentrated liquidity is not only a capital efficiency tool for users and LP’s, but in the cross chain context, it allows the protocol to require less collateral from the Validator network, which effectively means that it is more likely for smaller/medium nodes to bid for a spot in the validator set, thus having a healthy rotation of nodes participating to the network.

This ratio between validator collateral and TVL is something that smart contract platforms like ERC-20 DEXs do not need to care about, whereas in cross chain DEXs that rely on their own blockchain, it is the single most challenging factor that determines how fast it can grow liquidity without neglecting security and stability.

To read more about Chainflip and the future of AMMs, you can head to our website at https://chainflip.io.

--

--