Skip to content

Build a Hook Block

Build a new Hook Block as an advisory: the interface, the template, the conformance tests, the submission and what you earn.

A new Hook Block is an advisory: a contract HookrRoot asks for bounded advice on each swap and each liquidity add. The files and templates are in hookr-contracts.

  1. Implement IHookrAdvisory. bind freezes a pool's settings at launch. beforeSwap and afterSwap return a fee surcharge, a take with its recipient, or a refusal, within the pool's caps. beforeAddLiquidity allows or refuses an add.
  2. Start from TemplateAdvisory.sol, the smallest advisory that passes the conformance suite.
  3. Test it. Inherit AdvisoryConformance.sol in your test and build with solc 0.8.37.
  4. Submit it. Open an advisory submission with a public repository at a pinned commit, what bind takes, the most it will ever ask for (maxLpFeePips, maxQuoteTakePips, maxSubjectTakeBps, gasLimit) and the test command with its result.
  5. Review. Hookr checks it against IHookrAdvisory and the conformance suite. Once accepted, the registry admits it at its exact code hash behind a timelock, and launches can pick it.
  6. What you earn. Your advice names the recipient of its take, on every pool that picks your block, within the caps it was admitted with.

A fail-open advisory may not refuse or take from a swap. A pool binds one advisory.

Hookr is independent and not affiliated with or endorsed by Robinhood.