AggHook on Ethereum
Uniswap v4 Hook Contract 0x3382cd556178735b7b45c7b057bd5a4174b7a888 on Ethereum · Utility · Verified contract
- Volume (24h)
- $0
- Value locked (TVL)
- $0
- All-time volume
- $0
- Pools using this hook
- 1
- Swaps (24h)
- 0 (0 traders)
- Total swaps
- 0
What it does
An aggregator hook that routes each Uniswap v4 swap across a fixed set of Uniswap v4 and V3-style pools to pick the best effective price, taking a fee on the swap amount.
How it works step by step
- Holds a fixed list of two Uniswap v4 pools and two V3-style pools for the token pair in bytecode data
- Ranks venues by effective price (adjusted by a fee field) and orders them for each swap
- Executes the swap across venues in sequence, settling and taking tokens through the PoolManager
- Takes a fee from the specified swap amount and donates it back to the pool
- Restricts pool initialization and liquidity addition to a hardcoded admin address
- Swap behaviour
- On each swap the hook computes effective prices across its six hardcoded venues, sorts them, and routes the swap through them in order using price limits, settling token flows with the PoolManager and returning a BeforeSwapDelta that accounts for the executed amounts and fee.
- Liquidity behaviour
- beforeAddLiquidity is restricted to the hardcoded ADMIN via tx.origin and PoolManager; any other caller reverts. No liquidity removal callbacks are implemented, so the hook does not manage user liquidity.
- Fee behaviour
- Fees are taken on the specified amount in beforeSwap, with the fee amount derived from the swap amount's upper 16 bits (FEE_SHIFT = 16). Taken fees are donated back to the pool through the PoolManager donate call with the hook as the pool hook, rather than retained by the contract. A fee-overwrite return value of 0 is used, so the pool's static fee is not replaced.
- Owner & admin controls
- ADMIN (0xEC08EfF77496601BE56c11028A516366DbF03F13) is hardcoded and is the only address allowed to pass beforeAddLiquidity and beforeInitialize, checked via tx.origin (origin()) rather than msg.sender. Parameters such as the pool list and routing hysteresis are compiled into constants or bytecode data, so there is no owner setter, pause, or upgrade path in the verified source.
Enabled Uniswap v4 callbacks
beforeInitialize, beforeAddLiquidity, beforeSwap, beforeSwapReturnDelta
beforeInitialize: restricted to PoolManager and ADMIN, returns its selector. beforeAddLiquidity: restricted to PoolManager and ADMIN, returns its selector. beforeSwap: routes the swap across six underlying venues (two Uniswap v4 pools and two V3-style pools, including a Pancake V3 callback) and returns a non-zero BeforeSwapDelta so the hook itself settles flows and takes or donates fees. beforeSwapReturnDelta: enables the hook to return deltas that replace the pool's own swap accounting.
Security & trust assessment
Risk level: medium (verified source, high confidence).
Who controls it: The ADMIN key can only add liquidity and initialize pools for this hook; it cannot change fees, routing, or pool lists because those are immutable. The authorization uses tx.origin, so a phishing contract that tricks ADMIN into calling would pass the check, a concern only if the ADMIN key ever interacts with malicious contracts.
Risk to user funds: During swaps the hook temporarily holds and moves user and pool tokens between the PoolManager and the underlying venues, and takes or donates fees. No owner withdrawal function exists, so funds are not drained by an admin, but correctness depends entirely on the external pool contracts and the fixed configuration. A bug in the custom accounting could misdirect or strand swap amounts.
Security findings
- [medium] tx.origin-based admin authorization: _onlyAdmin compares ADMIN against origin(), not msg.sender, so any contract the ADMIN EOA calls can invoke the gated functions on its behalf.
- [medium] Hook takes custody of swap flows via return deltas: The hook returns non-zero BeforeSwapDelta and performs its own swaps and PoolManager settles/takes inside beforeSwap, so it actively controls the input and output token flows of every swap routed through it.
- [info] Immutable routing configuration: Routing targets, token addresses, pool keys and the venue list are hardcoded in the DATA blob and constants; the hook cannot be reconfigured and has no upgrade proxy, so the external pools it routes through are the trust boundary.
- [low] Route depends on external pool state: Route selection and price limits are computed from external pool state (slot0 and extsload) at swap time; no slippage protection beyond the caller's sqrtPriceLimit is evident in this path.
Contract details
- Verified source
- Yes (AggHook)
- Compiler
- solc 0.8.31+commit.fd3a2265
- Bytecode size
- 5,766 bytes
- Upgradeable proxy
- No
- Detected patterns
- return-delta
Pools using AggHook
- USDC / USDT (0.00% fee) — 24h volume $0, TVL $0, 0 swaps today