WrappedHook
BSCWrappedHook is a Uniswap v4 hook on BSC. Brand new: its first pool went live today.
- Contract name
- WrappedHook
How this hook works
Buyback and burnA buyback and burn hook. It takes a tax on trades, buys back the token and burns tokens.
Takes a tax on trades
On top of the normal pool fee, it keeps part of each trade as a tax. The tax can be changed, but never above 10%. The tax builds up in the hook until it is collected.
The code that does this (beforeSwap):function beforeSwap(address, PoolKey calldata key, SwapParams calldata p, bytes calldata) external override nonReentrant returns (bytes4, BeforeSwapDelta, uint24) { if (msg.sender != address(poolManager)) revert NotPoolManager(); // Only serve the canonical wX pool: WETH=currency0, a registered wX=currency1. (Anyone can // init a pool bearing this hook; without this, a rogue key would pull WETH float against a // non-wX currency0 — it reverts on the delta today, but assert it explicitly.) _validatePool(key); address wX = Currency.unwrap(key.currency1); WrapInfo storage w = infoOf[wX]; if (!w.active) revert NotActive(); if (p.amountSpecified >= 0) revert ExactOutputUnsupported(); // exact-input only in V1 uint256 amt = uint256(-p.amountSpecified); Currency hxc = Currency.wrap(wX); int128 dSpecified; int128 dUnspecified; if (p.zeroForOne) { // BUY: WETH in (amt), wX out. Take the WETH, skim fee, route the rest into X's pool for // xOut of X (locked as backing), then deliver xOut wX — reusing reserve claims first. wethCurrency.take(poolManager, address(this), amt, false); uint256 fee = _accrueFee(w, wX, amt); uint256 xOut = _routeToX(w, amt - fee); uint256 res = reserveOf[wX]; uint256 fromReserve = res >= xOut ? xOut : res; // …Buys back the token
It uses what it collects to buy the token back.
The code that does this (v4Swap):function _v4Swap(PoolKey memory k, bool wethIs0, bool buyX, uint256 amountIn) internal returns (uint256 out) { // Direction in the original pool: selling WETH means selling currency0 iff WETH is currency0. bool sellingWeth = buyX; bool zeroForOne = sellingWeth ? wethIs0 : !wethIs0; BalanceDelta d = poolManager.swap( k, SwapParams({ zeroForOne: zeroForOne, amountSpecified: -int256(amountIn), sqrtPriceLimitX96: zeroForOne ? TickMath.MIN_SQRT_PRICE + 1 : TickMath.MAX_SQRT_PRICE - 1 }), "" ); // The wrapper accounts for the complete requested input. Exhausted concentrated // liquidity may return a partial fill; fail atomically rather than retaining change. int128 inputDelta = zeroForOne ? d.amount0() : d.amount1(); if (inputDelta >= 0 || uint256(uint128(-inputDelta)) != amountIn) revert PartialFillUnsupported(); // The public wrapper market and fee ledger remain WETH-denominated. Only the // original-pool leg converts native currency, using the exact settled amount. bool nativeQuote = k.currency0.isAddressZero(); if (nativeQuote && buyX) IWrappedNative(WETH).withdraw(amountIn); // Pay the input side, collect the output side. if (zeroForOne) { k.currency0.settle(poolManager, address(this), uint256(uint128(-d.amount0())), false); out = uint256(uint128(d.amount1())); k.currency1.take(poolManager, address(this), out, false); } else { k.currency1.settle(poolManager, address(this), uint256(uint128(-d.amount1())), false); out = uint256(uint128(d.amount0())); k.currency0.take(poolManager, address(this), out, false); // …Burns tokens
It destroys some tokens (or sends them to an address nobody controls), so there are fewer of them.
The code that does this (unwrap):function unwrap(address wX, uint256 amount) external nonReentrant { address original = infoOf[wX].original; if (original == address(0)) revert NotActive(); WrappedToken(wX).burn(msg.sender, amount); uint256 fee = _entryExitFee(infoOf[wX], wX, amount); IERC20(original).safeTransfer(msg.sender, amount - fee); emit Unwrapped(wX, msg.sender, amount - fee); }Rewards to claim
It keeps track of what people have earned, and they claim it themselves.
The code that does this (claimFees):function claimFees(address to) external nonReentrant returns (uint256 amount) { amount = feesOwed[msg.sender]; if (amount > 0) { feesOwed[msg.sender] = 0; IERC20(WETH).safeTransfer(to, amount); emit FeesClaimed(msg.sender, amount); } }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) external override returns (bytes4) { if (msg.sender != address(poolManager)) revert NotPoolManager(); if (sender != address(this)) revert NotAuthorized(); _validatePool(key); return IHooks.beforeInitialize.selector; }No trading before the start
Trades are refused until trading has been opened.
The code that does this (beforeSwap):function beforeSwap(address, PoolKey calldata key, SwapParams calldata p, bytes calldata) external override nonReentrant returns (bytes4, BeforeSwapDelta, uint24) { if (msg.sender != address(poolManager)) revert NotPoolManager(); // Only serve the canonical wX pool: WETH=currency0, a registered wX=currency1. (Anyone can // init a pool bearing this hook; without this, a rogue key would pull WETH float against a // non-wX currency0 — it reverts on the delta today, but assert it explicitly.) _validatePool(key); address wX = Currency.unwrap(key.currency1); WrapInfo storage w = infoOf[wX]; if (!w.active) revert NotActive(); if (p.amountSpecified >= 0) revert ExactOutputUnsupported(); // exact-input only in V1 uint256 amt = uint256(-p.amountSpecified); Currency hxc = Currency.wrap(wX); int128 dSpecified; int128 dUnspecified; if (p.zeroForOne) { // BUY: WETH in (amt), wX out. Take the WETH, skim fee, route the rest into X's pool for // xOut of X (locked as backing), then deliver xOut wX — reusing reserve claims first. wethCurrency.take(poolManager, address(this), amt, false); uint256 fee = _accrueFee(w, wX, amt); uint256 xOut = _routeToX(w, amt - fee); uint256 res = reserveOf[wX]; uint256 fromReserve = res >= xOut ? xOut : res; // …Anyone can trigger payouts
Anyone can trigger a buyback, so nobody has to wait on the hook developer.
The code that does this (buybackAndBurn):function buybackAndBurn(address wX, uint256 amount, uint256 minimumOutput, uint256 deadline) external nonReentrant returns (uint256 burned) { WrapInfo storage w = infoOf[wX]; if (msg.sender != w.feeRecipient) revert NotAuthorized(); require(w.active && amount > 0 && minimumOutput > 0 && block.timestamp <= deadline, "invalid buyback"); IERC20(WETH).safeTransferFrom(msg.sender, address(this), amount); burned = abi.decode(poolManager.unlock(abi.encode(wX, amount, uint8(2))), (uint256)); require(burned >= minimumOutput, "buyback slippage"); WrappedToken(wX).mint(address(this), burned); WrappedToken(wX).burn(address(this), burned); IERC20(w.original).safeTransfer(address(0xdead), burned); }
Who controls it: The hook developer can change the wallets that receive its fees and the fee. The hook developer can also change: permissionless, wrapper. The hook developer can also call: create wrapper. The code never lets the fee go above 10%. Control can be passed on or 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 auditdisableWrapperconvertOriginalFeesSwapRouter02: nothing there can change how trades go.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
- Created a wrapper 3 times
Latest transactions
- 0x4c236561…19d67a block 133,954,477
- 0x2177744f…2ed4ca block 133,954,113
- 0xf9d5882c…4f1e80 block 133,953,595
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.