# IPoolInitializer

Provides a method for creating and initializing a pool, if necessary, for bundling with other methods that require the pool to exist.

### Functions[​](https://docs.uniswap.org/contracts/v3/reference/periphery/interfaces/IPoolInitializer#functions) <a href="#functions" id="functions"></a>

#### createAndInitializePoolIfNecessary[​](https://docs.uniswap.org/contracts/v3/reference/periphery/interfaces/IPoolInitializer#createandinitializepoolifnecessary) <a href="#createandinitializepoolifnecessary" id="createandinitializepoolifnecessary"></a>

```solidity
  function createAndInitializePoolIfNecessary(
    address token0,
    address token1,
    uint24 fee,
    uint160 sqrtPriceX96
  ) external returns (address pool)
```

Creates a new pool if it does not exist, then initializes if not initialized

This method can be bundled with others via IMulticall for the first action (e.g. mint) performed against a pool

**Parameters:**[**​**](https://docs.uniswap.org/contracts/v3/reference/periphery/interfaces/IPoolInitializer#parameters)

| Name           | Type    | Description                                                 |
| -------------- | ------- | ----------------------------------------------------------- |
| `token0`       | address | The contract address of token0 of the pool                  |
| `token1`       | address | The contract address of token1 of the pool                  |
| `fee`          | uint24  | The fee amount of the v3 pool for the specified token pair  |
| `sqrtPriceX96` | uint160 | The initial square root price of the pool as a Q64.96 value |

**Return Values:**[**​**](https://docs.uniswap.org/contracts/v3/reference/periphery/interfaces/IPoolInitializer#return-values)

| Name   | Type    | Description                                                                                                           |
| ------ | ------- | --------------------------------------------------------------------------------------------------------------------- |
| `pool` | address | Returns the pool address based on the pair of tokens and fee, will return the newly created pool address if necessary |


---

# 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.dragonswap.app/dragonswap/resources/developer-resources/smart-contracts/dragonswapv2/periphery/interfaces/ipoolinitializer.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.
