# IBaseVault

Interface for the BaseVault

## Functions

### submit

Submit a series of operations to the vault

```solidity
function submit(bytes calldata data) external;
```

**Parameters**

| Name   | Type    | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| ------ | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `data` | `bytes` | Encoded array of operations to submit ┌─────────────────────────────┬─────────────────────────┬───────────────────────────────────────────────┐ │ FIELDS │ SIZE │ DESCRIPTION │ ├─────────────────────────────┴─────────────────────────┴───────────────────────────────────────────────┤ │ operationsLength 1 byte Number of operations in the array │ │ │ │ \[for each operation]: │ │ │ │ SIGNATURE │ │ target 20 bytes Target contract address │ │ calldataLength 2 bytes Length of calldata │ │ calldata bytes Calldata (before pipelining) │ │ │ │ CLIPBOARD │ │ clipboardsLength 1 byte Number of clipboards │ │ \[for each clipboard entry]: │ │ resultIndex 1 byte Which operation to take from │ │ copyWord 1 byte Which word to copy │ │ pasteOffset 2 bytes What offset to paste it at │ │ │ │ CALL TYPE │ │ isStaticCall 1 byte 1 if static, 0 if a regular call │ │ \[if isStaticCall == 0]: │ │ │ │ CALLBACK HANDLING │ │ hasCallback 1 byte Whether to allow callbacks during operation │ │ \[if hasCallback == 1]: │ │ callbackData = 26 bytes Expected callback info │ │ ┌────────────────────┬──────────────────────────┬───────────────────┐ │ │ │ selector (4 bytes) │ calldataOffset (2 bytes) │ caller (20 bytes) │ │ │ └────────────────────┴──────────────────────────┴───────────────────┘ │ │ │ │ HOOKS │ │ hookConfig = 1 byte Hook configuration │ │ ┌─────────────────┬────────────────────────────────────────┐ │ │ │ hasHook (1 bit) │ configurableHookOffsetsLength (7 bits) │ │ │ └─────────────────┴────────────────────────────────────────┘ │ │ if configurableHookOffsetsLength > 0: │ │ configurableHookOffsets 32 bytes Packed configurable hook offsets │ │ if hasHook == 1: │ │ hook 20 bytes Hook contract address │ │ │ │ MERKLE PROOF │ │ proofLength 1 byte Merkle proof length │ │ proof \* 32 bytes Merkle proof data │ │ │ │ PAYABILITY │ │ hasValue 1 byte Whether to send native token with the call │ │ \[if hasValue == 1]: │ │ value 32 bytes Amount of native token to send │ └───────────────────────────────────────────────────────────────────────────────────────────────────────┘ |

### setGuardianRoot

Set the merkle root for a guardian Used to add guardians and update their permissions

```solidity
function setGuardianRoot(address guardian, bytes32 root) external;
```

**Parameters**

| Name       | Type      | Description             |
| ---------- | --------- | ----------------------- |
| `guardian` | `address` | Address of the guardian |
| `root`     | `bytes32` | Merkle root             |

### removeGuardian

Removes a guardian from the vault

```solidity
function removeGuardian(address guardian) external;
```

**Parameters**

| Name       | Type      | Description             |
| ---------- | --------- | ----------------------- |
| `guardian` | `address` | Address of the guardian |

### setSubmitHooks

Set the submit hooks address

```solidity
function setSubmitHooks(ISubmitHooks newSubmitHooks) external;
```

**Parameters**

| Name             | Type           | Description                              |
| ---------------- | -------------- | ---------------------------------------- |
| `newSubmitHooks` | `ISubmitHooks` | Address of the new submit hooks contract |

### pause

Pause the vault, halting the ability for guardians to submit

```solidity
function pause() external;
```

### unpause

Unpause the vault, allowing guardians to submit operations

```solidity
function unpause() external;
```

### checkGuardianWhitelist

Check if the guardian is whitelisted and set the root to zero if not Used to disable guardians who were removed from the whitelist after being selected as guardians

```solidity
function checkGuardianWhitelist(address guardian) external returns (bool isRemoved);
```

**Parameters**

| Name       | Type      | Description          |
| ---------- | --------- | -------------------- |
| `guardian` | `address` | The guardian address |

