# MaxApyFactory

## Overview

The MaxApyVaultFactory contract is responsible for deploying new MaxApy vaults with deterministic addresses. It manages vault creation and ensures proper initialization with standardized naming conventions.

## Constants

```solidity
uint256 public constant ADMIN_ROLE = _ROLE_0;      // Role for administrative functions
uint256 public constant DEPLOYER_ROLE = _ROLE_1;   // Role for deploying new vaults
address public immutable treasury;                  // MaxApy treasury address
```

## Events

```solidity
event CreateVault(address indexed asset, address vaultAddress);
```

## Functions

### Constructor

```solidity
constructor(address _treasury)
```

Initializes the factory with treasury address and sets up initial roles.

Parameters:

* `_treasury`: Address of the MaxApy treasury

### Deployment Functions

### deploy

```solidity
function deploy(
    address underlyingAsset,
    address vaultAdmin,
    bytes32 salt
) external returns (address deployed)
```

Deploys a new vault with a deterministic address using CREATE3.

Parameters:

* `underlyingAsset`: ERC20 token the vault will accept
* `vaultAdmin`: Admin address for the new vault
* `salt`: Unique salt for deterministic address generation

Returns:

* Address of the deployed vault

### View Functions

### computeAddress

```solidity
function computeAddress(bytes32 salt) external view returns (address)
```

Computes the deterministic deployment address for a given salt.

Parameters:

* `salt`: Salt to use for address computation

Returns:

* Expected deployment address

### Internal Functions

### parseName

```solidity
function parseName(string memory symbol) private pure returns (string memory)
```

Generates standardized vault name from asset symbol.

Parameters:

* `symbol`: Asset symbol

Returns:

* Formatted vault name (e.g., "MaxApy-USDC Vault")

### parseSymbol

```solidity
function parseSymbol(string memory symbol) private pure returns (string memory)
```

Generates standardized vault symbol from asset symbol.

Parameters:

* `symbol`: Asset symbol

Returns:

* Formatted vault symbol (e.g., "maxUSDC")


---

# 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://devs.maxapy.io/maxapy-erc4626/vault/maxapyfactory.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.
