Uniswap and the Opportunities of Decentralization

A lot of times in the Web3 space, you hear people throw around the term decentralization as something that’s going to change the world, but it can be difficult to understand what that actually means. Instead of starting at a high level and throwing around a bunch of abstract concepts, I want to dive into a specific protocol (Uniswap) and from there show how powerful decentralization actually can be. I'm going to work backward in this piece: start with what Uniswap is, what makes it unique, how its business model compares to business models in traditional finance, and finally what impact “decentralization” actually has. I’m going to try to show that decentralization is a powerful force that can enable fundamental changes to market structures and not just iterative improvements on existing product features.

In traditional public asset markets, liquidity is provided by market makers (think Citadel Securities). These market makers provide a huge amount of capital to financial markets—Citadel Securities executes approximately 440B of trades per day—and without them, the bid/ask spreads for many publicly traded assets would be much larger than they are today. Every asset has what's called a liquidity risk premium baked into the price of the asset: the higher the liquidity risk, the higher the expected return needed to justify an investment in the asset. By supplying liquidity, market makers provide a very important service to financial markets in decreasing the cost of capital for borrowers and decreasing volatility, slippage, and liquidity risks for investors and traders, and they are rewarded for doing so by pocketing the difference between the purchase and sale prices of their assets. Of course, they take on risk by buying and holding onto assets for some period of time; large directional moves can hurt market makers by forcing them to sell at a loss. We can think of their profits as a dynamic "fee" they receive in return for their liquidity provision.

