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

# Hook Interfaces

> Hook interfaces for extending vault behavior at lifecycle points

## Overview

Hooks are extension points in the Aera V3 protocol that allow custom logic to run at specific moments during vault operations. The vault owner configures hooks, and they execute automatically as part of the vault's normal operation flow. Hooks can enforce constraints (slippage bounds, position limits), calculate fees, validate parameters, or perform any other custom logic without modifying core vault contracts.

For a conceptual overview of how hooks work, see [Aera V3 Hooks](/guides/concepts/supported-protocols/aera-v3/hooks). This page documents the specific hook interfaces that contracts must implement.

***

## IBeforeTransferHook

Transfer hooks run before token transfers within [MultiDepositorVault](/contract-reference/multi-depositor-vault) vaults. They enforce transfer restrictions, blocklists, compliance requirements, or lock-up periods on vault unit transfers between addresses.

### Functions

#### beforeTransfer

Called before every vault unit transfer. The hook can revert to prevent the transfer.

**Signature:**

```solidity theme={null}
function beforeTransfer(address from, address to, uint256 amount) external
```

| Parameter | Type      | Description                             |
| --------- | --------- | --------------------------------------- |
| `from`    | `address` | Address sending vault units             |
| `to`      | `address` | Address receiving vault units           |
| `amount`  | `uint256` | Number of vault units being transferred |

***

## ISubmitHooks

Submit hooks run before and after an entire guardian submission batch. They operate on the full batch of operations and are useful for batch-level accounting, aggregate position checks, or state snapshots.

The vault owner configures submit hooks via `setSubmitHooks` on the [BaseVault](/contract-reference/base-vault).

### IBeforeSubmitHook

#### beforeSubmit

Called once before the guardian's operation batch executes. Can perform batch-level validation or pre-processing.

**Signature:**

```solidity theme={null}
function beforeSubmit(Operation[] calldata operations) external
```

| Parameter    | Type          | Description                                   |
| ------------ | ------------- | --------------------------------------------- |
| `operations` | `Operation[]` | The full batch of operations about to execute |

### IAfterSubmitHook

#### afterSubmit

Called once after all operations in the batch complete. Used for post-processing such as fee snapshots, position tracking, or state verification.

**Signature:**

```solidity theme={null}
function afterSubmit(Operation[] calldata operations) external
```

| Parameter    | Type          | Description                                |
| ------------ | ------------- | ------------------------------------------ |
| `operations` | `Operation[]` | The batch of operations that just executed |

***

## IOperationHook

Operation hooks run during individual operations within a submission batch. They are encoded in the guardian's Merkle tree alongside the operation.

### IBeforeOperationHook

#### beforeOperation

Called before an individual operation's target call executes. Typically validates calldata parameters -- for example, checking swap slippage against the `OracleRegistry`.

**Signature:**

```solidity theme={null}
function beforeOperation(address target, bytes calldata data, bytes calldata hookData) external
```

| Parameter  | Type      | Description                             |
| ---------- | --------- | --------------------------------------- |
| `target`   | `address` | Target contract of the operation        |
| `data`     | `bytes`   | Calldata for the operation              |
| `hookData` | `bytes`   | Additional context from the Merkle tree |

### IAfterOperationHook

#### afterOperation

Called after an individual operation completes. Verifies post-conditions such as no residual token approvals or expected balance changes.

**Signature:**

```solidity theme={null}
function afterOperation(address target, bytes calldata data, bytes calldata hookData) external
```

| Parameter  | Type      | Description                             |
| ---------- | --------- | --------------------------------------- |
| `target`   | `address` | Target contract of the operation        |
| `data`     | `bytes`   | Calldata that was executed              |
| `hookData` | `bytes`   | Additional context from the Merkle tree |

***

## IBeforeClaimHook

Claim hooks run before fee claims or other claim operations. They can enforce additional validation on who can claim and under what conditions.

### Functions

#### beforeClaim

Called before a fee claim executes. Can revert to prevent the claim.

**Signature:**

```solidity theme={null}
function beforeClaim(address claimer, address token, uint256 amount) external
```

| Parameter | Type      | Description                  |
| --------- | --------- | ---------------------------- |
| `claimer` | `address` | Address attempting the claim |
| `token`   | `address` | Token being claimed          |
| `amount`  | `uint256` | Amount being claimed         |

***

## Common Use Cases

| Hook                   | Use Case              | Example                                               |
| ---------------------- | --------------------- | ----------------------------------------------------- |
| `IBeforeOperationHook` | Slippage enforcement  | Check swap output against `OracleRegistry` prices     |
| `IAfterOperationHook`  | Approval cleanup      | Verify no residual ERC-20 approvals after operations  |
| `IBeforeSubmitHook`    | Position limits       | Check aggregate exposure before batch executes        |
| `IAfterSubmitHook`     | Fee snapshots         | Snapshot vault state for fee calculation              |
| `IBeforeTransferHook`  | Transfer restrictions | Enforce compliance blocklists on vault unit transfers |
| `IBeforeClaimHook`     | Claim validation      | Enforce timing or authorization on fee claims         |

<Info>
  This page was manually created as a baseline. Run the [contract reference generation pipeline](/contract-reference/overview#generation-pipeline) to update with complete NatSpec documentation from the Solidity source.
</Info>
