0xHaM-dWithdrawn mUSD Over Time
    Updated 2025-04-12
    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
    trunc(BLOCK_TIMESTAMP, 'd') as date,
    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,
    sum(n_withdrawn) over (order by date) as total_n_withdrawn,
    sum(total_collat_amount) over (order by date) as total_collat_amt,
    sum(total_collat_amount_usd) over (order by date) as total_collat_amt_usd,
    Last run: 15 days ago
    DATE
    N_WITHDRAWN
    N_WITHDRAWNERS
    TOTAL_COLLAT_AMOUNT
    TOTAL_MUSD_WITHDRAWN
    TOTAL_COLLAT_AMOUNT_USD
    TOTAL_N_WITHDRAWN
    TOTAL_COLLAT_AMT
    TOTAL_COLLAT_AMT_USD
    TOTAL_MUSD_WITHDRAWN_AMT
    1
    2025-04-12 00:00:00.000220.01472810001227.9022442278.234035693241.05593521434899.54789
    2
    2025-04-11 00:00:00.00030290.0083768350.05684.5782622258.219307692013.15369121433899.54789
    3
    2025-04-10 00:00:00.00013110.012912321921031.7058331958.210931691328.57542921425549.49789
    4
    2025-04-09 00:00:00.00018130.0129131972998.4740951828.198019690296.86959621393357.49789
    5
    2025-04-08 00:00:00.00015150.00636332114500.744891648.185109689298.39550121361385.49789
    6
    2025-04-07 00:00:00.00013100.01812244501410.6633781498.178746688797.65061121329271.49789
    7
    2025-04-06 00:00:00.00044140.033161227432749.945531368.160624687386.98723321324821.49789
    8
    2025-04-05 00:00:00.00038260.3412375527028543.456167928.127464684637.04170321202078.49789
    9
    2025-04-04 00:00:00.00033277.56912520429087.34638306.98182547.786234656093.58553620446808.49789
    10
    2025-04-03 00:00:00.00014120.07604214860.016232.721298210.21710917786.60371617721.15789
    11
    2025-04-02 00:00:00.000420.0006671624.5857.17881870.14106711553.8824182861.14789
    12
    2025-04-01 00:00:00.000110.00041234.5678934.063630.140411496.70361236.56789
    13
    2025-03-31 00:00:00.000210.14211462.6420.1411462.642
    13
    1KB
    32s