Pools

Hydrex pools are concentrated-liquidity AMM pools deployed via a pool deployer factory. The SDK provides utilities to compute pool addresses and model their on-chain state.


Computing Pool Addresses

Pool.getAddress is the recommended surface — it automatically uses POOL_DEPLOYER_ADDRESSES for the token's chain. For custom deployer addresses, use computePoolAddress directly.

typescript
import { Pool } from '@hydrexfi/hydrex-sdk';

// Recommended: uses POOL_DEPLOYER_ADDRESSES for the token's chain automatically
const poolAddress = Pool.getAddress(USDC, WETH);

Lower-level: computePoolAddress

typescript
import { computePoolAddress, POOL_DEPLOYER_ADDRESSES, ChainId } from '@hydrexfi/hydrex-sdk';

// Standard pool
const poolAddress = computePoolAddress({
  poolDeployer: POOL_DEPLOYER_ADDRESSES[ChainId.Base],
  tokenA: USDC,
  tokenB: WETH,
});

// Custom deployer
const customPoolAddress = computePoolAddress({
  poolDeployer: '0xYourCustomDeployer',
  tokenA: USDC,
  tokenB: WETH,
});

Creating a Pool Instance

The Pool constructor requires the pool deployer address and tick spacing in addition to the standard Uniswap V3 parameters. Pool data is typically fetched on-chain via your RPC.

typescript
import {
  Pool,
  POOL_DEPLOYER_ADDRESSES,
  INITIAL_POOL_FEE,
  DEFAULT_TICK_SPACING,
  ChainId,
} from '@hydrexfi/hydrex-sdk';

const pool = new Pool(
  USDC,                                       // tokenA
  WETH,                                       // tokenB
  INITIAL_POOL_FEE,                           // fee tier (100)
  sqrtRatioX96,                               // current sqrt price (Q64.96)
  POOL_DEPLOYER_ADDRESSES[ChainId.Base],      // deployer address
  liquidity,                                  // in-range liquidity
  tickCurrent,                                // current tick
  DEFAULT_TICK_SPACING,                       // tick spacing (60)
  ticks                                       // TickDataProvider or array
);

// Derived prices
const token0Price = pool.token0Price;
const token1Price = pool.token1Price;

// Pool address
const address = Pool.getAddress(USDC, WETH);

// Simulate a swap
const [outputAmount, updatedPool] = await pool.getOutputAmount(inputAmount);

Pool constructor parameters

ParameterTypeRequiredDescription
tokenATokenrequiredFirst token of the pair (order will be sorted internally).
tokenBTokenrequiredSecond token of the pair.
feenumberrequiredFee tier in hundredths of a bip. Default: INITIAL_POOL_FEE (100).
sqrtRatioX96BigintIshrequiredCurrent sqrt price as a Q64.96 fixed-point number.
poolDeployerstringrequiredAddress of the pool deployer factory contract.
liquidityBigintIshrequiredTotal in-range liquidity at the current tick.
tickCurrentnumberrequiredCurrent active tick index.
tickSpacingnumberrequiredTick spacing for this pool. Default: DEFAULT_TICK_SPACING (60).
ticksTickDataProvider | Tick[]optionalTick data for the pool, used in swap simulation.

Default constants

Use INITIAL_POOL_FEE (100) and DEFAULT_TICK_SPACING (60) for standard Hydrex pools. Custom fee tiers may use different tick spacings.
Hydrex

Hydrex is an Omni-Liquidity MetaDEX built on Base for Base, designed to bring new users onchain.

Paragraph

© 2026 Hydrex. All rights reserved.