MLDZMNSPINS AND VOLUME
    Updated 2024-07-12
    with price as (select
    d.value:"DAY" as day,
    d.value:"Greed price" as greed_price
    from (
    select livequery.live.udf_api(
    'https://flipsidecrypto.xyz/api/v1/queries/2cebaa4b-5d80-4982-88b7-61f59c6d11a6/data/latest'
    ):"data" as data
    ) responses join lateral flatten (input => responses.data) d
    )

    select
    count(*) as total_spins,
    sum(DECODED_LOG:spinType/1e18) as total_greed,
    sum(DECODED_LOG:spinType/1e18*(greed_price)) as total_usd_vol,
    avg(DECODED_LOG:spinType/1e18*(greed_price)) as avg_usd_vol,
    count(distinct ORIGIN_FROM_ADDRESS) as players,
    total_usd_vol/players as avg_usd_per_player
    from blast.core.ez_decoded_event_logs s
    left join price p on s.block_timestamp::date = p.day
    where CONTRACT_ADDRESS= '0x7fcb51ef936bace193b81478f9d17c8d91f94a2f'
    and EVENT_NAME = 'DailySpin'
    Auto-refreshes every 12 hours
    QueryRunArchived: QueryRun has been archived