Oracle hook on Ink
Uniswap v4 Hook Contract 0x5fdbbaaaee0e55eab2d810ac93842a4ea34720cc on Ink · Oracle
- Volume (24h)
- $0
- Value locked (TVL)
- $0
- All-time volume
- $0
- Pools using this hook
- 1
- Swaps (24h)
- 59 (33 traders)
- Total swaps
- 59
What it does
This hook charges a basis-point toll on swaps in its pinned pool, accrues it for the operator and protocol, and records a tick-based TWAP oracle, so traders pay the toll on every swap in that pool while LPs and other pools are not charged by it.
How it works step by step
- Records an on-chain tick observation ring buffer (observations, obsIndex, obsCount, tickCumulative) on swaps and exposes TWAP queries via consult and twapSqrtPriceX96
- Pins a pool (pinnedPool, poolPinned, AlreadyPinned error) so that only one pool is tracked by the hook
- Applies a toll (tollBps) on swaps that is accrued in totalTolled and pending, and collected through collect() via the pool manager's take/unlock flow
- Tracks an operator address with operator(), opAccrued and claimOperator() so a share of the toll can be claimed by an operator
- Gates liquidity additions and removals in before/after callbacks, which return zero deltas and read or compute pool state for the oracle and toll accounting
- Swap behaviour
- beforeSwap and afterSwap are both enabled with return-delta permissions, so the hook can adjust the swap amounts it returns; it appears to charge a toll in basis points (tollBps) on swaps and record the resulting tick/price into its observation buffer, with afterSwap also able to take a delta. Exact trade direction charged cannot be fully confirmed from bytecode.
- Liquidity behaviour
- beforeAddLiquidity, afterAddLiquidity, beforeRemoveLiquidity and afterRemoveLiquidity are present as selectors and appear to reject or gate liquidity changes rather than add new liquidity logic; treat exact behaviour as unconfirmed.
- Fee behaviour
- Toll-based: the hook takes a fee expressed as tollBps through return deltas on swaps, accrues it in totalTolled/pending, with a portion tracked for the operator (opAccrued) and collected via collect(). The pool's own LP fee is not described by the hook.
- Owner & admin controls
- An operator address is set and can claim accrued operator amounts via claimOperator(); a board() and pm() getter are exposed. No owner-only setter for tollBps was identified in the decoded selectors, but parameters appear fixed or set during initialization; treat as unconfirmed.
Enabled Uniswap v4 callbacks
beforeInitialize, beforeSwap, afterSwap, beforeSwapReturnDelta, afterSwapReturnDelta
beforeInitialize and afterInitialize record the pinned pool and initial price state; beforeSwap and afterSwap run the toll and observation logic; beforeSwapReturnDelta and afterSwapReturnDelta let the hook take a portion of swap amounts; liquidity hooks gate or observe position changes; beforeDonate and afterDonate are present as selectors but are likely no-ops.
Security & trust assessment
Risk level: medium, estimated (decoded bytecode, low confidence).
Who controls it: The operator can claim accrued toll amounts; no evidence of an owner able to change tollBps was found in the selectors, but without source this cannot be ruled out.
Risk to user funds: The hook can take a percentage of swap amounts through return deltas and holds accrued toll balances until they are collected or claimed, so trader and LP funds routed through the pinned pool are exposed to the toll.
Security findings
- [medium] Return-delta toll on swaps: The hook enables beforeSwapReturnDelta and afterSwapReturnDelta and takes tollBps from swap amounts, so it moves user and pool currency on every swap it is attached to.
- [medium] Operator claim path: claimOperator() lets a designated operator withdraw accrued toll revenue; the operator address is fixed at deployment in the bytecode and there is no visible rotation function.
- [low] Pinned pool dependency: The hook is bound to one pinned pool, so swaps in other pools are unaffected, but the pinned pool can break observation logic if its state is manipulated.
- [info] Liquidity gating: Liquidity callbacks are present and may block adds or removes; the exact conditions are not confirmed from decoded bytecode.
Contract details
- Verified source
- No
- Bytecode size
- 8,639 bytes
- Upgradeable proxy
- No
- Detected patterns
- erc6909-claims, moves-currency, oracle, return-delta, self-unlock, tax