**Returns**

| Name        | Type   | Description                                         |
| ----------- | ------ | --------------------------------------------------- |
| `isRemoved` | `bool` | Whether the guardian was removed from the whitelist |

### getActiveGuardians

Get all active guardians

```solidity
function getActiveGuardians() external view returns (address[] memory);
```

**Returns**

| Name     | Type        | Description                        |
| -------- | ----------- | ---------------------------------- |
| `<none>` | `address[]` | Array of active guardian addresses |

### getGuardianRoot

Get the guardian root for a guardian

```solidity
function getGuardianRoot(address guardian) external view returns (bytes32);
```

**Parameters**

| Name       | Type      | Description          |
| ---------- | --------- | -------------------- |
| `guardian` | `address` | The guardian address |

**Returns**

| Name     | Type      | Description       |
| -------- | --------- | ----------------- |
| `<none>` | `bytes32` | The guardian root |

### getCurrentHookCallType

Get the current hook call type

```solidity
function getCurrentHookCallType() external view returns (HookCallType);
```

**Returns**

| Name     | Type           | Description                |
| -------- | -------------- | -------------------------- |
| `<none>` | `HookCallType` | The current hook call type |

## Events

### SubmitHooksSet

Emitted when submit hooks are updated

```solidity
event SubmitHooksSet(address indexed submitHooksAddress);
```

**Parameters**

| Name                 | Type      | Description                           |
| -------------------- | --------- | ------------------------------------- |
| `submitHooksAddress` | `address` | The new submit hooks contract address |

### GuardianRootSet

Emitted when a guardian's merkle root is set

```solidity
event GuardianRootSet(address indexed guardian, bytes32 indexed root);
```

**Parameters**

| Name       | Type      | Description                          |
| ---------- | --------- | ------------------------------------ |
| `guardian` | `address` | The guardian's address               |
| `root`     | `bytes32` | The new merkle root for the guardian |

## Errors

### Aera\_\_ZeroAddressGuardian

```solidity
error Aera__ZeroAddressGuardian();
```

### Aera\_\_ZeroAddressOwner

```solidity
error Aera__ZeroAddressOwner();
```

### Aera\_\_CallerIsNotGuardian

```solidity
error Aera__CallerIsNotGuardian();
```

### Aera\_\_CallerIsNotAuthOrGuardian

```solidity
error Aera__CallerIsNotAuthOrGuardian();
```

### Aera\_\_SubmissionFailed

```solidity
error Aera__SubmissionFailed(uint256 index, bytes result);
```

### Aera\_\_AllowanceIsNotZero

```solidity
error Aera__AllowanceIsNotZero(address token, address spender);
```

### Aera\_\_ZeroAddressMerkleRoot

```solidity
error Aera__ZeroAddressMerkleRoot();
```

### Aera\_\_BeforeSubmitHooksFailed

```solidity
error Aera__BeforeSubmitHooksFailed(bytes result);
```

### Aera\_\_AfterSubmitHooksFailed

```solidity
error Aera__AfterSubmitHooksFailed(bytes result);
```

### Aera\_\_BeforeOperationHooksFailed

```solidity
error Aera__BeforeOperationHooksFailed(uint256 index, bytes result);
```

### Aera\_\_AfterOperationHooksFailed

```solidity
error Aera__AfterOperationHooksFailed(uint256 index, bytes result);
```

### Aera\_\_BeforeOperationHooksWithConfigurableHooks

```solidity
error Aera__BeforeOperationHooksWithConfigurableHooks();
```

### Aera\_\_ProofVerificationFailed

```solidity
error Aera__ProofVerificationFailed();
```

### Aera\_\_InvalidBeforeOperationHooksReturnDataLength

```solidity
error Aera__InvalidBeforeOperationHooksReturnDataLength();
```

### Aera\_\_GuardianNotWhitelisted

```solidity
error Aera__GuardianNotWhitelisted();
```

### Aera\_\_ExpectedCallbackNotReceived

```solidity
error Aera__ExpectedCallbackNotReceived();
```

### Aera\_\_NoResults

```solidity
error Aera__NoResults();
```
