PancakeV3Aggregator
BSCPancakeV3Aggregator is a Uniswap v4 hook on BSC. Brand new: its first pool went live today. Still in use: 2 trades in the last week, and 15 new pools this week.
- Contract name
- PancakeV3Aggregator
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 fee is paid out in the same trade.
The code that does this (pancakeV3SwapCallback):function pancakeV3SwapCallback(int256 amount0Delta, int256 amount1Delta, bytes calldata data) external override { (PoolId poolId, bool isQuote) = abi.decode(data, (PoolId, bool)); if (isQuote) revert QuoteRevert(amount0Delta, amount1Delta); address expectedPool = _transientExpectedPool(); if (expectedPool == address(0)) revert CallbackOutsideActiveSwap(); if (msg.sender != expectedPool) revert UnauthorizedCallback(); if (PoolId.unwrap(poolId) != _transientExpectedPoolId()) revert UnauthorizedCallback(); if (poolIdToExternalPool[poolId] != msg.sender) revert UnauthorizedCallback(); PoolKey storage canonical = _canonicalPoolKeyByAddress[msg.sender]; Currency owedCurrency; uint256 owedAmt; if (amount0Delta > 0 && amount1Delta <= 0) { owedCurrency = canonical.currency0; owedAmt = uint256(amount0Delta); } else if (amount1Delta > 0 && amount0Delta <= 0) { owedCurrency = canonical.currency1; owedAmt = uint256(amount1Delta); } else { revert UnexpectedSwapOutputDelta(); } _setTransientSwapInputPaid(owedAmt); poolManager.take(owedCurrency, msg.sender, owedAmt); }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 sqrtPriceX96) internal override returns (bytes4) { if (sqrtPriceX96 != SQRT_PRICE_1_1) revert InvalidSqrtPrice(sqrtPriceX96); if (key.currency0.isAddressZero() || key.currency1.isAddressZero()) revert NativeCurrencyNotSupported(); if (key.fee == 0 || key.fee >= LPFeeLibrary.MAX_LP_FEE) revert ExternalPoolMismatch(); address token0 = Currency.unwrap(key.currency0); address token1 = Currency.unwrap(key.currency1); address poolAddr = IPancakeV3Factory(factory).getPool(token0, token1, key.fee); if (poolAddr == address(0)) revert ExternalPoolNotFound(); if (!isAllowedExternalPool[poolAddr]) revert ExternalPoolNotAllowed(); if (IPancakeV3Pool(poolAddr).token0() != token0 || IPancakeV3Pool(poolAddr).token1() != token1) { revert ExternalPoolMismatch(); } if (IPancakeV3Pool(poolAddr).fee() != key.fee) revert ExternalPoolMismatch(); if (IPancakeV3Pool(poolAddr).tickSpacing() != key.tickSpacing) revert ExternalPoolMismatch(); PoolKey storage existing = _canonicalPoolKeyByAddress[poolAddr]; if (address(existing.hooks) != address(0)) revert PairAlreadyHasCanonicalPool(existing.toId()); _canonicalPoolKeyByAddress[poolAddr] = key; PoolId id = key.toId(); poolIdToExternalPool[id] = poolAddr; _initializedPools.push(key); emit AggregatorPoolRegistered(id); pollTokenJar(); 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 sqrtPriceX96) internal override returns (bytes4) { if (sqrtPriceX96 != SQRT_PRICE_1_1) revert InvalidSqrtPrice(sqrtPriceX96); if (key.currency0.isAddressZero() || key.currency1.isAddressZero()) revert NativeCurrencyNotSupported(); if (key.fee == 0 || key.fee >= LPFeeLibrary.MAX_LP_FEE) revert ExternalPoolMismatch(); address token0 = Currency.unwrap(key.currency0); address token1 = Currency.unwrap(key.currency1); address poolAddr = IPancakeV3Factory(factory).getPool(token0, token1, key.fee); if (poolAddr == address(0)) revert ExternalPoolNotFound(); if (!isAllowedExternalPool[poolAddr]) revert ExternalPoolNotAllowed(); if (IPancakeV3Pool(poolAddr).token0() != token0 || IPancakeV3Pool(poolAddr).token1() != token1) { revert ExternalPoolMismatch(); } if (IPancakeV3Pool(poolAddr).fee() != key.fee) revert ExternalPoolMismatch(); if (IPancakeV3Pool(poolAddr).tickSpacing() != key.tickSpacing) revert ExternalPoolMismatch(); PoolKey storage existing = _canonicalPoolKeyByAddress[poolAddr]; if (address(existing.hooks) != address(0)) revert PairAlreadyHasCanonicalPool(existing.toId()); _canonicalPoolKeyByAddress[poolAddr] = key; PoolId id = key.toId(); poolIdToExternalPool[id] = poolAddr; _initializedPools.push(key); emit AggregatorPoolRegistered(id); pollTokenJar(); 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 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
Across all its pools, the hook handled a trade: $347.82, and took its fee from a trade: $0.000870.
- Handled a trade 2 times, worth $347.82
Latest transactions
- 0xb09ebdac…c46deb block 135,519,704
- 0x02b2a365…afa6e7 block 135,511,151
- Took its fee from a trade 2 times, worth $0.000870
Latest transactions
- 0xb09ebdac…c46deb block 135,519,704 · 4.09e-7 WBNB
- 0x02b2a365…afa6e7 block 135,511,151 · 0.00000118 WBNB
- Registered an aggregator pool 15 times
Latest transactions
- 0x64fb24ed…ba5170 block 135,510,377
- 0x5cfa195b…9254b8 block 135,510,335
- 0x5028572e…f86707 block 135,510,295
- 0x1db6ada6…36cb78 block 135,510,236
- 0x5823a6af…e62be0 block 135,510,195
- 0x5d9ed07b…7b6278 block 135,510,155
- 0x1b051c49…4dc8ff block 135,510,116
- 0x7578ead1…c18b2a block 135,510,096
- 0x2ee97035…46a651 block 135,510,065
- 0x59b0bc57…65ebf2 block 135,510,035
Settings changes: changed the token jar (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. Dollar values count the amounts paid in ETH, stablecoins, BNB and BTC, at today’s prices.
Pools
15 totalOnly pools with trades in the last 7 days are listed here: 1 of 15. See all, newest first.