> ## Documentation Index
> Fetch the complete documentation index at: https://docs.saucerswap.finance/llms.txt
> Use this file to discover all available pages before exploring further.

# Check if a pool exists (V2)

> Check whether a SaucerSwap V2 pool exists for a token pair and fee tier with the factory getPool function before minting a new liquidity position.

> [!TIP]
>
> Checking if the liquidity pool with the matching fee tier exists using SaucerSwap's REST API is also a suitable alternative. For more information, see [Get all Liquidity Pools (V2)](https://docs.saucerswap.finance/developers/v2/liquidity/fetch-all-pools.md).

***

Function name: `getPool`

*No gas cost — read-only call.*

| Parameter Name | Description |
| - | - |
| *address token0* | The contract address of either token0 or token1 |
| *address token1* | The contract address of the other token |
| *uint24 fee* | The fee collected upon every swap in the pool, denominated in hundredths of a bip |

```solidity IUniswapV3Factory.sol theme={"dark"}
/// @notice Returns the pool address for a given pair of tokens and a fee, or address 0 if it does not exist
/// @dev tokenA and tokenB may be passed in either token0/token1 or token1/token0 order
/// @param tokenA The contract address of either token0 or token1
/// @param tokenB The contract address of the other token
/// @param fee The fee collected upon every swap in the pool, denominated in hundredths of a bip
/// @return pool The pool address
function getPool(
  address tokenA,
  address tokenB,
  uint24 fee
) external view returns (address pool);
```

> [!TIP]
>
> When working with HBAR, use the WHBAR (Wrapped HBAR) token address for either tokenA or tokenB.

> [!NOTE]
>
> The ordering of tokens for token0 and token1 does not matter.

> [!NOTE]
>
> If the pool does not exist, a zero address will be returned.

## Code overview

> [tab] JSON RPC
>
> Resources:
>
> * [SaucerSwap deployed contract IDs](https://docs.saucerswap.finance/developers/contracts.md)
> * [Ethers.js docs (v6)](https://docs.ethers.org/v6/)
> * [Hedera JSON RPC Relay](https://docs.hedera.com/evm/tutorials/intermediate/json-rpc-connections)
>
> ```typescript theme={"dark"}
> import * as ethers from 'ethers'; //V6
>
> //Set one of Hedera's JSON RPC Relay as the provider
> const provider = new ethers.JsonRpcProvider(hederaJsonRelayUrl, '', {
>   batchMaxCount: 1, //workaround for V6
> });
>
> //load ABI data containing the Factory's getPool function
> const interfaces = new ethers.Interface(abi);
>
> const factoryContract = new ethers.Contract(factoryEvmAddress, interfaces.fragments, provider);
> const result = await factoryContract.getPool(token0, token1, fee); //(token1, token0, fee) will give same result
> const poolEvmAddress = result; //address pool
> ```

## Next steps

> [card] [New liquidity position (V2)](https://docs.saucerswap.finance/developers/v2/liquidity/new-liquidity-position.md)
>
> Mint a position once the pool is confirmed.

> [card] [Fetch all pools (V2)](https://docs.saucerswap.finance/developers/v2/liquidity/fetch-all-pools.md)
>
> List every V2 pool from the REST API.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.