> For the complete documentation index, see [llms.txt](https://fluxion-network.gitbook.io/fluxion-network/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://fluxion-network.gitbook.io/fluxion-network/developer-resources/technical-overview-and-api/amm-v2-poolfactory.md).

# amm v2 poolfactory

## Overview

Factory contract that deploys pools and manages protocol fee configuration.

* Contract name: `PoolFactory`
* Address: `0x9336B143C572D75F1f2b7374532e8C96Eed41fe9`
* Network: Mantle Mainnet (`chainId 5000`)
* Explorer: [`Mantle Explorer`](https://explorer.mantle.xyz/address/0x9336B143C572D75F1f2b7374532e8C96Eed41fe9)
* Explorer API: [`smart-contract payload`](https://explorer.mantle.xyz/api/v2/smart-contracts/0x9336B143C572D75F1f2b7374532e8C96Eed41fe9)
* Sourcify metadata: [`metadata.json`](https://repo.sourcify.dev/contracts/full_match/5000/0x9336B143C572D75F1f2b7374532e8C96Eed41fe9/metadata.json)
* Sourcify source: [`contracts/factories/PoolFactory.sol`](https://repo.sourcify.dev/contracts/full_match/5000/0x9336B143C572D75F1f2b7374532e8C96Eed41fe9/sources/contracts/factories/PoolFactory.sol)

***

## Read Functions

### MAX\_FEE

```solidity
function MAX_FEE() external view returns (uint256 return0)
```

Reads contract state.

This function does not take parameters.

Return Values

| Name    | Type    | Description                |
| ------- | ------- | -------------------------- |
| return0 | uint256 | Not documented in NatSpec. |

***

### ZERO\_FEE\_INDICATOR

```solidity
function ZERO_FEE_INDICATOR() external view returns (uint256 return0)
```

Reads contract state.

This function does not take parameters.

Return Values

| Name    | Type    | Description                |
| ------- | ------- | -------------------------- |
| return0 | uint256 | Not documented in NatSpec. |

***

### allPools

```solidity
function allPools(uint256 arg0) external view returns (address return0)
```

Reads contract state.

Parameters

| Name | Type    | Description                |
| ---- | ------- | -------------------------- |
| arg0 | uint256 | Not documented in NatSpec. |

Return Values

| Name    | Type    | Description                |
| ------- | ------- | -------------------------- |
| return0 | address | Not documented in NatSpec. |

***

### allPoolsLength

```solidity
function allPoolsLength() external view returns (uint256 return0)
```

returns the number of pools created from this factory

This function does not take parameters.

Return Values

| Name    | Type    | Description                |
| ------- | ------- | -------------------------- |
| return0 | uint256 | Not documented in NatSpec. |

***

### customFee

```solidity
function customFee(address arg0) external view returns (uint256 return0)
```

Reads contract state.

Parameters

| Name | Type    | Description                |
| ---- | ------- | -------------------------- |
| arg0 | address | Not documented in NatSpec. |

Return Values

| Name    | Type    | Description                |
| ------- | ------- | -------------------------- |
| return0 | uint256 | Not documented in NatSpec. |

***

### customTeamFee

```solidity
function customTeamFee(address arg0) external view returns (uint256 return0)
```

Reads contract state.

Parameters

| Name | Type    | Description                |
| ---- | ------- | -------------------------- |
| arg0 | address | Not documented in NatSpec. |

Return Values

| Name    | Type    | Description                |
| ------- | ------- | -------------------------- |
| return0 | uint256 | Not documented in NatSpec. |

***

### feeManager

```solidity
function feeManager() external view returns (address return0)
```

Reads contract state.

This function does not take parameters.

Return Values

| Name    | Type    | Description                |
| ------- | ------- | -------------------------- |
| return0 | address | Not documented in NatSpec. |

***

### getFee

```solidity
function getFee(address pool, bool _stable) external view returns (uint256 return0)
```

Returns fee for a pool, as custom fees are possible.

Parameters

| Name     | Type    | Description                |
| -------- | ------- | -------------------------- |
| pool     | address | Not documented in NatSpec. |
| \_stable | bool    | Not documented in NatSpec. |

Return Values

| Name    | Type    | Description                |
| ------- | ------- | -------------------------- |
| return0 | uint256 | Not documented in NatSpec. |

***

### getPool (v3-style)

```solidity
function getPool(address tokenA, address tokenB, uint24 fee) external view returns (address return0)
```

Support for v3-style pools which wraps around getPool(tokenA,tokenB,stable)

Parameters

| Name   | Type    | Description                                         |
| ------ | ------- | --------------------------------------------------- |
| tokenA | address | .                                                   |
| tokenB | address | .                                                   |
| fee    | uint24  | 1 if stable, 0 if volatile, else returns address(0) |

Return Values

| Name    | Type    | Description                |
| ------- | ------- | -------------------------- |
| return0 | address | Not documented in NatSpec. |

***

### getPool

```solidity
function getPool(address tokenA, address tokenB, bool stable) external view returns (address return0)
```

Return address of pool created by this factory

Parameters

| Name   | Type    | Description                       |
| ------ | ------- | --------------------------------- |
| tokenA | address | .                                 |
| tokenB | address | .                                 |
| stable | bool    | True if stable, false if volatile |

Return Values

| Name    | Type    | Description                |
| ------- | ------- | -------------------------- |
| return0 | address | Not documented in NatSpec. |

***

### getTeamFee

```solidity
function getTeamFee(address pool, bool _stable) external view returns (uint256 return0)
```

Reads contract state.

Parameters

| Name     | Type    | Description                |
| -------- | ------- | -------------------------- |
| pool     | address | Not documented in NatSpec. |
| \_stable | bool    | Not documented in NatSpec. |

Return Values

| Name    | Type    | Description                |
| ------- | ------- | -------------------------- |
| return0 | uint256 | Not documented in NatSpec. |

***

### implementation

```solidity
function implementation() external view returns (address return0)
```

Reads contract state.

This function does not take parameters.

Return Values

| Name    | Type    | Description                |
| ------- | ------- | -------------------------- |
| return0 | address | Not documented in NatSpec. |

***

### isPaused

```solidity
function isPaused() external view returns (bool return0)
```

Reads contract state.

This function does not take parameters.

Return Values

| Name    | Type | Description                |
| ------- | ---- | -------------------------- |
| return0 | bool | Not documented in NatSpec. |

***

### isPool

```solidity
function isPool(address pool) external view returns (bool return0)
```

Is a valid pool created by this factory.

Parameters

| Name | Type    | Description                |
| ---- | ------- | -------------------------- |
| pool | address | Not documented in NatSpec. |

Return Values

| Name    | Type | Description                |
| ------- | ---- | -------------------------- |
| return0 | bool | Not documented in NatSpec. |

***

### pauser

```solidity
function pauser() external view returns (address return0)
```

Reads contract state.

This function does not take parameters.

Return Values

| Name    | Type    | Description                |
| ------- | ------- | -------------------------- |
| return0 | address | Not documented in NatSpec. |

***

### poolFeesImplementation

```solidity
function poolFeesImplementation() external view returns (address return0)
```

Reads contract state.

This function does not take parameters.

Return Values

| Name    | Type    | Description                |
| ------- | ------- | -------------------------- |
| return0 | address | Not documented in NatSpec. |

***

### stableFee

```solidity
function stableFee() external view returns (uint256 return0)
```

Reads contract state.

This function does not take parameters.

Return Values

| Name    | Type    | Description                |
| ------- | ------- | -------------------------- |
| return0 | uint256 | Not documented in NatSpec. |

***

### stableTeamFee

```solidity
function stableTeamFee() external view returns (uint256 return0)
```

Reads contract state.

This function does not take parameters.

Return Values

| Name    | Type    | Description                |
| ------- | ------- | -------------------------- |
| return0 | uint256 | Not documented in NatSpec. |

***

### team

```solidity
function team() external view returns (address return0)
```

Reads contract state.

This function does not take parameters.

Return Values

| Name    | Type    | Description                |
| ------- | ------- | -------------------------- |
| return0 | address | Not documented in NatSpec. |

***

### upgrader

```solidity
function upgrader() external view returns (address return0)
```

Reads contract state.

This function does not take parameters.

Return Values

| Name    | Type    | Description                |
| ------- | ------- | -------------------------- |
| return0 | address | Not documented in NatSpec. |

***

### volatileFee

```solidity
function volatileFee() external view returns (uint256 return0)
```

Reads contract state.

This function does not take parameters.

Return Values

| Name    | Type    | Description                |
| ------- | ------- | -------------------------- |
| return0 | uint256 | Not documented in NatSpec. |

***

### volatileTeamFee

```solidity
function volatileTeamFee() external view returns (uint256 return0)
```

Reads contract state.

This function does not take parameters.

Return Values

| Name    | Type    | Description                |
| ------- | ------- | -------------------------- |
| return0 | uint256 | Not documented in NatSpec. |

***

### voter

```solidity
function voter() external view returns (address return0)
```

Reads contract state.

This function does not take parameters.

Return Values

| Name    | Type    | Description                |
| ------- | ------- | -------------------------- |
| return0 | address | Not documented in NatSpec. |

***

## Write Functions

### createPool

```solidity
function createPool(address tokenA, address tokenB, bool stable) external returns (address pool)
```

Create a pool given two tokens and if they're stable/volatile

Parameters

| Name   | Type    | Description |
| ------ | ------- | ----------- |
| tokenA | address | .           |
| tokenB | address | .           |
| stable | bool    | .           |

Return Values

| Name | Type    | Description                |
| ---- | ------- | -------------------------- |
| pool | address | Not documented in NatSpec. |

***

### createPool (v3-style)

```solidity
function createPool(address tokenA, address tokenB, uint24 fee) external returns (address pool)
```

Support for v3-style pools which wraps around createPool(tokena,tokenB,stable)

Parameters

| Name   | Type    | Description                             |
| ------ | ------- | --------------------------------------- |
| tokenA | address | .                                       |
| tokenB | address | .                                       |
| fee    | uint24  | 1 if stable, 0 if volatile, else revert |

Return Values

| Name | Type    | Description                |
| ---- | ------- | -------------------------- |
| pool | address | Not documented in NatSpec. |

***

### setCustomFee

```solidity
function setCustomFee(address pool, uint256 fee) external
```

Set overriding fee for a pool from the default

Parameters

| Name | Type    | Description                |
| ---- | ------- | -------------------------- |
| pool | address | Not documented in NatSpec. |
| fee  | uint256 | Not documented in NatSpec. |

This function does not return a value.

***

### setCustomTeamFee

```solidity
function setCustomTeamFee(address pool, uint256 fee) external
```

Executes a state-changing call.

Parameters

| Name | Type    | Description                |
| ---- | ------- | -------------------------- |
| pool | address | Not documented in NatSpec. |
| fee  | uint256 | Not documented in NatSpec. |

This function does not return a value.

***

### setFee

```solidity
function setFee(bool _stable, uint256 _fee) external
```

Set default fee for stable and volatile pools.

Parameters

| Name     | Type    | Description              |
| -------- | ------- | ------------------------ |
| \_stable | bool    | Stable or volatile pool. |
| \_fee    | uint256 | .                        |

This function does not return a value.

***

### setFeeManager

```solidity
function setFeeManager(address _feeManager) external
```

Executes a state-changing call.

Parameters

| Name         | Type    | Description                |
| ------------ | ------- | -------------------------- |
| \_feeManager | address | Not documented in NatSpec. |

This function does not return a value.

***

### setPauseState

```solidity
function setPauseState(bool _state) external
```

Executes a state-changing call.

Parameters

| Name    | Type | Description                |
| ------- | ---- | -------------------------- |
| \_state | bool | Not documented in NatSpec. |

This function does not return a value.

***

### setPauser

```solidity
function setPauser(address _pauser) external
```

Executes a state-changing call.

Parameters

| Name     | Type    | Description                |
| -------- | ------- | -------------------------- |
| \_pauser | address | Not documented in NatSpec. |

This function does not return a value.

***

### setTeam

```solidity
function setTeam(address _team) external
```

Set team address

Parameters

| Name   | Type    | Description                |
| ------ | ------- | -------------------------- |
| \_team | address | Not documented in NatSpec. |

This function does not return a value.

***

### setUpgrader

```solidity
function setUpgrader(address _upgrader) external
```

Executes a state-changing call.

Parameters

| Name       | Type    | Description                |
| ---------- | ------- | -------------------------- |
| \_upgrader | address | Not documented in NatSpec. |

This function does not return a value.

***

### setVoter

```solidity
function setVoter(address _voter) external
```

Only called once to set to Voter.sol - Voter does not have a function to call this contract method, so once set it's immutable. This also follows convention of setVoterAndDistributor() in VotingEscrow\.sol

Parameters

| Name    | Type    | Description |
| ------- | ------- | ----------- |
| \_voter | address | .           |

This function does not return a value.
