Skip to main content

Discover Pools and Read State

The Dispatcher’s ledger tree is the pool registry.

Discover pool addresses

Read the Dispatcher’s direct subaccounts:

const poolAddresses = await publicClient.readContract({
address: dispatcher,
abi: [{
type: "function",
name: "subAccounts",
stateMutability: "view",
inputs: [{ name: "absolute_", type: "address" }],
outputs: [{ name: "", type: "address[]" }],
}],
functionName: "subAccounts",
args: [dispatcher],
});

Do not assume that every discovered address is ready for trading. For each candidate, read targetTokenAddress(pool) or poolSummary(pool). Ignore uninitialized entries and apply any deployment-specific allowlist required by your product.

Read a pool summary

poolSummary(pool) returns:

FieldMeaning
totalScaleCurrent total pool scale
totalTargetScaleTotal target scale
priceOfUSDScale-to-USD conversion
targetTokenAddressPool ownership or claim token
treasuryAddressPool treasury account
reserveAssetCountNumber of registered reserve assets
claimTokenCountNumber of active claim tokens exposed by the summary
anchorTokenAddressesAssets used as pool anchors

All scale and price fields are packed Float values.

Page through reserve assets

Large pools must be read in pages:

const page = await publicClient.readContract({
address: dispatcher,
abi: poolAbi,
functionName: "reserveAssetInfos",
args: [pool, start, limit],
});

Each ReserveAssetInfo includes:

  • token address,
  • stableness,
  • fee,
  • reserve,
  • scale,
  • target scale,
  • name, symbol, and decimals,
  • pool-role and ledger flags.

The reference app reads up to 600 reserve assets per page. Use a smaller page when required by RPC response limits.

Snapshot consistency

Read pool summary and asset pages against the same block when reproducible quotes matter. A quote assembled from different blocks can mix incompatible reserve, scale, and target state.

Cache token metadata, but refresh financial state before quoting.