MLDZMNvelo8
    Updated 2022-08-03
    with tb1 as (select
    *
    from optimism.core.fact_token_transfers
    where ORIGIN_TO_ADDRESS='0xe592427a0aece92de3edee1f18e0157c05861564' and ORIGIN_FUNCTION_SIGNATURE='0x414bf389'
    -- and ADDRESS_NAME='rubicon: rubicon router'
    ),


    tb2 as (select
    tx_hash,
    SYMBOL as first_pair
    from tb1 x
    join optimism.core.dim_contracts y on x.CONTRACT_ADDRESS=y.ADDRESS
    where ORIGIN_FROM_ADDRESS=FROM_ADDRESS
    ),

    tb3 as (select
    tx_hash,
    SYMBOL as second_pair
    from tb1 z
    join optimism.core.dim_contracts c on z.CONTRACT_ADDRESS=c.ADDRESS
    where ORIGIN_FROM_ADDRESS=TO_ADDRESS
    ),


    tb4 as (select
    tb3.tx_hash,
    first_pair,
    second_pair,
    CONCAT(first_pair,' / ',second_pair) as asset_pairs
    from tb3
    join tb2 on tb2.tx_hash=tb3.tx_hash
    )


    select
    Run a query to Download Data