PegFeeHook on Ethereum
Uniswap v4 Hook Contract 0x33ca5c16208ec08ac97d4f6315aafa792a916044 on Ethereum · Fee sharing · Verified contract
- Volume (24h)
- $37.24K
- Value locked (TVL)
- $5.14K
- All-time volume
- $37.86K
- Pools using this hook
- 1
- Swaps (24h)
- 38 (8 traders)
- Total swaps
- 53
What it does
A fee hook for the imdUSD/USDC pool that charges extra fees on swaps that push the price more than 0.25% away from $1, with the surcharge going to the imdUSD Treasury.
How it works step by step
- Restricts itself to exactly one pool: (imdUSD, USDC) with fee 100 pips, tick spacing 1, this hook, and an opening price of exactly $1.
- Charges zero surcharge for swaps ending within ±0.25% of $1 or moving the price back toward $1.
- Ramps the surcharge linearly from 0 at 0.25% deviation to a 4.5% extra fee (5% total) at 2% deviation, flat beyond.
- Prices the surcharge from the swap's end price, not the start price.
- Mints the surcharge as ERC-6909 claims so swaps never revert on token transfer, then anyone can call sweep to send tokens to the Treasury.
- Has no owner, parameters or storage to change after deployment.
- Swap behaviour
- On each swap, afterSwap reads the end-of-swap price; if it is beyond the ±0.25% band in the direction the swap pushed it, a surcharge in the unspecified currency is computed and minted as claims, and returned as a delta so the swapper pays it. Otherwise no surcharge.
- Liquidity behaviour
- No liquidity callbacks. Add and remove liquidity hooks are present but revert with NotImplemented and their permission flags are not set. Initial liquidity protection is handled off-hook via PositionManager maximum token amounts at deployment.
- Fee behaviour
- Every swap pays the pool's static LP fee of 0.01%. A swap that pushes the stable's price beyond ±0.25% from $1 and ends there also pays a surcharge rising linearly from zero at the band edge to a total of 5% at 2% from $1, flat beyond. The surcharge is taken in the unspecified currency and minted as ERC-6909 claims to the hook, later swept to the imdUSD Treasury. Surcharge is priced from the swap's end price, not its start.
- Owner & admin controls
- No admin controls found. No owner, no pausing, no upgradeability, no parameters to change; constants are fixed and the hook is immutable. Anyone may call sweep(currency) to convert claims into tokens at the Treasury.
Enabled Uniswap v4 callbacks
beforeInitialize, afterSwap, afterSwapReturnDelta
beforeInitialize: restricts the pool to the single (imdUSD, USDC) pool with fixed fee, tick spacing and hook, and requires an opening price of exactly $1. afterSwap: computes the end-price surcharge and mints it as ERC-6909 claims. afterSwapReturnDelta: returns the surcharge as a delta so the swapper pays it.
Security & trust assessment
Risk level: low (verified source, high confidence).
Who controls it: No privileged key exists. Nothing can be changed after deployment, so no single party can alter fees, pause swaps or move funds. Treasury address is fixed at construction.
Risk to user funds: The hook never holds pool principal and cannot block swaps or liquidity removal. It takes a surcharge only on swaps that move the price more than 0.25% from $1 in the pushing direction, and that surcharge is paid by the swapper and sent to the Treasury. The hook's afterSwap delta is the only mechanism that touches user amounts.
Security findings
- [low] Surcharge can be avoided by splitting or influenced by pre-trades: Surcharge is priced from where a swap ends, so a sale split into several steps pays less in total than one swap ending at the same price, and a trade placed before a swap can push that swap past the band edge so it pays the surcharge. The surcharge goes to the Treasury, not to the party that moved the price.
- [info] Surcharge is non-blocking by design: Surcharge is minted as claims rather than transferred during the swap, so swaps cannot revert on Treasury transfer failures; claims can accumulate and wait for sweep if the token transfer is refused.
- [low] Initial liquidity protection is external to the hook: The pool's initial liquidity depends on PositionManager maximum token amounts set at deployment rather than hook logic; an empty pool's price can be moved freely before deposits, mitigated only by those maximums.
- [info] No pause or blocking path for swaps: The hook only reads pool state and mints claims; it does not hold user principal, and it cannot block swaps or withdrawals, since the only revert paths are constructor and initialization checks plus the unused callbacks.
Contract details
- Verified source
- Yes (PegFeeHook)
- Compiler
- solc 0.8.26+commit.8a97fa7a
- Bytecode size
- 6,559 bytes
- Upgradeable proxy
- No
- Detected patterns
- erc6909-claims, moves-currency, return-delta, self-unlock
Pools using PegFeeHook
- imdUSD / USDC (0.01% fee) — 24h volume $37.24K, TVL $5.14K, 38 swaps today