Hooks
Smart contracts that react to Super Token events in real time. Hooks receive callbacks when streams are created, updated, or deleted — enabling composable, programmable financial logic on-chain.
How Hooks Work
When a user opens, updates, or closes a stream to a Hook, the Superfluid Host contract invokes callback functions on the app before and after the agreement state changes. This lets your contract automatically respond — for example, splitting an incoming stream across multiple recipients, or opening a counter-stream.
Callback Lifecycle
Architecture
User calls Host
All stream operations go through the Superfluid Host contract via callAgreement() or batchCall().
Host invokes callbacks
If the receiver is a registered Hook, the Host calls the app's before/after hooks with the Superfluid context.
App executes logic
Your callback can open new streams, distribute tokens, update state — all atomically within the same transaction.
Host validates rules
After execution, the Host checks that the app didn't violate any rules (e.g. the jailing rule for reverting deletes).
Use Cases
Hooks unlock financial primitives that aren't possible with standard tokens. Here are some of the patterns being used in production.
Payment Splitters
Split incoming streams across multiple recipients based on configurable shares. Revenue sharing, DAO treasury management, referral fees.
Subscription Services
Gate access based on active streams. Users stream to subscribe, stop to cancel. No recurring charge approvals needed.
Streaming DEXes
Dollar-cost averaging via continuous token swaps. Stream one token in, receive another out. SuperBoring and Ricochet pioneered this.
Vesting & Payroll
Continuous token vesting with cliff periods. Contributors receive tokens every second instead of monthly batches.
Lending & Liquidation
Stream interest payments instead of accruing debt. Automatic liquidation when stream deposits are insufficient.
Reward Distribution
Stream rewards to LPs or stakers proportionally via GDA pools. Rewards flow every second, no claiming required.
Apps Built with Hook Callbacks
AlfaFrens
Social streaming — fans subscribe to creators with per-second payments.
Flow State
Quadratic funding and continuous community grants.
SuperBoring
Stream-based DCA into any token via Uniswap.
Nerite
Borrowing protocol with streaming interest payments.
AlfaFrens
Social streaming — fans subscribe to creators with per-second payments.
Flow State
Quadratic funding and continuous community grants.
SuperBoring
Stream-based DCA into any token via Uniswap.
Nerite
Borrowing protocol with streaming interest payments.
AlfaFrens
Social streaming — fans subscribe to creators with per-second payments.
Flow State
Quadratic funding and continuous community grants.
SuperBoring
Stream-based DCA into any token via Uniswap.
Nerite
Borrowing protocol with streaming interest payments.
AlfaFrens
Social streaming — fans subscribe to creators with per-second payments.
Flow State
Quadratic funding and continuous community grants.
SuperBoring
Stream-based DCA into any token via Uniswap.
Nerite
Borrowing protocol with streaming interest payments.
AlfaFrens
Social streaming — fans subscribe to creators with per-second payments.
Flow State
Quadratic funding and continuous community grants.
SuperBoring
Stream-based DCA into any token via Uniswap.
Nerite
Borrowing protocol with streaming interest payments.
AlfaFrens
Social streaming — fans subscribe to creators with per-second payments.
Flow State
Quadratic funding and continuous community grants.
SuperBoring
Stream-based DCA into any token via Uniswap.
Nerite
Borrowing protocol with streaming interest payments.
AlfaFrens
Social streaming — fans subscribe to creators with per-second payments.
Flow State
Quadratic funding and continuous community grants.
SuperBoring
Stream-based DCA into any token via Uniswap.
Nerite
Borrowing protocol with streaming interest payments.
AlfaFrens
Social streaming — fans subscribe to creators with per-second payments.
Flow State
Quadratic funding and continuous community grants.
SuperBoring
Stream-based DCA into any token via Uniswap.
Nerite
Borrowing protocol with streaming interest payments.
Getting Started
Build your first Hook with the CFASuperAppBase contract and the SuperTokenV1Library.
contract MySuperApp is CFASuperAppBase {
using SuperTokenV1Library for ISuperToken;
function onFlowCreated(
ISuperToken token,
address sender,
int96 flowRate,
bytes calldata ctx
) internal override returns (bytes memory) {
// Split incoming flow 50/50
int96 half = flowRate / 2;
ctx = token.createFlowWithCtx(
recipientA, half, ctx
);
ctx = token.createFlowWithCtx(
recipientB, half, ctx
);
return ctx;
}
}Resources
Hooks Documentation
Complete guide to building, registering, and deploying Hooks.
CFASuperAppBase Reference
The recommended base contract for CFA-based Hooks.
SuperTokenV1Library
Solidity library for stream and distribution operations inside callbacks.
Protocol Monorepo
Core protocol contracts, tests, and deployment scripts.
Register Your Hook
Built a Hook? Register it with the Superfluid ecosystem so it can be discovered and integrated by dashboards and partner applications.
Register Your App
