Uniswap v4 introduced one of the most significant architectural changes in DeFi: hooks. If you've heard the term but aren't sure what it means in practice, this post breaks it down — and shows a real hook we built and got merged into the official Uniswap hook registry.
What Are Uniswap v4 Hooks?
In previous versions of Uniswap, the protocol was essentially closed. You could create pools, add liquidity, and swap tokens, but you couldn't customize what happened during those operations. The logic was fixed.
V4 changes that with hooks — external smart contracts that "hook into" the lifecycle of pool operations. Think of them like middleware for a DEX.
Every major pool action in v4 has a before and after stage:
- beforeSwap / afterSwap — runs before or after a token swap
- beforeAddLiquidity / afterAddLiquidity — runs when liquidity is added
- beforeRemoveLiquidity / afterRemoveLiquidity — runs when liquidity is removed
- beforeInitialize / afterInitialize — runs when a pool is first created
When a pool is created, the pool creator specifies a hook contract address. From that point on, every operation on that pool calls the relevant hook functions. The hook can run custom logic, modify behavior, collect fees, enforce rules — whatever the contract is designed to do.
The key insight: hooks don't modify the Uniswap core protocol. They're external contracts that the protocol calls at defined points. This means anyone can write a hook, and pool creators choose which hook (if any) to attach to their pool.
Why Hooks Matter
Before v4, if you wanted custom behavior on a DEX — say, distributing a portion of swap fees to a list of stakeholders — you had two options: fork the entire protocol, or build a wrapper contract that interacted with the pool externally. Both were messy.
Hooks make this native. Some real use cases:
- Dynamic fees — adjust swap fees based on volatility, time of day, or pool utilization
- On-chain limit orders — execute trades when price hits a target
- TWAP (time-weighted average price) orders — spread large trades over time
- Custom access control — restrict who can trade in a pool (KYC pools, DAO-gated pools)
- Revenue distribution — automatically route a share of pool activity to stakeholders
That last one is what we built.
BatchDistributeHook: What It Does
Our hook lets pool operators push-distribute ERC-20 tokens or native currency (ETH) to up to 200 recipients in a single transaction through the Spraay batch contract on Base.
The use case: a pool generates fees or revenue, and the operator wants to distribute those funds to a list of stakeholders — liquidity providers, DAO members, team wallets, community funds, whatever the arrangement is.
Without a hook, the operator would need to manually collect fees, calculate shares, and send individual transactions to each recipient. With BatchDistributeHook, they call the distribution function and the Spraay batch contract handles the rest: one on-chain transaction, all recipients paid, all amounts verifiable.
The hook interacts with Spraay's batch contract on Base at 0xb9c1ab7bd023c784c19b8e9f10ce9cded9ff9010. This is the same contract that powers all of Spraay's batch payment infrastructure — the same one our e-commerce plugins, robot fleet payments, and gateway all settle through.
How It Works
The flow is straightforward:
- A pool is created with BatchDistributeHook as its hook contract
- The pool operates normally — swaps, liquidity, everything works as expected
- When the operator wants to distribute accumulated tokens, they call the hook's distribute function
- The hook approves the Spraay batch contract to spend the specified token amount
- The batch contract executes a single transaction that transfers tokens to all recipients
- Each recipient's share is settled on-chain, verifiable by anyone
The operator defines the recipient list and amounts. The hook handles the approval and contract interaction. The batch contract handles the multi-send efficiently.
Up to 200 recipients per batch means this scales to meaningful distribution sizes without needing multiple transactions.
Merged Into the Uniswap Hook Registry
Uniswap maintains an official hook registry — a curated list of hooks that developers have built for the v4 ecosystem. Getting listed means the hook has been reviewed and meets the registry's standards.
Our BatchDistributeHook was merged into the Uniswap hooklist as PR #10617 in October 2026, listed as "Add BatchDistributeHook hook on base." It's now part of the official v4 hook ecosystem.
This matters because it puts Spraay's batch payment infrastructure directly into the Uniswap developer surface. Anyone browsing the hook registry looking for distribution solutions finds our hook, and through it, the batch contract that powers the rest of our protocol.
The Bigger Picture
Hooks are still early. Most v4 pools are running without hooks, and the ecosystem of available hooks is still growing. But the architecture is powerful: it turns Uniswap from a fixed protocol into a programmable platform.
For us, BatchDistributeHook is a proof point. The same batch contract that settles robot fleet payments and e-commerce vendor payouts can also settle DeFi revenue distribution — all through one on-chain primitive. That's the advantage of building infrastructure instead of applications: the same settlement layer works across use cases.
If you're building on Uniswap v4 and need batch distribution, the hook is on the registry. If you're building anything that needs to pay multiple recipients on Base in one transaction, the Spraay batch contract is open and documented.
Spraay Protocol is multi-chain batch payment infrastructure built by Plagtech. BatchDistributeHook is listed on the Uniswap v4 hook registry. Learn more at spraay.app.
Top comments (0)