◧ Territory · 10 inbound routes · 1,724 words

Swaps, Explained

A swap is the direct exchange of one cryptocurrency or token for another — without a centralized intermediary holding custody of either asset at any point during the trade.


Token swaps sit at the operational center of decentralized finance. Every time someone converts ETH to USDC, bridges BTC to a smart-contract chain, or rotates out of a yield position, a swap mechanism is doing the work. Understanding how that mechanism functions — and what can go wrong — is foundational knowledge for anyone participating in on-chain markets.

What a Swap Actually Does

At its core, a swap replaces the traditional order-book model. In centralized exchanges, a buyer and seller must be matched; an intermediary holds funds during settlement. Decentralized swaps route trades through smart contracts that hold pooled liquidity and execute atomically: both legs of the trade happen in a single transaction, or neither does.

The most common implementation is the automated market maker (AMM), pioneered at scale by Uniswap. Instead of matching orders, AMMs maintain liquidity pools — pairs of tokens (e.g., ETH/USDC) contributed by liquidity providers. The pool's pricing follows a mathematical invariant, most commonly the constant-product formula x * y = k, where x and y are the reserve balances of each token. A swap shifts the ratio, and the formula automatically adjusts the marginal price.

Uniswap has become something close to the reference implementation of this model. It now powers roughly 31% of MetaMask swaps on Ethereum mainnet — a striking figure given the number of competing protocols — and has expanded to offer in-app wallet integration, portfolio tracking, and native cross-chain swap support.

JLJohn
Apr 2, 2026
View article →

NEAR Intents goes live with confidential swaps shielding amounts, routes, and wallets across 100+ assets on 30+ chains

NEAR Intents goes live with confidential swaps shielding amounts, routes, and wallets across 100+ assets on 30+ chains
𝕏/@near_intents Apr 2, 2026
Top Comment
Benthic
Apr 2, 2026

No public RPC, no block explorer, permissioned validators processing transactions they "can't read" — this is a TEE-based trust model repackaged as privacy infrastructure. Intel SGX side-channel attacks have been demonstrated repeatedly since 2018 (Foreshadow, Plundervolt, AEPIC Leak), and NEAR's confidential shard inherits every one of those assumptions. Viewkeys for selective disclosure to regulators is clever positioning for institutional adoption, but it also means this is privacy-from-the-public, not privacy-from-authority — a fundamentally different guarantee than what ZK-based systems like Aztec or Zcash shielded pools offer. 100+ assets across 30+ chains routed through a single TEE bridge is a massive honeypot surface if those enclaves get popped.

◧ What our coverage revealsLeviathan signal

Readers engage with swaps not as a DeFi primitive but as a three-way extraction battleground: wallets embedding swap fees into UX convenience, nation-state actors using swap rails to launder stolen funds, and regulators threatening to criminalize the act of swapping itself.

4,777 reader clicks across 42 stories41% on the top 10%most-read: 991 clicks ↗

On-Chain Swaps: Single-Chain vs. Cross-Chain

The original DeFi swap existed within a single blockchain. You could exchange any ERC-20 token for any other ERC-20 token on Ethereum, settled in one block. This remains the dominant use case by volume.

Cross-chain swaps solve a harder problem: moving value between entirely separate blockchains — say, native BTC on the Bitcoin network to ETH on Ethereum — without wrapping assets through a custodian. The approaches differ meaningfully:

  • Atomic swaps use hash time-locked contracts (HTLCs) to link two transactions across chains cryptographically, so both settle or both refund. Elegant in theory; limited in practice by liquidity and latency constraints.
  • Cross-chain liquidity protocols like THORChain maintain native asset pools on multiple chains, routing swaps through a shared settlement layer. THORChain's frontend recently crossed $1 billion in cumulative swap volume, and the protocol has introduced "Rapid Swaps" — a mechanism that splits large trades into multiple sub-swaps executed per block to reduce slippage and settlement time. Maya Protocol, which shares architectural DNA with THORChain, went live with decentralized swaps from DASH to multiple chains inside the DashPay wallet.
  • Bridge-plus-swap aggregators wrap a bridge transfer and a DEX swap into a single user action. The 0x Cross-Chain API, currently in private beta across 15+ chains, is an example of infrastructure that exposes this as a composable building block for wallet and application developers.
  • Intent-based systems represent a newer approach. Rather than specifying the exact route, the user declares an intent — "I want X amount of token B for token A" — and a network of solvers competes to fill it optimally. NEAR Intents launched with confidential swap execution, shielding amounts, routes, and wallet addresses across 100+ assets on 30+ chains.

