We're in the phase of the market where there's a lot of retail inbounds but not enough education about the Ethereum ecosystem and DeFi.

Next on deck: Uniswap ( @Uniswap), a decentralized exchange built on Ethereum utilizing an Automated Market Maker (AMM) model.

A 🧵
TL;DR: Uniswap is a decentralized exchange that automatically matches buyers and sellers of Ethereum assets.

Any user can swap any between any asset, as long as there is a pool that can be routed through.

Any user can also provide liquidity to earn trading fees on assets.
1/ Centralized exchanges have long dominated crypto.

For years, users that wanted to swap between assets (e.g. ETH -> USDC) had to sign up for exchanges, be required to KYC, and risk losing their assets or face long service times.
2/ Centralized exchanges have been hacked for hundreds of millions, with reparations taking years and deprecating the user experience.

Also, Centralized exchanges can delist assets, censor trades (think $GME), and otherwise lock user's assets due to risk limits or KYC concerns.
3/ Enter decentralized exchanges.

DEXs are decentralized platforms that allow anyone to swap between coins and list trading pairs all through the blockchain.
4/ When people refer to exchanges, they often mean order book exchanges.

With order books, users can set buy and sell orders at specific prices they want their assets to trade at.

Users can also use other order types to manage risk, buy/sell in more efficient ways, etc.
5/ Ethereum only had on-chain order book DEXs for a while, though the early ones didn't work.

If anyone remembers Etherdelta, it was notoriously difficult to use. Liquidity was poor, the user interface was nigh impossible for most, and placing/canceling orders was gas-intensive.
6/ Some Ethereum DEXs settled orders and the order book off-chain, which improved the user experience slightly.

But there remained an issue with liquidity.

Users that wanted to buy a lot of an asset quickly often didn't have respective sell orders to buy into.
7/ Automated market makers were deemed a potential solution for DEXs on Ethereum.

With order book exchanges, the orders on each side of a trade can span a vast variety of prices. For instance, there may be 10% of sell-side liquidity at x, then 90% at 5x.
8/ AMMs scrap order books for an algorithm that automatically prices liquidity.

AMMs automatically determine prices based on the algorithm (input x -> get y).

These algos can be tuned to benefit certain types of trades, cater toward stable assets, and so on.
9/ Uniswap uses a constant product market maker model, exemplified by the equation x * y = k.

The CPMM model is the most popular in Ethereum DeFi as it is generalized and is relatively easy for users to understand when using DEXs & for devs to implement.
10/ Because Uniswap's liquidity is priced on a curve, there is always an ask to match a bid, and always a bid to match an ask.

Roughly speaking, there is an "infinite" amount of liquidity on both sides of a pool due to the curve.

Users do not need to worry about an order book.
11/ This aside, what the AMM model also allows for is for anyone to deposit assets into the exchange to be traded against.

As long as users have both assets in a market, they can provide liquidity, have users trade against it, and earn a 0.30% fee on each trade made.
12/ This allows any user to unlock yield on their assets, as long as they're fine with taking the associated "inventory risk" (so to say) when depositing assets into pools.

When a user deposits ETH and USDC into a CFMM, they reduce upside exposure to their ETH.
13/ That's to say, a user would make less from ETH rallying in price if they have coins in an AMM against a stable asset than if they held the ETH by itself.

The opposite applies as well.
14/ That being said, Uniswap allows users to create any market as they please, as long as they list standard tokens.

Popular pairs include ETH-USDC, WBTC-ETH, though if someone wanted to, they could list something as long tail as like (ren)DOGE-YAM.
15/ If a pair between two assets doesn't exist, Uniswap will try and "route" the transaction through other pairs.

Here's an example:

BADGER doesn't trade against ETH due to WBTC-BADGER liquidity incentives.

If someone has ETH and wants BADGER, Uniswap routes it through WBTC.
16/ This is a concept known as routing, whereby as long as there is a common pair between two tokens, they can be swapped along a route/path.

The router optimizes for the best price, though the more pairs you trade through, the higher you pay in transaction fees.
17/ Uniswap has a number of other features such as:

Slippage tolerance: Often, more than one transaction settles per block in a particular market.

Users can set a slippage tolerance to stop themselves from paying a high price if someone buys at the same time they do.
18/ Transaction deadlines: Users can set a transaction time for each trade to ensure that if a trade is pending for too long, it is automatically reverted.

Sends: Users can buy an asset for another person or address by adding a custom recipient of a trade.
19/ To recap:

Uniswap is a decentralized exchange that uses an algorithm, instead of an order book to process trades.

Anyone can trade on the exchange and anyone can provide liquidity to earn fees on their assets.

Uniswap can facilitate swaps between almost any Ethereum asset.
20/ Uniswap v3 adds a new dynamic to the exchange.

I did a whole thread on some of the key changes that can be found in the attached tweet, though I'll give a recap in the coming tweets. https://twitter.com/n2ckchong/status/1374615288507895809?lang=en
21/ While good, Uniswap v2 (the current version) is somewhat capital inefficient.

That's to say, capital deposited in the protocol can be used more efficiently for more utility, though that isn't the case now.
22/ When you provide liquidity to Uniswap v2, your assets are allocated across the pool from 0 to infinity.

The reality is most assets don't trade in a range from 0 to infinity.

Thus, providing liquidity to most pairs is *capital inefficient*.
23/ With v3, users can provide liquidity in specific price ranges.

User liquidity is only tradable within the range and thus has a higher utilization rate per trade vs. v2.

Users should be able to collect more fees per dollar deposited vs. v2.
Fini/ As always, none of this is investment advice. Please take caution when interacting with protocols on-chain and understand all risks before doing so.

These are fun to write, so there's more to come.
You can follow @n2ckchong.
Tip: mention @twtextapp on a Twitter thread with the keyword “unroll” to get a link to it.

Latest Threads Unrolled: