
DeFi Evaluation Method: Uniswap Iteration Review
TechFlow Selected TechFlow Selected

DeFi Evaluation Method: Uniswap Iteration Review
Uniswap's evolution from version V1 to V4, as well as the introduction of the UniswapX protocol, reflects an underlying logic of functional innovation for DEX (AMM).
Recently, I've been summarizing an evaluation methodology for the DeFi sector. After researching several cases, Uniswap stands out as a typical representative both in terms of influence and iterative logic.
From its V1 to V4 versions, and with the introduction of the UniswapX protocol, Uniswap’s internal logic has consistently focused on functional innovation and mechanism optimization for DEX trading.
V1 pioneered the initial implementation of AMM in the crypto space; V2 reduced ETH exposure and introduced a more manipulation-resistant price oracle; V3 addressed capital inefficiency through concentrated liquidity; V4 enabled customizable DEX functionality; and the UniswapX protocol enhances competition among third-party aggregators via an auction mechanism, thereby optimizing price slippage.
Uniswap Development History
Uniswap's position and influence need no elaboration. According to real-time data from Dune, Uniswap remains the DEX with the largest market share to date.
Although it hasn't existed for very long as a leading DEX, its repeated iterations are worth reviewing:
June 2017: Vitalik published the article "On Path Independence";
November 2018: Uniswap V1 launched — enabling trades between ETH and ERC-20 tokens;
March 2020: Uniswap V2 launched — enabling direct trading between any two ERC-20 tokens;
May 2021: Uniswap V3 launched — improving LP capital efficiency by introducing concentrated liquidity;
June 2023: Uniswap V4 released — introducing Hooks for customization and preventing value leakage;
July 2023: Uniswap X launched — aggregating on-chain and off-chain liquidity with MEV protection.
Uniswap V1: Experimenting with Automated Market Making
In 2017, Vitalik introduced the concept of Automated Market Makers (AMM) in his blog post "On Path Independence," marking the first application of AMM within the crypto domain. While similar mechanisms had been discussed outside of crypto—such as in traditional finance—this was a novel idea for blockchain-based trading.
We know that in stock markets, futures markets, or existing CEXs, trading mostly occurs through an Order Book model. Market makers (e.g., brokers or centralized exchanges) match buy and sell orders at matching prices to facilitate transactions between buyers and sellers.
However, this approach faces challenges in decentralized environments. In a DEX setting—where anyone can create markets—it's difficult to maintain sufficient liquidity using order books, resulting in poor trade execution rates and user experience. Without adequate liquidity, DEXs struggle to match the efficiency of CEXs.
Vitalik’s article introduced a new concept to the crypto market: the Automated Market Maker (AMM). Instead of relying on order books, asset pricing is determined algorithmically.
Under the AMM model, there's no need for market maker quotes or system-based order matching. Traders can directly swap assets using pool liquidity.
TokenA and TokenB maintain a constant product relationship: tokenA_balance(p) * tokenB_balance(p) = K (where K remains constant).
This is a liquidity-driven trading mechanism, known as Constant Product Market Making (CPMM).
By defining any (monotonic) relationship between TokenA and TokenB and computing its derivative at any time, prices can be derived, forming a path-independent market maker.
Three Key Participants: LPs, Traders, and Arbitrageurs
In the AMM mechanism, unlike the order book model, there are no specific counterparty traders. The actual value of assets is determined mathematically by the constant product formula—effectively making the smart contract itself the counterparty, enabling automated asset swaps.
The smart contract requires someone to provide liquidity. These contributors are called Liquidity Providers (LPs), who deposit assets into the pool’s smart contract to enable trading and earn a portion of transaction fees in return.
Once LPs establish initial liquidity, traders can begin swapping tokens, while arbitrageurs naturally enter the scene to exploit price differences across markets, helping align the pool price with the broader market price.
In Uniswap V1, launched in November 2018, all assets were traded via ETH. Trades occurred between ETH and ERC-20 tokens, meaning anyone could add a token to pair with native ETH—making ETH the de facto intermediary in all trades.
What happens when we make a trade within a single pool?
Suppose one ETH equals 100 TokenA, and an ETH/TokenA pool consists of 10 ETH and 1,000 TokenA.
At this point, 10 ETH and 1,000 TokenA are equally valued at $1,000, maintaining a 1:1 value ratio.
k = 10 * 1,000 = 10,000. This product remains fixed unless additional liquidity is added.
Now suppose I want to sell 5 ETH into the pool. Then:
y = 10,000 / (10 + 5) = 666.67. The ETH balance increases to 15, while the TokenA balance drops to 666.67. Thus, I receive 333.33 TokenA for my 5 ETH. The new ETH price becomes 666.67 / 15 = 44.44, meaning 1 ETH now equals 44.44 TokenA.
Of course, if the pool price deviates significantly from other markets, arbitrageurs will quickly step in to eliminate the price difference. Since AMM only generates trading prices but cannot discover true market prices, arbitrageurs play a crucial role.
Impermanent Loss, LP Tokens, and Slippage
Impermanent loss occurs when the price ratio of deposited tokens changes relative to when they were initially deposited. The greater the change, the larger the impermanent loss.
Let’s continue with an example as an LP:
Uniswap V1 core formula: x*y = k
As a liquidity provider, let's deposit 10 ETH and 1,000 TokenA into the pool. At this moment, 1 ETH = 100 TokenA, so the constant product is 10 * 1,000 = 10,000 (x*y=10,000, x=100y).
Now suppose the price rises to 1 ETH = 200 TokenA. We can solve:
x*y = 10,000, x = 200y → x ≈ 7.071, y ≈ 1,414.21
The pool balance shifts from 10 ETH and 1,000 TokenA to approximately 7.071 ETH and 1,414.21 TokenA.
Do you see the issue?
If I withdraw all assets now, I get 7.071 ETH and 1,414.21 TokenA. Valued in TokenA, this equals 7.071 * 200 + 1,414.21 = 2,828.41. But if I had simply held the original 10 ETH and 1,000 TokenA, their current value would be 10 * 200 + 1,000 = 3,000 TokenA.
The difference (3,000 - 2,828.41 = 171.59 TokenA) represents impermanent loss.
Impermanent loss arises because under the AMM model, LPs automatically rebalance their holdings based on price movements, leading to principal erosion and missed gains.
Since LPs act as both buyers and sellers, they are forced to accumulate more of an asset when its price falls and reduce holdings when it rises, resulting in losses.
You can mitigate this risk through hedging strategies, such as opening short or long positions against ETH.
To incentivize users to become LPs and bear price volatility, LP Tokens were introduced.
These serve as rewards for liquidity providers, entitling them to a share of trading fees (in Uniswap V1, traders pay 0.3% per trade, which goes entirely to LPs). They also function as proof of stake, allowing LPs to reclaim their deposited liquidity.
Another key concept is slippage—a term familiar to frequent DEX traders. As a liquidity-driven trading system, AMM relies on a smooth curve defined by the elegant constant product equation, where prices continuously adjust based on supply and demand.
When large trades occur, slippage emerges—the difference between your expected price and the actual execution price. In other words, the price you anticipate may differ from the final executed price.
Uniswap V2: Adaptation, Oracles, and Flash Loans
Uniswap V1 only supported ETH/ERC-20 trading pairs, effectively using ETH as an intermediary currency for ERC-20 token swaps. Although simple, this created ETH exposure, impermanent loss, and slippage risks for LPs.
Uniswap V2 retained the “constant product market maker” mechanism but brought significant improvements: supporting direct ERC-20/ERC-20 trading pairs, eliminating the need to route through ETH.
Beyond this, two major upgrades stood out: improved price oracles and flash loans.
Improvement of Price Oracle
In Uniswap V1, deriving prices by dividing the reserves of two assets within the pool was vulnerable to manipulation if used as an on-chain price feed.
One goal of the V2 upgrade was to increase the cost and difficulty of price manipulation.
For example, in V1, if another contract used the ETH-DAI price to settle derivatives, an attacker could buy ETH from the ETH-DAI pool at an inflated price, triggering derivative settlement, then sell ETH back to restore the price—all potentially done atomically or via miner-controlled transaction ordering.
In V2, to better reflect market equilibrium, the price updates once per block, with the exchange rate calculated before the next block begins—meaning the price reference is based on the last trade of the previous block.
Additionally, V2 introduced Time-Weighted Average Price (TWAP) data. At the start of each block, the relative prices of the two assets are accumulated, allowing other Ethereum contracts to estimate the TWAP over any desired interval.
More precisely, Uniswap V2 accumulates price totals whenever someone interacts with the contract at the beginning of a block. Each price is weighted by the duration since the last update, based on block timestamps. Therefore, at any given moment, the accumulator reflects the sum of spot prices per second throughout the contract’s history.
Oracle users can choose arbitrary start and end times, making TWAP manipulation significantly more expensive and less feasible.
Implementation of Flash Loans
Flash loans represent a radical innovation compared to traditional finance, as real-world transactions lack blockchain-like rollback capabilities.
V2 introduced Flash Swaps, allowing users to borrow assets from the pool and use them elsewhere on-chain, repaying the loan plus fees within the same atomic transaction. If repayment fails, the entire transaction reverts.
Effectively, anyone can instantly borrow any asset stored in Uniswap pools. In V1, users couldn’t receive and use an asset before paying for it—for instance, to swap TokenA for TokenB, they first had to send TokenA to the contract.
Other updates in V2 included a revised contract framework, using fixed-point binary encoding for price precision, protocol fee adjustments, and support for meta-transactions on minted pool shares.
Uniswap V3: Enhancing Capital Efficiency
Background: Uniswap V2 faced liquidity inefficiencies.
As explained earlier, in V1 and V2, liquidity was spread uniformly across the entire price range [0, +∞). This meant that theoretically, trades could occur at any price along the hyperbolic curve defined by the constant product formula.
While this seems beneficial—offering wide trading ranges—in practice, most trading activity clusters around narrow price intervals. For assets with varying volatility, this leads to severe liquidity fragmentation and low capital utilization outside active price zones.
Providing liquidity far from the current price is often pointless and wasteful, as those price levels may never be reached.
Concentrated Liquidity
To address this, Uniswap V3 introduced concentrated liquidity—allowing LPs to allocate liquidity within specific price ranges.
This enables more efficient capital deployment in high-activity price bands and allows tailored configurations for pools with different volatility profiles.
Each small price interval in V3 functions like a standalone V2 pool. During trading, the price moves smoothly along the curve. When it reaches the boundary of one interval, it transitions to the next.
With this understanding, we introduce a key concept in V3: Ticks.
Ticks represent the smallest price increments tradable within the system. In V3, the entire [0, +∞) price range is divided into numerous fine-grained ticks, enabling precise control over upper and lower price bounds.
Through granular tick control, the entire price axis is discretized into evenly spaced ticks, each with an index and corresponding price, and each possessing its own liquidity depth.
Mathematically, V3 differs slightly from V2, though the foundation remains similar: L = √(xy).
L represents the liquidity amount—a composite measure of the two token balances in the pool. While the product of the two token quantities still equals K, liquidity depth varies across ticks, so equivalent formulas differ accordingly.
We won’t delve deeper into the mathematics here. Interested readers can refer to Atis Elsts’ paper on V3’s mathematical principles.
While V2 used a flat 0.3% fee, V3 offers three fee tiers—0.05%, 0.3%, and 1%—based on tick granularity. LPs can now concentrate capital in the most actively traded price ranges to maximize returns.
Additionally, V3 further optimized the oracle system inherited from V2 by storing multiple accumulation variables instead of just one, extending data usability and reducing gas costs.
Uniswap V4: Customizable, Programmable DEX
Building on Uniswap V3’s concentrated liquidity model, V4 allows anyone to deploy custom liquidity pools on Uniswap, transforming it into a highly efficient, customizable DEX platform.
The core innovation in V4 is the Hooks contract, aiming to empower creators to make flexible design decisions through plug-in logic.
For each pool, creators can define a "Hooks contract" that executes custom logic at critical lifecycle points. These hooks can also manage swap fees and withdrawal charges for LPs.
Hooks & Custom Pools
Hooks are a set of contracts developed by third parties or the Uniswap team. When creating a pool, operators can bind it to a hook, which will be automatically invoked during specific trading stages. The hook executes developer-defined logic at key lifecycle events.
In other words, hooks are externally deployed contracts that execute custom logic at specified points during a pool’s operation. They allow integrators to build concentrated liquidity pools with flexible, programmable behavior. Hooks can modify pool parameters or introduce new features.
Every Uniswap liquidity pool has a lifecycle: creation with default fee tiers, adding/removing/rebalancing liquidity, and token swaps. In Uniswap V3, these lifecycle events are tightly coupled and strictly ordered.
But Uniswap V4 introduces Hooks to enable customizable liquidity. Hook contracts give pool deployers a way to inject code, allowing custom actions at key lifecycle moments—such as before or after swaps, or when LP positions change.
In short, hooks are plugins for customizing how pools, swaps, fees, and LP interactions work. Developers can innovate atop Uniswap’s liquidity and security by integrating hooks with v4 smart contracts to create customized AMM pools.
Examples of functionalities achievable via hook contracts include:
Executing large orders over time via TWAMM;
On-chain limit orders executed at specified prices;
Dynamic fees adjusted based on volatility;
Internal MEV distribution mechanisms for LPs;
Implementing median, truncated, or other custom oracles.
The core logic of Uniswap V4 remains identical to V3—immutable and non-upgradable. However, since each pool is now defined not just by tokens and fee tiers but also by its associated hook, a wide variety of specialized pools can be built. Although each pool can have its own hook contract, the hook’s permissions are fixed at pool creation.
V4 also includes architectural improvements such as Flash Accounting, which significantly reduces gas costs. This feature leverages EIP-1153’s “transient storage,” implemented post-Cancun upgrade on Ethereum.
Additional enhancements in V4 include singleton pattern (storing all pool states in a single contract), flash accounting (ensuring pool solvency), restored native ETH support, ERC-1155 token compatibility, and enhanced governance mechanisms.
UniswapX: Strengthening Competition
UniswapX is a new permissionless, open-source (GPL), auction-based protocol for trading across AMMs and other liquidity sources.
The protocol improves swap functionality in several ways:
Better prices through aggregated liquidity;
Gasless swaps;
MEV protection;
No fees if trades fail;
Cross-chain swaps without gas will roll out in the coming months.
Next-level Aggregation
Background: Ongoing innovation in on-chain trading has led to an explosion of liquidity pools. New fee tiers, Layer 2 solutions, and additional protocols further fragment liquidity.
Solution: UniswapX addresses this by outsourcing routing complexity to a competitive network of third parties, who must compete to fill trades using AMM pools or their private inventories.
With UniswapX, traders can use the Uniswap interface without worrying about getting the best price. Their trades are always transparently recorded and settled on-chain. All orders are powered by Uniswap’s Smart Order Router, forcing third parties to compete with Uniswap V1, V2, V3, and eventually V4.
Essentially, UniswapX strengthens competition by leveraging third-party routing to optimize price slippage across asset pools.
Moreover, UniswapX introduces new innovations:
Gasless trading with no fees on failure. Traders sign unique off-chain orders, which third parties submit on-chain by paying gas. Third parties factor gas costs into the trade price but can reduce costs by batching multiple orders to compete for better rates.
MEV protection: Previously extracted MEV is returned to traders via better prices. UniswapX helps users avoid explicit MEV extraction—orders executed via third-party private inventory cannot be sandwich attacked, and routers are incentivized to use private transaction relays when routing to on-chain liquidity.
The upcoming cross-chain version of UniswapX will combine swapping and bridging into a seamless operation. With cross-chain UniswapX, users will be able to swap across chains in seconds—stay tuned for developments.
Uniswap's Core Theme: Iteration
From V1 to V4 and the launch of the UniswapX protocol, Uniswap’s evolution reflects continuous functional innovation in DEX (AMM) design.
V1 pioneered AMM in crypto; V2 reduced ETH exposure and introduced manipulation-resistant oracles; V3 solved capital inefficiency via concentrated liquidity; V4 enabled customizable DEXs; and UniswapX optimizes price slippage by enhancing competition among third-party aggregators through an auction mechanism.
We can see that every step Uniswap takes is a self-driven revolution—reducing borrowing costs, improving user experience, strengthening competitive dynamics, and embracing emerging technologies. This relentless iteration is precisely what enables a protocol to achieve long-term sustainability and success.
Join TechFlow official community to stay tuned
Telegram:https://t.me/TechFlowDaily
X (Twitter):https://x.com/TechFlowPost
X (Twitter) EN:https://x.com/BlockFlow_News













