A few months ago, we announced a vision for Uniswap v4. In it, we introduced hooks and how they turn liquidity on Uniswap into a platform for developers to create pools with new and unique features. This vision for Uniswap came with unfinished v4 code to serve as a starting point for the Uniswap community to build on. Since then, the Uniswap community has been out in force. With the support of the Uniswap Foundation, developers have worked on hundreds of hook ideas, implementations, hackathons, Github commits, and educational resources.
Hooks are the newest addition in Uniswap v4. They are like plugins that let developers innovate on the Uniswap Protocol's liquidity and security to create new AMM features.
Hooks are smart contracts that can run arbitrary code at various points of a pool action's lifecycle. These hooks are permissionless, meaning anyone can create and deploy a hook. Once created, pool deployers choose which hooks they want to enable in their pools; hooks are not enforced across all pools. For example, a USDC/ETH pool deployer can enable a TWAMM hook and a more resistant oracle. For a more technical explanation of hooks, please read the Uniswap Foundation's documentation.
When we open-sourced the v4 code, we published a few sample hook contracts. Since then, dozens of other hooks have been coded, including:
- Arbitrage Controller: Sets dynamic fees for a pool based on the price movements to discourage informed order flow from arbitrageurs.
- Crosschain Liquidity: Transfers the user's LP to another chain, without them having to worry about bridging.
- Fair Trade: Launches tokens with safety guarantees for future token holders and traders.
- Median Price Oracle: A median price oracle that is more resistant to manipulation than TWAP.
- Backrunning: Captures arbitrage after a swap and distributes profits back to the LPs instead of being captured by backrunning MEV arbitrageurs.
- Vote Escrow: A Curve-style voting escrow (ve) hook.
- Automated Buybacks: Allows protocols to automate token buybacks from their treasure when prices drop below some threshold.
Uniswap v4's hook design gives developers much more flexibility using liquidity on Uniswap. Developers will build new and exciting AMM features that we haven't thought of yet. The sky is the limit, and we've seen so much excitement at the events we've done with the Uniswap Foundation at EthCC and EthGlobal NYC.
Open-sourcing Uniswap v4 serves two purposes. One is to experiment with novel and innovative hook designs. The other is to build in public and receive meaningful feedback and contributions from the community.
Once again, we're delighted and grateful to see so much activity in Github. Our v4-core and v4-periphery repos have been forked over 1,000 times. We've closed nearly 100 PRs and have had over 50 commits. These contributions range from translating the v4 whitepaper into other languages, gas optimization, and following best practices to more extensive efforts like migrating tests to Foundry.
Other contributions have sparked discussions among Uniswap developers and researchers. Thogard's PR inspired us to consider NoOps design, and jtriley-eth makes a good case for replacing ERC-1155 with ERC-6909. These quality contributions continue to shape Uniswap v4 into a powerful liquidity platform for DeFi.
The Uniswap Foundation has put together education resources and tools to help developers build on top of Uniswap v4. They've created documentation, created a hooks directory, sponsored hackathons, and have much more planned. Their resources aggregate helpful resources within the broader community. For example, Msfew's curated list of Uniswap v4 hook resources includes tools, templates, tutorials, articles, videos, and dozens of hook implementations.
Hackathons double as great locations for workshops. The Uniswap Foundation and Uniswap Labs co-hosted a workshop on v4 and hooks right before the ETHGlobal NYC hackathon, inspiring dozens of hook projects.
Uniswap v4 is a community effort. By building in public, Uniswap Labs, the Uniswap Foundation, and the larger Uniswap community can all meaningfully contribute in ways that will build better onchain market infrastructure for all of crypto.