Sandeshrabby swap charges copy
    Updated 2024-12-26
    -- forked from rabby swap charges @ https://flipsidecrypto.xyz/edit/queries/80fd4069-6ee9-49c3-806d-e311512f6c33
    with rabby as
    (
    with tab as
    (
    (
    select 'optimism' as chain, tx_hash,block_timestamp,origin_from_address,contract_address, symbol, amount_precise,amount_usd
    from optimism.core.ez_token_transfers
    where 1=1
    and to_address='0x39041f1b366fe33f9a5a79de5120f2aee2577ebc'
    and block_timestamp>= current_date()- interval '2 week'
    )
    union
    (
    select 'optimism' as chain, tx_hash,block_timestamp,origin_from_address, '0x0000000000000000000000000000000000000000' as contract_address, 'ETH' as symbol,amount_precise,amount_usd
    from optimism.core.ez_native_transfers
    where 1=1
    and to_address='0x39041f1b366fe33f9a5a79de5120f2aee2577ebc'
    and block_timestamp>= current_date()- interval '2 week'
    )

    union all

    (
    select 'arbitrum' as chain, tx_hash,block_timestamp,origin_from_address,contract_address, symbol, amount_precise,amount_usd
    from arbitrum.core.ez_token_transfers
    where 1=1
    and block_timestamp>= current_date()- interval '2 week'
    and to_address='0x39041f1b366fe33f9a5a79de5120f2aee2577ebc'

    )
    union
    (
    select 'arbitrum' as chain, tx_hash,block_timestamp,origin_from_address, '0x0000000000000000000000000000000000000000' as contract_address, 'ETH' as symbol,amount_precise,amount_usd
    from arbitrum.core.ez_native_transfers
    where 1=1
    QueryRunArchived: QueryRun has been archived