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

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

event CreateVault(address indexed asset, address vaultAddress);

Functions

Constructor

constructor(address _treasury)

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

Parameters:

  • _treasury: Address of the MaxApy treasury

Deployment Functions

deploy

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

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

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

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")

Last updated