Skip to main content

Dynamic fees

A dynamic-fee pool lets the hook decide the swap fee instead of fixing it when the pool is created. About two thirds of hooked pools on Robinhood Chain are dynamic-fee pools.

Ask for it​

Create a hook that charges 1% when the price has moved more than 2% in the last ten minutes, and 0.3% otherwise.
Charge 1% on swaps larger than 1 ETH and 0.3% on everything else.

Say the fee levels and the rule that picks between them. If you only say "dynamic fees", SuperHooks has to pick the rule for you.

How it works​

There are two ways a hook can set the fee. SuperHooks chooses based on your rule:

  • Per swap: beforeSwap returns the fee for that one swap. Good for rules that depend on the swap itself, such as its size.
  • Stored: the hook updates the pool's fee from time to time by calling the PoolManager. Good for rules that depend on recent history.

Fees are in hundredths of a basis point: 3000 is 0.30%, and the maximum is 1000000 (100%).

The pool​

The pool must be created as a dynamic-fee pool. Tell SuperHooks the pool is for this hook and it sets the flag for you. A hook that expects dynamic fees will usually reject pools created with a fixed fee.

Dynamic-fee pools on Robinhood Chain mostly use tick spacing 200, or 8 for tight pairs.

Things to check in the summary​

  • The highest fee the hook can ever charge.
  • What the rule measures and over what period.
  • Whether anyone, including you, can change the levels later.