> ## 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.

# BaseVault

> Core vault contract -- guardian operations, Merkle verification, hooks, and pause

## Overview

`BaseVault` is the abstract base contract that all Aera V3 vault types inherit from. It provides the core infrastructure for guardian-based operation execution, Merkle proof verification, configurable hooks, and emergency pause functionality. Both `SingleDepositorVault` and `MultiDepositorVault` extend `BaseVault` to add depositor-specific logic.

The vault accepts batches of operations submitted by an authorized guardian. Each operation is validated against a Merkle tree that whitelists specific contract targets and calldata patterns. Hooks can intercept operations at multiple lifecycle points to enforce constraints such as slippage bounds, position limits, and approval cleanup.

For a conceptual overview of how `BaseVault` fits into the Aera V3 architecture, see [Aera V3 Overview](/guides/concepts/supported-protocols/aera-v3/overview).

## Functions

### submit

Submits a batch of operations for the guardian to execute atomically. Each operation is validated against the guardian's Merkle tree before execution. Submit hooks fire before and after the batch, and individual operations can have pre-hooks and post-hooks.

**Signature:**

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

| Parameter    | Type          | Description                               |
| ------------ | ------------- | ----------------------------------------- |
| `operations` | `Operation[]` | Array of operations to execute atomically |

### pause

Pauses all guardian operations on the vault. Can be called by the guardian or the vault owner as an emergency safety mechanism.

**Signature:**

```solidity theme={null}
function pause() external
```

### unpause

Resumes guardian operations after a pause. Can only be called by the vault owner.

**Signature:**

```solidity theme={null}
function unpause() external
```

### setGuardianRoot

Sets the Merkle root that defines the guardian's allowed operations. Only callable by the vault owner.

**Signature:**

```solidity theme={null}
function setGuardianRoot(bytes32 root) external
```

| Parameter | Type      | Description                                 |
| --------- | --------- | ------------------------------------------- |
| `root`    | `bytes32` | New Merkle root encoding allowed operations |

### setSubmitHooks

Configures the before-submit and after-submit hook contracts for the vault. Only callable by the vault owner.

**Signature:**

```solidity theme={null}
function setSubmitHooks(address beforeHook, address afterHook) external
```

| Parameter    | Type      | Description                                   |
| ------------ | --------- | --------------------------------------------- |
| `beforeHook` | `address` | Contract to call before each submission batch |
| `afterHook`  | `address` | Contract to call after each submission batch  |

### checkGuardianWhitelist

Checks whether a guardian is still authorized on the vault's whitelist. Can be called by anyone. Removes the guardian if it fails the whitelist check.

**Signature:**

```solidity theme={null}
function checkGuardianWhitelist() external
```

### guardian

Returns the address of the vault's current guardian.

**Signature:**

```solidity theme={null}
function guardian() external view returns (address)
```

### owner

Returns the address of the vault owner.

**Signature:**

```solidity theme={null}
function owner() external view returns (address)
```

### paused

Returns whether the vault is currently paused.

**Signature:**

```solidity theme={null}
function paused() external view returns (bool)
```

## Events

### Submitted

Emitted when a guardian successfully submits a batch of operations.

```solidity theme={null}
event Submitted(address indexed guardian, uint256 operationCount)
```

### Paused

Emitted when the vault is paused.

```solidity theme={null}
event Paused(address indexed account)
```

### Unpaused

Emitted when the vault is unpaused.

```solidity theme={null}
event Unpaused(address indexed account)
```

### GuardianRootSet

Emitted when the guardian's Merkle root is updated.

```solidity theme={null}
event GuardianRootSet(bytes32 indexed root)
```

### SubmitHooksSet

Emitted when submit hooks are configured.

```solidity theme={null}
event SubmitHooksSet(address beforeHook, address afterHook)
```

## Errors

### Vault\_\_Paused

Thrown when a guardian operation is attempted while the vault is paused.

```solidity theme={null}
error Vault__Paused()
```

### Vault\_\_InvalidProof

Thrown when an operation's Merkle proof does not verify against the guardian root.

```solidity theme={null}
error Vault__InvalidProof()
```

### Vault\_\_NotGuardian

Thrown when a non-guardian address attempts a guardian-only action.

```solidity theme={null}
error Vault__NotGuardian()
```

### Vault\_\_NotOwner

Thrown when a non-owner address attempts an owner-only action.

```solidity theme={null}
error Vault__NotOwner()
```

## Inheritance

`BaseVault` is the root of the Aera V3 vault hierarchy:

* **BaseVault** -- Core guardian operations, Merkle verification, hooks, pause
  * [SingleDepositorVault](/contract-reference/single-depositor-vault) -- Adds single-depositor deposit/withdraw
  * [MultiDepositorVault](/contract-reference/multi-depositor-vault) -- Adds multi-depositor ERC-20 vault units and order solving

<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>
