LittlerDataLRON withdraws & redeem copy
    Updated 2025-04-02
    -- forked from LRON withdraws & redeem @ https://flipsidecrypto.xyz/studio/queries/d8b78ed5-bf9f-45bd-ab47-062d531da1c1


    with redeems as (
    select
    tx_hash
    ,date_trunc('hour',block_timestamp) as hour
    ,origin_from_address
    ,utils.udf_hex_to_int(right(data, 64))::int / 1e18 as LRON_amount
    ,iff(origin_to_address = '0xcad9e7aa2c3ef07bad0a7b69f97d059d8f36edd2', 'Scrow contract', origin_to_address) as origin_to_address --0xcad9e7aa2c3ef07bad0a7b69f97d059d8f36edd2 scrow contract
    from ronin.core.fact_event_logs
    where 1=1
    and block_timestamp > '2025-03-19'
    and contract_address = '0xcad9e7aa2c3ef07bad0a7b69f97d059d8f36edd2' --LRON contract
    and topic_0 = '0xfbde797d201c681b91056529119e0b02407c7bb96a4a2c75c01fc9667232c8db' --redeem topic
    ),

    wron_price as ( --wrapped ron
    select
    hour
    ,price
    from ronin.price.ez_prices_hourly
    where token_address = '0xe514d9deb7966c8be0ca922de8a064264ea6bcd4'
    and hour > '2025-03-19'
    ),

    hourly as (
    select
    tx_hash
    ,hour
    ,sum(lron_amount * price) as redeem_volume_usd
    ,avg(lron_amount * price) as avg_redeem_usd
    ,median(lron_amount * price) as median_redeem_usd
    ,max(lron_amount * price) as max_redeem_usd
    ,min(lron_amount * price) as min_redeem_usd
    ,sum(lron_amount) as redeem_volume
    Last run: 25 days ago
    DATE
    REDEEM_VOLUME_USD
    AVG_REDEEM_USD
    MEDIAN_REDEEM_USD
    MAX_REDEEM_USD
    MIN_REDEEM
    1
    2025-03-22 00:00:00.0001911.854144058100.62390231915.570161185.934370.20045792
    2
    2025-03-31 00:00:00.00010830.75130283515.75006204105.15016081317.754738880.696986234
    3
    2025-03-29 00:00:00.00016520.0834109311101.338894062106.029610905.150.718448224
    4
    2025-04-01 00:00:00.0004132.185726171375.65324783428.2637636683361.28042.771488
    5
    2025-03-30 00:00:00.0003410.790827151426.34885339420.6907019942502.65750.709516773
    6
    2025-03-23 00:00:00.0008279.392836487.02310831.171362594.7570.790768
    7
    2025-04-02 00:00:00.00046.35360451811.58840112910.60403124.4306650.714877518
    8
    2025-03-21 00:00:00.00013747.136818618274.94273637224.7082559988.2488654690.77285
    9
    2025-03-25 00:00:00.00026410.3770827041056.41508330881.16147910.9164581120.402483
    10
    2025-03-20 00:00:00.0001.5413061.5413061.5413061.5413061.541306
    11
    2025-03-24 00:00:00.0002896.6673712137.93654148616.143881143.60440530.0393389
    12
    2025-03-26 00:00:00.00018859.523215694992.60648503780.70167370.167952190.469217426
    13
    2025-03-28 00:00:00.0008157.975966474509.87349790564.058497256235.944595720
    14
    2025-03-27 00:00:00.0003330.435633217208.15222707666.1516751273.243425360.350083953
    14
    1KB
    36s