BtcAccHook on Base

Uniswap v4 Hook Contract 0x704268ac7043aeef50f47b6a03ae68ccf808e044 on Base · Fee sharing · Verified contract

Volume (24h)
$0
Value locked (TVL)
$6.39K
All-time volume
$575.30K
Pools using this hook
9
Swaps (24h)
0 (0 traders)
Total swaps
3,731

What it does

Charges a 1% default fee (user-adjustable from 1% to 10%) on swaps in base-token pools and forwards it to the BtcAcc Bitcoin accumulation contract.

How it works step by step

  • Restricts pool initialization so every pool pairs one allowed base token (ETH, WETH, USDC, cbBTC) with another asset
  • Charges a per-wallet swap fee, defaulting to 1% and settable by the wallet between 1% and 10%
  • Takes the fee from the swap output via PoolManager.take and returns it as a hook delta
  • Converts non-base fee tokens into the base token through an internal swap in the same pool
  • Deposits the base token into BtcAcc on behalf of the swapper with the other token as referrer
  • Skips fee collection when the BtcAcc contract is killed
Swap behaviour
On each swap from a whitelisted router, afterSwap takes the fee from the output currency, converts it to a base token if needed, deposits it into BtcAcc for the swapper, and returns the fee as a delta reducing the swapper's output.
Liquidity behaviour
No liquidity callbacks.
Fee behaviour
Charges a per-wallet swap fee on the output currency of each swap: default 1% (100 bips), user-settable between 1% and 10%. Fee is taken from the pool via manager.take and forwarded to BtcAcc as a deposit; afterSwap returns the fee amount as a return delta so the swapper receives less.
Owner & admin controls
Operator of the linked BtcAcc contract (via getOperator) can whitelist or remove routers through setWhitelistedRouter. No owner-set fee; each wallet can set its own swap fee between 100 and 1000 bips via setWalletSwapFee. Hook respects a BtcAcc contractKilled flag that disables fee-taking.

Enabled Uniswap v4 callbacks

beforeInitialize, afterSwap, afterSwapReturnDelta

beforeInitialize restricts pool creation so exactly one currency must be an allowed base token (ETH, WETH, USDC or cbBTC). afterSwap takes the fee and deposits it into BtcAcc. afterSwapReturnDelta lets the hook reduce the swapper's received amount by the fee.

Security & trust assessment

Risk level: medium (verified source, high confidence).

Who controls it: The BtcAcc operator can whitelist arbitrary routers, which determines which callers can trigger fee-taking through msgSender() logic. Router whitelisting does not move user funds directly, but a malicious whitelisted router could report arbitrary user addresses to misdirect fee credit.

Risk to user funds: The hook takes a percentage of each swap's output currency through manager.take and return delta, forwarding it to the BtcAcc contract. It can also hold tokens transiently while converting non-base fees via an internal swap. It does not hold user principal beyond the fee amount.

Security findings

  • [medium] Trust in whitelisted router msgSender: afterSwap calls IValidRouter(sender).msgSender() on whitelisted routers to attribute fees; a whitelisted router controlling that return value can credit deposits to arbitrary addresses.
  • [medium] Unprotected internal swap for non-base fees: Fee is taken on the output currency and a non-base fee token is swapped back through the same pool with a price limit of MIN or MAX price and no slippage bound, exposing the conversion to sandwich or price manipulation.
  • [low] User-settable fee up to 10%: setWalletSwapFee allows any wallet to set its own fee from 1% to 10%, so the effective fee charged to a swap can be raised to 10% by the swapper's own choice of wallet, which is an intentional but notable cost to traders routing through that address.
  • [info] Hook moves user currency: Hook can take tokens and reduce swap output via return delta; the kill switch in BtcAcc disables fees, and the swap path depends on external BtcAcc deposit contracts that are not analysed here.

Contract details

Verified source
Yes (BtcAccHook)
Compiler
solc 0.8.26+commit.8a97fa7a
Bytecode size
6,522 bytes
Upgradeable proxy
No
Detected patterns
access-control, moves-currency, return-delta

Pools using BtcAccHook