mousemouseGetting Started
    Updated 2025-04-08
    with deposit as (
    select
    date_trunc('day', block_timestamp) as day,
    sum(full_decoded_log:data[2]:value) / pow(10, 18) as daily_deposit
    from ronin.core.ez_decoded_event_logs
    where event_name = 'Deposit'
    and full_decoded_log:data[2]:name = 'assets'
    and contract_address = '0xcad9e7aa2c3ef07bad0a7b69f97d059d8f36edd2'
    group by 1
    ),

    withdraw as (
    select
    date_trunc('day', block_timestamp) as day,
    sum(full_decoded_log:data[3]:value) / pow(10, 18) as daily_withdraw
    from ronin.core.ez_decoded_event_logs
    where event_name = 'Withdraw'
    and full_decoded_log:data[3]:name = 'assets'
    and contract_address = '0xcad9e7aa2c3ef07bad0a7b69f97d059d8f36edd2'
    group by 1
    ),

    combined as (
    select
    coalesce(d.day, w.day) as day,
    coalesce(d.daily_deposit, 0) as hourly_RON_deposited,
    - coalesce(w.daily_withdraw, 0) as hourly_RON_withdrawn,
    coalesce(d.daily_deposit, 0) - coalesce(w.daily_withdraw, 0) as net_hourly_stake,
    sum(coalesce(d.daily_deposit, 0) - coalesce(w.daily_withdraw, 0))
    over (order by coalesce(d.day, w.day)) as cumulative_net_stake
    from deposit d
    full outer join withdraw w
    on d.day = w.day
    )

    select *
    Last run: 3 months ago
    DAY
    HOURLY_RON_DEPOSITED
    HOURLY_RON_WITHDRAWN
    NET_HOURLY_STAKE
    CUMULATIVE_NET_STAKE
    1
    2025-04-08 00:00:00.00062763.123481873-27505.00553182735258.1179500465772766.3853886
    2
    2025-04-07 00:00:00.00036091.419226201-25011.71310373911079.7061224625737508.26743855
    3
    2025-04-06 00:00:00.00061010.6491-26435.04060490934575.6084950915726428.56131609
    4
    2025-04-05 00:00:00.00068791.074375183-22668.97907092846122.0953042555691852.952821
    5
    2025-04-04 00:00:00.000764041.30039-129435.580094151634605.7202958495645730.85751674
    6
    2025-04-03 00:00:00.000153080.36084-23381.282599302129699.0782406985011125.13722089
    7
    2025-04-02 00:00:00.000302186.6284-8503.61015644293683.018243564881426.0589802
    8
    2025-04-01 00:00:00.0004514.547794042-5752.361415653-1237.8136216114587743.04073664
    9
    2025-03-31 00:00:00.00051645.637833453-15573.20019220936072.4376412444588980.85435825
    10
    2025-03-30 00:00:00.0007222.804-4777.6088924762445.1951075244552908.416717
    11
    2025-03-29 00:00:00.00027670.286-22856.0103601954814.2756398054550463.22160948
    12
    2025-03-28 00:00:00.000268257.206736311-10587.791441972257669.4152943384545648.94596967
    13
    2025-03-27 00:00:00.0002703957.491-4251.3885409982699706.1024594287979.53067534
    14
    2025-03-26 00:00:00.00040331.908-23584.471498816747.43650121588273.42821633
    15
    2025-03-25 00:00:00.000387228.654843146-32790.894354437.7608431461571525.99171513
    16
    2025-03-24 00:00:00.000454448.813871988-3577.784450871.0298719881217088.23087199
    17
    2025-03-23 00:00:00.00029025.69-1052718498.69766217.201
    18
    2025-03-22 00:00:00.00022111.854-2443.77119668.083747718.511
    19
    2025-03-21 00:00:00.000513645.035-17765.607495879.428728050.428
    20
    2025-03-20 00:00:00.000232073-2232071232171
    21
    2KB
    8s