Updated 2024-05-23
    -- Step 1: Gather all interactions with different contracts
    with interactions as (
    -- Shop Contract Interactions
    select
    block_timestamp,
    tx_hash,
    origin_from_address as interacted_wallet,
    origin_function_signature as method
    from blast.core.fact_event_logs
    where contract_address = '0xca4a0be8d75435ae10eb5a98ca91d35740682fd0'
    union all
    -- GM Contract Interactions
    select
    block_timestamp,
    tx_hash,
    origin_from_address as interacted_wallet,
    origin_function_signature as method
    from blast.core.fact_event_logs
    where contract_address = '0x20a0284330d130d9d2b7a8ee238ec521233101ea'
    and origin_function_signature != '0x77a084dd' -- Exclude "tempt result"
    union all
    -- Specific Spy Activities (10 WAI tokens to GM Contract)
    select
    block_timestamp,
    tx_hash,
    origin_from_address as interacted_wallet,
    'spy' as method
    from blast.core.fact_event_logs
    where contract_address = '0x129ed667bf8c065fe5f66c9b44b7cb0126d85cc3'
    and concat('0x', substr(topics[2], 27, 40)) = '0x20a0284330d130d9d2b7a8ee238ec521233101ea'
    and livequery.utils.udf_hex_to_int(data) / power(10, 18) = 10
    QueryRunArchived: QueryRun has been archived