# MultiDepositorVaultFactory

**Inherits:** IMultiDepositorVaultFactory, FeeVaultDeployer, Sweepable

Used to create new multi-depositor vaults using delegate call

*Only one instance of the factory will be required per chain*

## State Variables

### ERC20\_NAME\_SLOT

ERC7201-compliant transient storage slot for storing vault token erc20 name during deployment

*Equal to keccak256(abi.encode(uint256(keccak256("aera.factory.erc20.name")) - 1)) & \~bytes32(uint256(0xff));*

```solidity
bytes32 internal constant ERC20_NAME_SLOT = 0x79a9bb099f009196aa3acc685f15554a8e8fd10fee7019652e2c9a6d65a86500;
```

### ERC20\_SYMBOL\_SLOT

ERC7201-compliant transient storage slot for storing vault token erc20 symbol during deployment

*Equal to keccak256(abi.encode(uint256(keccak256("aera.factory.erc20.symbol")) - 1)) & \~bytes32(uint256(0xff));*

```solidity
bytes32 internal constant ERC20_SYMBOL_SLOT = 0xab25fe6ab1c05d9a94c8d6727a857804585a85a98c2bb360f69300eb1a356300;
```

### MULTI\_DEPOSITOR\_VAULT\_PARAMETERS\_SLOT

ERC7201-compliant transient storage slot for storing multi depositor vault parameters during deployment

*Equal to keccak256(abi.encode(uint256(keccak256("aera.factory.multiDepositorVaultParameters")) - 1)) & \~bytes32(uint256(0xff));*

```solidity
bytes32 internal constant MULTI_DEPOSITOR_VAULT_PARAMETERS_SLOT =
    0xe5669a0cf4b353071b0fa74e3cea85f64b33cd9eee158e4f6614aca797ff3a00;
```

### \_DEPLOY\_DELEGATE

Address of the deploy delegate

```solidity
address internal immutable _DEPLOY_DELEGATE;
```

## Functions

### constructor

```solidity
constructor(address initialOwner, Authority initialAuthority, address deployDelegate)
    Sweepable(initialOwner, initialAuthority);
```

### create

Create multi depositor vault

```solidity
function create(
    bytes32 salt,
    string calldata description,
    ERC20Parameters calldata erc20Params,
    BaseVaultParameters calldata baseVaultParams,
    FeeVaultParameters calldata feeVaultParams,
    IBeforeTransferHook beforeTransferHook,
    address expectedVaultAddress
) external override requiresAuth returns (address deployedVault);
```

**Parameters**

| Name                   | Type                  | Description                                                    |
| ---------------------- | --------------------- | -------------------------------------------------------------- |
| `salt`                 | `bytes32`             | The salt used to generate the vault address                    |
| `description`          | `string`              | Vault description                                              |
| `erc20Params`          | `ERC20Parameters`     | ERC20 parameters for deployment                                |
| `baseVaultParams`      | `BaseVaultParameters` | Base vault parameters for deployment                           |
| `feeVaultParams`       | `FeeVaultParameters`  | Fee vault parameters for deployment                            |
| `beforeTransferHook`   | `IBeforeTransferHook` | Before transfer hooks for deployment                           |
| `expectedVaultAddress` | `address`             | Expected vault address to check against deployed vault address |

**Returns**

| Name            | Type      | Description            |
| --------------- | --------- | ---------------------- |
| `deployedVault` | `address` | Deployed vault address |

### getERC20Name

Get the ERC20 name of vault units

```solidity
function getERC20Name() external view returns (string memory name);
```

**Returns**

| Name   | Type     | Description                       |
| ------ | -------- | --------------------------------- |
| `name` | `string` | The name of the vault ERC20 token |

### getERC20Symbol

Get the ERC20 symbol of vault units

```solidity
function getERC20Symbol() external view returns (string memory symbol);
```

**Returns**

| Name     | Type     | Description                         |
| -------- | -------- | ----------------------------------- |
| `symbol` | `string` | The symbol of the vault ERC20 token |

### multiDepositorVaultParameters

Get the vault parameters

```solidity
function multiDepositorVaultParameters() external view returns (IBeforeTransferHook beforeTransferHook);
```

**Returns**

| Name                 | Type                  | Description                                  |
| -------------------- | --------------------- | -------------------------------------------- |
| `beforeTransferHook` | `IBeforeTransferHook` | The hooks called before vault unit transfers |

### \_deployVault

Deploy vault

```solidity
function _deployVault(
    bytes32 salt,
    string calldata description,
    ERC20Parameters calldata erc20Params,
    BaseVaultParameters calldata baseVaultParams,
    FeeVaultParameters calldata feeVaultParams,
    IBeforeTransferHook beforeTransferHook
) internal returns (address deployed);
```

**Parameters**

| Name                 | Type                  | Description                                                       |
| -------------------- | --------------------- | ----------------------------------------------------------------- |
| `salt`               | `bytes32`             | The salt value to create vault                                    |
| `description`        | `string`              | Vault description                                                 |
| `erc20Params`        | `ERC20Parameters`     | ERC20 parameters for vault deployment used in MultiDepositorVault |
| `baseVaultParams`    | `BaseVaultParameters` | Parameters for vault deployment used in BaseVault                 |
| `feeVaultParams`     | `FeeVaultParameters`  | Parameters for vault deployment specific to FeeVault              |
| `beforeTransferHook` | `IBeforeTransferHook` | Parameters for vault deployment specific to MultiDepositorVault   |

**Returns**

| Name       | Type      | Description            |
| ---------- | --------- | ---------------------- |
| `deployed` | `address` | Deployed vault address |

### \_storeERC20Parameters

Store ERC20 name and symbol in transient storage

```solidity
function _storeERC20Parameters(ERC20Parameters calldata params) internal;
```

**Parameters**

| Name     | Type              | Description                             |
| -------- | ----------------- | --------------------------------------- |
| `params` | `ERC20Parameters` | Struct containing ERC20 name and symbol |

### \_storeMultiDepositorVaultParameters

Store beforeTransferHook address in transient storage

```solidity
function _storeMultiDepositorVaultParameters(IBeforeTransferHook beforeTransferHook) internal;
```

**Parameters**

| Name                 | Type                  | Description                             |
| -------------------- | --------------------- | --------------------------------------- |
| `beforeTransferHook` | `IBeforeTransferHook` | The hooks called before token transfers |

### \_createVault

Create a new vault with delegate call

```solidity
function _createVault(bytes32 salt) internal returns (address deployed);
```

**Parameters**

| Name   | Type      | Description                    |
| ------ | --------- | ------------------------------ |
| `salt` | `bytes32` | The salt value to create vault |

**Returns**

| Name       | Type      | Description            |
| ---------- | --------- | ---------------------- |
| `deployed` | `address` | Deployed vault address |

### \_loadStringFromSlot

Load a short string from the given storage slot

```solidity
function _loadStringFromSlot(uint256 slot) internal view returns (string memory);
```

**Parameters**

| Name   | Type      | Description               |
| ------ | --------- | ------------------------- |
| `slot` | `uint256` | Storage slot to read from |

**Returns**

| Name     | Type     | Description    |
| -------- | -------- | -------------- |
| `<none>` | `string` | Decoded string |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.aera.finance/the-protocol/core/multidepositorvaultfactory.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
