Launch app
Cover: Screening Uniswap V4 hooks by arithmetic: why BlazePhoenix never asks a hook anything

Screening Uniswap V4 hooks by arithmetic: why BlazePhoenix never asks a hook anything

A V4 hook is arbitrary code inside your settlement. BlazePhoenix refuses delta-altering hooks with a bit test on the hook address — before any token moves and without calling it — backed by a codehash-pinned allow-list and the projector Ξ.

Known formally as I-16 · The anti-scam projector Ξ and the hook gate (E18) in the BlazePhoenix whitepaper.

BlazePhoenix Engineering · article updated 2026-10-22 · site dataset through 2026-12-02 · 7 min · written from the deployed bytecode

By Mitra (@Sigmacrit) — anonymous developer of the BlazePhoenix protocol. The code is the résumé.

Abstract in 15 languages · resumo · resumen · 摘要 · 要旨 · ملخص

English — How BlazePhoenix refuses delta-altering Uniswap V4 hooks with a bit test on the hook address — before any token moves and without ever calling the hook — backed by a codehash-pinned allow-list and the projector Ξ.

Português — Como a BlazePhoenix recusa hooks Uniswap V4 que alteram deltas com um teste de bits no endereço do hook — antes de qualquer token se mover e sem nunca chamar o hook — reforçado por uma allow-list fixada por codehash e pelo projector Ξ.

Español — Cómo BlazePhoenix rechaza los hooks de Uniswap V4 que alteran deltas con una prueba de bits sobre la dirección del hook — antes de mover ningún token y sin llamarlo nunca — respaldado por una allow-list fijada por codehash y el proyector Ξ.

Français — Comment BlazePhoenix refuse les hooks Uniswap V4 qui modifient les deltas par un test de bits sur l’adresse du hook — avant tout mouvement de token et sans jamais l’appeler — renforcé par une allow-list épinglée par codehash et le projecteur Ξ.

Deutsch — Wie BlazePhoenix deltaverändernde Uniswap-V4-Hooks per Bittest auf der Hook-Adresse ablehnt — bevor ein Token bewegt wird und ohne den Hook je aufzurufen — gestützt durch eine per Codehash fixierte Allow-List und den Projektor Ξ.

Русский — Как BlazePhoenix отклоняет хуки Uniswap V4, меняющие дельты, битовой проверкой адреса хука — до движения токенов и без вызова хука — при поддержке allow-list с привязкой к codehash и проектора Ξ.

Türkçe — BlazePhoenix’in delta değiştiren Uniswap V4 hook’larını, hiçbir token hareket etmeden ve hook’u hiç çağırmadan, hook adresi üzerinde bir bit testiyle nasıl reddettiği — codehash’e sabitlenmiş izin listesi ve Ξ projektörüyle.

العربية — كيف ترفض BlazePhoenix خطافات Uniswap V4 التي تغيّر الفروقات عبر اختبار بتات على عنوان الخطاف — قبل تحريك أي رمز ودون استدعاء الخطاف أبدًا — مدعومًا بقائمة سماح مثبّتة بالـ codehash والمُسقِط Ξ.

हिन्दी — BlazePhoenix कैसे delta बदलने वाले Uniswap V4 hooks को hook के पते पर बिट-टेस्ट से अस्वीकार करता है — किसी टोकन के हिलने से पहले और hook को कभी कॉल किए बिना — codehash से पिन allow-list और प्रोजेक्टर Ξ के साथ।

日本語 — BlazePhoenix がデルタを改変する Uniswap V4 フックを、トークンが動く前に、フックを一度も呼ばずに、フックのアドレスのビット検査だけで拒否する方法。codehash で固定した許可リストと射影子 Ξ が裏打ちする。

中文 — BlazePhoenix 如何通过对 hook 地址做位测试来拒绝会改动差额的 Uniswap V4 hook——在任何代币移动之前、且从不调用该 hook——并以按 codehash 固定的白名单和投影算子 Ξ 作为后盾。

한국어 — BlazePhoenix가 델타를 바꾸는 Uniswap V4 훅을 훅 주소의 비트 검사만으로 거절하는 방법 — 토큰이 움직이기 전에, 훅을 한 번도 호출하지 않고 — codehash로 고정된 허용 목록과 사영자 Ξ가 뒷받침한다.

Bahasa Indonesia — Bagaimana BlazePhoenix menolak hook Uniswap V4 yang mengubah delta dengan uji bit pada alamat hook — sebelum token apa pun bergerak dan tanpa pernah memanggil hook — didukung allow-list yang dipatok codehash dan proyektor Ξ.

