# AlphaProVaultFactory

### createVault <a href="#createpool" id="createpool"></a>

{% code fullWidth="false" %}

```solidity
function createVault(
  VaultParams calldata params,
) external returns (address vaultAddress)
```

{% endcode %}

Creates a vault for a given set of vault parameters.

#### Parameters:

<table><thead><tr><th width="146.33333333333331">Varible</th><th width="170">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>params</code></td><td>VaultParams</td><td>The custom data structure containing the  <a href="../../manage-liquidity/user-guides/vault-parameters">Vault Parameters'</a> variables and assigned values.</td></tr></tbody></table>

#### Returns:

<table><thead><tr><th width="188.33333333333331">Variable</th><th width="125">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>vaultAddress</code></td><td>address</td><td>The address of the new vault after it is created.</td></tr></tbody></table>

### numVaults

{% code fullWidth="false" %}

```solidity
function numVaults() external view returns (uint256)
```

{% endcode %}

#### Return Value:

<table><thead><tr><th width="188.33333333333331">Variable</th><th width="178">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>vaults.length</code></td><td>uint256</td><td>The number of vaults created by the factory.</td></tr></tbody></table>

### setProtocolFee

{% code fullWidth="false" %}

```solidity
function setProtocolFee(uint256 _protocolFee) external onlyGovernance
```

{% endcode %}

Sets the protocol fee as a % of fees received from Uniswap. Can only be called by Charm Governance.

#### Parameters:

<table><thead><tr><th width="188.33333333333331">Variale</th><th width="115">Type</th><th>Description</th></tr></thead><tbody><tr><td><pre><code>_protocolFee
</code></pre></td><td>uint256</td><td><p>The amount of protocol fees as a % of fees earned by the vault, with 1 unit of fees = 1e-4 % of fees earned.</p><p></p><p>The maximum protocol fee is 20000 units (20%).</p></td></tr></tbody></table>

### setGovernance

```solidity
function setGovernance(address _governance) external onlyGovernance
```

The first step to change the address of Charm Governance. Can only called by Charm Governance.

#### Parameters:

<table><thead><tr><th width="222.33333333333331">Variable</th><th width="119">Type</th><th>Description</th></tr></thead><tbody><tr><td><pre><code>_governance
</code></pre></td><td>address</td><td>The new address of Charm Governance. The changes will not take effect until the new address calls <a href="#acceptgovernance"><code>accepGovernance</code></a></td></tr></tbody></table>

### acceptGovernance

```solidity
function acceptGovernance() external
```

The second step to to change the address of Charm Governance. Can only be called by the address assigned to `_governance`.

#### State Changes:

<table data-full-width="false"><thead><tr><th width="188">Variable</th><th width="176">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>governance</code></td><td>address</td><td>Setting the value of <code>_governance</code> as the new Charm Governance address.</td></tr></tbody></table>

### **Getter functions for public variables**

Getter functions are automatically generated for the following public variables:

<table data-full-width="false"><thead><tr><th width="238">Variable</th><th width="115">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>template</code></td><td>address</td><td>The address of the template vault used by <a href="#createpool">createVault</a> to clone and create LP vaults.</td></tr><tr><td><code>vaults</code></td><td>array</td><td>The array that contains the address of all the vaults created by Alpha Vaults.</td></tr><tr><td><code>isVault</code></td><td>mapping</td><td>The mapping used to check whether a vault have been created by Alpha Vaults.</td></tr><tr><td><code>governance</code></td><td>address</td><td>The address of Charm Governance.</td></tr><tr><td><code>pendingGovernance</code></td><td>address</td><td>The provisional address of Charm Governance. Not finalised until it calls calls <a href="#acceptgovernance"><code>accepGovernanc</code></a></td></tr><tr><td><code>protocolFee</code></td><td>uint256</td><td>The protocol fee applied to all vaults created using Alpha Vaults.</td></tr></tbody></table>
