AeraV2Factory

AeraV2Factory

Inherits: IAeraV2Factory, Sweepable

Used to create new vaults and deploy modules.

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

State Variables

wrappedNativeToken

The address of wrapped native token.

address public immutable wrappedNativeToken;

parameters

STORAGE ///

Vault parameters for vault deployment.

Parameters public override parameters;

Functions

constructor

FUNCTIONS ///

Initialize the factory contract.

constructor(address wrappedNativeToken_) Ownable;

Parameters

Name
Type
Description

wrappedNativeToken_

address

The address of wrapped native token.

create

Create V2 vault.

function create(
    bytes32 saltInput,
    string calldata description,
    VaultParameters calldata vaultParameters,
    AssetRegistryParameters calldata assetRegistryParameters,
    HooksParameters calldata hooksParameters
)
    external
    override
    onlyOwner
    returns (
        address deployedVault,
        address deployedAssetRegistry,
        address deployedHooks
    );

Parameters

Name
Type
Description

saltInput

bytes32

The salt input value to generate salt.

description

string

Vault description.

vaultParameters

VaultParameters

Struct details for vault deployment.

assetRegistryParameters

AssetRegistryParameters

Struct details for asset registry deployment.

hooksParameters

HooksParameters

Struct details for hooks deployment.

Returns

Name
Type
Description

deployedVault

address

The address of deployed vault.

deployedAssetRegistry

address

The address of deployed asset registry.

deployedHooks

address

The address of deployed hooks.

computeVaultAddress

Calculate deployment address of V2 vault.

function computeVaultAddress(
    bytes32 saltInput,
    string calldata description,
    VaultParameters calldata vaultParameters
) external view override returns (address);

Parameters

Name
Type
Description

saltInput

bytes32

The salt input value to generate salt.

description

string

Vault description.

vaultParameters

VaultParameters

Struct details for vault deployment.

_deployAssetRegistry

INTERNAL FUNCTIONS ///

Deploy asset registry.

function _deployAssetRegistry(
    bytes32 salt,
    address vault,
    AssetRegistryParameters memory assetRegistryParameters
) internal returns (address deployed);

Parameters

Name
Type
Description

salt

bytes32

The salt value to deploy asset registry.

vault

address

Vault address.

assetRegistryParameters

AssetRegistryParameters

Struct details for asset registry deployment.

Returns

Name
Type
Description

deployed

address

The address of deployed asset registry.

_deployHooks

Deploy hooks.

function _deployHooks(
    bytes32 salt,
    address vault,
    HooksParameters memory hooksParameters
) internal returns (address deployed);

Parameters

Name
Type
Description

salt

bytes32

The salt value to deploy hooks.

vault

address

Vault address.

hooksParameters

HooksParameters

Struct details for hooks deployment.

Returns

Name
Type
Description

deployed

address

The address of deployed hooks.

_deployVault

Deploy V2 vault.

function _deployVault(
    bytes32 salt,
    address assetRegistry,
    address hooks,
    string calldata description,
    VaultParameters memory vaultParameters
) internal returns (address deployed);

Parameters

Name
Type
Description

salt

bytes32

The salt value to create vault.

assetRegistry

address

Asset registry address.

hooks

address

Hooks address.

description

string

Vault description.

vaultParameters

VaultParameters

Struct details for vault deployment.

Returns

Name
Type
Description

deployed

address

The address of deployed vault.

_computeVaultAddress

Calculate deployment address of V2 vault.

function _computeVaultAddress(bytes32 salt) internal view returns (address);

Parameters

Name
Type
Description

salt

bytes32

The salt value to create vault.

Returns

Name
Type
Description

<none>

address

Calculated deployment address.

_calculateSalt

Calculate salt from vault parameters.

function _calculateSalt(
    bytes32 saltInput,
    VaultParameters memory vaultParameters,
    string calldata description
) internal pure returns (bytes32);

Parameters

Name
Type
Description

saltInput

bytes32

The salt value to create vault.

vaultParameters

VaultParameters

Struct details for vault deployment.

description

string

Vault description.

Events

VaultCreated

EVENTS ///

Emitted when the vault is created.

event VaultCreated(
    address indexed vault,
    address assetRegistry,
    address hooks,
    address indexed owner,
    address indexed guardian,
    address feeRecipient,
    uint256 fee,
    string description,
    address wrappedNativeToken
);

Errors

Aera__DescriptionIsEmpty

ERRORS ///

error Aera__DescriptionIsEmpty();

Aera__WrappedNativeTokenIsZeroAddress

error Aera__WrappedNativeTokenIsZeroAddress();

Aera__InvalidWrappedNativeToken

error Aera__InvalidWrappedNativeToken();

Aera__VaultAddressMismatch

error Aera__VaultAddressMismatch(address deployed, address computed);

Aera__GuardianIsAssetRegistryOwner

error Aera__GuardianIsAssetRegistryOwner();

Aera__GuardianIsHooksOwner

error Aera__GuardianIsHooksOwner();

Last updated