BOB Gateway recently launched fixed-rate, instant BTC swaps — a product responding to demand for price certainty on large BTC conversions, though the protocol briefly paused its gateway swaps following the KelpDAO exploit while confirming there was no exposure.

Aggregators: Routing for Best Execution

Single-protocol swaps rarely offer the best price for any given trade. Liquidity is fragmented across dozens of AMMs, order books, and private market makers. Aggregators solve this by splitting and routing orders across multiple sources simultaneously.

1inch is the most widely integrated aggregator by API adoption. Its Pathfinder algorithm examines thousands of possible routes and splits trades across pools to minimize price impact. KuCoin's Web3 Wallet recently integrated the 1inch API specifically to enable gasless swaps for real-world asset (RWA) tokens — highlighting how aggregator infrastructure is now embedded silently inside consumer wallets rather than accessed directly.

The competitive dynamic here is compression: aggregators commoditize swap execution quality, pushing the differentiation to user experience, gas efficiency, and cross-chain capability.

◧ The angles that pull readers in6 threads
  1. 01
    Wallet-native swap integration

    Safe{Wallet}'s CoW Swap partnership (991 clicks, the dominant signal) shows readers want swaps embedded directly in their existing custody layer, not routed through a separate DEX UI.

  2. 02
    Swap fee extraction economics

    Uniswap's 0.25% UI fee, Phantom's 0.85–1.5% take, and WLFI's 10% pre-launch fee pulled readers tracking who captures value from their trades and whether the DEX promise of low-cost swaps is eroding.

  3. 03
    Cross-chain intent-based routing

    1inch's atomic swap white paper, NEAR Intents' confidential cross-chain swaps, and Uniswap adding Solana via Jupiter signal readers following the technical race to make multi-chain execution seamless and trustless.

  4. 04
    Institutional stablecoin swap adoption

    Deutsche Bank on UDPN, Securitize/Ethena enabling 24/7 BUIDL-to-USDtb atomic swaps, and Nubank offering USDC swaps to 100M customers show readers watching TradFi legitimize swap infrastructure.

  5. 05
    Swaps as laundering rail

    Lazarus Group converting Lykke hack proceeds via DAI swaps and the XRP thief routing funds through 120+ Ripple-to-Tron swaps on Bridgers demonstrate that readers track how adversaries exploit swap anonymity to disperse stolen funds.

  6. 06
    Regulatory criminalization of swaps

    The Treasury's proposed mixer rule under the PATRIOT Act explicitly naming swaps and wallet-splitting as potential targets drew readers alarmed that ordinary self-custody activity could become a federal offense.

Slippage, Price Impact, and MEV

Three related concepts govern swap economics and are frequently misunderstood as the same thing:

Price impact is deterministic. A large trade relative to pool depth moves the AMM's price curve, meaning you receive fewer output tokens than a smaller trade would achieve at the quoted rate. It's a function of pool size and trade size.

Slippage tolerance is a user-set parameter that defines the maximum acceptable gap between the quoted price and the executed price. If market conditions move the price beyond that tolerance before the transaction confirms, the swap reverts. Setting tolerance too low causes frequent failed transactions; setting it too high opens the door to exploitation.

MEV (Maximal Extractable Value) via sandwich attacks is the exploitation vector. A bot detects a pending swap in the mempool, inserts a buy transaction immediately before it (pushing the price up), allows the victim's swap to execute at the worse rate, then sells immediately after (capturing the price difference). The victim bears both slippage and the value extracted. Research and tooling around this — including MEV-aware RPC endpoints and private transaction relays — has become a significant area of protocol development. Choosing a DEX aggregator or wallet that routes through MEV-protected infrastructure meaningfully reduces exposure.

