Uniswap v4 explained: hooks, singleton contract and flash accounting
Thread775 words
Explains Uniswap v4 design: hooks for custom pool logic such as dynamic fees, limit orders and TWAMM, a singleton contract, flash accounting with EIP-1153 transient storage, native ETH and the Business Source License.
Key claims
Singleton architecture cuts pool creation gas cost by an estimated 99%
v3 has handled over USD 1.5T in trading volume
v4 code is under a BSL 1.1 that restricts commercial use for up to four years
0/ people are increasingly talking about @Uniswap v4 and the implications it has ๐
through hooks, custom pools, improved architecture & gas efficiency, $UNI v4 is set to be a GAME-CHANGER for the #DeFi space ๐
a ๐งต on the vision for @Uniswap V4 (0/20) ๐
1/ two years into the @Uniswap v3 journey, the project has made considerable strides, becoming the largest decentralized exchange protocol with over $1.5T in trading volume. But @Uniswap is still evolving and refining its technology
2/ in line with their commitment to continuous growth and innovation, @Uniswap recently announced its v4. With this upgrade, @uniswap aims to revolutionize how liquidity is provisioned and how tokens are traded on-chain, carving out new possibilities in #DeFi
3/ transparency is paramount to @Uniswap. Hence, @Uniswap has released the draft code for @Uniswap v4 for public scrutiny and community contribution, hoping to build a more resilient & efficient protocol over the ensuing months
4/ @Uniswap v3 pioneered an opinionated approach to liquidity provision, dealing with an intricate balance of trade-offs. New features like the oracle integration led to real-time on-chain pricing data but came at the expense of increased fees & code complexity
5/ the plan for @Uniswap v4 is to democratize these tradeoff decisions. The introduction of "hooks" (contracts triggered at different stages of a pool action lifecycle) will allow anyone to customize their trading & liquidity protocols while optimizing for their specific needs
6/ #hooks enable the addition of unique functionalities, like pools that can dynamically adjust fees, incorporate on-chain limit orders, or operate as a time-weighted average market maker (TWAMM) that spreads out large orders over time
7/ in addition to customization, @Uniswap v4 enhances efficiency and reduces costs through a singleton contract, which hosts all pools within a single smart contract
8/ this amalgamation of hooks and singleton architecture fosters a robust platform for secure pool customization and efficient routing across multiple pools
9/ during a pool's lifecycle in @Uniswap v3, several operations occur in a strict sequence. To facilitate customizable liquidity in @Uniswap v4, hooks are deployed to execute actions at critical lifecycle points, allowing pool deployers to embed code performing specific actions
10/ hooks (plugins) let developers build atop @Uniswap Protocol's liquidity & security, resulting in custom #AMM pools. Things like #TWAMM, volatility-based dynamic fees, on-chain limit orders & out-of-range liquidity lending are among the most exciting possibilities
11/ other cool options with hooks include customized onchain oracles, auto-compounded LP fees back into LP positions & redistributing internalized #MEV profits back to LPs. @Uniswap v4, therefore, opens the door to pools of all types, defined by more than just tokens & fee tiers
12/ to ensure the system's robustness, each pool can use its own hook smart contract. However, hooks can only exercise specific permissions determined at pool creation. This principle guarantees that @Uniswap v4โs core logic remains non-upgradeable, similar to v3
13/ @Uniswap v4 introduces substantial improvements over v3's architecture, yielding significant gas savings
14/ the singleton contract will house all pools, removing the need for token transfers between different contract-based pools. Estimates suggest a pool creation gas cost reduction of 99%
15/ v4 also features a flash accounting system, which works on net balances instead of transferring assets in and out of pools after every swap. Combined with the potential of transient storage enabled by EIP-1153, these changes offer considerable gas savings
16/ @Uniswap v4โs architectural efficiency means that fee tiers are no longer rigidly defined. Pool creators can now set fees at competitive levels or dynamically adjust them via a fee hook. Moreover, native $ETH support returns in v4, contributing to additional gas savings
17/ embracing openness and transparency, the @Uniswap community will govern #v4 just like previous versions. The code will be released under a Business Source License 1.1, which restricts commercial or production use for up to four years, after which it converts to a GPL license
18/ Similar to v3, @Uniswap Governance & #Uniswap Labs can grant exceptions to the license. Protocol fee mechanism will follow v3's model, allowing Governance to vote to impose a protocol fee on any pool, up to a capped amount
19/ further details on the fee mechanism are available in the whitepaper ๐๐
github.com/Uniswap/v4-core/blob/main/whitepaper-v4-draft.pdf
20/ @Uniswap's v4 signals commitment to fostering growth & driving innovation in #DeFi
I'm convinced that by enabling enhanced customization & efficiency, @Uniswap v4 will significantly advance the industry towards a vision of a more inclusive and accessible financial future
what's your view on @Uniswap v4? ๐ค
tagging #DeFi chads to follow ๐ซก๐
@thesaint_
@DeFiMinty
@Haylesdefi
@poopmandefi
@DeFi_Cheetah
@Hercules_Defi
@ViktorDefi
@Louround_
@hmalviya9
@0xTindorr
@0xsurferboy
@Dynamo_Patrick
@CryptoShiro_
@ShivanshuMadan
@0xFlips
@0xSalazar
@Slappjakke
@Flowslikeosmo
@splinter0n
1 image on X
What came next ยท since 10 Jul 2023
Show how the covered asset moved
This explainer walks through how things work without making a call on the token, so price moves since publication are shown as market context.
Covered, no call
Since then
Zero has written 1 more piece on Uniswap and $UNI since this one.
Daily closes in USD from DefiLlama and Yahoo Finance. Only a bullish or bearish call in a thesis or market take is tracked; explainers, lists, maps and mentions are neutral context. Not financial advice.