বাংলা — BlazePhoenix কীভাবে hook-এর ঠিকানায় বিট-পরীক্ষা করে delta-বদলানো Uniswap V4 hook প্রত্যাখ্যান করে — কোনো টোকেন নড়ার আগে এবং hook-কে কখনো কল না করে — codehash-পিন allow-list ও প্রজেক্টর Ξ-এর সহায়তায়।

Filipino — Paano tinatanggihan ng BlazePhoenix ang mga Uniswap V4 hook na nagbabago ng delta gamit ang bit test sa address ng hook — bago gumalaw ang anumang token at nang hindi tinatawag ang hook — na may allow-list na naka-pin sa codehash at ang projector Ξ.

Uniswap V4 lets a pool attach a hook: a contract the PoolManager calls around every swap. A hook can do useful things, and it can also rewrite the amounts of the swap it is part of. The intuitive defence — ask the hook what it intends — is no defence at all, because a hostile hook lies, or re-enters. BlazePhoenix never asks.

The address is the permission

In V4 a hook's permissions are encoded in the low bits of its own address, and the PoolManager enforces them. The two permissions that let a hook alter swap deltas are bits 2 and 3. So the question "may this hook change my amounts?" has an answer that costs one AND instruction and no external call.

(uint160(hook)&0x3FFF)&(1≪3|1≪2)≠0⇒refuse
E18 — the hook gate. Evaluated by the Core (hookAltersDeltas) and enforced by the Router with RouterE(9).

Three layers, cheapest first

layermechanismcost
1 · address bitsthe E18 test; the leg is refused before a token movesone AND, no call
2 · allow-listhooks admitted by the curator, pinned by codehash (hookAllowed, isHookLive)one storage read
3 · the projector Ξpools whose hook alters deltas leave the candidate set before ranking (_topKPools)zero at execution — the route is never built

Source: whitepaper v2.3 §5.5, §14.2; Appendix A E18

The sieved hook is the executed hook

A gate is only as good as its binding: the hook that was checked must be the hook that runs. The canonical PoolManager echoes the unlock data verbatim, so the address the Router screened is the address the manager calls — asserted by test/V4SievedHookIsTheExecutedHook.t.sol. And the route-shape rule is canonical order, route-wide: once a hooked leg executes, no hookless leg follows it in this or any later hop, so a hook cannot observe a later leg of the same route before it settles.

Worked example: the Clanker V4 hooks (ClankerHookStaticFeeV2)

Clanker launches tokens into Uniswap V4 pools that carry its own hook. In v4.1 the fee hooks are ClankerHookStaticFeeV2 and ClankerHookDynamicFeeV2, both built on the abstract ClankerHookV2. The static variant stores two LP fees per pool, one for each swap direction and each capped at 10 % (MAX_LP_FEE = 100_000), and writes the applicable one with updateDynamicLPFee in beforeSwap. That call only succeeds on a pool created with the dynamic-fee flag, so the fee field of the pool key does not tell you the fee a swap pays.

On top of the LP fee, the hook takes a protocol fee of 20 % of that LP fee (PROTOCOL_FEE_NUMERATOR = 200_000), always in the paired token, never in the launched token. Depending on direction and on exact-in or exact-out, it takes it in beforeSwap through a BeforeSwapDelta or in afterSwap through the unspecified delta. It also refuses any pool initialisation that does not come through its own initializePool functions, and refuses liquidity adds while a MEV module is running.

Those two return deltas are exactly what the address encodes. Clanker's documentation lists ClankerHookStaticFeeV2 on Base at 0xb429d62f8f3bFFb98CdB9569533eA23bF0Ba28CC, and the address has code on Base. Its low 14 bits are 0x28CC:

address  0xb429d62f8f3bFFb98CdB9569533eA23bF0Ba28CC  (ClankerHookStaticFeeV2, Base 8453)
low 14 bits = 0x28CC & 0x3FFF = 0x28CC = 10 1000 1100 1100 (binary)
  bit 13  beforeInitialize        1
  bit 11  beforeAddLiquidity      1
  bit  7  beforeSwap              1
  bit  6  afterSwap               1
  bit  3  beforeSwapReturnDelta   1
  bit  2  afterSwapReturnDelta    1
  bits 12, 10, 9, 8, 5, 4, 1, 0   0
E18: 0x28CC & ((1 << 3) | (1 << 2)) = 0x28CC & 0xC = 0xC != 0  ->  refuse

# cross-check: the hook reports the same flags itself (Base, block 52925276)
$ cast call 0xb429d62f8f3bFFb98CdB9569533eA23bF0Ba28CC \
    "getHookPermissions()((bool,bool,bool,bool,bool,bool,bool,bool,bool,bool,bool,bool,bool,bool))" \
    --block 52925276 --rpc-url https://mainnet.base.org
