Skip to content
Derivatives and DeFi · Part 3 of 3

DeFi Basics: Swaps, Liquidity Pools and Impermanent Loss

Trade, lend and earn straight from your wallet, with no exchange in between. How DeFi works under the hood, and the risks the APY banner doesn’t show.

Time6 min
Last updated20 Oct 2026
Your guide
Teddy turns a valve between two connected wooden tanks, one with dark water and one with orange water, above a small turning water wheel

The short version

  • DeFi apps are smart contracts you use straight from your wallet. No account, no KYC, no one to call if it goes wrong.
  • A DEX swaps tokens against a liquidity pool, priced by a formula. Watch slippage, price impact and MEV bots.
  • Providing liquidity earns fees, but if prices move apart you can end up with less than if you’d just held: impermanent loss.
  • The big risks are smart-contract bugs, bad approvals, depegs and “yield” paid in tokens that keep falling.

Decentralized finance, or DeFi, lets you do most of what a bank or exchange does (swap, lend, borrow, earn interest) straight from your own wallet. No sign-up, no opening hours, no one who can freeze your account.

It also has no help desk, no deposit insurance and no undo button. DeFi rewards people who understand what they’re clicking and punishes those who don’t. This guide covers the mechanics behind the most common actions, and what can go wrong with each.

How DeFi works

DeFi apps are smart contracts: programs that live on a blockchain like Ethereum, Solana or a Layer 2 such as Base or Arbitrum. You use them by connecting a self-custody wallet (MetaMask, Rabby, Phantom and others) and signing transactions.

Two things to understand from day one:

  • You pay gas for every action, in the network’s coin. On Ethereum mainnet that’s ETH; on Solana, SOL.
  • Your wallet signs what you approve. If you approve something bad, no one can reverse it. Set up a separate wallet for DeFi, as explained in Your first wallet, set up safely.

Swaps on a DEX

A DEX (decentralized exchange) like Uniswap, Curve, Aerodrome or Jupiter lets you swap one token for another. Most don’t use an order book. They use an AMM (automated market maker): a liquidity pool holding two tokens, priced by a formula.

The classic formula is x × y = k. A pool holds, say, ETH and USDC. When you buy ETH, you add USDC and take ETH out. The pool now has less ETH, so the formula makes ETH more expensive for the next buyer. Price is set by the ratio of tokens in the pool.

What that means for you:

A liquidity pool before and after someone buys 10 ETH, and the constant-product curve that sets the new price
  • Price impact: the bigger your trade relative to the pool, the more you move the price against yourself. A $1,000 swap in a pool with $50 million is fine. In a pool with $50,000, it’s painful.
  • Slippage: the price can move between when you click and when the transaction lands. Your slippage setting caps how much worse you’ll accept. Keep it low (0.5% to 1% for big tokens); very high settings invite bots to take the difference.
  • MEV: bots watch pending transactions and can “sandwich” yours, buying just before and selling just after. Low slippage settings, DEX aggregators and wallets with MEV protection reduce this.

Tip. DEX aggregators route your swap across many pools to find the best price. Many wallets have one built in.

Token approvals

Before a DeFi app can move one of your tokens, you sign an approval: permission for that contract to spend it. Many apps ask for unlimited approval by default.

That permission stays until you remove it. If the app is later hacked, or if you approved a malicious contract, your tokens can be taken without another signature. Two habits:

  • Approve only the amount you need when the wallet lets you.
  • Review and revoke old approvals regularly with a tool like revoke.cash.

See token approval in the glossary.

Liquidity pools: earning fees

Where does the pool’s money come from? From users like you. Liquidity providers (LPs) deposit both tokens of a pair, and in return they earn a share of every swap fee, typically 0.01% to 1% per trade depending on the pool.

On some DEXs (Uniswap v3 and v4, and others), LPs choose a price range. Inside it, they earn more fees for the same money. If price leaves the range, they stop earning and end up holding just one of the two tokens. More fees, more management.

Impermanent loss, explained

