# BaseVault and core interactions

### What is the `BaseVault`

Every vault in Aera inherits from the `BaseVault` . It is a foundational smart contract in Aera V3 that allows guardians to take vault operations secured by a set of owner-approved hooks. It serves as an abstract base contract for both single depositor and multi-depositor Vaults incorporating features for guardians, vault pausing while being agnostic to how assets move in and out of the vault and how fees are charged.

At its core, the `BaseVault` implements:

* Guardian-based operation execution protected by Merkle proof verification
* Operation chaining & callback handling support
* Configurable pre- and post- operation hooks for extensible behavior
* Pausing functionality
* Mandatory whitelist integration for guardians

The protocol comes with two audited implementations, the `SingleDepositorVault` and `MultiDepositorVault` supporting vaults where a single owner retains custody at all times (treasury management) and vaults that allow multiple depositors to jointly participate in the same strategy (yield).

### Why it matters

`BaseVault` encapsulates “core” Aera functionality (off chain strategies) while retaining flexibility for implementers to define their own extensions. `BaseVaults` can also be used as sub vaults on the same or other chains when a direct deposit/withdraw facility isn't needed.

**Unified security model**:

* Provides a common security foundation for both permissioned (single-depositor) and permissionless (multi-depositor) vaults
* Guardian-based system with Merkle verification ensures only carefully curated operations can be executed on the vault

**Flexible architecture**:

* Submit operations support both simple and advanced execution patterns:
  * Basic operations for standard, zero-value calls
  * Advanced operations with native token transfers, chaining inputs and outputs and listening for callbacks
* Hook system enables vault-specific logic at multiple points:
  * Before/after entire submission batches
  * Before/after individual operations
  * Hooks can have custom code for operation-specific behavior or be configurable if operation calldata will be constrained in a simple way

**Built in vault management workflows**:

* Emergency pause functionality
* Whitelist restrictions on guardians

### How to use `BaseVault`

A `BaseVault` is rarely used directly as it is most often used as an abstract contract for other Aera vaults but the functions it defines are present in every Aera vault.

Core operations on `BaseVault` include:

* Administrative functions:
  * `setGuardianRoot` to elect a new guardian or update their hooks
  * `removeGuardian` to remove a guardian
  * `setSubmitHooks` to configure vault level `beforeSubmit` and `afterSubmit` hooks
  * `pause` to halt vault operations by guardians
  * `unpause` to resume operations
* Guardian functions:
  * `submit` vault operations
  * `pause` to halt vault operations by guardians
* Permissionless functions:
  * `checkGuardianWhitelist` allows anyone to validate whether a guardian is still whitelisted and remove them from vault management if the answer is no

### Caveats

* Guardians MUST be whitelisted through the whitelist contract
* Guardian roots should be managed with extreme care
* `BaseVault` uses the Auth.sol library and therefore retains flexibility on how roles are assigned. The trust model should be carefully considered especially for sensitive operations like unpausing
