"So, what is a DEX exactly. I need a refresher after the pause we took." Already forgot John? Not good :
Decentralized Exchanges (DEXs) are like online marketplaces for trading cryptocurrencies. Traditionally, people used Centralized Exchanges (CEXs) for trading, but DEXs have become more popular. Here's why:
CEXs are like big banks for crypto, but they have some problems. First, they can get hacked, and people can lose their money. Second, the exchange can stop you from trading or taking out your money whenever they want.
DEXs are different. They let you trade cryptocurrencies directly with others without using a big exchange in the middle. This means you don't need to give a lot of personal information or follow strict rules. It's more like trading with a friend.
In recent years, DEXs have become a serious alternative to CEXs. They've grown a lot, and many people are using them because they offer more freedom and control over your assets.
"And what were the 2 main types of DEXs?" Glad you remembered that there are 2 main ones John :
- Order Book Based DEXs: These work kind of like traditional exchanges. They have lists of buy and sell orders for different cryptocurrencies at different prices. Users can place orders at their preferred prices, just like in centralized exchanges (CEXs). But in DEXs, your assets are stored in your own wallet, not on the exchange. DEXs can have order books that are on-chain (recorded on the blockchain) or off-chain (recorded outside the blockchain).
- Liquidity Pool Based DEXs: These DEXs use something called Liquidity Pools. Think of these pools as a collection of tokens sitting in smart contracts that users can trade with. Most Liquidity Pool DEXs use something called Automated Market Makers (AMM). AMMs are like mathematical robots that automatically set the prices of tokens based on a formula. They make trading available 24/7, provide better access to capital, and are pretty efficient. Some well-known AMM-based DEXs are Uniswap, SushiSwap, Curve, Balancer, and Bancor. These became really popular during the DeFi boom in 2020.
"Could you give me a recap on Automated Market Makers (AMMs). I remember that we talked about Uniswap back then." Yes, we talked about that AMM. Here is a recap John :
Automated Market Makers (AMMs) are like the engines that power some decentralized exchanges, like Uniswap. Unlike regular exchanges, which have order books where people place buy and sell orders, AMMs work differently.
In AMMs, there are no order books. Instead, they use something called "liquidity pools." Imagine these pools as collections of tokens just waiting to be traded. For instance, if you want to exchange Ethereum (ETH) for DAI, you trade using the ETH/DAI liquidity pool. This pool holds both ETH and DAI tokens.
People who deposit their tokens into these pools are called "Liquidity Providers" (LPs). They add their tokens to the pool based on certain rules (usually an equal amount of each token). LPs do this because they can earn money from trading fees that users pay when they trade on the exchange.
The cool thing is, anyone can become an LP and help make trading happen in these pools. With AMMs, you don't need a big centralized exchange to provide liquidity. Instead, smart contracts automatically handle trades, including figuring out the trade prices. This is different from regular exchanges, where there are people or companies acting as intermediaries.
So, in short, AMMs make trading on decentralized exchanges smooth and automatic, without the need for middlemen. You can think of traditional exchanges as following a "peer-to-peer" model, while AMMs follow a "peer-to-contract" model.
"What are the existing types of AMMs out there?" As far as I know, 4 types :
- Constant Product Market Makers: This formula, used by Uniswap and Bancor, is like a curved line on a graph. It works by multiplying the quantities of two tokens in a liquidity pool (x and y) to keep the product (k) constant. This creates a range of prices for the tokens. However, the prices can be unstable because large trades can significantly affect the price due to pool size. This can lead to something called "impermanent loss."
- Constant Sum Market Maker: This formula creates a straight line on the graph, making it ideal for trades with zero slippage (smooth trading). However, it has a flaw: it can be exploited by arbitrageurs when the quoted price differs from the market price elsewhere. These arbitrageurs can drain the entire liquidity pool, leaving no liquidity for other traders. So, it's not suitable for most AMM uses.
- Constant Mean Market Maker: Balancer popularized this formula, which is also known as the Value Function. It allows liquidity pools with more than two tokens and various token ratios beyond the standard 50/50 distribution. Instead of keeping the product constant, it maintains the weighted geometric mean constant. This enables variable exposure to different assets in the pool and allows swaps between any of the pool's assets.
- Stableswap Invariant: Curve Finance introduced this formula, which is a hybrid of the Constant Product and Constant Sum formulas. It uses a Constant Sum curve when the portfolio is balanced and switches to a Constant Product curve when it's imbalanced. This minimizes slippage and impermanent loss, making it suitable for trading assets with similar values, like stablecoins.
In summary John, these different AMM formulas provide various ways to set token prices in liquidity pools. Each has its strengths and weaknesses, so they are used in different situations depending on the type of assets being traded and the desired trading experience.
"How are prices determined on a Constant Product AMM?" Here is your answer friend :
I will use Uniswap for the example because we know more about it.
- Constant Product Formula: Uniswap uses a formula called the Constant Product Market Maker. This formula keeps the product of the reserve tokens (x and y) in the liquidity pool constant. The formula looks like this: x * y = k, where:
- x represents one type of token in the pool.
- y represents the other type of token in the pool.
- k is the constant total liquidity that determines the token prices in the pool.
- Example: Imagine there's a liquidity pool on Uniswap with 61,404,818 DAI and 26,832 ETH as of April 21, 2021. This means that the product (k) of the DAI and ETH reserves remains constant. Therefore, if you calculate the price of ETH in DAI, it would be 61,404,818 DAI / 26,832 ETH = 2,289 DAI for 1 ETH.
- Price Differences: Now, here's the catch. The price you see on Uniswap for 1 ETH is 2,289 DAI. But if you check another exchange like Balancer and see that the price of ETH is 2,100 DAI, it creates an opportunity for arbitrage.
- Arbitrage: Arbitrageurs are traders who take advantage of these price differences. They can buy ETH for a lower price on Balancer and then sell it on Uniswap for a higher price, making a quick profit (assuming no trading fees for simplicity). They keep doing this until the prices on both exchanges become equal.
In a nutshell, on Constant Product AMMs like Uniswap, prices change only when the balance of tokens in the liquidity pool changes. This can lead to price differences between different exchanges, and arbitrageurs exploit these differences to equalize prices.
"And what are the various Automated Market Makers (AMMs)?" That's actually a very good question John.
Let's start with the familiar one: Uniswap is like a special place on the Ethereum blockchain where you can easily trade one cryptocurrency for another without giving up control of your money. It started back in November 2018 and was one of the first to use a math formula called the Constant Product Market Maker. This formula helps figure out how much of one token you get when you trade another.
Uniswap got even cooler in May 2020 when it became Uniswap version 2. This new version let you trade lots of different Ethereum-based tokens, not just a few.
But the real excitement happened on May 5, 2021, when Uniswap released version 3. This version brought two big changes:
- Concentrated Liquidity: Now, people who put money into Uniswap (we call them Liquidity Providers or LPs) can choose the price ranges where they want to provide their money. For example, if they're helping with the ETH/DAI trading, they can decide to focus on the $2,000 - $3,000 price range or the $1,500 - $1,700 range. This makes it more efficient for LPs, and they get special tokens (Non-Fungible Tokens or NFTs) to show their position.
- Multiple Pool Fee Tiers: Uniswap version 3 offers different fees for LPs to choose from:
- 0.05% for pairs with stable prices (like USDC/DAI)
- 0.30% for pairs with more price changes (like ETH/DAI)
- 1.00% for pairs that are a bit more unusual.
So, depending on how much action a trading pair sees, LPs can pick the fee that suits them best. It's like choosing the right tool for the right job.
Now, let's take a look at SushiSwap : SushiSwap is like a sibling to Uniswap, but it has its own unique flavors. It was created in August 2020 by someone using the name Chef Nomi. At first, it was basically a copy of Uniswap's version 2, using the same math model called the Constant Product Market Maker.
What made SushiSwap stand out was its SUSHI token. This was before Uniswap had its own UNI token. SushiSwap attracted a lot of attention because it offered tasty rewards for people who joined its yield farming.
In September 2020, SushiSwap did something called a "vampire attack" on Uniswap. It basically sucked out a big chunk of Uniswap's money and moved it to SushiSwap. This made SushiSwap look like a big deal overnight, but Uniswap quickly bounced back.
Now, as of April 2021, SushiSwap has about $4.5 billion in money locked up, which is quite a lot but still less than Uniswap's $10.3 billion. Uniswap is like the big brother in the world of decentralized exchanges.
One cool thing about SushiSwap is that it joined forces with Yearn Finance, which is like a farming expert in the crypto world. Together, they offer more services and ways to make money.
When it comes to fees, both Uniswap and SushiSwap charge a 0.3% fee on trades. But SushiSwap gives 0.05% of that fee to its SUSHI token holders. Uniswap can do the same with its UNI token if people vote for it.
Uniswap has a lot more trading pairs, over 2,000 of them. That's like having more options on the menu. SushiSwap has fewer options, around 400 trading pairs.
Uniswap hangs out on Ethereum, but it plans to move to Layer 2 with Optimism. SushiSwap, on the other hand, is quite the traveler. It's on nine different blockchains, like Ethereum, Binance Smart Chain, and others.
Let's see what da fuss is about with Balancer John : Balancer is like a manager for your crypto money. It's not just a regular exchange; it also helps you manage your investments. Instead of you paying fees to invest in a fund, people who put their money into Balancer's pools get paid when the fund is rebalanced. It's like getting a reward for being part of a club.
Unlike Uniswap, which works with only two types of crypto at a time, Balancer can handle multiple types at once. It's like having more options when you invest. Also, the people who create these pools can set their own fees, which can be really low or even high, giving them more control.
There are three types of Balancer pools:
- Public pools: Anyone can join, and the rules can't be changed. This is the most secure option.
- Private pools: Only the owner can change the rules and add money. It's a bit like a private club.
- Smart pools: Anyone can join, and the rules can change over time. This is the most flexible option.
Balancer version 2 is even cooler because it can handle up to 16 different types of crypto in one pool. It's like having a big mixing pot for your money. These smart pools can also do things like automatically buying back tokens or lending out unused money to make more money.
Balancer also has a special way of launching new tokens called Liquidity Bootstrapping Pools (LBPs). These are like short-lived pools where the token's price starts high and goes down slowly. This way, big investors can't just grab all the tokens at once, making it fairer for everyone. It's like selling concert tickets, but the prices get cheaper as time goes on.
"You forgot Curve Finance!" No, I did not :
Curve Finance is like a special exchange that's really good at swapping similar things. In the world of crypto, there are different versions of the same stuff, like copies or wrappers. Curve Finance helps you trade these similar things easily.
It mainly works with stablecoins (which are like crypto dollars) and wrapped or synthetic versions of Bitcoin and Ethereum. For example, it has a big pool called 3CRV that holds stablecoins like DAI, USDT, and USDC. The amounts of these stablecoins in the pool change depending on what people want to trade. If there's more of one stablecoin, it's a chance for smart traders to make some quick money by balancing things out.
Curve Finance also deals with tokens that earn you money when you keep them. It works with tokens from Compound, Aave, and Yearn Finance. They made a special pool called yUSD that contains these earning tokens. People who join this pool can make money in three ways: from the earnings of the tokens, fees from trading on Curve, and rewards from Curve Finance.
To make it easier for people to trade not-so-popular tokens, Curve came up with something called base pools and metapools. A base pool is like a pool for one kind of token, and a metapool links it to another pool. This makes it simple for users to swap that one token. The most popular base pool is 3CRV. Making metapools helps Curve do a few things: it keeps their main pools strong, allows them to trade less popular tokens, and brings in more fees for people who own CRV tokens.
I bet that you did not hear about our last candidate : Bancor is like an exchange that works in a different way compared to others. It was one of the first of its kind, starting in 2017. It uses something called an AMM system, just like Uniswap, but with a twist.
Instead of swapping any token for any other token like Uniswap, Bancor uses its special coin called Bancor Network Token (BNT) as the go-between. It has separate pools for each token that you want to trade using BNT.
Bancor version 2 introduced some cool stuff like letting people put in just one type of token instead of two when they add to the pool. This makes it easier for them to keep all their money in one type of token while still earning money from fees and rewards.
They also tackle something called "impermanent loss," which is a risk that people worry about when they provide money to these pools. Bancor makes it less scary by promising to cover these losses for pool providers. But you need to stick around for at least 100 days to get the full benefit, with a 30-day wait before it starts.
Bancor also has some extra things like vBNT and Vortex. When you put your BNT in a special pool, you get vBNT, which can be used for voting on how Bancor works, earning fees, or even borrowing other tokens using your vBNT as collateral. It's like getting extra powers for your BNT tokens.
"What are the differentiators between the AMMs bud?" Slow down John. This is enough for the moment. I will come back later with some more info regarding this topic. Untill then, please understand what we have just talked about here.
TL;DR :
- DEX (Decentralized Exchange): These are online platforms for crypto trading, offering more control and security than traditional exchanges.
- Two Main DEX Types:
- Order Book Based: Like traditional exchanges, with buy and sell orders.
- Liquidity Pool Based: Use automated systems (AMMs) for trading, efficient and accessible.
- AMMs (Automated Market Makers): Power liquidity pools, automate trades, and determine prices using various formulas.
- Constant Product AMM Pricing: Prices change based on token balances in the pool; arbitrageurs equalize prices.
- Various AMMs: Different formulas (e.g., Constant Product, Constant Sum, etc.) set token prices in pools, each with unique features.
- DEX Overview:
- Uniswap: User-friendly, many tokens.
- SushiSwap: Offers yield farming and merged with Yearn Finance.
- Balancer: Supports custom pools and fees.
- Curve Finance: Specializes in stablecoin swaps.
- Bancor: Uses its token and offers impermanent loss protection.
- Unique DEX Features: Each DEX caters to different trading preferences.
All of the info above was written by me with the help of the How to Defi book, advanced edition, from Coingecko. Hope it helped others like it did for our boy John here!
[link] [comments]
You can get bonuses upto $100 FREE BONUS when you:
π° Install these recommended apps:
π² SocialGood - 100% Crypto Back on Everyday Shopping
π² xPortal - The DeFi For The Next Billion
π² CryptoTab Browser - Lightweight, fast, and ready to mine!
π° Register on these recommended exchanges:
π‘ Binanceπ‘ Bitfinexπ‘ Bitmartπ‘ Bittrexπ‘ Bitget
π‘ CoinExπ‘ Crypto.comπ‘ Gate.ioπ‘ Huobiπ‘ Kucoin.
Comments