Skip to main content

Hydration Dashboards

Overviewโ€‹

Hydration, formerly known as HydraDX, is a decentralized finance hub on Polkadot. It offers several types of DEX pools:

  • Omnipool: a single liquidity pool for assets that have been vetted by governance. Typically, these would be currencies that have existed for a while and are expected to generate a high volume of trades.
  • Stable pools: pools where all coins in the same pool are expected to trade almost at the same price, e.g. USDC/USDT.
  • xyk-pools: pools where the price of the assets is determined by the x * y = k formula, also known as the constant product formula.

Users can swap from any asset to any other asset using an automated router that will calculate the most efficient path.

Liquidity providers can earn fees from the trades in the pools they provide liquidity to.

Here you'll find a variety of dashboards that help visualize data from the Hydration parachain:

  • hydration on Polkadot: This dashboard provides a comprehensive view of DEX volumes and liquidity on the Hydration parachain.

Key Tablesโ€‹

Data from the hydration parachain is organized into several key tables: hydradx.balances, hydradx.blocks, hydradx.calls, hydradx.events, hydradx.extrinsics, hydradx.transfers, hydradx.traces

The hydradx.traces table is created by a snapshot script utilizing Hydration API calls to fetch accurate values which would be difficult to calculate from the blockchain events alone.

Useful Queriesโ€‹

Some of the most important queries for Hydration are made available as materialized views.

Subject AreaQueryMaterialized ViewDescription
Oraclequery_3459562dune.substrate.result_hydradx_oracleProvides hourly oracle values for all currencies present in the omnipool. Uses LRNA.
Oracle (Alt.)query_3573146dune.substrate.result_hydra_dx_oracle_newProvides hourly oracle values for all currencies present in the omnipool. Uses DOT.
Oracle (Alt. Daily)query_3445402dune.substrate.result_hydra_dx_oracle_new_dailySame, but aggregated daily.
Oracle Pairsquery_3483707dune.substrate.result_hydra_dx_oracle_pairsProvides volume and transaction counts for all pairwise trades in the omnipool.
Omnipool Liquidityquery_3507194dune.substrate.result_hydradx_liquidity_masterProvides liquidity in the Omnipool on a per-account basis.
Assetsquery_3482301N/AProvides asset_id, symbol, and decimals for all assets in the Hydration parachain.

The first Oracle query is the recommended one to use for any oracle use cases that are not historical in nature. This is because it relies on the most reliable mechanism for determining the actual price, using the intermediate LRNA token price. This level of detail is only available from Jan. 2024 onwards.

For historical price analysis, the alternative oracle query uses DOT as the intermediate currency. It may be slightly less accurate and take a bit longer to calculate.

Liquidity in the Omnipool is calculated on a per-account basis, using the NFT positions that represent shares in the Omnipool.

Dune users are encouraged to study the source code of the queries, including parts of a query that may have been commented out for future use.

Uncommenting these parts may accelerate your effort of adopting a query to a slightly different use case.

Getting Started with Queriesโ€‹

To get started with querying data from Hydration, you are welcome to use the mentioned materialized queries. You can also use the following DuneSQL queries as examples:

Hydration Omnipool Asset (Latest)
WITH MaxTimestamps AS (
SELECT
CAST(JSON_VALUE(kv,'strict $.id') AS INT) as asset_id,
MAX(ts) as max_ts
FROM hydradx.traces
WHERE track='omniasset'
GROUP BY 1
), A AS
(
SELECT
m.asset_id,
A1.ticker,
A1.decimals,
m.max_ts as ts,
CAST(JSON_VALUE(t.pv,'strict $.cap') as UINT256) as cap,
CAST(JSON_VALUE(t.pv,'strict $.hubReserve') as UINT256) as hubReserve,
CAST(JSON_VALUE(t.pv,'strict $.protocolShares') as UINT256) as protocolShares,
CAST(JSON_VALUE(t.pv,'strict $.shares') as UINT256) as shares,
JSON_VALUE(t.pv, 'strict $.tradable.bits') as tradeable
FROM MaxTimestamps m
INNER JOIN hydradx.traces t ON m.asset_id = CAST(JSON_VALUE(t.kv,'strict $.id') AS INT) AND m.max_ts = t.ts
JOIN query_3482301 A1 on A1.asset_id=m.asset_id
WHERE t.track='omniasset'
)
SELECT
asset_id,
ticker,
round(100.0 * hubReserve / (sum(hubReserve) OVER(ORDER BY 1)), 1) as percentage_of_pool,
(cap)/POW(10,18) as cap,
round(hubReserve/POW(10,12)) as hubReserve,
round(protocolShares/POW(10, decimals)) as protocolShares,
round(shares/POW(10, decimals)) as shares,
ts as last_update-- when this data was collected
FROM A
where tradeable='15' -- all bits set to "on"
ORDER BY 3 DESC


The query is fairly typical for a parachain query on Dune. It calculates the last available values from the snapshot table hydradx.traces.

The query uses Dune's native UINT256 type extensively, which allows to deal with very large numbers and still maintain precision.

Query result:

DuneSQL Reference

For more information on DuneSQL, please refer to the DuneSQL Cheatsheet and DuneSQL Official Documentation.