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. This page documents the specific hook interfaces that contracts must implement.IBeforeTransferHook
Transfer hooks run before token transfers within MultiDepositorVault 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:| 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 viasetSubmitHooks on the BaseVault.
IBeforeSubmitHook
beforeSubmit
Called once before the guardian’s operation batch executes. Can perform batch-level validation or pre-processing. Signature:| 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:| 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 theOracleRegistry.
Signature:
| 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:| 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:| 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 |
This page was manually created as a baseline. Run the contract reference generation pipeline to update with complete NatSpec documentation from the Solidity source.