Hook
UnichainHookHook is a Uniswap v4 hook on Unichain. Brand new: its first pool went live today. Still in use: 45 trades in the last week, and 1 new pool this week.
- Contract name
- Hook
How this hook works
Liquidity managerA liquidity manager hook. It sets its own trading fee, manages liquidity for its providers and trades on its own.
Sets its own trading fee
Instead of a fixed fee chosen by the pool creator, it decides the fee itself on each trade. The fee goes to liquidity providers; the hook keeps nothing for itself.
The code that does this (fee):function _fee(IPoolManager manager, PoolKey calldata key, SwapParams calldata params) private returns (uint24 fee, uint24 feeOverride, uint24 protocolFee, uint160 sqrtPriceX96) { PoolId id = key.toId(); Store.Layout storage s = Store.store(); Store.Book storage book = s.book[id]; uint256 since = _rule(manager, key, id, book, params); { // the tick before the swap, for afterSwap: transient, keyed by the pool, gone when the transaction ends int24 tickBefore; (sqrtPriceX96, tickBefore, protocolFee,) = StateLibrary.getSlot0(manager, id); assembly ("memory-safe") { tstore(id, tickBefore) } } Store.Settings storage set = s.settings[id]; if (set.feeCap == 0) return (key.fee, 0, protocolFee, sqrtPriceX96); fee = _curve(manager, key, set, book, since, params.zeroForOne); feeOverride = fee | LPFeeLibrary.OVERRIDE_FEE_FLAG; }Manages liquidity for its providers
Liquidity providers deposit through the hook and it runs the pool position for them, tracking each one’s share.
The code that does this (fillOne):function _fillOne(IPoolManager manager, PoolKey calldata key, PoolId id, Store.Layout storage s, int24 tick, bool zeroForOne) private { bytes32 slot = keccak256(abi.encode(id, tick, zeroForOne)); uint256 epoch = s.orderEpoch[slot]; Store.Bucket storage bucket = s.buckets[keccak256(abi.encode(slot, epoch))]; uint128 liquidity = bucket.liquidity; if (liquidity == 0) return; (BalanceDelta total, BalanceDelta fees) = manager.modifyLiquidity( key, ModifyLiquidityParams(tick, tick + key.tickSpacing, -int256(uint256(liquidity)), slot), "" ); _accrue(manager, key, bucket, fees); BalanceDelta out = total - fees; bucket.amount0 = uint256(uint128(out.amount0())); bucket.amount1 = uint256(uint128(out.amount1())); bucket.filled = true; s.orderEpoch[slot] = epoch + 1; if (bucket.amount0 != 0) manager.mint(address(this), key.currency0.toId(), bucket.amount0); if (bucket.amount1 != 0) manager.mint(address(this), key.currency1.toId(), bucket.amount1); emit IMandate.OrderFilled(id, tick, zeroForOne, epoch, bucket.amount0, bucket.amount1); }Trades on its own
It makes trades itself, for example to convert the fees it collected.
The code that does this (reset):function _reset( IPoolManager manager, PoolKey memory key, PoolId id, uint160 sqrtRefX96, bool zeroForOne, uint160 limit ) private { (uint160 spot,,,) = StateLibrary.getSlot0(manager, id); if (spot == sqrtRefX96 || StateLibrary.getLiquidity(manager, id) != 0) return; if (zeroForOne ? limit >= sqrtRefX96 : limit <= sqrtRefX96) revert IMandate.PoolPriceOff(); BalanceDelta moved = manager.swap( key, SwapParams({zeroForOne: spot > sqrtRefX96, amountSpecified: -1, sqrtPriceLimitX96: sqrtRefX96}), "" ); if (BalanceDelta.unwrap(moved) != 0) revert IMandate.PoolPriceOff(); }Burns tokens
It destroys some tokens (or sends them to an address nobody controls), so there are fewer of them.
The code that does this (settle):function _settle(IPoolManager manager, PoolKey calldata key, PoolId id, address sender, bool zeroForOne, Sum memory sum) private { (Currency input, Currency output) = zeroForOne ? (key.currency0, key.currency1) : (key.currency1, key.currency0); manager.mint(address(this), input.toId(), sum.taken); manager.burn(address(this), output.toId(), sum.given); Store.Book storage book = Store.store().book[id]; if (zeroForOne) book.idle1 = SafeCast.toUint128(book.idle1 + sum.fee); else book.idle0 = SafeCast.toUint128(book.idle0 + sum.fee); // URC-2: a swap the hook filled itself. Amounts are the swapper's, signed like the pool's Swap event. // A match too large for a signed 128-bit delta reverts here, inside the swap's try: the match is skipped // (MatchSkipped) and the swap trades in the pool. What matchSwap returns therefore always fits an int128. int128 paid = -SafeCast.toInt128(uint256(sum.taken)); int128 got = SafeCast.toInt128(uint256(sum.given)); emit IMandate.HookSwap( PoolId.unwrap(id), sender, zeroForOne ? paid : got, zeroForOne ? got : paid, zeroForOne ? 0 : SafeCast.toUint128(sum.fee), zeroForOne ? SafeCast.toUint128(sum.fee) : 0 ); }Needs a signed approval
Some actions need a message signed by an approved address.
The code that does this (steer):function _steer(IPoolManager manager, Signed memory c) private { PoolId id = c.key.toId(); Store.Layout storage s = Store.store(); Store.Settings storage set = s.settings[id]; Store.Book storage book = s.book[id]; if (set.curator == address(0)) revert IMandate.UnknownPool(); if (block.timestamp > c.deadline) revert IMandate.Expired(); if (book.movedBlock == block.number) revert IMandate.AlreadyMoved(); bytes32 digest = Intents.digest(address(this), id, c.width, c.sender, book.nonce, c.deadline); if (!SignatureChecker.isValidSignatureNow(set.curator, digest, c.signature)) revert IMandate.BadSignature(); book.nonce += 1; // a signed width is used once Compass.Bounds memory bounds = Compass.Bounds(set.widthMin, set.widthMax, set.offsetMax); if (!Compass.widthAllowed(bounds, c.width, c.key.tickSpacing)) revert IMandate.OutOfBounds(); _signedMove(manager, c.key, id, set, book, c.width); }Locks tokens or liquidity
Some tokens or liquidity are locked for a set time and can’t be taken out before then.
The code that does this (settle):function _settle(IPoolManager manager, PoolKey calldata key, PoolId id, address sender, bool zeroForOne, Sum memory sum) private { (Currency input, Currency output) = zeroForOne ? (key.currency0, key.currency1) : (key.currency1, key.currency0); manager.mint(address(this), input.toId(), sum.taken); manager.burn(address(this), output.toId(), sum.given); Store.Book storage book = Store.store().book[id]; if (zeroForOne) book.idle1 = SafeCast.toUint128(book.idle1 + sum.fee); else book.idle0 = SafeCast.toUint128(book.idle0 + sum.fee); // URC-2: a swap the hook filled itself. Amounts are the swapper's, signed like the pool's Swap event. // A match too large for a signed 128-bit delta reverts here, inside the swap's try: the match is skipped // (MatchSkipped) and the swap trades in the pool. What matchSwap returns therefore always fits an int128. int128 paid = -SafeCast.toInt128(uint256(sum.taken)); int128 got = SafeCast.toInt128(uint256(sum.given)); emit IMandate.HookSwap( PoolId.unwrap(id), sender, zeroForOne ? paid : got, zeroForOne ? got : paid, zeroForOne ? 0 : SafeCast.toUint128(sum.fee), zeroForOne ? SafeCast.toUint128(sum.fee) : 0 ); }
Who controls it: It has an admin address, but no admin-only settings in its own code. The code cannot be changed.
Based on the hook’s published code.What do these labels mean?
Safety report
Before you build on it. Automated checks, not an audittakeForsource on every trade.What it can do
Its code executes inside each trade in pools that use it.
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
Across all its pools, the hook joined: $6.01.
- Joined 1 time, worth $6.01
- Opened a pool 1 time
Settings changes: set the split (1 time), set the share (1 time).
Counted from what the hook recorded on-chain across all its pools, for every action in its published code, plus token transfers in and out of it. Dollar values count the amounts paid in ETH, stablecoins, BNB and BTC, at today’s prices.