PoolFeeHookCreatorAdd
RobinhoodPoolFeeHookCreatorAdd is a Uniswap v4 hook on Robinhood Chain. Live for 4 days. Still in use: 30 trades in the last week, and 1 new pool this week.
- Contract name
- PoolFeeHookCreatorAdd
How this hook works
Trading taxA trading tax hook. It sets its own trading fee, takes a cut of every trade and manages its own liquidity.
Sets its own trading fee
Instead of a fixed fee chosen by the pool creator, it decides the fee itself on each trade.
The code that does this (isOverride):function isOverride(uint24 self) internal pure returns (bool) { return self & OVERRIDE_FEE_FLAG != 0; }Takes a cut of every trade
On top of the normal pool fee, it keeps a share of each trade. It can never be above 3%. The fee builds up in the hook until it is collected.
The code that does this (beforeSwap):function beforeSwap(IHooks self, PoolKey memory key, IPoolManager.SwapParams memory params, bytes calldata hookData) internal returns (int256 amountToSwap, BeforeSwapDelta hookReturn, uint24 lpFeeOverride) { amountToSwap = params.amountSpecified; if (msg.sender == address(self)) return (amountToSwap, BeforeSwapDeltaLibrary.ZERO_DELTA, lpFeeOverride); if (self.hasPermission(BEFORE_SWAP_FLAG)) { bytes memory result = callHook(self, abi.encodeCall(IHooks.beforeSwap, (msg.sender, key, params, hookData))); // A length of 96 bytes is required to return a bytes4, a 32 byte delta, and an LP fee if (result.length != 96) InvalidHookResponse.selector.revertWith(); // dynamic fee pools that want to override the cache fee, return a valid fee with the override flag. If override flag // is set but an invalid fee is returned, the transaction will revert. Otherwise the current LP fee will be used if (key.fee.isDynamicFee()) lpFeeOverride = result.parseFee(); // skip this logic for the case where the hook return is 0 if (self.hasPermission(BEFORE_SWAP_RETURNS_DELTA_FLAG)) { hookReturn = BeforeSwapDelta.wrap(result.parseReturnDelta()); // any return in unspecified is passed to the afterSwap hook for handling int128 hookDeltaSpecified = hookReturn.getSpecifiedDelta(); // Update the swap amount according to the hook's return, and check that the swap type doesn't change (exact input/output) if (hookDeltaSpecified != 0) { bool exactInput = amountToSwap < 0; amountToSwap += hookDeltaSpecified; if (exactInput ? amountToSwap > 0 : amountToSwap < 0) { HookDeltaExceedsSwapAmount.selector.revertWith(); // …Manages its own liquidity
It adds and removes liquidity itself, so it can own part or all of the pool.
The code that does this (unlocked):function _unlocked(bytes calldata data) internal override returns (bytes memory) { bool adding; assembly ("memory-safe") { adding := tload(ADDING_SLOT) } if (!adding) return super._unlocked(data); assembly ("memory-safe") { tstore(ADDING_SLOT, 0) } ( PoolKey memory key, uint128 liquidity, uint256 salt, bool quoteIs0, uint256 tokenMax, uint256 quoteMax, address creator ) = abi.decode(data, (PoolKey, uint128, uint256, bool, uint256, uint256, address)); (BalanceDelta delta,) = poolManager.modifyLiquidity( key, IPoolManager.ModifyLiquidityParams({ tickLower: MIN_TICK, tickUpper: MAX_TICK, liquidityDelta: int256(uint256(liquidity)), salt: bytes32(salt) }), "" ); uint256 owed0 = _owed(delta.amount0()); uint256 owed1 = _owed(delta.amount1()); // …Rewards to claim
It keeps track of what people have earned, and they claim it themselves.
The code that does this (claimDeferredCreatorFees):function claimDeferredCreatorFees(address creator, Currency quote) external nonReentrant returns (uint256 amount) { amount = _takeCreatorDebt(creator, quote); _sendOrRevert(quote, creator, amount); emit DeferredFeesClaimed(Currency.unwrap(quote), creator, creator, amount, false); }Rules for adding liquidity
It decides who can add liquidity, or when.
The code that does this (beforeAddLiquidity):function beforeAddLiquidity( address, PoolKey calldata key, IPoolManager.ModifyLiquidityParams calldata, bytes calldata ) external onlyPoolManager returns (bytes4) { PoolId id = key.toId(); bool open; assembly ("memory-safe") { open := eq(tload(SEED_POOL_SLOT), id) } if (!open) revert LiquidityLocked(); assembly ("memory-safe") { tstore(SEED_POOL_SLOT, 0) } 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(IHooks self, PoolKey memory key, uint160 sqrtPriceX96) internal noSelfCall(self) { if (self.hasPermission(BEFORE_INITIALIZE_FLAG)) { self.callHook(abi.encodeCall(IHooks.beforeInitialize, (msg.sender, key, sqrtPriceX96))); } }Anyone can trigger payouts
Anyone can collect the fees it has built up, so nobody has to wait on the hook developer.
The code that does this (collect):function collect(PoolId id) external nonReentrant returns (uint256 amount) { uint256 acc = accrued[id]; if (acc <= 1) return 0; // unregistered (0) or nothing beyond the floor (1) amount = acc - 1; accrued[id] = 1; // effects first Currency quote = quoteOf[id]; poolManager.unlock(abi.encode(quote, amount)); PoolConfig memory c = pools[id]; (,,, address platform) = feeConfig.currentFee(); uint256 creatorAmount = Math.mulDiv(amount, c.creatorBps, BPS); uint256 platformAmount = amount - creatorAmount; if (creatorAmount > 0 && !_trySend(quote, c.creator, creatorAmount)) { creatorDeferred[c.creator][quote] += creatorAmount; emit FeesDeferred(id, Currency.unwrap(quote), c.creator, creatorAmount, false); } if (platformAmount > 0 && !_trySend(quote, platform, platformAmount)) { platformDeferred[quote] += platformAmount; emit FeesDeferred(id, Currency.unwrap(quote), platform, platformAmount, true); } emit FeesCollected(id, Currency.unwrap(quote), platformAmount, creatorAmount); }
Who controls it: The hook developer can change: migrator. The hook developer can also call: propose migrator, cancel pending migrator, execute migrator. The pool creator can call: add creator liquidity. The migrator can call: register. Control can be passed on but not given up. 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 auditWhat it can do
Its code executes inside each trade in pools that use it.
It can take or add tokens during a swap. Fees, burns and custom curves work this way, and so do scams.
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
- Handled a trade 30 times
Latest transactions
- 0xadcf9c27…70d353 block 123,287,994
- 0xd731758e…234a85 block 123,287,949
- 0xcbdc3726…04580e block 123,275,180
- 0x1afd036e…2b9623 block 123,275,133
- 0xedb98282…9da95f block 123,274,764
- 0x3a7b832d…b38609 block 123,274,722
- 0x0a13828c…db47cd block 121,807,243
- 0x506a970e…e4a92a block 121,807,182
- 0xa12093f4…fcd043 block 121,805,817
- 0x26a1a2e9…751684 block 121,803,465
- Took its fee from a trade 15 times
Latest transactions
- 0xf8ba766e…78bb25 block 121,807,577
- 0x1fc61a4c…5c8c00 block 121,805,896
- 0xefd3481b…85452e block 121,803,806
- 0xc870179a…962592 block 121,802,944
- 0x7677a26c…f5f424 block 121,724,735
- 0xd70abccd…dae146 block 121,720,514
- 0xd2a97a05…580c52 block 121,708,003
- 0x51b60843…88f93c block 121,707,544
- 0x3d01b4a4…1672f4 block 121,706,199
- 0x1262b5c8…f04f2b block 121,694,780
- Registered a new pool 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.