CDXRHookV3
EthereumHookCDXRHookV3 is a Uniswap v4 hook on Ethereum. Live for 1 day. Still in use: 3 trades in the last week, and 1 new pool this week.
- Contract name
- CDXRHookV3
How this hook works
Restricted tradingRuns the single CDXR / USDT pool and controls who can sell CDXR. Every sell is checked against a separate rules contract and recorded. Buying is open, and the hook takes no fees.
Sells need approval
Before a sell goes through, the hook asks a rules contract whether this seller is allowed. If the answer is no, the trade is refused.
Sells only through trusted routers
To know who the seller really is, the hook accepts sells only through routers the hook developer trusts. A sell sent any other way is refused.
The code that does this (_resolveSwapper):function _resolveSwapper(address sender) internal view returns (address swapper) { if (!trustedRouters[sender]) revert UntrustedRouter(sender); swapper = IMsgSender(sender).msgSender(); // Backstop against unforeseen router code paths: // swapper == 0: router not locked / msgSender() misconfigured // swapper == sender: router is selling for itself (not a user-initiated flow) if (swapper == address(0) || swapper == sender) revert InvalidSwapper(swapper); }Every sell is recorded
After a sell, the hook reports the seller and the amounts to the rules contract, which can use them for limits.
The code that does this (afterSwap):function afterSwap( address sender, PoolKey calldata key, SwapParams calldata params, BalanceDelta delta, bytes calldata /* hookData — deliberately unused */ ) external override onlyPoolManager onlyAuthorizedPool(key) returns (bytes4, int128) { if (params.zeroForOne) { // Re-derive swapper — msgSender() is constant within the router's unlock window address swapper = _resolveSwapper(sender); // Actual CDXR sent by the swapper (amount0 is negative → negate to get magnitude) int128 amount0 = delta.amount0(); uint256 cdxrSold = amount0 < 0 ? uint256(uint128(-amount0)) : 0; // Actual USDT received by the swapper int128 amount1 = delta.amount1(); uint256 usdtActual = amount1 > 0 ? uint256(uint128(amount1)) : 0; // Record with actual amounts — reverts if over spend limit permissionModule.recordSwap(swapper, cdxrSold, usdtActual); } return (IHooks.afterSwap.selector, 0); }Trading can be paused
If the rules contract says the pool is paused, all trades are refused, buys included.
Who controls it: The hook developer can replace the rules contract, change which routers are trusted, and pass on or give up control. 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 auditsetPermissionModulesetTrustedRouterWhat it can do
Its code executes inside each trade in pools that use it.
Hook history
Nothing recorded yet.
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.