How do custom hooks work in the Labs interface?

One of the most powerful new features of Uniswap v4 are hooks, pieces of code that allow developers to add custom functionality to the Uniswap Protocol. The Uniswap Labs products will seek to leverage as much new functionality as possible while ensuring user safety. At launch, hook functions will be supported when providing liquidity and swapping.

 

Hooks in LP Flows

Liquidity providers on the Uniswap Labs interface are able to add any hook to their pool creation or liquidity management operations by pasting the address of the hook into the new Position Management flow.

 

Position Management.png

 

Hook developers who want to point their users directly into the liquidity management flow with their hook pre-populated can deep link to the page using the following URL format: https://app.uniswap.org/positions/create/v4?hook={hookAddress}

 

Hooks in Swapping (aka Routing)

Routing in the Uniswap Labs interface happens either via our classic offchain routing or via UniswapX, depending on which will offer swappers the most efficient route at the time of swapping.

 

In the classic routing flow, the interface will automatically consider routing through any pool on Uniswap v2, v3 or v4 that does not utilize beforeSwap or afterSwap hooks or custom fee tiers. We are actively working to add support for these pools.

 

UniswapX is able to support any pools including those that use beforeSwap, afterSwap and custom fee tiers. Developers of these hooks can run their own fillers to participate in Uniswap Labs interface routing. More details on running a filler can be found here.