CopiesGapHook on Robinhood Chain
Uniswap v4 Hook Contract 0xb260edba1304e427bb787deb422d4a4d261c60c4 on Robinhood Chain · Dynamic fee · Verified contract
- Volume (24h)
- $0
- Value locked (TVL)
- $0
- All-time volume
- $0
- Pools using this hook
- 1
- Swaps (24h)
- 18 (2 traders)
- Total swaps
- 18
What it does
Outsiders swapping in this pool pay 2% of the output to the pool's vault by default, and trades that would profit from the pool lagging a reference market pay the measured gap plus 1%, up to 90%, while the vault itself trades fee-free.
How it works step by step
- Lets whichever account initializes a pool become that pool's vault, and records it in vaultOf.
- Charges non-vault swappers a fee of FEE_BPS (200 bps) of the swap's unspecified output, transferred to the vault via poolManager.take and reported through noteFee.
- Compares the pool price against an optional reference market (a Pons bonding curve or another v4 pool, converted through a v3 pool if quotes differ) and raises the outsider fee to the gap plus MARGIN_BPS when a swap would profit from the mispricing, capped at MAX_FEE_BPS (90%).
- Keeps an anchor of the reference price from earlier blocks and measures the gap against both live and anchored prices, charging the larger, to resist same-transaction manipulation of the reference.
- Enforces a per-pool cap on outsider swap size (setCap, 0 = uncapped) and allows only one outsider swap per pool per block.
- Exempts the vault from the fee, the cap and the one-swap-per-block rule.
- Swap behaviour
- Vault swaps pay no hook fee. Outsider swaps are checked against the optional per-pool cap and the one-swap-per-block limit, then pay 2% of the output by default. If a reference market exists and a trade buys the coin where it is cheaper here, or sells it where it is dearer here, the fee rises to the measured gap plus 1%, up to 90%. Trades in the other direction pay the 2% flat fee. Fees are taken from the output currency in afterSwap.
- Liquidity behaviour
- No liquidity callbacks.
- Fee behaviour
- Outsider swaps pay FEE_BPS (200 bps) of the output by default. The fee is raised to the reference gap plus MARGIN_BPS (100 bps) for swaps that would profit from the pool being stale, capped at MAX_FEE_BPS (9000 bps). The vault pays no fee. Fees are sent to the vault, which may share them via noteFee.
- Owner & admin controls
- There is no owner or pause role. Only the pool's vault (the initializing address) can call setReference and setCap for its pool. Anyone can call poke to record the reference price. The contract is not proxied and has no upgrade path visible in the ABI. The vault itself is an external contract (ICopiesVault) whose controls are not included in this input.
Enabled Uniswap v4 callbacks
beforeInitialize, beforeSwap, afterSwap, afterSwapReturnDelta
beforeInitialize registers the initializer as the pool vault. beforeSwap enforces the outsider cap and one-swap-per-block rule, reads the reference and anchor prices, and sets the dynamic fee in transient storage. afterSwap takes the fee from the output leg and pays it to the vault. afterSwapReturnDelta lets afterSwap return the taken amount so it is netted from the swapper's delta.
Security & trust assessment
Risk level: medium (verified source, high confidence).
Who controls it: The vault address for each pool can set its reference market and swap cap, and the keeper controlling that vault decides when the gap fee applies. No global owner exists in this hook.
Risk to user funds: The hook holds no tokens. It moves outsider swap output to the vault as a fee each swap and can revert outsider swaps via the cap or one-swap-per-block rule, but cannot pull funds from the pool or other users.
Security findings
- [medium] Vault controls reference and cap: The initializing address can point the reference at any curve or pool and set any cap, which directly determines outsider fees up to 90% and the swap size allowed. A malicious or compromised vault can price outsiders out of the pool or cap their trades to zero-impact sizes.
- [low] Fee taken from swap output: afterSwap takes FEE_BPS or the dynamic fee from the output via poolManager.take and returns it as a hook delta, so the hook holds no balance but does move user funds to the vault on every outsider swap.
- [low] Reference reads can fail silently: If the reference curve or converter reverts or returns zero, _referencePrice returns 0 and the pool falls back to the flat fee, so the dynamic protection can be disabled without any event.
- [info] External vault call in afterSwap: noteFee is called on the vault inside a try/catch, so a failing vault cannot block swaps, but a vault that re-enters or consumes gas could still affect the transaction.
Contract details
- Verified source
- Yes (CopiesGapHook)
- Compiler
- solc 0.8.26+commit.8a97fa7a
- Bytecode size
- 8,421 bytes
- Upgradeable proxy
- No
- Detected patterns
- liquidity-management, moves-currency, return-delta