0xHaM-dTotal Withdrawn mUSD
    Updated 2025-05-01
    with priceTb as (
    select
    hour,
    price
    from ethereum.price.ez_prices_hourly
    where SYMBOL = 'WBTC'
    and hour::date >= '2025-03-01'
    )
    , eventTb as (
    select
    BLOCK_TIMESTAMP,
    TX_HASH,
    ORIGIN_FROM_ADDRESS as borrower_add,
    regexp_substr_all(SUBSTR(data, 3, len(data)), '.{64}') AS segmented_data,
    regexp_substr_all(SUBSTR(INPUT, 11, len(INPUT)), '.{64}') AS segmented_input_data,
    ethereum.public.udf_hex_to_int(segmented_data[2])::int/1e18 as collat_amount,
    (ethereum.public.udf_hex_to_int(segmented_data[2])::int/1e18)*price as collat_amount_usd,
    ethereum.public.udf_hex_to_int(segmented_input_data[1])::int/1e18 as mUSD_withdrawn_amt,
    from mezo.testnet.fact_event_logs log
    join mezo.testnet.fact_traces trace using(TX_HASH)
    join priceTb on trunc(BLOCK_TIMESTAMP, 'hour') = hour
    where log.CONTRACT_ADDRESS = '0x20faea18b6a1d0fcdbccfffe3d164314744baf30'
    and left(input,10) ilike '0x5f705f69'
    and TX_SUCCEEDED = TRUE
    and log.TOPIC_0 = '0xf575eb5cdee005607f56587351e18943ddacd11756b9d37980ec251797ff136c'
    )
    select
    count(distinct TX_HASH) as n_withdrawn,
    count(distinct borrower_add) as n_withdrawners,
    sum(collat_amount) as total_collat_amount,
    sum(mUSD_withdrawn_amt) as total_mUSD_withdrawn,
    sum(collat_amount_usd) as total_collat_amount_usd,
    from eventTb




    Last run: 23 days ago
    N_WITHDRAWN
    N_WITHDRAWNERS
    TOTAL_COLLAT_AMOUNT
    TOTAL_MUSD_WITHDRAWN
    TOTAL_COLLAT_AMOUNT_USD
    1
    137885810.25031629421768.55789874751.495375645
    1
    54B
    7s