# Build a Hook Block

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](https://github.com/Hookr-fun/hookr-contracts/blob/main/CONTRIBUTING.md#proposing-a-hook-block).

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](https://github.com/Hookr-fun/hookr-contracts/issues/new?template=module-submission.yml) 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.

---

This page: https://hookr.fun/docs/integrations/build-a-hook-block. Every docs page as Markdown: https://hookr.fun/docs.md.
