AlgebraIntegralAggregator
RobinhoodAlgebraIntegralAggregator is a Uniswap v4 hook on Robinhood Chain. Runs code on every swap. Can take tokens from swaps. Gates who can add liquidity. Runs at pool creation.
- Contract name
- AlgebraIntegralAggregator
How this hook works
Custom pricingA custom pricing hook. It sets its own prices, stops liquidity being added directly and only lets approved callers create pools.
Sets its own prices
It can fill trades itself, at its own price, instead of using Uniswap’s normal formula.
The code that does this (beforeSwap):function _beforeSwap(address, PoolKey calldata key, SwapParams calldata params, bytes calldata) internal override returns (bytes4, BeforeSwapDelta, uint24) { _validateAmount(params.amountSpecified); (uint256 output, uint256 input, bool settled) = _conductSwap( params.zeroForOne ? key.currency1 : key.currency0, params.zeroForOne ? key.currency0 : key.currency1, params, key.toId()); if (!settled) revert IncompleteSwap(); if (input > uint128(type(int128).max) || output > uint128(type(int128).max)) revert InvalidAmount(); bool exactInput = params.amountSpecified < 0; if (exactInput ? input != uint256(-params.amountSpecified) : output != uint256(params.amountSpecified)) { revert IncompleteSwap(); } return (IHooks.beforeSwap.selector, toBeforeSwapDelta(int128(-params.amountSpecified), exactInput ? -int128(uint128(output)) : int128(uint128(input))), 0); }Liquidity can’t be added directly
Nobody can add liquidity to its pools through Uniswap directly. Liquidity only comes in through the hook’s own code.
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, PoolKey calldata key, uint160) internal virtual override returns (bytes4) { if (key.currency0.isAddressZero() || key.currency1.isAddressZero()) revert NativeCurrencyNotSupported(); address token0 = Currency.unwrap(key.currency0); address token1 = Currency.unwrap(key.currency1); address poolAddr = _resolveExternalPool(token0, token1, key); // Defensive programming for untrustable factory. if (IAlgebraPool(poolAddr).token0() != token0 || IAlgebraPool(poolAddr).token1() != token1) { revert ExternalPoolMismatch(); } PoolKey storage existing = _canonicalPoolKeyByAddress[poolAddr]; if (address(existing.hooks) != address(0)) { revert PairAlreadyHasCanonicalPool(existing.toId()); } _canonicalPoolKeyByAddress[poolAddr] = key; poolIdToExternalPool[key.toId()] = poolAddr; _initializedPools.push(key); emit AggregatorPoolRegistered(key.toId()); return IHooks.beforeInitialize.selector; }
Who controls it: Nobody. The hook has no admin functions, and the code cannot be changed.
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 checks every deposit before it goes in.
It runs when a pool is created, often to lock in that pool’s settings.
Hook history
- Registered an aggregator 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.