PoolHook
RobinhoodPoolHook is a Uniswap v4 hook on Robinhood Chain. Runs code on every swap. Can block LP withdrawals. Gates who can add liquidity. Runs at pool creation.
- Contract name
- PoolHook
How this hook works
Price recordA price record hook. It keeps a price record, controls who adds or removes liquidity and only lets approved callers create pools.
Keeps a price record
It records the pool’s price over time, so other apps can read a fair average price.
The code that does this (beforeSwap):function beforeSwap(address, PoolKey calldata, SwapParams calldata, bytes calldata) external returns (bytes4, BeforeSwapDelta, uint24) { _onlyManager(); _observe(); return (IHooks.beforeSwap.selector, BeforeSwapDeltaLibrary.ZERO_DELTA, 0); }Rules for adding or removing liquidity
It decides who can add or remove liquidity, or when.
The code that does this (beforeAddLiquidity):function beforeAddLiquidity( address sender, PoolKey calldata, ModifyLiquidityParams calldata params, bytes calldata ) external returns (bytes4) { _onlyManager(); _observe(); bool lowerEnd = params.tickLower == Params.FULL_RANGE_LOWER; bool upperEnd = params.tickUpper == Params.FULL_RANGE_UPPER; if (sender == POOL ? !(lowerEnd && upperEnd) : (lowerEnd || upperEnd)) revert NotPermitted(); return IHooks.beforeAddLiquidity.selector; }Only approved callers create pools
New pools with this hook can only be created by approved callers, for example its own factory or launcher.
The code that does this (beforeInitialize):function beforeInitialize(address sender, PoolKey calldata key, uint160) external returns (bytes4) { _onlyManager(); if (sender != POOL || PoolId.unwrap(key.toId()) != PoolId.unwrap(poolKey().toId())) { revert NotPermitted(); } uint32 now_ = uint32(block.timestamp); initializedAt = now_; lastTs = now_; ringLastTs = now_; _ring[0] = Entry(now_, 0, 0); ringCount = 1; return IHooks.beforeInitialize.selector; }
Who controls it: Nobody. The hook has no admin functions, and the code cannot be changed.
What do these labels mean? Based on the hook’s published code.
What it can do
Its code executes inside each trade in pools that use it.
It runs before liquidity is removed, so it can delay or refuse LP exits.
It checks every deposit before it goes in.
It runs when a pool is created, often to lock in that pool’s settings.
Hook history
Nothing recorded yet.
Counted from token transfers in and out of the hook. Its published code records no actions of its own.