Concepts

How it works

One swap, from the router to the LPs.

One swap, from the router to the LPs. Nothing runs between swaps: no keeper, no oracle push.

  1. 1

    A swap enters the PoolManager

    The pool's fee is dynamic, so the hook decides it.
  2. 2

    The PoolManager calls beforeSwap

    The hook's only permissions are beforeInitialize and beforeSwap.
  3. 3

    The hook reads the pool price

    The block's first swap pins the top-of-block price, so splitting one arb into many swaps doesn't make it cheaper.
  4. 4

    It reads the perp market, same block

    Two gas-capped precompile calls: oracle at 0x…0807, mark at 0x…0806. A bad read never reverts.
  5. 5

    It computes the fee

    Gap, premium and stress, in integer math. Every input is emitted in FeeComputed.
  6. 6

    The fee goes to LPs

    Returned with the override flag 0x400000. The PoolManager charges it like any LP fee.

Why the same block matters#

HyperEVM and HyperCore share one consensus. The price the hook reads is the price the perp market has in that block, not a feed pushed later. The pool and the market are compared at the same moment.

Static feeVolatilePairHookAven
Knows the market priceNoNo (pool history)Yes, in-block
Charges the arb moreNoPartlyYes, by the gap
Needs a keeper / feedNoNoNo
Admin keys——None
Aven · MIT · ETHGlobal MumbaiEdit on GitHub ↗