permaryblub analysis
    Updated 2025-02-26
    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', -4, 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', -4, current_date)
    and a.block_timestamp < current_date
    group by 1, 2, 5
    )

    select
    Last run: about 2 months ago
    GAME
    UNIQUE_PLAYERS
    TOTAL_WAGERED
    TOTAL_PLAYS
    1
    Blub Plinko2481823177.253256214337
    2
    Blub Wheel3032297733.294270544517
    3
    Blub Flip3753464080.4842077712540
    3
    125B
    4s