Afonso_Diaz2023-08-22 11:44 PM
    Updated 2023-08-22
    with t as (
    select
    tx_hash,
    block_timestamp,
    iff(iff(nft_from_address = '0x0000000000000000000000000000000000000000', 'Deposit', 'Withdraw') = 'Withdraw', nft_from_address, nft_to_address) as user
    from optimism.core.ez_nft_transfers a
    join optimism.core.ez_token_transfers b
    using(tx_hash, block_timestamp)
    join optimism.core.ez_token_transfers c
    using(tx_hash, block_timestamp)
    where nft_address = '0xc36442b4a4522e871399cd717abdd847ab11fe88'
    and '0x0000000000000000000000000000000000000000' in (nft_from_address, nft_to_address)
    and not '0x0000000000000000000000000000000000000000' in (from_address, to_address)
    and b.symbol != c.symbol
    and b.origin_to_address = c.origin_to_address
    qualify row_number() over (partition by tx_hash order by block_timestamp) = 1

    union all

    select
    tx_hash,
    block_timestamp,
    iff(iff(nft_from_address = '0x0000000000000000000000000000000000000000', 'Deposit', 'Withdraw') = 'Withdraw', nft_from_address, nft_to_address) as user
    from arbitrum.core.ez_nft_transfers a
    join arbitrum.core.ez_token_transfers b
    using(tx_hash, block_timestamp)
    join arbitrum.core.ez_token_transfers c
    using(tx_hash, block_timestamp)
    where nft_address = '0xc36442b4a4522e871399cd717abdd847ab11fe88'
    and '0x0000000000000000000000000000000000000000' in (nft_from_address, nft_to_address)
    and not '0x0000000000000000000000000000000000000000' in (from_address, to_address)
    and b.symbol != c.symbol
    and b.origin_to_address = c.origin_to_address
    qualify row_number() over (partition by tx_hash order by block_timestamp) = 1

    union all
    Run a query to Download Data