> For the complete documentation index, see [llms.txt](https://devs.maxapy.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://devs.maxapy.io/maxapy-erc4626/vault/maxapyfactory.md).

# 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
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://devs.maxapy.io/maxapy-erc4626/vault/maxapyfactory.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
