Tokens & Currencies

The SDK provides several currency and amount primitives that are used throughout — from pool construction to trade building and calldata encoding.


Token

Represents a standard ERC-20 token. The constructor takes chain ID, contract address, decimals, and optional symbol/name.

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

const USDC = new Token(
  ChainId.Base,
  '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913',
  6,
  'USDC',
  'USD Coin'
);

Constructor parameters

ParameterTypeRequiredDescription
chainIdChainIdrequiredThe chain this token is deployed on.
addressstringrequiredThe ERC-20 contract address (checksummed).
decimalsnumberrequiredNumber of decimal places (e.g. 6 for USDC, 18 for WETH).
symbolstringoptionalTicker symbol for display purposes.
namestringoptionalFull token name for display purposes.

Native / ExtendedNative

Represents the native chain currency (ETH on Base). Use Native.onChain(chainId) to get a cached singleton. Both Native and ExtendedNative wrap to WNATIVE[chainId].

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

const eth = Native.onChain(ChainId.Base);
// eth.wrapped === WNATIVE[ChainId.Base]

BoostedToken

Represents an ERC4626 vault-share token (e.g. a Morpho or Euler position). The vault deposits an underlying token and issues shares. When used in a BoostedRoute, the SDK automatically inserts WRAP/ UNWRAP steps.

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

const mwETH = new BoostedToken(
  ChainId.Base,
  '0xYourVaultAddress',
  18,
  'mwETH',
  'Morpho Wrapped ETH',
  WETH // underlying Token
);

// Route with automatic wrap/unwrap
const boostedRoute = new BoostedRoute([pool], USDC, mwETH);

BoostedRoute steps

Inspect boostedRoute.steps to see the WRAP, SWAP, and UNWRAP sequence the SDK will execute. Each step has a type from BoostedRouteStepType.

CurrencyAmount

Wraps a raw token amount (as a string or bigint) with its currency reference. Provides formatting helpers.

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

const amount = CurrencyAmount.fromRawAmount(USDC, '1000000'); // 1 USDC
// amount.toSignificant(6) => "1.00000"
// amount.toExact() => "1"

Percent

A fraction that renders as a percentage. Used for slippage tolerances, fee tiers, and liquidity percentages. Constructed as new Percent(numerator, denominator).

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

const slippage = new Percent(50, 10_000); // 0.5%
const fee = new Percent(1, 100);          // 1%

Price

A typed price ratio between two currencies. Carry type information about the base and quote tokens to prevent mixing up price directions.

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

const price = new Price({
  baseAmount: usdcAmount,
  quoteAmount: wethAmount,
});
// price.toSignificant(5)

Type Reference

Type / ClassDescription
TokenERC-20 token with chainId, address, decimals
NativeNative ETH; .onChain(chainId) returns a cached singleton instance
ExtendedNativeExtended native currency; same API as Native
BoostedTokenERC4626 vault-share token; extends Token; has .underlying
CurrencyAmount<T>Amount + currency; .fromRawAmount(), .fromFractionalAmount()
PercentFraction rendered as %; extends Fraction
Price<Base,Quote>Typed price between two currencies
FractionArbitrary precision ratio; base class for Percent / Price
CurrencyUnion: NativeCurrency | Token | BoostedToken
AnyTokenToken | BoostedToken
BigintIshstring | number | JSBI — accepted anywhere a raw amount is needed
Hydrex

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

Paragraph

© 2026 Hydrex. All rights reserved.