chapters· Integrate
25 · Build & manage

Integrate buybacks

Contract-to-contract donations and quotes: oracle-free buybacks in a dozen lines.

Traditional buyback machinery needs a price oracle and a keeper — two trust dependencies. Here your contract just donate()s, and the pot executes at real market prices, riding real user flow, only when there is real demand. The whole integration is a dozen lines.

Route protocol revenue into buybacks

the entire integration
IGlueHook constant HOOK = IGlueHook(0xb216070c3509047ea597E2E626A29cea427a60C8); function routeRevenue(uint256 amt) external { // ERC20 secondary: approve + donate SECONDARY.approve(address(HOOK), amt); HOOK.donate(key, amt); } // native secondary instead: HOOK.donate{value: amt}(key, amt);

That's it. No oracle to configure, no keeper to fund, no schedule to design. The pot spends itself into real buys and real sells at the pool's own price — your revenue becomes buy pressure exactly when the market shows demand, and sell absorption exactly when it shows supply.

Quote before you act

// what would the machine do right now? (uint256 spend, uint256 minOut) = HOOK.quotePump(key, 1 ether); (uint256 absorbed, uint256 paid) = HOOK.quoteShield(key, -1e18); // read the machine's state IGlueHook.Pot memory pot = HOOK.potOf(poolId); IGlueHook.Program memory prog = HOOK.programOf(poolId);

Index the machine

Every mechanic emits a dedicated event — an indexer can reconstruct the full history of a pool's machine from logs alone:

eventfires when
Donated(poolId, donor, amount)the pot was fueled
Pumped(poolId, spent, bought)the pot bought main inside a buy
Shielded(poolId, absorbed, paid)the pot absorbed part or all of a sell
Delivered(poolId, to, amount, mode)main left the hook (direct / burned / dead / held / parked)
Harvested(poolId, mainFees, secondaryFees, burned, fueled)a program's fees were collected and split
Compounded(poolId, liquidity, a0, a1)the compound minted liquidity into the position

Being a pot recipient

Any contract can be a pot's recipient or a program's fee recipient. Deliveries are push-first with bounded gas: if your contract refuses (or is expensive), the value books — per pool in parkedDirectOf for pot deliveries, per (recipient, asset) in owedOf for harvest legs — and you pull it later with flushDirect(poolId) / claim(asset) at your own gas. You can never brick the machine by being slow.

one integration, 23 networks

The hook is at the same address everywhere, so the constant above ports unchanged. Only the PoolKey differs per chain (different token addresses), nothing else.

FAQ

What's the minimum integration?+

One line: hook.donate{value: amt}(key, amt) fuels a pool's defense from any contract. No token approvals needed for a native secondary, one approve otherwise.

How do I read the machine before acting?+

quotePump(key, buySize) and quoteShield(key, sellSize) are free views returning the spend/output the machine WOULD do — size your logic against them, no oracle involved.

Can I build buy-pressure logic without holding a role?+

Yes — donations and quotes are permissionless. A router, a game, a rewards contract can fuel and read any hooked pool without asking anyone.

How do I find the hook on a new chain?+

Same address everywhere: 0xb216070c3509047ea597E2E626A29cea427a60C8. Hardcode it once, gate by chainId if you must, and the integration ports across all 23 networks.

What events should my indexer watch?+

The harvest event for fee flows, the delivery events for pump/shield/burn output (each carries its mode), and the pot events for donations. Everything the machine does is reconstructible from logs.