Uniswap V4 introduces the concept of hooks, which allow developers to customize and extend the behavior of liquidity pools. A developer who wishes for Uniswap to route swap requests through their hook must open a PR to add their hook to Uniswap’s permitted list of hooks for routing (the allowlist). Additionally, certain hooks which hold pool liquidity in the hook rather than in the pool will not have their hooked pool TVL reported correctly without opening a PR to adjust their TVL. Not adjusting the TVL to be accurate can negatively impact routing for new hooks and hooks which require no pool TVL. This document explains how a developer can open PRs for either or both scenarios.
Allowlisting a New Hook
Prerequisites:
- Your hook is deployed and you have the address on hand
- You have deployed a V4 pool with your hook (with at least some nominal amount of liquidity)
- You have submitted the Hook Intake Form
Steps:
- Clone the Uniswap routing-api repo
git clone [git@github.com](<mailto:git@github.com>):Uniswap/routing-api.git
- Create a new branch including the name of your hook
- Add your hook address to
lib/util/hooksAddressesAllowlist.ts
-
Add a new const variable which includes the name of your hook and the chain on which it is deployed, populated with your hook address
export const CLANKER_STATIC_FEE_HOOKS_ADDRESS_ON_BASE = '0xdd5eeaff7bd481ad55db083062b13a3cdf0a68cc'
-
Add the hook variable to the corresponding HOOKS_ADDRESSES_ALLOWLIST under the correct chainId
[ChainId.BASE]: [
ADDRESS_ZERO,
...
CLANKER_STATIC_FEE_HOOKS_ADDRESS_ON_BASE,
],
-
Example PR: https://github.com/Uniswap/routing-api/pull/1146/files
- Commit and submit the PR
- In the PR comments, include a link to the Uniswap App page for the hooked pool which you have already deployed
Notes:
- You may add more than one hook in a single PR if it is the same hook deployed on different chains. Please submit different PRs for hooks which have different functions.
- To ensure your hook PR is reviewed in a timely fashion and for Uniswap to add your hook to our list of allowed hooks, please ensure you submit the Hook Intake Form in addition to submitting your PR.
- Your PR will not be accepted until Uniswap performs a review of your hook code. This process can take up to several weeks depending on the current backlog of hook reviews. Please ensure you submit the github link for the source code to your hook in the Hook Intake Form.
- To confirm if your hook has been included in our routing algorithm, or see what hooks are already allowed, please check here.
Updating TVL for Low- and 0-TVL Hooks
Prerequisites:
- Your hook is allowlisted (see above steps)
- You have deployed a V4 pool with your hook