Error Reference

Common errors encountered when using the Hydrex SDK and how to diagnose and fix them.


SDK Errors

ADDRESSES_NOT_EQUALToken comparison

Thrown when comparing tokens that have mismatched addresses. Ensure you are using the same token instance or comparing by address.

TICK_OUT_OF_RANGEPosition creation

The tick value is outside the allowable range [MIN_TICK, MAX_TICK]. Use nearestUsableTick() to align ticks to the pool's tick spacing.

ZERO_LIQUIDITYPosition / Pool

A trade or position was attempted with zero liquidity. Check that tick bounds cover the current price.

PRICE_BOUNDSTick / Price conversion

A price is outside the representable range. Ensure the price you're computing a tick for is within valid pool price bounds.

INSUFFICIENT_INPUT_AMOUNTSwap simulation

The input amount is insufficient to execute the trade. This typically happens when there is not enough liquidity in the range.

On-chain Revert Errors

STF (Safe Transfer From)

Token transfer failed. Ensure you have approved the contract for the required token amount before calling swap or deposit functions.

Too little received

The output amount fell below your minimum due to slippage. Increase your slippageTolerance or reduce trade size.

Transaction too old

The transaction deadline passed before it was included in a block. Increase your deadline or resubmit.

Price limit already exceeded

The sqrtPriceLimitX96 was already crossed before the swap executed. Adjust or remove the price limit.

Retry Utility

The SDK exports a retry utility for retrying async operations with exponential backoff. Throw RetryableError to signal that the error is transient and the operation should be retried.

typescript
import { retry, RetryableError } from '@hydrexfi/hydrex-sdk';

const { promise, cancel } = retry(
  async () => {
    const result = await fetchSomeData();
    if (!result) throw new RetryableError('No result yet');
    return result;
  },
  { n: 3, minWait: 500, maxWait: 2000 }
);

const result = await promise;
// cancel() to abort early

Slippage & Price Impact

Most reverts during swaps are caused by slippage settings that are too tight for current market conditions. Here are best practices:

typescript
// Use a reasonable slippage — too tight will cause reverts in volatile markets
const slippage = new Percent(50, 10_000); // 0.5% — good starting point

// For low-liquidity pools or large trades, increase tolerance:
const highSlippage = new Percent(100, 10_000); // 1%

// Check trade impact before submitting
if (trade.priceImpact.greaterThan(new Percent(3, 100))) {
  console.warn('High price impact:', trade.priceImpact.toFixed(2) + '%');
}
Hydrex

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

Paragraph

© 2026 Hydrex. All rights reserved.