permaryDaily Xblub ferdy
    Updated 2025-02-25
    with avax_price as (
    select
    date_trunc('day', hour) as day,
    avg(price) as price
    from avalanche.price.ez_prices_hourly
    where symbol = 'AVAX'
    and hour >= dateadd('day', -30, current_date)
    group by 1
    ),

    blub_games as (
    select
    date_trunc('day', a.block_timestamp) as date,
    a.origin_from_address as player,
    count(distinct a.tx_hash) as play_count,
    sum(a.amount * b.price) as total_wagered,
    case when lower(a.origin_to_address) = '0x7d812a58dd63eb3a7b3b84f9290bd84db148893f' then 'Blub Flip'
    when lower(a.origin_to_address) = '0x0382df14b587c51052ffcca53db8697849ca1b2e' then 'Blub Plinko'
    when lower(a.origin_to_address) = '0x3d74cbac40e2f23a795c665056613e3f3a83d160' then 'Blub Wheel'
    end as game
    from avalanche.core.ez_native_transfers a
    join avax_price b on date_trunc('day', a.block_timestamp) = b.day
    where lower(a.origin_to_address) in (
    '0x7d812a58dd63eb3a7b3b84f9290bd84db148893f',
    '0x0382df14b587c51052ffcca53db8697849ca1b2e',
    '0x3d74cbac40e2f23a795c665056613e3f3a83d160'
    )
    and a.origin_function_signature in (
    '0x53ccbeea', '0xe427275b', '0x11af445d'
    )
    and a.block_timestamp >= dateadd('day', -30, current_date)
    and a.block_timestamp < current_date
    group by 1, 2, 5
    )
    -- 5️⃣ DAILY TRENDS: How the Game is Growing Over Time
    select
    Last run: about 2 months ago
    DATE
    unique_players
    daily_wagered
    daily_plays
    1
    2025-02-24 00:00:00.0001741339776.963493175418
    2
    2025-02-23 00:00:00.0002382866786.427437627378
    3
    2025-02-22 00:00:00.0001901060638.265323442237
    4
    2025-02-21 00:00:00.00044135834.391933542551
    5
    2025-02-20 00:00:00.0003891723.483247188446
    6
    2025-02-19 00:00:00.0002716966.443623229201
    7
    2025-02-18 00:00:00.0003632208.06774375257
    8
    2025-02-17 00:00:00.0003633859.9154205315
    9
    2025-02-16 00:00:00.0002410941.428475130
    10
    2025-02-15 00:00:00.0004172622.212740125423
    11
    2025-02-14 00:00:00.0001710811.29594010466
    12
    2025-02-13 00:00:00.00082511.411237518
    13
    2025-02-12 00:00:00.00098259.20556427
    14
    2025-02-11 00:00:00.00071747.1142412542
    15
    2025-02-10 00:00:00.00091999.56604531316
    16
    2025-02-09 00:00:00.000913240.95852937588
    17
    2025-02-08 00:00:00.00075096.141667598
    18
    2025-02-07 00:00:00.00064229.53227187547
    19
    2025-02-06 00:00:00.0008795.69853906327
    20
    2025-02-05 00:00:00.00091485.41717291739
    30
    1KB
    4s