ElfomoFiAggregator
BaseElfomoFiAggregator is a Uniswap v4 hook on Base. Brand new: its first pool went live today.
- Contract name
- ElfomoFiAggregator
How this hook works
Trading taxA trading tax hook. It takes a cut of every trade, limits some actions to approved addresses and stops liquidity being added directly.
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 0.05%.
The code that does this (conductSwap):function _conductSwap( Currency settleCurrency, Currency takeCurrency, SwapParams calldata params, PoolId poolId ) internal override returns (uint256 amountSettle, uint256 amountTake, bool hasSettled) { if (params.amountSpecified >= 0) revert ExactOutputNotSupported(); if (activePair[poolId].token0 == address(0)) revert PoolNotInitialized(); amountTake = uint256(-params.amountSpecified); if (amountTake == 0) revert ZeroAmount(); uint256 grossOut; { address tokenIn = Currency.unwrap(takeCurrency); address tokenOut = Currency.unwrap(settleCurrency); poolManager.take(takeCurrency, address(this), amountTake); IERC20(tokenIn).forceApprove(elfomoSwap, amountTake); uint256 balBefore = IERC20(tokenOut).balanceOf(address(this)); IElfomoSwap(elfomoSwap).swap(tokenIn, tokenOut, int256(amountTake), 0, address(this), 0); grossOut = IERC20(tokenOut).balanceOf(address(this)) - balBefore; IERC20(tokenIn).forceApprove(elfomoSwap, 0); } if (grossOut == 0) revert ZeroOutput(); uint256 fee = feeOnOutput(grossOut); amountSettle = grossOut - fee; if (amountSettle == 0) revert ZeroOutput(); poolManager.sync(settleCurrency); // …Approved addresses only
Some actions are limited to addresses on an approved list.
The code that does this (beforeInitialize):function _beforeInitialize(address, PoolKey calldata key, uint160) internal override returns (bytes4) { if (key.fee != LPFeeLibrary.DYNAMIC_FEE_FLAG || key.tickSpacing != CANONICAL_TICK_SPACING) { revert InvalidPoolParams(); } address t0 = Currency.unwrap(key.currency0); address t1 = Currency.unwrap(key.currency1); if (!isAllowedPair[t0][t1]) revert PairNotAllowed(); PoolId pid = key.toId(); if (activePair[pid].token0 != address(0)) revert PoolAlreadyInitialized(); activePair[pid] = PairSpec({token0: t0, token1: t1}); _initializedKeys.push(key); return IHooks.beforeInitialize.selector; }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 override returns (bytes4) { if (key.fee != LPFeeLibrary.DYNAMIC_FEE_FLAG || key.tickSpacing != CANONICAL_TICK_SPACING) { revert InvalidPoolParams(); } address t0 = Currency.unwrap(key.currency0); address t1 = Currency.unwrap(key.currency1); if (!isAllowedPair[t0][t1]) revert PairNotAllowed(); PoolId pid = key.toId(); if (activePair[pid].token0 != address(0)) revert PoolAlreadyInitialized(); activePair[pid] = PairSpec({token0: t0, token1: t1}); _initializedKeys.push(key); return IHooks.beforeInitialize.selector; }Simple trades only
Trades must state the amount going in, not the amount coming out.
The code that does this (rawQuote):function _rawQuote(bool zeroToOne, int256 amountSpecified, PoolId poolId) internal view override returns (uint256 amountUnspecified) { if (amountSpecified >= 0) revert ExactOutputNotSupported(); PairSpec memory p = activePair[poolId]; if (p.token0 == address(0)) revert PoolNotInitialized(); uint256 amountIn = uint256(-amountSpecified); if (amountIn == 0) revert ZeroAmount(); address tokenIn = zeroToOne ? p.token0 : p.token1; address tokenOut = zeroToOne ? p.token1 : p.token0; uint256 grossOut = IElfomoSwap(elfomoSwap).getAmountOut(tokenIn, tokenOut, amountIn); if (grossOut == 0) revert ZeroOutput(); uint256 netOut = grossOut - feeOnOutput(grossOut); if (netOut == 0) revert ZeroOutput(); return netOut; }
Who controls it: Nobody. The hook has no admin functions, and 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.
Pools using it let the hook choose the swap fee instead of a fixed tier.
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
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.