> ## Documentation Index
> Fetch the complete documentation index at: https://docs.x402r.org/llms.txt
> Use this file to discover all available pages before exploring further.

# HookCombinator

> Chain hooks into a single operator slot for composite state tracking

## Overview

HookCombinator chains hooks into one, invoking each in sequence. Each operator slot accepts only one hook address, so use HookCombinator when you need more than one hook on the same action.

## Deployment

Deploy via HookCombinatorFactory:

```typescript theme={null}
const comboAddress = await hookCombinatorFactory.write.deploy([
  [escrowPeriodAddress, paymentIndexRecorderHookAddress]  // Records auth time + payment index
]);

config.authorizePostActionHook = comboAddress;
```

## Behavior

* The combinator invokes hooks in the order provided
* **If any hook reverts, all revert**: the entire recording is atomic
* Each hook receives the same `paymentInfo`, `amount`, `caller`, and `data` parameters

## Limits

<Warning>
  **Max 10 hooks per combinator.** Each extra hook adds \~1k gas overhead for the delegation call.
</Warning>

## Gas

**Cost:** Sum of all individual hook costs + \~1k gas overhead per hook for delegation.

Example: EscrowPeriod (\~20k) + PaymentIndexRecorderHook (\~20k) + \~2k overhead = \~42k gas total.

## Next Steps

<CardGroup cols={2}>
  <Card title="AuthorizationTimeRecorderHook" icon="clock" href="/contracts/hooks/authorization-time">
    Record authorization timestamps.
  </Card>

  <Card title="PaymentIndexRecorderHook" icon="list-ol" href="/contracts/hooks/payment-index">
    Index payments for on-chain queries.
  </Card>
</CardGroup>
