MoDeFiCorrelated Wallets List
    Updated 2024-06-07
    WITH address_array AS (
    SELECT REPLACE(lower(value),' ','') AS address
    FROM TABLE(SPLIT_TO_TABLE('{{address_list}}', ','))
    where address!=''),

    txs as
    (select BLOCK_TIMESTAMP, 'Polygon' as chain, FROM_ADDRESS, TO_ADDRESS, TX_HASH
    from polygon.core.fact_transactions
    where FROM_ADDRESS in (select address from address_array)
    and TO_ADDRESS in ((select address from address_array))
    and TO_ADDRESS!=FROM_ADDRESS
    union all
    select BLOCK_TIMESTAMP, 'Optimism' as chain, FROM_ADDRESS, TO_ADDRESS, TX_HASH
    from optimism.core.fact_transactions
    where FROM_ADDRESS in (select address from address_array)
    and TO_ADDRESS in ((select address from address_array))
    and TO_ADDRESS!=FROM_ADDRESS
    union all
    select BLOCK_TIMESTAMP, 'Arbitrum' as chain, FROM_ADDRESS, TO_ADDRESS, TX_HASH
    from arbitrum.core.fact_transactions
    where FROM_ADDRESS in (select address from address_array)
    and TO_ADDRESS in ((select address from address_array))
    and TO_ADDRESS!=FROM_ADDRESS
    union all
    select BLOCK_TIMESTAMP, 'Ethereum' as chain, FROM_ADDRESS, TO_ADDRESS, TX_HASH
    from ethereum.core.fact_transactions
    where FROM_ADDRESS in (select address from address_array)
    and TO_ADDRESS in ((select address from address_array))
    and TO_ADDRESS!=FROM_ADDRESS
    union all
    select BLOCK_TIMESTAMP, 'Avalanche' as chain, FROM_ADDRESS, TO_ADDRESS, TX_HASH
    from avalanche.core.fact_transactions
    where FROM_ADDRESS in (select address from address_array)
    and TO_ADDRESS in ((select address from address_array))
    and TO_ADDRESS!=FROM_ADDRESS
    union all
    QueryRunArchived: QueryRun has been archived