Swap Infrastructure Inside Wallets

The boundary between "wallet" and "exchange" has collapsed. Virtually every non-custodial wallet now embeds swap functionality, either through proprietary infrastructure or third-party APIs.

Ledger recently added in-app swaps for Ondo tokenized stocks, bringing RWA exposure directly into its hardware wallet interface. The same wallet added NEAR Intents swaps — though with explicit user warnings about risks of fund loss and potential scams, reflecting the early-stage nature of cross-chain intent infrastructure.

Uniswap's own wallet has evolved to include cross-chain swaps and portfolio tracking, reducing the need to switch between applications. Intent-based AI wallets are also emerging as a category: rather than requiring users to navigate DEX interfaces manually, these wallets accept natural-language instructions and route accordingly.

The practical upshot is that swap quality — execution price, speed, gas cost, and MEV protection — is increasingly a wallet feature, not a separate application decision.

◧ Timeline8 events
  1. 2020-01launch

    Curve Finance launches as stablecoin-optimized AMM

  2. 2021-05launch

    Uniswap V3 launches concentrated liquidity for targeted swap efficiency

  3. 2023-07launch

    UniswapX launches intent-based protocol enabling zero-gas swaps via fillers

  4. 2023-10milestone

    Uniswap interface begins charging 0.25% fee on swaps

  5. 2024-05exploit

    Lazarus Group launders Lykke hack proceeds via DAI swaps across multiple wallets

  6. 2024-09milestone

    1inch publishes white paper on intent-based atomic cross-chain swaps

  7. 2025-01launch

    NEAR Intents goes live with confidential cross-chain swaps across 100+ assets on 30+ chains

  8. 2025-03launch

    Safe{Wallet} ships native swaps powered by CoW Swap

Institutional and OTC Dimensions

Large holders often bypass on-chain AMMs entirely for significant position changes. OTC (over-the-counter) desks offer bilateral trades at negotiated prices, avoiding both price impact and public mempool exposure. A recent example: a whale reportedly used OTC to rotate $272 million into wstETH and $222 million into cbBTC amid KelpDAO turbulence — a trade that would have been impossible to execute on-chain without catastrophic slippage.

The futures vs. swaps debate has a parallel in traditional finance that has resurfaced in crypto. Kalshi's launch of crypto perpetuals reignited discussion about whether perpetual futures or swap contracts better serve price discovery and risk management for institutional participants — a question with regulatory as well as structural dimensions that remains unresolved.

Gas, Fees, and Cost Structure

Every on-chain swap carries a cost structure with three components:

1. Protocol fee: Paid to the liquidity pool or protocol treasury. Uniswap V3 pools charge between 0.01% and 1% depending on the fee tier selected. 2. Liquidity provider fee: Distributed to LPs as a return on the capital they provide. 3. Gas fee: Paid to network validators for including the transaction. On Ethereum mainnet, this can dwarf the protocol fee for small trades. On Layer 2 networks (Arbitrum, Base, Optimism) and alternative L1s, gas is typically a fraction of a cent.

Gasless swap experiences — where a third party sponsors or batches the gas cost — are becoming more common through ERC-4337 account abstraction and relayer networks. The 1inch integration in KuCoin's wallet uses this to offer gasless RWA swaps specifically.

0xpmm.eth
Nov 4, 2025
View article →

Balancer v2 exploit post-mortem reveals rounding flaw in stable pool invariant — attacker manipulated batch-swaps to distort BPT pricing and drain funds, echoing prior Bunni rounding bug warnings about Solidity’s math limits.

Balancer v2 exploit post-mortem reveals rounding flaw in stable pool invariant — attacker manipulated batch-swaps to distort BPT pricing and drain funds, echoing prior Bunni rounding bug warnings about Solidity’s math limits.
𝕏/@moo9000 Nov 4, 2025
Top Comment
Spencer420
Nov 6, 2025

"An attacker manipulated exchange rates in Balancer V2 stable pools by issuing a long, alternating batch‑swap sequence that exploited rounding in the stable invariant. The sequence produced an underestimation of the invariant D, which reduced the implied BPT price. Proceeds accumulated as internal balances and were withdrawn in a subsequent transaction."

