Hook Types
Aera V3 defines several hook interfaces that cover different vault lifecycle points: Submit hooks run before and after an entire guardian submission batch. The vault owner configures these viasetSubmitHooks, specifying a beforeSubmit and afterSubmit hook contract. Submit hooks operate on the full batch of operations and are useful for batch-level accounting, aggregate position checks, or state snapshots.
Operation hooks run during individual operations within a submission batch. These are encoded in the guardian’s Merkle tree alongside the operation itself:
- Pre-hooks execute before the operation’s target call. They typically validate calldata parameters — for example, a Uniswap swap pre-hook might consult the
OracleRegistryto enforce on-chain slippage bounds, ensuring the swap’s minimum output is within an acceptable range of the oracle price. - Post-hooks execute after the operation completes. They verify post-conditions like ensuring no residual token approvals remain or confirming that expected token balances changed as intended.
IBeforeTransferHook) run before token transfers within multi-depositor vaults. These can enforce transfer restrictions, blocklists, or compliance requirements on vault unit transfers between addresses.
Execution Flow
When a guardian submits a batch of operations to a Gauntlet vault, hooks execute at multiple points in the pipeline: The execution order is deterministic:beforeSubmithook fires once for the entire batch- For each operation: pre-hook, Merkle verification, execution, post-hook
afterSubmithook fires once after all operations complete
Hook Composition
Hooks in Aera V3 can be composed and chained together. A hook contract can internally delegate to other hook contracts, building a pipeline of validation and transformation logic. This composition pattern allows Gauntlet to layer multiple independent concerns into a single hook configuration:- A submit hook might first check aggregate position limits, then update a fee accounting snapshot, then emit events for off-chain monitoring — each implemented as a separate internal hook in a composed pipeline.
- An operation pre-hook might chain an oracle price check with a calldata parameter extraction step, where the first hook fetches the current price and the second validates that the operation’s parameters are within bounds.
Common Use Cases
Hooks enable a range of vault behaviors without requiring changes to the core Aera V3 contracts: Slippage enforcement. Pre-hooks on swap operations consult theOracleRegistry for current asset prices and verify that the swap’s minimum output falls within acceptable bounds. This protects vault assets from sandwich attacks and excessive slippage during guardian-submitted trades.
Position limits. Submit hooks or post-hooks can check that the vault’s exposure to any single protocol, asset, or chain stays within defined limits after an operation batch completes.
Transfer restrictions. Transfer hooks on multi-depositor vaults can enforce compliance rules, blocklists, or lock-up periods on vault unit transfers between addresses.
Fee calculation. Post-submit hooks can snapshot vault state for fee calculation, ensuring that fee accrual reflects actual operations rather than being manipulated through timing.
Approval cleanup. Post-hooks verify that no ERC-20 token approvals remain after operations complete, enforcing the zero-approval invariant that protects vault assets between guardian submissions.
Related Pages
- Aera V3 Overview — Protocol architecture and contract overview
- Aera V3 Guardian Model — How guardians submit operations validated by hooks
- Security — Trust assumptions and audit history
- Custom Hooks Guide — Building and deploying custom hooks
- Contract Reference — Hook contract interfaces and ABIs