LittlerDatapolymarket kanye all events
    Updated 2024-01-16
    -- forked from polymarket kanye new music 2023 conditionID all events copy @ https://flipsidecrypto.xyz/edit/queries/f97c514b-b3cd-4b6e-b984-e5a1766d5d58


    with
    all_bets as (
    select
    block_timestamp
    ,tx_hash
    ,decoded_log
    ,contract_address
    ,event_name
    from polygon.core.ez_decoded_event_logs
    where 1=1
    --and tx_hash = '0x5433f05fd5cdc8c8278e24a2cf619dd387aa47833059b1f9bf3f3fc5a2d001cf'
    and contract_address in ('0x6a9d222616c90fca5754cd1333cfd9b7fb6a4f74', '0x4d97dcd97ec945f40cf65f87097ace5ea0476045')
    and event_name in ('QuestionInitialized', 'ConditionPreparation')
    ),

    bets_titles as (
    select
    hex_decode_string(split_part(decoded_log:ancillaryData, '0x', 2)) as Question_Details
    ,tx_hash
    ,block_timestamp
    from all_bets
    where contract_address = '0x6a9d222616c90fca5754cd1333cfd9b7fb6a4f74'
    and event_name = 'QuestionInitialized'
    ),

    bets_id as (
    select
    tx_hash
    ,decoded_log:conditionId as conditionId
    ,decoded_log:questionId as questionId
    from all_bets
    where contract_address = '0x4d97dcd97ec945f40cf65f87097ace5ea0476045'
    and event_name = 'ConditionPreparation'
    QueryRunArchived: QueryRun has been archived