permary Gas & Transaction Costs
    Updated 2025-03-17
    WITH eth_gas AS (
    SELECT
    'Ethereum' AS chain,
    AVG(f.tx_fee) AS avg_gas_fee_native,
    AVG(f.tx_fee * p.price) AS avg_gas_fee_usd
    FROM ethereum.core.fact_transactions f
    JOIN ethereum.defi.ez_dex_swaps d
    ON f.tx_hash = d.tx_hash
    JOIN ethereum.price.ez_prices_hourly p
    ON DATE_TRUNC('hour', f.block_timestamp) = p.hour
    AND p.symbol = 'ETH'
    WHERE d.symbol_in = 'XSGD' OR d.symbol_out = 'XSGD'
    ),
    polygon_gas AS (
    SELECT
    'Polygon' AS chain,
    AVG(ft.tx_fee) AS avg_gas_fee_native,
    AVG(ft.tx_fee * p.price) AS avg_gas_fee_usd
    FROM polygon.core.fact_transactions ft
    JOIN polygon.defi.ez_dex_swaps ds
    ON ft.tx_hash = ds.tx_hash
    JOIN polygon.price.ez_prices_hourly p
    ON DATE_TRUNC('hour', ft.block_timestamp) = p.hour
    AND p.symbol = 'MATIC'
    WHERE ds.symbol_in = 'XSGD' OR ds.symbol_out = 'XSGD'
    ),
    avalanche_gas AS (
    SELECT
    'Avalanche' AS chain,
    AVG(am.tx_fee) AS avg_gas_fee_native,
    AVG(am.tx_fee * p.price) AS avg_gas_fee_usd
    FROM avalanche.core.fact_transactions am
    JOIN avalanche.defi.ez_dex_swaps ap
    ON am.tx_hash = ap.tx_hash
    JOIN avalanche.price.ez_prices_hourly p
    ON DATE_TRUNC('hour', am.block_timestamp) = p.hour
    Last run: about 1 month ago
    CHAIN
    AVG_GAS_FEE_NATIVE
    AVG_GAS_FEE_USD
    1
    Ethereum0.0135226405331.013065399
    2
    Polygon0.11801681020.1002904686
    3
    Avalanche0.0053383192350.1904306036
    3
    121B
    471s