Concepts
Architecture
Three contracts next to the Uniswap v4 PoolManager: one hook, one launcher, one blueprint registry.
Every Uniswap v4 pool on Robinhood Chain lives inside one singleton contract, the PoolManager (0x8366a39CC670B4001A1121B8F6A443A643e40951). A pool can name one hook contract; the PoolManager calls that hook at the points its address allows. Rule Craft does not fork or wrap the PoolManager. It supplies the hook.
Contracts
| Contract | Job |
|---|---|
| RuleCraftHook | The one hook every Rule Craft pool points at (permission mask 0x20C4). Stores each pool's frozen rules, refuses exact-output swaps, applies add-ons to buys and pays royalties and protocol share to whoever is owed. No owner. |
| RuleCraftLauncher | Mints a fixed-supply token, opens its pool with the rules, seeds the whole supply as liquidity, holds that founding position for the creator and routes exact-input swaps. |
| BlueprintRegistry | Stores published blueprints (rules, author, royalty). Fixes the treasury and the protocol share when it is deployed. |
Why one hook
A v4 hook's permissions are fixed by its address. RuleCraftHook is mined to an address ending in 0x20C4: beforeInitialize, beforeSwap, afterSwap and afterSwapReturnDelta. Every Rule Craft pool points at it, so every pool shows the same four bits; what differs is the frozen rule set stored for each pool, which decides what those callbacks do.
Flow of a swap
- The PoolManager calls
beforeSwapon RuleCraftHook. It refuses exact-output swaps and, if Size-Scaled Fee is on, returns the LP fee for this trade. - The swap executes against concentrated liquidity as usual.
- On a buy,
afterSwapchecks the Snipe Guard cap, then takes the burn, guard tax and LP stream from the token output. - From the guard tax and stream (add-on revenue) it sets aside the blueprint royalty and protocol share, and donates the rest to in-range LPs. Sells pay only the LP fee.