Uniswap is a decentralized exchange that matches buyers and sellers for digital assets, and just like traditional exchanges, users can go there and make trades. However, instead of operating an order-book-based matching engine, Uniswap provides liquidity to the swaps it lists by operating an AMM (automated market maker) model. Without going into too many details (here's the whitepaper for Uniswap V3 if you're interested in technical details: https://uniswap.org/whitepaper-v3.pdf), the essence of an automated market maker is pretty simple: Uniswap's protocol will perform the job of supplying liquidity and market-making algorithmically. Instead of earning profits from the spread of their buy/sell points, Uniswap LPs earn a fee that’s a percentage of the total value of each executed trade and is distributed via smart contract logic. Just like any traditional exchange, the actual movements in prices are caused by a combination of the activity of buyers and sellers and the activity of arbitrageurs who keep prices aligned across different exchanges and across different swap pairs.

What this means for users like you and me is that we can participate in the liquidity provision process simply by providing capital and letting Uniswap handle the rest. Uniswap will aggregate all such capital into liquidity pools for a certain swap pair, and then traders can buy and sell out of those pools.

ETH/USDC is one of the largest liquidity pools on Uniswap. As a user, I can go and deposit a proportional amount of ETH and USDC, and in return, I receive an LP (Liquidity Provider) token, which represents a pro-rata share in the fees earned by the entire pool. As traders buy and sell assets, they pay fees for each trade, and those fees get distributed to LP token holders. Of course, just like with traditional market makers, LPs bear risk by providing capital.

As the exchange price of ETH/USDC moves in either direction, the AMM model will only accept trades which preserve the constant product k between the two assets. Arbitrageurs will make trades in the pool that obey this rule until the resulting balance between the two assets in the pool represents the new market price that’s reflected in other exchanges across crypto, e.g. Binance. For example, if the price of ETH/USDC on Uniswap starts at 1,000 and moves to 1,500 on exchanges such as Binance, arbitrageurs will buy ETH on Uniswap, sell ETH on Binance, and pocket the difference. They will continue this process, bidding up the price of ETH/USDC on Uniswap until it’s equivalent to the price of ETH on all exchanges, at which point no arbitrage opportunity will exist anymore.

Notice that the above price-setting process results in an odd property of liquidity pools: in order to achieve the proper ratio between assets, they sell more of whatever asset is appreciating in exchange for the asset whose value is depreciating. For example, let’s say we start with 1 ETH and 1,000 USDC in a pool with a constant product of 1,000. If the price moves to 1,500, arbitrageurs will make trades until the new ratio is 1:1,500, but the product between the two quantities must still equal 1,000 (x*y = k AND x/y = new price, where x = quantity of ETH, y= quantity of USDC). The resulting balance of assets in the pool will be: 0.816 ETH and 1224.74 USDC.

As the price of ETH relative to USDC moved up, the pool sold some of its ETH and bought some USDC. What this means for LPs is they naturally incur an opportunity cost: how much value was lost depositing capital into a liquidity pool compared to if they had just held onto their assets? In the above example, if the LP had not deposited their assets into the ETH/USDC pool, they would have had

1 ETH * 1,500 + 1,000 USDC * 1 = 2,500 USD

Contrast this with the scenario in which they did deposit their assets into the liquidity pool:

0.816 ETH * 1,500 + 1,224.74 * 1 = 2448.74 USD

The 51.26 USD difference in value above is generally referred to as impermanent loss (IL) in the DeFi community. To be clear, traditional market-makers also bear a similar risk. In general, they make the most money when volatility is high but the overall direction of the market is neutral and tend to lose money when losses due to large price movements outweigh the profits they generate from market-making and hedging directional risk.

** Note: for more detailed calculations/explanations of impermanent loss and how to hedge IL risk, please read: ETH Neutral Liquidity Provision.

Specific mechanics aside, the overall idea is that Uniswap allows you essentially to obtain equity in a market maker (and therefore a share of its profits!), simply by providing your capital.

Now that we have an understanding of what Uniswap does at its core, let's talk about two new features Uniswap Labs recently released:

Uniswap 4 (https://blog.uniswap.org/uniswap-v4) and

Uniswap X (https://blog.uniswap.org/how-uniswapv4-uniswapx-work-together)

Uniswap 4 allows for custom hooks. This means that developers can program custom behavior for liquidity pools and these functions get run in between the lifecycle methods of a liquidity pool (almost like React Hooks, but for liquidity pools instead of React Components). A few examples of custom hooks are TWAMM (time-weighted average market maker), dynamic fees, and auto-compounding LP fees.

For TWAMM, think dollar cost averaging, but done algorithmically:

"Say Alice wants to regularly buy $1,000 of ETH per month. She could split that into $1,000 a month, $250 a week, or $33 a day. Or $5,000 over five months. The TWAMM hook is a "set it and forget it" pool that can do exactly that"[1]

Dynamic fees based on volatility:

UniswapV3 allowed LPs to charge fixed percentage fees for trades according to the liquidity concentration range they specify (for more on this, please refer to the "Comparing different AMMs" section in the ETH Neutral Liquidity Provision document linked above). LPs however take on more risk during more volatile periods and in V3 were not properly compensated during these periods. With Uniswap V4 and custom hooks, we can now create liquidity pools that do properly compensate LPs for volatility risk by adjusting fees dynamically.

Auto compounding LP fees back into LP Positions:

This means that LPs can choose to turn on a switch that will automatically take their profits and reinvest them back into the pool.

Uniswap is not simply creating another exchange; it's creating an open-source liquidity protocol. And by that I mean it's both automating the processes by which we create and supply liquidity in markets (capital pooling, arbitrage, market making, etc.), thus increasing access to those market opportunities, AND it's open sourcing the development of that liquidity creation. Any developer can come in and define custom behavior for a pool, attract capital, and essentially run a custom market-making operation with capital from you and me. Meanwhile, as we sit on the sidelines our pro rata share in that market-making operation is ensured via code at the smart contract level. All of this can be done quickly and seamlessly online, with no concerns for either geographical boundaries or counterparty risk. 

What's more, the open-source nature of custom hooks means that other protocols/users in the Web3 ecosystem can simply use the hooks interface to interact with the suite of Uniswap smart contracts, and they can define any custom behavior they want; the hooks provide a set of functions that tell Uniswap how that behavior fits into the lifecycle of a pool (similar to React Hooks useState and useEffect. Think of it as an interface for creating new applications, and not just an application itself). Uniswap has provided a set of ready-made hooks it encourages users to use, but already the community has come up with a set of custom hooks including but not limited to:

  • Multi-Sig (requires multiple signatures for certain pool actions, such as adding or removing liquidity)

  • Whitelist (restricts pool participation to a whitelist of approved addresses)

  • KYC (allows for Know Your Customer (KYC) checks to be performed on users before they are allowed to trade on a pool)

  • Trading Hours (restrict trading activity to only specific periods)

  • Automated Buyback (protocols can enable automated buybacks from their treasury when a token price drops below a certain threshold in a Uniswap Pool).

These hooks can all be tailored to the specific needs of a pool and do not need to be implemented uniformly across all of Uniswap. Once created, the hooks can be used by any developer and accessed easily via Github, and the parameters surrounding how LPs want to supply capital can be combined in different ways and customized according to LPs preferences. This paradigm shift from isolated pools of capital providing liquidity to a more open source model leads to a world in which the benefits of software composability can be applied to financial markets (more on this in another post).

Uniswap X is another interesting release that, like Uniswap V4 Hooks, introduces new market opportunities. Before we dive into Uniswap X, first let’s talk about DEX aggregators.

DEX (decentralized exchange) aggregators are services that take orders from traders, scan multiple DEXs/protocols across multiple blockchains, and attempt to maximize the value accrued to the trader according to the parameters he/she sets. While DEXs aggregate liquidity and match buyers and sellers on the exchange, DEX aggregators match buyers and sellers with different DEXs, trying to find the best deal and minimize costs, like slippage. It can do things like split up your trade across multiple DEXs and liquidity sources. For example, you might place an order for 1,000 USDC for 1 ETH through 0x's smart order routing API, and it might calculate that the best route to take is to execute 50% of the order through Bancor, 25% through Uniswap, and 25% through Curve.

DEX aggregators and routers however need continuous maintenance and adjustment to continue to bring traders optimized prices. To solve this, Uniswap X is creating "a marketplace that would gamify liquidity discovery. Instead of accepting a quote from a single source, swaps go through an auction system. “Fillers” will compete to find the best route that offers the best price for swappers… Fillers, who look like the block-builders and traders of today, are incentivized to use any strategy at their disposal to offer lower prices. They can give MEV back to swappers, look for obscure liquidity sources, tap into private inventory, or save gas by batching — anything that will give them an advantage to win the auction." [2]

In other words, fillers are any market participants who can maximize value for traders by optimizing the route a trade takes, and they earn a fee for doing so. Essentially, they look for arbitrage opportunities in markets during trade execution, and then they push that value back to traders (and take a little bit themselves).

What's unique about both Uniswap 4 and Uniswap X is not necessarily the suite of features they provide to traders but rather the roles they create in the Uniswap ecosystem for participants that previously had no chance of contributing and acquiring value from this process (market makers and arbitrageurs). In this case, the primary value proposition of decentralization is not making trading UX features incrementally better, it’s shifting the power structures of how liquidity is supplied to markets and therefore enabling increased access and new types of opportunities. Uniswap is creating new markets and new roles, not just new products.

A very salient example of this type of market transformation is how Uber changed the taxi industry. As we all know, the features Uber offers riders are pretty great: call a car for wherever you are, and (usually) it'll show up in 5-10 minutes. But how did it change the industry for drivers?

Taxi companies in different cities work with regulators and sell "Medallions", which are licenses that drivers need in order to operate official taxis. They are also signals to riders that the cab they're jumping in is an official taxicab of the city and therefore subject to its price regulations (meters, flat fares) and to official channels of accountability. This type of licensing is necessary for trust. Otherwise, you're simply jumping in the back of some random person's car, and there's no recourse if that person decides to provide horrible service, overcharge you, drop you off in the wrong location, or worse.

These taxicab companies don't hire their drivers and therefore don't provide benefits to their drivers, similar to Uber. Instead, they own fleets of officially licensed cars (the yellow cabs) and lease them out to drivers. Those drivers need to pay for all their expenses, e.g. fuel costs, tolls, insurance, etc., in addition to the leasing fee they pay the taxicab company (sound familiar?). The taxicab company incurs very little risk, since all of their revenue comes from recurring contracts, and the drivers get to keep the vast majority of the revenue they earn. 

So how did Uber change the game? To solve the trust problem, it used an information network in place of the taxicab's licensing regime. It created a platform where riders could see reviews, drivers were punished for bad behavior, and a centralized entity could deal with disputes and safety concerns. We now trust Uber drivers like we trust taxicabs. 

The net effect of this alternative solution to the trust problem of ridership means that Uber has eliminated a significant barrier to entry for drivers (and also a significant source of rent-seeking profits for taxicab companies), namely, the fact that drivers could not use their own cars, and instead had to lease them from companies. Many people in the US already own cars for their own needs, and instead of having to repeatedly pay "rent" to these taxicab companies, they can just use an asset they already own, thus dramatically reducing the lifetime cost of being a driver and therefore significantly increasing overall access to this type of job (not to mention changing the very nature of the job itself. Uber drivers have way more flexibility than taxi drivers do). 

As Bill Gurley said in How to Miss by a Mile: An Alternative Look at Uber's Potential Market Size:

"When you materially improve an offering, and create new features, functions, experiences, price points, and even enable new use cases, you can materially expand the market in the process. The past can be a poor guide for the future if the future offering is materially different than the past."

Crucially, by expanding access to new opportunities, Uniswap could expand the total supply of capital available for liquidity provision, which currently is dominated by professional market-makers. According to an S&P global report, "…there is over $20 trillion of retail client assets in over 100 million brokerage accounts”[3]. The vast majority of that $20 trillion right now is deployed into investment accounts and not into liquidity provision strategies. LP strategies could give retail investors an uncorrelated source of market neutral returns that they don’t currently have access to. Furthermore, significantly increasing the total supply of liquidity across financial markets could decrease the liquidity risk premium for many assets, thus decreasing the cost of capital for many firms and individuals and increasing their demand for borrowing. This is especially true of “riskier” financial assets that currently suffer from poor liquidity in markets.

Uniswap offers insights into what decentralization is, and how it can dramatically rewire economic structures and therefore create new types of economic opportunities, not just incrementally better ones. If you're sitting there asking yourself why Uniswap features are better than traditional brokerage features, then you're asking yourself the wrong questions. The innovation happening in Web3 is much more profound than simply iterating on a set of features; it is reimagining the infrastructure upon which all of our financial products are built. The important question therefore is not "How is Uniswap better than Robinhood”, but rather “What does Uniswap allow us to do that was not possible before”? 

[1] Uniswap Labs. “Uniswap V4 TWAMM Hook” Uniswap Labs Blog, 24 August 2023, https://blog.uniswap.org/v4-twamm-hook.

[2] Uniswap Labs. “How Uniswap v4 and UniswapX Create the Best Swapping Experience” Uniswap Labs Blog, 04 October 2023, https://blog.uniswap.org/how-uniswapv4-uniswapx-work-together.

[3] S&P Global. “Retail Investors: A Changing Landscape”, 2022, https://cdn.ihsmarkit.com/www/pdf/0622/SP-Global-and-Stockperks-Retail-Investors-Report.pdf

Previous
Previous

Inflation Analysis — 2024