CRIUS
Uniswap v4SecurityExplainer

Uniswap v4 hooks on Robinhood Chain, explained

What Uniswap v4 hooks are, how their permissions are encoded in the hook address, which permissions can block swaps or trap liquidity, and how to check any hook on Robinhood Chain.

Crius 3 min read

Uniswap v4 is now where most of Robinhood Chain’s DEX volume trades: at time of writing, about $301 million of a roughly $604 million 24-hour DEX volume ran through v4 pools, slightly more than Uniswap v3. Many of those pools have a hook attached. Hooks are what make v4 flexible (launch taxes, dynamic fees, anti-snipe rules), and also what make some v4 pools dangerous. This article explains how they work and how to check one.

What a hook is

In Uniswap v4 every pool lives inside one contract, the PoolManager. When a pool is created it can name a hook contract, which the PoolManager calls at fixed points:

  • before and after a pool is initialized;
  • before and after liquidity is added or removed;
  • before and after every swap;
  • before and after donations.

A hook can also return deltas: it can change how many tokens a swap or liquidity change actually moves. That is how hook-based taxes work.

Permissions live in the address

A hook can’t decide at runtime which callbacks it uses. The permissions are encoded in the lowest 14 bits of the hook’s address, and the PoolManager only calls the callbacks whose bit is set. Deployers mine an address with the right bits.

That has a useful consequence: you can read a hook’s capabilities from its address alone, without trusting its source code or even seeing it.

The permissions that matter

Permission What the hook can do Risk flag
beforeSwap Run code before every swap, including reverting it can_block_or_reprice_swaps
beforeSwapReturnDelta, afterSwapReturnDelta Change the amounts a swap moves (taxes, fees, or worse) can_modify_swap_amounts
beforeRemoveLiquidity Run code before liquidity leaves, including blocking it can_gate_liquidity_removal
beforeAddLiquidity Run code before liquidity is added, including blocking it can_gate_liquidity_add
afterAddLiquidityReturnDelta, afterRemoveLiquidityReturnDelta Change the amounts a liquidity change moves can_modify_liquidity_amounts

None of these is bad on its own: launchpads use beforeSwap to enforce launch rules, and dynamic-fee hooks use it to set the fee. But a hook that can block swaps and is unverified deserves caution, because you can’t see what conditions it blocks on.

Checking a hook

The Crius API decodes every v4 hook on Robinhood Chain. List them with /hooks:

Terminal window
curl "https://api.crius.sh/v1/robinhood/hooks?sort=pools&limit=20" -H "x-api-key: $CRIUS_API_KEY"

and inspect one with /hook/{address}:

Terminal window
curl "https://api.crius.sh/v1/robinhood/hook/0x4e3468951d49f2eea976ed0d6e75ffcb44a9a544" -H "x-api-key: $CRIUS_API_KEY"

You get the decoded permissions, risk flags, whether the source is verified, the events the hook actually emits on chain and the pools that use it. Filter the list with verified=false or risk=can_block_or_reprice_swaps to find the hooks worth a closer look.

Hooks in token security checks

You rarely care about a hook in the abstract; you care whether the token you want to trade is safe. The /security endpoint includes the token’s pool hook (permissions and risk) and the hook tax measured from real trades: what the pool sent versus what the trader received. Because it’s measured from actual swaps, it catches taxes that a simple contract scan would miss, including taxes that only apply to some wallets.

What to look for

  • Verified, widely used hooks (launchpad hooks, well-known fee hooks) are generally fine; their behaviour is visible.
  • Unverified hooks with beforeSwap and return deltas can change or block your trade. Check the realized tax and whether people have successfully sold recently.
  • beforeRemoveLiquidity on an unverified hook can stop liquidity providers from withdrawing.
  • A hook’s behaviour can depend on who you are. Compare buy and sell tax across many real trades rather than trusting one simulation.

Read more in the Uniswap concepts guide and the pools and hooks reference.

To catch new hooked pools as they are created, see the hands-on guide How to Detect New Uniswap v4 Pools on Robinhood Chain, and the Uniswap v4 API for every endpoint in one place.

Build with Crius

Robinhood Chain data in one API

Free plan with 1M credits a month. Your key in under a minute.

Related APIs

More from the blog