◧ Risk matrixanalyst read
  • Smart ContractHigh

    Balancer's stable-pool rounding flaw exploited via batch-swaps to distort BPT pricing, and a $2M MEV bot drain on Curve pools via reverse-swap arbitrage, confirm that AMM invariant math errors remain an acute, recurring attack surface.

  • RegulatoryHigh

    The US Treasury's proposed PATRIOT Act 'mixer rule' explicitly frames routine swap activity and wallet-splitting as potential criminal acts, introducing compliance uncertainty for every on-chain swap aggregator and wallet provider.

  • CentralizationMedium

    Front-end fee layers — Uniswap UI (0.25%), Phantom (0.85%), MetaMask — are concentrating swap revenue extraction in a handful of wallet gatekeepers, recreating brokerage rent-seeking within nominally permissionless infrastructure.

  • LiquidityMedium

    MEV bots executing large swaps in Curve pools to create exploitable arb conditions illustrate that thin or concentrated liquidity remains vulnerable to adversarial routing manipulation even on battle-tested AMMs.

  • Counterparty / CustodialMedium

    In-wallet swap integrations (Safe + CoW, MetaMask + Hyperliquid) shift execution trust from DEX smart contracts to the wallet provider's routing layer, introducing an opaque intermediary whose fill quality is hard for users to audit.

  • MarketLow

    Cross-chain competition is compressing swap fees: Uniswap adding Solana via Jupiter, 1inch launching Solana-EVM native swaps, and Odos V3's programmable routing increase substitutability and limit sustained fee extraction.

Security Considerations

Swap infrastructure has been the site of significant exploits:

  • Smart contract bugs in AMM pool logic have enabled flash loan attacks that drain liquidity.
  • Oracle manipulation targets protocols that rely on spot AMM prices as price feeds for other operations.
  • Approval exploits occur when users grant unlimited token spending approval to a malicious or compromised contract. Best practice is to use limited approvals or revoke unused ones via tools like Revoke.cash.
  • Bridge exploits compound the cross-chain swap attack surface significantly — bridge contracts controlling large cross-chain liquidity pools have been among the largest DeFi hacks by dollar value.
  • Phishing via swap UIs remains common. Fake Uniswap or 1inch interfaces that look legitimate but route funds to attacker-controlled contracts continue to claim victims.

BOB pausing gateway swaps in response to the KelpDAO hack — even with no direct exposure — reflects the kind of defensive posture that maturing protocols are taking when adjacent infrastructure is compromised.

Regulatory Context

Swap protocols occupy genuinely ambiguous regulatory territory. The SEC has periodically argued that some token-to-token swaps may constitute securities transactions. The CFTC's view of perpetual swaps as futures products differs jurisdictionally. The EU's MiCA framework addresses exchange-like services but has limited coverage of non-custodial AMMs.

In practice, most on-chain swap protocols operate without KYC because the smart contract has no counterparty with regulatory obligations. The legal exposure falls on front-end operators and, potentially, governance token holders — a tension that has driven several protocol teams to implement geographic restrictions on their front-end interfaces while leaving the underlying contracts permissionless.

Outlook

The structural direction is clear: swaps are becoming faster, cheaper, more private, and more cross-chain by default. THORChain's Rapid Swaps and NEAR's confidential intent system represent two ends of a convergent trajectory — high throughput and privacy-preserving execution. The 0x Cross-Chain API entering private beta across 15+ chains signals that cross-chain swap infrastructure is maturing from experimental to production-grade for application developers.

What remains contested is the user experience layer. Wallet-embedded swaps, AI-assisted routing, and intent-based execution are each bids to make the complexity invisible. Whether MEV protection and slippage management can be reliably abstracted away — without introducing new trust assumptions — is the open engineering and security question that will define the next phase of swap infrastructure.

Latest Swaps news

Was this explainer helpful?

Community notes

Spot something off or out of date? Drop a note. Editors review topic notes daily and roll accepted fixes into the explainer — contributors are recognized in the monthly $SQUID drop.

0/1000

Loading notes…