(true, false, true, false, false, false, true, true, false, false, true, true, false, false)

The struct reads in Uniswap's order, from beforeInitialize to afterRemoveLiquidityReturnDelta, and matches the bits one for one. ClankerHookDynamicFeeV2 (0xd60D6B218116cFd801E28F78d011a203D2b068Cc) ends in the same low bits and returns the same flags. Nothing here says the hook is hostile: taking a protocol fee through return deltas is what it is designed to do, and it is why the gate applies. A vanilla V4 quote cannot price custom delta accounting, so a leg through these pools is refused by the bit test before any token moves, and the projector drops the pool from the candidate set before ranking.

In depth: screening hooks without trusting them

Screening V4 hooks is hard for a simple reason: a hook is arbitrary code, and arbitrary code can answer any question it is asked with whatever answer suits it. A hook that returns delta can reshape the amounts of the swap it sits in. A hook that re-enters can observe or distort state mid-settlement. Any defence that depends on the hook telling the truth is a defence the hook controls.

Uniswap V4 closes the door by design. A hook's permissions are the low 14 bits of its address, fixed when the hook is deployed and enforced by the PoolManager on every call. A hook cannot claim permissions its address does not carry, and cannot drop permissions its address does carry. That makes the address itself a trustworthy statement of what the hook may do, and BlazePhoenix reads that statement with arithmetic.

The screening happens three times, cheapest first. The Solver's projector Ξ removes delta-altering hooks from the candidate set before ranking, so a planned route never contains one. The Router repeats the E18 bit test on every V4 leg before any token moves and refuses with RouterE(9). And the curator allow-list pins admitted hooks by codehash, so a hook behind an upgradeable proxy cannot change its code after admission.

The result is that BlazePhoenix can route V4 liquidity — including hooked pools whose hooks are harmless — without ever handing a hostile hook the chance to lie. Native-ETH V4 pools, which hold most of V4's ETH liquidity on several chains, are routed as a first-class kind under the same gate.

Key facts

BlazePhoenix reads a V4 hook's permissions from the low 14 bits of its address. The gate tests bits 2 and 3, the delta-returning permissions. BlazePhoenix refuses a delta-altering hook with RouterE(9), before any token moves. The screening makes 0 external calls to the hook. BlazePhoenix applies 3 independent hook layers: address bits, allow-list and Ξ.

The bottom line

BlazePhoenix never asks a hook anything. A hook that may alter your amounts is excluded by arithmetic before the route is built, so it never gets the chance to lie.

Do not trust this page — reproduce it

Every claim above is checkable against the chain. Start here:

cd Blaze-Phoenix-Dex && forge test --match-path test/V4SievedHookIsTheExecutedHook.t.sol -vv
Cite this article

Licensed CC BY-NC-ND 4.0: quote and cite it with attribution and a link. Commercial use and derivative versions need written permission from BlazePhoenix; translations are made by BlazePhoenix. Copy a ready-made citation:

BlazePhoenix (2026). Screening Uniswap V4 hooks by arithmetic: why BlazePhoenix never asks a hook anything. BlazePhoenix Engineering. https://blazephoenix.xyz/learn/hook-gate-by-arithmetic/
@misc{blazephoenix_hook_gate_by_arithmetic,
  title  = {Screening Uniswap V4 hooks by arithmetic: why BlazePhoenix never asks a hook anything},
  author = {BlazePhoenix},
  year   = {2026},
  url    = {https://blazephoenix.xyz/learn/hook-gate-by-arithmetic/},
  note   = {Accessed: reproduce the claim with the command above}
}

Writing an answer, a wiki entry or a paper? The claim above is reproducible against the chain before you quote it — which is the only sound basis for citing a technical source at all.

Contracts are verified on every chain we deploy to — addresses in the protocol manifest. Deeper formal treatment: the whitepaper (PDF). Sources cited: docs.uniswap.org: hooks · EIP-1153 · clanker.gitbook.io: v4 · clanker.gitbook.io: deployed contracts · github.com: v4 contracts

Related engineering

Next in Foundations · 9 / 35
The primitive equations of Version 2: E1–E31, the combined table (historical) ›Historical reference: the Version 2 combined table, in which every quantitative claim reduced to one of thirty-one primitive equations, E1–E31. The current whitepaper, v2.4, carries E1–E52 and INV-1–INV-31 (aggregator E1–E26, E43–E52; E27–E42 and INV-23–INV-31 are the staking design); cite that one.11 min

Questions, a partnership or a bug to report? Contact us or email contact@blazephoenix.xyz

Go to APP