6/6 hooks · 24/24 tests · Orca + Raydium · Anchor 0.31 · Solana mainnet
the gap
CLMMs have no hooks. Yet.
Concentrated liquidity on Solana is fast and capital-efficient, but a pool is a fixed machine: one fee tier, one set of rules, no place to inject custom logic at swap or liquidity events. If you want a dynamic fee, a time lock, or MEV dampening, you fork the AMM.
Uniswap v4 solved this on the EVM with hooks — contracts called at ten points in a pool’s lifecycle. Patcha brings that model to Orca Whirlpools and Raydium CLMM: small, composable modules patched into the pool, not bolted onto a fork.
standard library
Six modules, ready to patch.
Dynamic Fee
Adjust the pool fee in real time based on volatility or volume bands.
TimeLock
Gate liquidity actions until a timestamp or after a cooldown window.
WhitelistGate
Restrict swaps or LP actions to an allowlist of addresses.
RangeOrder
Execute one-sided range orders that convert as price crosses a tick.
AntiMEV
Dampen sandwich/MEV extraction via per-block caps and dynamic slippage.
KYCGate
Require a verified-credential attestation before permitting actions.
the designer
Compose visually. Patch like a synth.
integration
Plug into Orca and Raydium.
Hooks trigger on whirlpool swap and liquidity CPIs. Dynamic fees and gating apply per position without touching the core program.
The same hook definitions install against Raydium CLMM pools — one module, two venues, identical parameter schema.
dyn-fee → whirlpool swap CPI · dyn-fee → raydium clmm swap CPI
on-chain
Anchor mainnet executor.
Hooks are enforced by a single Anchor program. Each pool installs a hook via PDA-derived accounts; the executor is called on Orca and Raydium CPI entry points.
coming with the phase 2 hook executor
