The v4 Social hook and router

Copies settle in the swap itself: through the v4 Social hook on its own pools, through the v4 Social router everywhere else.

Router.swapyour exact-input copy→PoolManager.unlockone callback→Hook.beforeSwapmints 15 bps as claims→Pool swapthe rest of the input→Hook.afterSwapemits Post

The hook

V4SocialHook has the beforeSwap, afterSwap and beforeSwapReturnDelta permissions, deployed at a CREATE2 address whose low bits carry those flags. On a copy, beforeSwap takes 15 bps of the specified input by minting it as PoolManager claims (ERC-6909) and returning the same amount as its delta, so nothing stays open and the pool does not need to hold the fee currency first. afterSwap emits Post(trader, poolId, zeroForOne, amountIn, amountOut, copiedFrom). The three pools use a dynamic fee that the hook sets to 0.30%. The hook has no owner.

hookData

LengthMeaning
0 bytesPlain swap, posted under tx.origin, no copy fee
32 bytesabi.encode(poster), plain swap posted under that address
96 bytesabi.encode(copier, trader, sourceTx), a copy: exact input only, 15 bps fee

The router

V4SocialRouter.swap(key, zeroForOne, amountIn, minOut, trader, sourceTx, deadline) swaps exact input on any v4 pool. With a non-zero trader it takes the same 15 bps from the input before the swap and books it with the same split. On v4 Social pools it charges nothing itself and forwards the copy to the hook. It emits Post with the real sender, so swaps from smart accounts are attributed to the right wallet.

Why two paths

A v4 pool's hook is fixed when the pool is created. The house TSLA, NVDA and QQQ pools and every Pons coin pool already run their own hook, so v4 Social created its own three pools with its hook and reaches every other pool through the router. Off v4 Social pools and outside the router, the feed attributes a swap to the transaction sender.