# WarpX V3 Factory

#### Creating a New Pool <a href="#user-content-creating-a-new-pool" id="user-content-creating-a-new-pool"></a>

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

Creates a liquidity pool for the given token pair and fee tier.

* Tokens can be passed in any order; they will be sorted internally
* Reverts if the pool already exists or if the fee tier is not supported
* Returns the address of the newly created pool

**Parameters:**

| Name     | Type    | Description                                              |
| -------- | ------- | -------------------------------------------------------- |
| `tokenA` | address | One of the two tokens in the pool                        |
| `tokenB` | address | The other token in the pool                              |
| `fee`    | uint24  | Fee tier (e.g., 500, 3000, 10000) in hundredths of a bip |

**Example:**

```
address pool = factory.createPool(USDC, WETH, 3000); // 0.30% fee tier
```

#### Querying Existing Pools <a href="#user-content-querying-existing-pools" id="user-content-querying-existing-pools"></a>

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

Returns the pool address for a token pair and fee tier, or `address(0)` if it doesn't exist.

**Parameters:**

| Name     | Type    | Description          |
| -------- | ------- | -------------------- |
| `tokenA` | address | First token address  |
| `tokenB` | address | Second token address |
| `fee`    | uint24  | Fee tier             |

**Example:**

```
address pool = factory.getPool(USDC, WETH, 3000);require(pool != address(0), "Pool does not exist");
```

#### Checking Fee Tier Validity <a href="#user-content-checking-fee-tier-validity" id="user-content-checking-fee-tier-validity"></a>

```
function feeAmountTickSpacing(uint24 fee) external view returns (int24)
```

Returns the tick spacing for a fee tier, or `0` if the fee tier is not enabled.

**Parameters:**

| Name  | Type   | Description         |
| ----- | ------ | ------------------- |
| `fee` | uint24 | Fee amount to check |

**Example:**

```
int24 tickSpacing = factory.feeAmountTickSpacing(3000);require(tickSpacing != 0, "Fee tier not supported");
```

### Supported Fee Tiers <a href="#user-content-supported-fee-tiers" id="user-content-supported-fee-tiers"></a>

| Fee           | Tick Spacing | Use Case                             |
| ------------- | ------------ | ------------------------------------ |
| 100 (0.01%)   | 1            | Stablecoin pairs (e.g., USDC/USDT)   |
| 500 (0.05%)   | 10           | Correlated assets (e.g., WETH/stETH) |
| 3000 (0.30%)  | 60           | Most token pairs                     |
| 10000 (1.00%) | 200          | Exotic or high-volatility pairs      |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.warpx.exchange/for-developers/warpx-v3/core/warpx-v3-factory.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
