TWAMM on Base
Uniswap v4 Hook Contract 0xed1698c29928a6c44cddb0c75ab0e5d47eb72a80 on Base · TWAMM · Verified contract
- Volume (24h)
- $0
- Value locked (TVL)
- $8.29K
- All-time volume
- $271.04K
- Pools using this hook
- 15
- Swaps (24h)
- 0 (0 traders)
- Total swaps
- 779
What it does
Runs time-weighted average market maker orders on Uniswap v4 pools, letting users split a large trade into continuous small swaps over a set duration that are executed against the pool each time it is touched.
How it works step by step
- Accepts long-term orders that sell one token for the other at a constant rate until an interval-aligned expiration timestamp.
- Holds order sell tokens in the hook and tracks each order by owner, expiration and direction.
- Executes virtual orders lazily on each beforeSwap, beforeAddLiquidity and beforeRemoveLiquidity call by matching opposing flows and settling the remainder against the pool.
- Lets order owners sync an order to collect earned output tokens into tokensOwed and then claim them.
- Rejects pools whose currency0 is native ETH and sets up TWAMM state on pool initialization.
- Swap behaviour
- Before every swap, pending virtual TWAMM orders for the pool are executed up to the current block, and the resulting net trade is routed through the pool manager as a real swap.
- Liquidity behaviour
- Before adding or removing liquidity the hook executes any pending TWAMM virtual orders for the pool, so the pool state is brought up to date first; removal execution errors are swallowed so withdrawals are never blocked.
- Fee behaviour
- Uses the pool's static fee.
- Owner & admin controls
- Not stated.
Enabled Uniswap v4 callbacks
beforeInitialize, beforeAddLiquidity, beforeRemoveLiquidity, beforeSwap
beforeInitialize initializes TWAMM state for the pool and rejects pools with a native currency; beforeAddLiquidity and beforeRemoveLiquidity execute pending TWAMM orders before liquidity changes; beforeSwap executes pending TWAMM orders before each swap.
Security & trust assessment
Risk level: medium (verified source, high confidence).
Who controls it: The owner can call killHook, which is one-way: after it is called new TWAMM orders are rejected and remaining orders can be unwound via sync, but normal pool swaps and liquidity actions keep working. The owner has no way to move user funds or change fees, and ownership can be transferred to any address.
Risk to user funds: The hook holds the sell tokens of all active TWAMM orders and the claimable tokensOwed balances, custodied in the hook contract. Order owners can withdraw their owed amounts through sync and claim functions. The owner cannot directly withdraw these balances, but a killHook call returns unexpired order amounts to their owners via sync.
Security findings
- [medium] Owner can permanently kill the TWAMM feature: killHook is callable only by the owner and permanently disables submitOrder and batchSubmitOrders. Existing orders can still be synced and their unexecuted portion refunded, so users are not trapped, but new TWAMM activity stops for everyone.
- [low] Single-owner control without timelock: Owned contract with a single owner key and no timelock; ownership transfer is a single step.
- [info] Virtual orders execute as real swaps on the pool: Virtual orders are settled by real swaps executed through the pool manager inside beforeSwap and liquidity hooks, so a large pending order can move the pool price against the trader who triggered execution.
- [info] Removal path tolerates execution failure: beforeRemoveLiquidity wraps executeTWAMMOrders in a try/catch so that an execution failure cannot block withdrawals, meaning pending orders may remain unexecuted in that case.
Contract details
- Verified source
- Yes (TWAMM)
- Compiler
- solc 0.8.26+commit.8a97fa7a
- Bytecode size
- 18,500 bytes
- Upgradeable proxy
- No
- Detected patterns
- erc6909-claims, moves-currency, ownable, self-unlock, twamm
Pools using TWAMM
- WETH / FWB (0.50% fee) — 24h volume $0, TVL $8.29K, 0 swaps today
- token8 / token7 (0.30% fee) — 24h volume $0, TVL $0, 0 swaps today
- token8 / token7 (0.50% fee) — 24h volume $0, TVL $0, 0 swaps today
- token8 / token7 (0.70% fee) — 24h volume $0, TVL $0, 0 swaps today
- token100 / token101 (0.30% fee) — 24h volume $0, TVL $0, 0 swaps today
- token100 / token101 (0.50% fee) — 24h volume $0, TVL $0, 0 swaps today
- token100 / token101 (0.70% fee) — 24h volume $0, TVL $0, 0 swaps today
- testPrice1 / testPrice2 (0.30% fee) — 24h volume $0, TVL $0, 0 swaps today
- WETH / FWB (0.30% fee) — 24h volume $0, TVL $0, 0 swaps today
- testPrice1 / testPrice2 (0.70% fee) — 24h volume $0, TVL $0, 0 swaps today
- testPrice1 / testPrice2 (0.50% fee) — 24h volume $0, TVL $0, 0 swaps today
- token105 / token106 (0.70% fee) — 24h volume $0, TVL $0, 0 swaps today
- token106 / token105 (0.50% fee) — 24h volume $0, TVL $0, 0 swaps today
- token106 / token105 (0.70% fee) — 24h volume $0, TVL $0, 0 swaps today
- token106 / token105 (0.30% fee) — 24h volume $0, TVL $0, 0 swaps today