0xbicandle
    Updated 2023-09-22
    -- WHERE topic0 = 0x137a44067c8961cd7e1d876f4754a5a3a75989b4552f1843fc69c3b372def160
    -- and topic1 = 0xe096982abd597114bdaa4a60612f87fabfcc7206aa12d61c50e7ba1e6c291100
    -- and contract_address = 0xc8ee91a54287db53897056e12d9819156d3822fb
    with gmx_v2_tx as
    (
    SELECT
    TX_HASH
    FROM arbitrum.core.fact_event_logs
    WHERE CONTRACT_ADDRESS = '0xc8ee91a54287db53897056e12d9819156d3822fb'
    group by 1
    ),

    swap_detail as
    (
    SELECT
    BLOCK_TIMESTAMP
    ,TX_HASH
    ,CONTRACT_ADDRESS
    ,DECODED_LOG['from'] as from_address
    ,DECODED_LOG['to'] as to_address
    ,DECODED_LOG['value'] as value
    FROM arbitrum.core.fact_decoded_event_logs
    WHERE TX_HASH in (select TX_HASH from gmx_v2_tx group by 1)
    and EVENT_NAME='Transfer'
    and TO_ADDRESS not in ('0x0000000000000000000000000000000000000000')
    )

    SELECT
    *
    from
    (
    SELECT
    TX_HASH
    ,count(*) as cnt
    from swap_detail
    group by 1
    Run a query to Download Data