How Liquidity Pools and AMMs Work on DEXs
We have finally reached the mechanics of liquidity pools on decentralized exchanges. First, I will explain a bit of background. This was mentioned earlier in the module, but now we will go through it in detail.
Initially, there were centralized exchanges that allowed people to buy and sell cryptocurrency. All trading there is handled through an order book system. On the right, you can see an example: users place buy and sell orders for Bitcoin against USDT. The same applies to any trading pair — ETH/USDT, or any other pair.
When buy and sell orders match at the same price, the centralized exchange executes the trade: the buyer receives the asset, and the seller receives the money. The exchange charges a fee, which it sets at its discretion. This is how all centralized exchanges operate — it is a standard mechanism.
But in DeFi, there was a need for a system that could automatically process swaps based on a predefined formula, without using an order book. Why? Because DeFi works entirely on the blockchain — on smart contracts.
Every action is a separate transaction. Transactions take up space in a block, require time, and cost money (network fees). An order-book system with thousands of open orders on one trading pair is simply impossible to run efficiently on-chain — it is too heavy and expensive.
That is why AMM — Automated Market Maker was created. The AMM performs one key function: it uses a predefined mathematical formula to calculate prices inside liquidity pools and automatically executes swaps between assets.
An AMM is basically a program, an algorithm, a robot. This is why it is often illustrated as a robot — because it mechanically follows the formula without deviation.
It executes trades inside a specific liquidity pool, using only the formula embedded in its smart contract. External market conditions — volatility, price spikes, crashes, or even temporary stablecoin depegs — do not change how the AMM works. The only things that matter are the pool’s internal asset balances and the mathematical rule.
Thus, the AMM enables people to swap one asset for another based on an algorithm that always executes under any conditions — regardless of Bitcoin’s price, Ethereum’s volatility, or whether USDT deviates from $1.
The formula embedded in the AMM is always applied consistently within its trading pair.
In order for any decentralized exchange to allow users to swap one asset for another based on a specific formula, someone first has to deposit these assets into the protocol. This is the role of liquidity providers. Who are they? They are users who supply certain tokens — for example, Bitcoin and USDT — and make it possible for other people to swap between them according to a predefined formula.
In other words, liquidity providers deposit, for example, ETH and USDT. Then the AMM takes these tokens into its smart contract and allows other users to swap ETH for USDT and back, according to a predefined formula. That is all.
Let us look at a very simple, illustrative example. Imagine you run a currency exchange booth in Moscow, exchanging rubles for US dollars. You have a certain amount of capital in dollars and a certain amount in rubles. You must hold two assets to be able to exchange in both directions. That is logical.
Suppose the current exchange rate is 100 rubles per 1 dollar. Any person can come to your exchange, take 500 dollars, and give you a certain amount of rubles at the rate you set. Obviously, to avoid economic shocks and prevent people from simply coming in and taking all your dollars at once, you need a built-in system — a formula that increases the price of the asset as demand for it grows.
So, if someone comes in, takes 500 dollars from your exchange, and gives you rubles, then the dollar rate for the next customer will be higher. You must maintain a 50/50 balance between the assets, in line with their current market value. Therefore, the first customer might buy dollars at 100 rubles, and the next one might buy them at 110 rubles. Again, this example is completely abstract. If the amounts are larger, the percentage change in price will be smaller. This is just to give you an intuitive understanding of how the mechanism works.
If another person comes in and takes another 1,000 dollars, you will have even fewer dollars and more rubles. Demand for dollars increases, and your exchange automatically raises the dollar rate for the next buyer. In this way, you adjust the exchange rate and maintain a 50/50 proportion between the assets — dollars and rubles.
As a result, customers will never be able to completely drain you of all dollars or all rubles, because the formula dynamically adjusts the asset price as demand rises.
This is exactly how the standard AMM formula on decentralized exchanges of the first generation (version 2) works:
x * y = k,
where k is a constant, x is the amount of the first asset, and y is the amount of the second asset. k always remains unchanged.
We go into more detail on the formulas, the math, the swap process, how the price changes when you buy or sell a given asset for a given amount, and all the relevant calculations in the main module.
Because k is a constant, the ratio of tokens in the pool is what determines the asset price. This is exactly what I explained earlier: if the pool holds fewer dollars, the dollar price rises; if there are more dollars than originally relative to the ruble balance, rubles become more expensive. Naturally, the higher the demand for dollars in my exchange, the higher their price will be.
Another important point: the AMM of version 2, with the formula x * y = k, works across the entire price range — over the full range of possible prices.
Imagine that you have one thousand dollars, and you spread this entire amount across the entire price curve — from zero to infinity. This means that even if the price of Ethereum reaches one million dollars, part of your funds will still be allocated in that region, completely unused. And if Ethereum is trading around five thousand dollars, only a very small portion of your capital is active in this price area.
Meanwhile, the huge portion of your capital allocated near one dollar, one cent, half a cent, down to zero — and upward toward infinity — remains fully idle. That capital does not participate in swaps and does not generate fees.
The formula x * y = k allows the liquidity pool to function across this entire infinite price curve, but this leads to the main problem of version 2 AMMs: extremely inefficient capital usage. The majority of the funds are idle most of the time.
The next, more advanced version of AMM — concentrated liquidity — solves precisely this problem. Instead of spreading your entire capital from zero to infinity, you can restrict it to the specific range you are interested in.
For example, you understand that Ethereum will not fall to 10 dollars, and at the same time it will not rise to one million dollars anytime soon. So allocating capital to these extreme zones makes no sense — it will spend 99% of the time inactive. In the region of 1 dollar per ETH, capital would remain inactive 100% of the time.
This is why version 2 is inefficient. In version 3, you can choose a specific range (price interval).
For example:
- from 1000 to 5000 dollars.
As long as the price of Ethereum stays inside this range, you earn swap fees.
If ETH moves outside this interval — you stop earning.
Example:
- If ETH reaches the upper boundary at 5000$, the entire position shifts into stablecoins.
- If ETH falls below 1000$, the entire position shifts into ETH.
This is explained in far more detail in the module — here we are only introducing the concept.
Let’s summarize liquidity pools.
Version 2 (x * y = k)
Assets are always held in a 50/50 ratio based on market value.
Disadvantage #1 — low yield.
A pool that allocates capital across the entire infinite price spectrum naturally has low returns. Why? Because most of the capital is idle most of the time.
If ETH trades at 5000$, and a user swaps 1 ETH for USDT while I am a liquidity provider in a version 2 pool, I earn almost nothing. At this exact price point, out of my entire 1000-dollar position, only about 1 dollar is actively working. All the rest lies inactive in unreachable areas of the curve.
Conditionally speaking, I earned a one-dollar fee. This is very little, and the rest of the capital — the part allocated around one million dollars and the part allocated around five dollars — is simply idle and does not earn any fees. This is different from concentrated-range liquidity pools, where I specify a concrete price interval and concentrate my capital inside it, significantly increasing fee-earning efficiency.
The second feature of version-two liquidity pools is the fifty–fifty ratio of assets. If you deposit liquidity into a version-two pool, your assets will always be held in a fifty–fifty ratio based on their market value. This is neither good nor bad. This is not a plus or a minus. It is simply a structural property of version-two pools because they are built on the formula x * y = k.
The next point is low impermanent loss. This is important. It really is low. And the reason is simple: capital is distributed across the entire curve from zero to infinity. When the price of ETH rises, we earn fees, and the pool always contains some portion of ETH and some portion of the second asset.
What impermanent loss is — you do not need to think about that now. It is separate terminology, explained later in the module. Next point — very low capital efficiency. I already mentioned this above.
Version-two pools can become interesting only when additional token emissions are added on top. Because version two has very low organic yield and inefficient capital usage, the base fee income in ETH (if you provide liquidity to an ETH pair) will be extremely low. Therefore, these pools may be worthwhile only if they offer high incentives.
As I mentioned in a previous lesson: if a version-two pool has strong incentive rewards, then such a pool may make sense. Otherwise, they are not interesting at all — except perhaps stablecoin pools, and even those only if there are incentives on top. Without additional token emissions, the yield of a standard 50/50 version-two pool is extremely low.
Version 3 — concentrated-range liquidity
Now let’s move on to version-three concentrated-range liquidity pools. Here the yield is high — and the reason is obvious. We concentrate our deposit within a specific price interval. This increases fee revenue because capital is used efficiently.
The asset ratio is no longer fixed at fifty–fifty. It depends on the range you set and changes dynamically, because version three uses its own formula (more complex than x * y = k).
Impermanent loss is high. Naturally, version three has higher impermanent loss. I will explain this in detail in the module (for users with the appropriate access), but for now it’s not necessary to think about it. A clear advantage is the very high efficiency of capital usage, because we use a specific price range on the curve and earn fees effectively.
There is also a high degree of flexibility. What do I mean by flexibility? You can set any ranges with any tokens — not just stablecoins. Everything discussed today (both version two and version three) applies to all assets supported by the DEX.
This applies not only to stablecoins — it applies to any assets that can be deposited into a liquidity pool. Version-three liquidity pools allow you to position your capital however you want, depending on your goals, financial strategy, and objectives. You can use liquidity very flexibly.
Version two does not allow this. Now let’s look at several cases where using version-two liquidity pools — that is, pools with a fifty–fifty ratio and low efficiency — is truly justified.
The first case is when the trading pair includes a top-tier asset. This may be Ethereum, bitcoin, or other large-cap assets that are difficult to move. Such assets are less volatile, and this point is very important.
The first point is directly connected to the second: version-two pools can be used only if there are additional token rewards distributed by a major project — the so-called incentives. If the yield from these incentives is around twenty percent APY or higher, then such pools can be considered.
You can also use asset-to-asset trading pairs. But again: the key condition is the presence of additional token emissions. If there are no incentives, version-two pools should not be used.
Organic yield in version two is extremely low:
- about 0.5% per year for stablecoins,
- around 8% APY for Ethereum pairs, which is also low.
Asset-to-asset pairs may also be considered, such as:
- ETH — staked ETH (LST; explained in the Staking module),
- Aptos — staked Aptos,
- bitcoin — Ethereum.
In such cases, using version two may be justified — but only if there are additional token emissions. Without them, version-two pools are highly inefficient due to low yields and poor capital efficiency.
Let’s examine a concrete example of yield. This pool uses version two, the x * y = k model, which means a fifty–fifty ratio. Fee yield is 5% APY — very low. This is organic yield: fees paid by traders swapping Ton and stTon.
However, the pool also distributes TON token emissions amounting to 77% APY — which is very strong. In this case, using version two is justified because we earn not only the base fee income but also significant additional TON rewards.
This specific pool makes sense if you already hold TON, plan to hold it long-term, and understand how you manage this asset. And again, we reinforce the fundamental rule for all strategies and instruments: we only work with assets that are already in our portfolio and that we do not plan to sell in the near future.
Again, do not treat this as investment advice. Most likely, if you are watching this lesson later, not on the day it was released, this incentive program may already be over, and the yield may have dropped. This is simply an example of a situation where using version-two liquidity pools is truly justified and reasonable, because there is a large token emission.
If there were no token emissions and the base yield were just five percent APY — with nothing else added — then this would be a highly inefficient and unreasonable use of capital.
It is important to understand that incentive programs eventually end — and they always end. So this is merely an example that will help you later, when working with any DeFi instruments or DEXes, to understand that if there is an interesting version-two trading pair, then for such a pool to make sense, there must be some form of token emissions. Only then does the yield become meaningful.
Five percent APY is very low. Version-three pools can generate significantly higher returns.
Summary of today’s lesson
Now let’s summarize today’s lesson.
There are AMMs — Automated Market Makers — which are simply robots, or rather smart contracts, that exchange one asset for another according to a predefined formula, regardless of what happens outside. The pool contains two assets, and the AMM executes swaps upon user request.
All trading pairs on decentralized exchanges can be divided into three categories.
First category — stablecoin to stablecoin.
For example, USDC–USDT. This also includes pairs of staked ETH with a stablecoin or with regular ETH. stETH is pegged to ETH and has built-in staking yield, so although it is not literally a stablecoin, its behavior in a pair resembles that of a stablecoin pair.
The same applies to wrapped bitcoin. In DeFi, the native bitcoin cannot be used directly. It must be bridged into another network, such as Ethereum or Arbitrum. Therefore, DeFi uses several versions of wrapped bitcoin, and pairs between those versions also exist.
Second category — asset to stablecoin.
A classic example is ETH–USDC, BTC–USDT, AVAX–USDC, etc. One asset is volatile, the other is stable.
Third category — asset to asset.
For example, BTC–ETH, ETH–ARB, ETH–OP, ETH–SOL, and many others. The list is endless: one volatile asset paired with another volatile asset.
Also remember that there is version-two liquidity and version-three liquidity.
Version-two liquidity should only be used when there is additional token emission, providing strong yields — twenty, thirty percent APY or more. At the same time, the assets must be strong, fundamental — and importantly, they must already be part of your portfolio.
In all other cases, version-three liquidity with ranges is the better choice. In the next lesson, I will explain liquidity pools that work differently: they also earn from trading fees, but in addition, they earn because traders lose money when opening positions.
These materials are created for educational purposes only and do not constitute financial advice.