Use Tuven
USDX: one asset, two interfaces
Use the right unit scale for native payments, token approvals, and DEX integrations.
USDX appears in two interfaces backed by the same underlying balance. Native calls use 18 decimals. The ERC-20 facade at the fixed USDX contract address uses 6 decimals. There is no second independent balance to wrap or unwrap.
1 USDX = 1_000_000_000_000_000_000 native wei
= 1_000_000 ERC-20 facade units
facadeUnits = nativeWei / 1_000_000_000_000
nativeWei = facadeUnits * 1_000_000_000_000Choose the interface for your action
- Use native 18-decimal values for eth_getBalance, transaction value, gas fees, and launchpad creation or curve purchases.
- Use ERC-20 6-decimal values for USDX balanceOf, approve, transfer, transferFrom, and Uniswap V2 router calls.
- Parse token amounts with the token’s actual decimals. A different ERC-20 may use a different unit scale.
Convert with integers
import { parseUnits, formatUnits } from 'viem';
const nativeAmount = parseUnits('12.50', 18);
const dexAmount = parseUnits('12.50', 6);
// The native value may contain dust below facade precision.
const facadeAmount = nativeAmount / 1_000_000_000_000n;
console.log(formatUnits(facadeAmount, 6)); // '12.5'Keep monetary calculations in bigint. Converting large balances to JavaScript Number before a transaction can lose precision. Reject inputs that exceed an asset’s decimal precision instead of silently rounding them.
Avoid double counting and unsupported calls
USDX has administrative asset controls. Integrators should account for pause, denylist, and supply-management policy, and should not assume the asset has the same issuer rights or redemption arrangements as a similarly named token elsewhere.