0xHaM-dTotal
    Updated 2025-05-13
    with priceTb as (
    select
    hour,
    price
    from ethereum.price.ez_prices_hourly
    where SYMBOL = 'WBTC'
    and hour::date >= '2025-03-01'
    )
    ,
    openTrove as (
    select
    BLOCK_TIMESTAMP,
    tx_hash,
    FROM_ADDRESS as borrower_add,
    value as collateral,
    value*price as collateral_usd,
    regexp_substr_all(SUBSTR(INPUT, 11, len(INPUT)), '.{64}') AS segmented_data,
    ethereum.public.udf_hex_to_int(segmented_data[1])::int/1e18 as debt_value,
    from mezo.testnet.fact_traces
    join priceTb on trunc(BLOCK_TIMESTAMP, 'hour') = hour
    where TO_ADDRESS = '0x20faea18b6a1d0fcdbccfffe3d164314744baf30'
    and left(input,10) ilike '0x8f09162b'
    and tx_succeeded = 'True'
    )
    ,
    adjustTrove as (
    select
    BLOCK_TIMESTAMP,
    tx_hash,
    FROM_ADDRESS as borrower_add,
    value as collateral,
    value*price as collateral_usd,
    regexp_substr_all(SUBSTR(INPUT, 11, len(INPUT)), '.{64}') AS segmented_data,
    ethereum.public.udf_hex_to_int(segmented_data[1])::int/1e18 as debt_value,
    ethereum.public.udf_hex_to_int(segmented_data[2])::int/1e18 as adjust_amt,
    ethereum.public.udf_hex_to_int(segmented_data[3])::int/1e18 as increase_debt,
    Last run: 18 days ago
    N_TXN
    N_BORROWERS
    TOTAL_DEBT
    TOTAL_COLLATERAL
    TOTAL_COLLATERAL_USD
    AVG_DEBT
    AVG_COLLAT
    MEDIAN_DEBT
    MEDIAN_COLLAT
    AVG_DEBT_PER_BORROWER
    AVG_COLLAT_PER_BORROWER
    1
    3516029436331131713.8794920.3882971721799837.242830879417.8530682448820.00057987193322424.240.00015511249.208923749490.0006926313756
    1
    146B
    6s