ProtectedNative30HookV1
RobinhoodProtectedNative30HookV1 is a Uniswap v4 hook on Robinhood Chain. Runs code on every swap. Can take tokens from swaps. Runs at pool creation.
- Contract name
- ProtectedNative30HookV1
How this hook works
Trading taxA trading tax hook. It takes a tax on trades and only lets approved callers create pools.
Takes a tax on trades
On top of the normal pool fee, it keeps part of each trade as a tax. Buys and sells can be taxed differently.
The code that does this (beforeSwap):function _beforeSwap(address sender, PoolKey calldata key, SwapParams calldata params, bytes calldata data) internal override returns (bytes4, BeforeSwapDelta, uint24 overrideFee) { _requirePool(key); if (!initialized) revert UninitializedPool(); if (swapActive) revert ReentrantSwap(); if (params.amountSpecified == 0) revert NoTrade(); swapActive = true; activeSwap = keccak256(abi.encode(sender, key, params, data)); overrideFee = _beforeModule(sender, key, params, data); if (params.zeroForOne && block.timestamp < ProtectedLaunchTokenV1(token).startedAt() + 300) { activeBuyer = LaunchProtectionModuleV1(module).protectedBuyer(sender); } activeOpeningTaxPpm = params.zeroForOne ? LaunchProtectionModuleV1(module).openingTaxPpmForSender(sender) : 0; bool nativeIsSpecified = params.zeroForOne == (params.amountSpecified < 0); if (!nativeIsSpecified) return (IHooks.beforeSwap.selector, BeforeSwapDeltaLibrary.ZERO_DELTA, overrideFee); uint256 nativeAmount = _absolute(params.amountSpecified); (uint256 gross, uint256 platformFee, uint256 creatorFee, uint256 openingTax) = _quoteTradeFees(nativeAmount, params.amountSpecified > 0, params.zeroForOne, activeOpeningTaxPpm); uint256 total = platformFee + creatorFee + openingTax; if (params.amountSpecified < 0 && total >= nativeAmount) revert NoTrade(); expectedNativePoolAmount = params.amountSpecified > 0 ? gross : nativeAmount - total; if (expectedNativePoolAmount == 0) revert NoTrade(); _accrue(sender, key, params.zeroForOne, gross, platformFee, creatorFee, openingTax); return (IHooks.beforeSwap.selector, toBeforeSwapDelta(total.toInt256().toInt128(), 0), overrideFee); }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 price) internal override returns (bytes4) { _requirePool(key); if (initialized || sender != initializer || price != initialSqrtPriceX96) revert UnauthorizedInitializer(); initialized = true; return IHooks.beforeInitialize.selector; }
Who controls it: No admin functions: nobody can change its rules after deployment.
Based on the hook’s published code.
What 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 runs when a pool is created, often to lock in that pool’s settings.
Hook history
- Accrued the native fees 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.