Here’s the catch. When the price of one token moves, arbitrage traders rebalance the pool. As ETH rises, they buy the cheap ETH from your pool until it matches the market. That leaves you with less ETH and more USDC than you deposited.

The result: you’d have more money if you had simply held the two tokens. That shortfall is called impermanent loss (IL). It’s “impermanent” because it disappears if prices return to where you entered. If you withdraw while they’re apart, it’s very permanent.

Impermanent loss grows as one token’s price moves away from the other: −5.7% at 2x, −25.5% at 5x

For a standard 50/50 pool, IL depends only on how far the price ratio moves, in either direction:

One token’s price changes byImpermanent loss vs holding
1.25× (or 0.8×)−0.6%
1.5× (or 0.67×)−2.0%
2× (or 0.5×)−5.7%
3× (or 0.33×)−13.4%
5× (or 0.2×)−25.5%

Fees can make up for it, but only if the pool trades a lot relative to its size. A pool paying 20% a year in fees still loses money against holding if one token triples. Concentrated ranges magnify both the fees and the IL.

Try your own numbers:

Base Camp tool

Impermanent loss calculator

What providing liquidity to a 50/50 pool costs you, compared with just holding both tokens.

$
%

100 = doubled, -50 = halved.

%

0 for a stablecoin.

Before trading fees, which can make up for the loss. Assumes a standard 50/50 pool such as Uniswap v2. For learning only, not financial advice.

Tip. Finematics explains this well with visuals: How do Liquidity Pools work? and What Is Impermanent Loss?.

Lending and borrowing

Lending protocols like Aave and Morpho let you deposit tokens to earn interest, or borrow against them. Every loan is over-collateralized: to borrow $1,000 of USDC, you might deposit $1,500 or more of ETH as collateral.

If your collateral falls in value and your loan crosses a set threshold, the protocol sells your collateral to repay the loan: a liquidation, just like in futures. Borrowing against volatile crypto is leverage, so the same rules apply: keep a big buffer and watch it.

Yield: where does it come from?

When a DeFi app offers 8% or 80%, ask where the money comes from:

  • Real yield: trading fees, interest paid by borrowers, staking rewards. Sustainable, usually single digits for stablecoins and major tokens.
  • Token rewards: the protocol pays you in its own token. If the token’s price keeps falling, the APY is mostly an illusion.
  • Leverage loops and points programs: higher returns, stacked risks.

APR is simple interest; APY includes compounding. Our APR/APY calculator converts one into the other:

Base Camp tool

APR to APY converter

Turn a simple yearly rate into the real one with compounding, or back.

%
$

For learning only, not financial advice.

The risks to know

  • Smart-contract bugs and exploits: even audited protocols get hacked. Spread funds, favor long-running protocols.
  • Bridges: moving tokens between chains through a bridge adds the bridge’s own risk. Bridges have been some of the biggest hacks in crypto history.
  • Depegs: stablecoins and wrapped tokens can lose their peg.
  • Oracle failures: if the price feed a protocol relies on is manipulated, liquidations and losses follow.
  • Rug pulls: new pools and farms can be traps. See The 10 most common crypto scams.
  • Your own mistakes: wrong network, bad approval, phishing site. Bookmark the apps you use.

Watch out. If you can’t explain where the yield comes from, you are the yield. Start with small amounts on established protocols, and never put money in DeFi that you can’t afford to lose entirely.

Before you use a DeFi app

  • I reached the app through a bookmark, not a link or ad
  • I’m using a separate wallet for DeFi, not my savings wallet
  • I know where the yield comes from
  • I set a sensible slippage limit
  • I approved only what I need, and I’ll revoke it later
  • I understand what happens if one token’s price doubles or halves

Where to go next

That completes Ridge. You have a plan, a journal, price action skills and an understanding of derivatives and DeFi. Summit starts where most traders stop looking: Advanced market structure: liquidity, sweeps and deviations.

Written by
VikingXBT

On the climb since 2017. Trades futures and reads onchain data. Automates the boring parts.

More from VikingXBT →