# AeraVaultModulesFactory

## AeraVaultModulesFactory

**Inherits:** IAeraVaultAssetRegistryFactory, IAeraVaultHooksFactory, Sweepable

Used to create new asset registry and hooks.

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

### State Variables

#### v2Factory

The address of the v2 factory.

```solidity
address public immutable v2Factory;
```

#### wrappedNativeToken

Wrapped native token.

```solidity
IERC20 public immutable wrappedNativeToken;
```

### Functions

#### onlyOwnerOrV2Factory

MODIFIERS ///

*Throws if called by any account other than the owner or v2 factory.*

```solidity
modifier onlyOwnerOrV2Factory();
```

#### constructor

FUNCTIONS ///

```solidity
constructor(address v2Factory_) Ownable;
```

#### deployAssetRegistry

Deploy asset registry.

```solidity
function deployAssetRegistry(
    bytes32 salt,
    address owner_,
    address vault,
    IAssetRegistry.AssetInformation[] memory assets,
    IERC20 numeraireToken,
    IERC20 feeToken,
    AggregatorV2V3Interface sequencer
) external override onlyOwnerOrV2Factory returns (address deployed);
```

**Parameters**

| Name             | Type                                | Description                              |
| ---------------- | ----------------------------------- | ---------------------------------------- |
| `salt`           | `bytes32`                           | The salt value to deploy asset registry. |
| `owner_`         | `address`                           |                                          |
| `vault`          | `address`                           | Vault address.                           |
| `assets`         | `IAssetRegistry.AssetInformation[]` | Initial list of registered assets.       |
| `numeraireToken` | `IERC20`                            | Numeraire token address.                 |
| `feeToken`       | `IERC20`                            | Fee token address.                       |
| `sequencer`      | `AggregatorV2V3Interface`           | Sequencer Uptime Feed address for L2.    |

**Returns**

| Name       | Type      | Description                             |
| ---------- | --------- | --------------------------------------- |
| `deployed` | `address` | The address of deployed asset registry. |

#### deployHooks

Deploy hooks.

```solidity
function deployHooks(
    bytes32 salt,
    address owner_,
    address vault,
    uint256 minDailyValue,
    TargetSighashData[] memory targetSighashAllowlist
) external override onlyOwnerOrV2Factory returns (address deployed);
```

**Parameters**

| Name                     | Type                  | Description                                                                                             |
| ------------------------ | --------------------- | ------------------------------------------------------------------------------------------------------- |
| `salt`                   | `bytes32`             | The salt value to deploy hooks.                                                                         |
| `owner_`                 | `address`             |                                                                                                         |
| `vault`                  | `address`             | Vault address.                                                                                          |
| `minDailyValue`          | `uint256`             | The minimum fraction of value that the vault has to retain during the day in the course of submissions. |
| `targetSighashAllowlist` | `TargetSighashData[]` | Array of target contract and sighash combinations to allow.                                             |

**Returns**

| Name       | Type      | Description                    |
| ---------- | --------- | ------------------------------ |
| `deployed` | `address` | The address of deployed hooks. |

### Events

#### AssetRegistryCreated

EVENTS ///

Emitted when the asset registry is created.

```solidity
event AssetRegistryCreated(
    address indexed assetRegistry,
    address indexed vault,
    address indexed owner,
    IAssetRegistry.AssetInformation[] assets,
    IERC20 numeraireToken,
    IERC20 feeToken,
    IERC20 wrappedNativeToken,
    AggregatorV2V3Interface sequencer
);
```

#### HooksCreated

Emitted when the hooks is created.

```solidity
event HooksCreated(
    address indexed hooks,
    address indexed vault,
    address indexed owner,
    uint256 minDailyValue,
    TargetSighashData[] targetSighashAllowlist
);
```

### Errors

#### Aera\_CallerIsNeitherOwnerOrV2Factory

MODIFIERS ///

```solidity
error Aera_CallerIsNeitherOwnerOrV2Factory();
```

#### Aera\_\_V2FactoryIsZeroAddress

```solidity
error Aera__V2FactoryIsZeroAddress();
```


---

# 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/v2-archive/contracts/aeravaultmodulesfactory.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.
