permaryTotal amount paid out winnings
    Updated 2025-02-26
    with avax_price as (
    select
    date_trunc('hour', hour) as price_hour,
    avg(price) as price
    from avalanche.price.ez_prices_hourly
    where symbol = 'AVAX'
    group by 1
    ),

    winner_events as (
    select
    tx_hash,
    block_timestamp,
    contract_address
    from avalanche.core.ez_decoded_event_logs
    where lower(contract_address) in (
    '0x7d812a58dd63eb3a7b3b84f9290bd84db148893f',
    '0x0382df14b587c51052ffcca53db8697849ca1b2e',
    '0x3d74cbac40e2f23a795c665056613e3f3a83d160'
    )
    and origin_function_signature = '0x61a3dd87' -- Winner picked event signature
    and block_timestamp between timestamp '2025-02-22 20:20:00' and timestamp '2025-02-25 17:40:00' -- Fixed timestamp order
    ),

    winner_transactions as (
    select
    t.tx_hash,
    t.block_timestamp
    from avalanche.core.fact_transactions t
    join winner_events w on t.tx_hash = w.tx_hash
    ),

    payouts as (
    select
    tr.tx_hash,
    tr.block_timestamp,
    Last run: about 2 months ago
    WINNINGS_AVAX
    WINNINGS_USD
    1
    112033.21182650714.536069
    1
    30B
    5s