vilppuYolo Games Daily Bet Volumes (all games - YOLO excluded) copy
    Updated 2024-07-29
    -- forked from Yolo Games Daily Bet Volumes (all games - YOLO excluded) @ https://flipsidecrypto.xyz/studio/queries/2e5f21f1-582c-4c1a-84b1-401c2dbb4b93

    -- forked from Yolo Games Daily Bet Volumes (Pre TGE Games) @ https://flipsidecrypto.xyz/edit/queries/4ed0329a-beb2-4fa3-864e-5429e449b4af

    -- All fee payment transactions for v2 and limited.
    -- Volume is derived from the fee (1% of total volume).
    with yolo_bets as (
    select distinct
    block_timestamp,
    tx_hash,
    event_index as index,
    case
    when contract_address = lower('0x28EF3eaE1AbB6D6e22e9bFc7a0944f707E4726b3')
    then 'YOLO Limited'
    when contract_address = lower('0x0000000000E14E87e5c80A8A90817308fFF715d3')
    then 'YOLO V2'
    end as game_type,
    cast(decoded_log['token'] as string) as token,
    cast(decoded_log['amount'] as float) / power(10,18) as fee_amount,
    cast(decoded_log['amount'] as float) / power(10,18) * 100 as bet_amount,
    from
    blast.core.ez_decoded_event_logs
    where
    contract_address in (
    lower('0x0000000000E14E87e5c80A8A90817308fFF715d3'), lower('0x28EF3eaE1AbB6D6e22e9bFc7a0944f707E4726b3')
    )
    and event_name = 'ProtocolFeePayment'
    and tx_status = 'SUCCESS'
    ),

    -- Get MOD bets for ETHUSD AND BTCUSD for both directions (moon and doom).
    mod_bets as (
    select distinct
    block_timestamp,
    tx_hash,
    event_index as index,
    QueryRunArchived: QueryRun has been archived