Uniswap V4: The Future of Customizable DeFi
Since its launch in 2018, Uniswap has gone through several upgrades, with the latest being Uniswap V4. Uniswap V4 offers an array of new features, such as hooks and the Singleton, that promise to take the DeFi liquidity pool game to the next level. In this blog post, we will explore Uniswap V4's defining features and what they mean for DeFi users.
Uniswap: A Brief History
Uniswap started in August 2018 as an Ethereum-based protocol that allowed users to swap ERC-20 tokens without an order book or an intermediary. Instead, Uniswap relied on an automated market maker (AMM) mechanism that used smart contracts to ensure liquidity and trading.
With two primary roles - liquidity provision and trading - Uniswap incentivized liquidity providers with trading fees, leading to its exponential growth. Fast forward to the present day, and Uniswap boasts an impressive $1.2 trillion accumulated trade volume, over 127 million trades, 300+ integrations, and a thriving community of 4,400 delegates.
Uniswap V2 and V3: Evolution and Capital Efficiency
Uniswap continued its evolution with the launch of Uniswap V2 in March 2020. This version introduced oracles' pricing, ensuring protection against manipulation and bugs. Additionally, a game-changing event occurred in September 2020 when $UNI tokens were airdropped to early adopters, marking the transition of Uniswap's governance to the Uniswap DAO.
In March 2021, Uniswap V3 arrived, targeting enhanced capital efficiency. The core idea behind V3 was concentrated liquidity, empowering users to supply assets within specific price ranges. The tighter the range, the higher the transaction fees earned, resulting in improved capital efficiency for liquidity providers. Uniswap V3's unique approach allowed it to maintain its position as the leading DEX, capturing a substantial 57.4% share of on-chain trading volumes.
Challenges and Uniswap V4's Vision
Despite its success, Uniswap V3 faced certain challenges. Its Business Source License expiration in April 2023 opened doors for hard forks to compete directly with Uniswap. Furthermore, on-chain data indicated that active management and adjustment of the positions did not always outperform standard setups, highlighting the need for improvement.
“Uniswap v3 took a powerful, opinionated approach to liquidity provision, balancing an incredibly complex tradeoff space,” said Hayden Adams, Uniswap’s founder. “New features come at the expense of higher fees and code complexity… Our vision with Uniswap v4 is to allow anyone to make these tradeoff decisions.”
Uniswap V4: The defining features
Hooks
Hooks are a brand-new feature of Uniswap V4 that allows for custom-designed liquidity pools. Hooks are code snippets that execute specific actions at crucial stages of a pool's lifecycle, including creation, funding, trading, and withdrawal.
With hooks, DeFi users can
- create on-chain limit orders 👀
- automatically deposit tokens to lending protocols or auto-compound fees to earn interest
- create time-weighted average market makers (TWAMMs) and customize the fee structure or the price algorithm of the pool
Hooks can enable liquidity providers to optimize their returns by utilizing their idle funds in other ways, making Uniswap liquidity more versatile.
Hook also enables MEV internalization which is highly similar to ProtoRev on Osmosis but with higher network fees (due to computation costs of backward calculating), weaker ordering guarantees, and greater flash loans’ borrowing costs.
The Singleton
The Singleton is another feature of Uniswap V4 that allows an unlimited number of markets to be created using just one smart contract. Previously, swaps were done by calling the swap function on a specific pool contract, which would update the reserves and prices of the tokens in that pool. With The Singleton, the swap function is called on the smart contract, which reduces gas costs and increases efficiency. The Singleton also allows for direct interactions between different markets within the same contract, opening up many possibilities for customization and functionality.
Protocol Fee & Governance
Uniswap V4 introduces several key changes to fee structures and governance. Similar to V3, the Uniswap DAO can now collect a capped percentage of the swap fee for a specific pool. In addition, a new feature allows the DAO to collect a capped percentage of the withdrawal fee on a pool-by-pool basis.
Notably, governance no longer has control over fee tiers or tick spacings, providing more flexibility and autonomy. Moreover, the implementation of withdrawal fees is now handled through hooks, allowing for customization at the individual pool level, without any default withdrawal fee in place.
Uniswap V4: Is it as Revolutionary as V3?
Uniswap V4 introduces a new dimension of time granularity on top of the price granularity introduced in V3. This addition offers traders, market makers, and MEV searchers increased flexibility, leading to improved execution quality and reduced LP losses.
In summary, Uniswap V4 presents numerous features that benefit users by saving on gas fees and reducing LP losses. These features include:
- Singleton model: By eliminating the need for oracles from the core ERC 1155 account, pools can customize their own oracle logic or utilize external sources of price data.
- Efficient flag data storage: Optimizing loading by storing flag data in the address, this technique utilizes unused bits within the address and reduces gas costs for reading and writing small data amounts.
- Consolidation of Uniswap pools: All Uniswap pools are brought together into a single contract, incorporating accounting and gas optimizations to decrease the cost of swaps, particularly for multihop swaps.
- Flash accounting with EIP-1153: Contracts can temporarily modify their state during a transaction, reverting it back at the end without affecting the final state root. This can save gas by avoiding unnecessary SSTORE operations.
However, in terms of technological advancements, it appears that they may have hit a bottleneck. The implementation of limit orders seems reminiscent of 1inch and Izumi Finance, while the Singleton feature, consolidating vaults into a single smart contract, has already been implemented in Balancer V2.
V4 makes Uniswap a more composable protocol compared to V3. With features like hooks and the singleton, V4 simplifies building on and utilizing its liquidity. This newfound composability may unlock a wave of creativity, making DeFi fun again.
Also, the two biggest problems with DEX protocols - (1) Losses of LPs to arbitrageurs (the notorious LVR) (2) Poor quality of execution of non-arbitrage trades remained untackled though one may use hooks to build mitigating solutions but the level of flexibility provided by Hook remains debatable.
Notably, we may expect further liquidity fragmentation from Uniswap V4 which could potentially bring about higher fixed transaction costs, offsetting gas savings aforementioned, hence lower execution quality and LP losses.
WEN…?
Uniswap V4 is still simmering in the oven, but you can sneak a peek at its draft code on GitHub. The team expects it to take several months before Uniswap V4 is ready to be served up.The features we explored in Uniswap V4 represent just the tip of the iceberg. The whitepaper provides a comprehensive overview of the advancements and possibilities that await us in this latest version. Do delve deeper into the whitepaper to grasp the full extent of Uniswap V4's potential. 🦄
About Polkastarter
Polkastarter is the leading decentralized fundraising platform enabling crypto’s most innovative projects to kick-start their journey and grow their communities. Polkastarter allows its users to make research-based decisions to participate in high-potential IDOs, NFT sales, and Gaming projects.
Polkastarter aims to be a multi-chain platform. Currently, users can participate in IDOs and NFT sales on Ethereum, BNB Chain, Polygon, Celo, and Avalanche, with many more to come.
Website | Twitter | Discord | Telegram | Instagram | Youtube