mo115Clipper daily - main pools
    -- forked from Clipper Total @ https://flipsidecrypto.xyz/edit/queries/0b375ca0-c692-4ead-9382-22708c2c2763

    with final as (with txs as (
    --arbitrum
    (with txso as (select date_trunc('day',BLOCK_TIMESTAMP) as date, ORIGIN_FROM_ADDRESS as wallet , TX_HASH as txs
    from arbitrum.core.ez_decoded_event_logs
    where EVENT_NAME='Swapped'
    and CONTRACT_NAME ='ClipperDirect Pool Token'),
    ETH as (select date_trunc ('day',HOUR) as date, avg(PRICE)as price
    from ethereum.core.fact_hourly_token_prices
    where SYMBOL = 'WETH'
    group by 1)
    select date,wallet, txs , AMOUNT_USD,'arbitrum' as network
    from txso w left join arbitrum.core.ez_token_transfers e on w.txs=e.TX_HASH
    where FROM_ADDRESS in (select ORIGIN_FROM_ADDRESS
    from arbitrum.core.ez_decoded_event_logs
    where EVENT_NAME='Swapped'
    and CONTRACT_NAME ='ClipperDirect Pool Token')
    union
    select w.date, wallet, txs ,(AMOUNT*price) as AMOUNT_USD,'arbitrum' as network
    from txso w left join arbitrum.core.ez_eth_transfers e on w.txs=e.TX_HASH
    left join ETH m on w.date=m.date
    where ETH_FROM_ADDRESS in (select ORIGIN_FROM_ADDRESS
    from arbitrum.core.ez_decoded_event_logs
    where EVENT_NAME='Swapped'
    and CONTRACT_NAME ='ClipperDirect Pool Token'))
    UNION

    --optimism
    (with txso as (select date_trunc('day',BLOCK_TIMESTAMP) as date, ORIGIN_FROM_ADDRESS as wallet , TX_HASH as txs
    from optimism.core.ez_decoded_event_logs
    where EVENT_NAME='Swapped'
    and CONTRACT_NAME ='ClipperDirect Pool Token'),
    ETH as (select date_trunc ('day',HOUR) as date, avg(PRICE)as price
    from ethereum.core.fact_hourly_token_prices
    where SYMBOL = 'WETH'
    Run a query to Download Data