Updated 2022-10-22
    with
    OP_TO as
    (select
    BLOCK_TIMESTAMP as bridge_date ,
    TX_HASH as bridge_tx,
    FROM_ADDRESS as sender ,
    CONTRACT_ADDRESS as token ,
    SYMBOL,
    (RAW_AMOUNT/pow(10, DECIMALS)) as volume ,
    (RAW_AMOUNT/pow(10, DECIMALS)) * avg(PRICE) as USD
    from optimism.core.fact_token_transfers inner join optimism.core.fact_hourly_token_prices
    on TOKEN_ADDRESS = CONTRACT_ADDRESS
    where lower(ORIGIN_TO_ADDRESS)=lower('0x4200000000000000000000000000000000000010')
    and HOUR::date = BLOCK_TIMESTAMP::date
    --and tx_hash ='0xbd7f683384e0a6750a5ce14b847efcfffff4f6e542556eed2683393660eb3547'
    group by 1,2,3,4,5,6),
    TO_OP as
    (select
    BLOCK_TIMESTAMP as bridge_date ,
    TX_HASH as bridge_tx ,
    from_ADDRESS as sender ,
    CONTRACT_ADDRESS as token ,
    SYMBOL,
    (RAW_AMOUNT/pow(10, DECIMALS)) as volume ,
    (RAW_AMOUNT/pow(10, DECIMALS)) * avg(PRICE) as USD
    from ethereum.core.fact_token_transfers inner join ethereum.core.fact_hourly_token_prices
    on TOKEN_ADDRESS = CONTRACT_ADDRESS
    where lower(ORIGIN_TO_ADDRESS)=lower('0x99c9fc46f92e8a1c0dec1b1747d010903e884be1')
    and HOUR::date = BLOCK_TIMESTAMP::date
    --and tx_hash ='0xbd7f683384e0a6750a5ce14b847efcfffff4f6e542556eed2683393660eb3547'
    group by 1,2,3,4,5,6)
    ,op_to_where_to as (select
    max(BLOCK_TIMESTAMP),TX_HASH ,bridge_date, bridge_tx ,
    Run a query to Download Data