# Factory

The `UniswapV2Factory` contract is a core component of the Fathom DEX. It is responsible for creating and managing pairs (liquidity pools) for token exchanges.

### State Variables

#### feeTo

* **Type:** `address`
* **Description:** Address to which protocol fees are sent.

#### feeToSetter

* **Type:** `address`
* **Description:** Address with the permission to update the `feeTo` address.

#### getPair

* **Type:** `mapping(address => mapping(address => address))`
* **Description:** Mapping from two token addresses to the address of their liquidity pool.

#### allPairs

* **Type:** `address[]`
* **Description:** Array of all created pair addresses.

### Set Functions

#### createPair

* **Parameters:**
  * `address tokenA`: The first token of the pair.
  * `address tokenB`: The second token of the pair.
* **Returns:**
  * `address pair`: The address of the created pair.
* **Description:** Creates a new liquidity pair for `tokenA` and `tokenB`. Emits the `PairCreated` event.

#### setFeeTo

* **Parameters:**
  * `address _feeTo`: The address to set as the fee recipient.
* **Description:** Sets the address to which protocol fees are sent. Can only be called by the `feeToSetter`.

#### setFeeToSetter

* **Parameters:**
  * `address _feeToSetter`: The address to set as the new `feeToSetter`.
* **Description:** Sets the address that can update the fee recipient. Can only be called by the current `feeToSetter`.

### Read Functions

#### allPairsLength

* **Parameters:** None
* **Returns:**
  * `uint`: The length of the `allPairs` array.
* **Description:** Returns the number of all pairs created.

#### getInitHash

* **Parameters:** None
* **Returns:**
  * `bytes32`: The keccak256 hash of the UniswapV2Pair creation code.
* **Description:** Returns the initialization hash of the UniswapV2Pair contract.

### Events

#### PairCreated

* **Parameters:**
  * `address indexed token0`: The first token of the pair.
  * `address indexed token1`: The second token of the pair.
  * `address pair`: The address of the created pair.
  * `uint`: The total number of pairs.
* **Description:** Emitted when a new pair is created.
