Custom pricing hook on MegaETH
Uniswap v4 Hook Contract 0x428270c7f0ea6d4a55c1a717066960797e646a88 on MegaETH · Custom pricing
- Volume (24h)
- $0
- Value locked (TVL)
- $0
- All-time volume
- $0
- Pools using this hook
- 1
- Swaps (24h)
- 0 (0 traders)
- Total swaps
- 0
What it does
A custom accounting hook that wraps a Uniswap v4 pool with internal share-token liquidity management, enforces withdrawal caps, and can be paused by an admin.
How it works step by step
- Manages liquidity through an internal ERC20-style share token (mint, burn, transfer, approve)
- Routes addLiquidity and removeLiquidity through the pool manager using unlock/unlockCallback
- Applies withdrawal caps (MAX_WITHDRAW_BPS) and a minimum share threshold
- Lets an admin pause swaps and liquidity actions for a bounded duration
- Uses beforeSwapReturnDelta to adjust swap currency deltas
- Validates the pool key on initialization
- Swap behaviour
- beforeSwap runs on every swap with a return delta enabled, so the hook can adjust the amounts exchanged. It is also gated by the pause state.
- Liquidity behaviour
- Liquidity is managed through the hook itself: addLiquidity and removeLiquidity wrap the pool manager via unlock/unlockCallback, mint and burn internal share tokens (ERC20-style balanceOf, transfer, approve, transferFrom), and use DEAD_SHARES to seed the supply. beforeAddLiquidity and beforeRemoveLiquidity callbacks are also enabled, and withdrawals are subject to a cap.
- Fee behaviour
- No fee logic identified from the decoded selectors; the pool's static fee applies. The hook uses return deltas on swaps, which can alter the amounts exchanged, but the exact fee mechanics cannot be determined without source.
- Owner & admin controls
- An admin address (read via admin()) can call setPaused(bool,uint256) to pause the hook for a bounded duration (MAX_PAUSE_DURATION). Pausing gates swaps and liquidity actions. Withdrawal limits are enforced via MAX_WITHDRAW_BPS and MIN_WITHDRAWAL_SHARES, and admin-only actions revert with NotAdmin. No upgrade mechanism was identified from the selectors.
Enabled Uniswap v4 callbacks
beforeInitialize, beforeAddLiquidity, beforeRemoveLiquidity, beforeSwap, beforeSwapReturnDelta
beforeInitialize validates or records the pool key on pool creation. beforeAddLiquidity and beforeRemoveLiquidity run checks around direct pool liquidity changes. beforeSwap runs logic before each swap and is paired with beforeSwapReturnDelta, letting the hook take or give currency deltas during swaps.
Security & trust assessment
Risk level: medium, estimated (decoded bytecode, medium confidence).
Who controls it: The admin can pause the hook for up to the maximum pause duration, halting swaps and liquidity operations for all users. Admin-only functions are gated by NotAdmin, but the admin key is a single point of control.
Risk to user funds: The hook holds pooled liquidity through its share token accounting and can move currency via take and transfer during liquidity operations. Its return delta on swaps and its pause ability can affect how user funds are priced and whether they can be withdrawn.
Security findings
- [medium] Admin pause can block trading and withdrawals: The hook can pause swaps and liquidity actions via setPaused, bounded by MAX_PAUSE_DURATION, so users may be temporarily unable to trade or withdraw.
- [medium] Return delta can modify swap amounts: beforeSwapReturnDelta lets the hook alter the currency amounts of swaps, so it can take or redirect value from traders and LPs. The exact amounts depend on logic not visible without source.
- [low] Hook holds and moves pool funds: The hook uses an unlock callback pattern (unlock/unlockCallback) and moves currency via take and transfer, so it holds or moves pool funds during liquidity operations.
- [info] Withdrawal cap in place: The hook includes withdrawal caps (MAX_WITHDRAW_BPS, WithdrawalCapExceeded) and a minimum withdrawal share threshold, which limits how quickly liquidity can exit.
- [info] Unverified source: No verified source is available, so function purposes and parameter handling are inferred from selectors and storage only.
Contract details
- Verified source
- No
- Bytecode size
- 13,225 bytes
- Upgradeable proxy
- No
- Detected patterns
- erc20, moves-currency, pausable, return-delta, self-unlock
Pools using Custom pricing hook
- wiTRY / USDm (Dynamic fee) — 24h volume $0, TVL $0, 0 swaps today