scottincryptoUni V3 Swaps
    Updated 2021-09-18
    with all_tx_list as (
    select
    tx_id
    from ethereum.udm_events
    where event_name = 'Swap'
    and block_timestamp < getdate() - interval'2 month'
    and contract_address in ('0x6c6bc977e13df9b0de53b251522280bb72383700', --usdc-dai pair
    '0x7858e59e0c01ea06df3af3d20ac7b0003275d4bf', --usdc-usdt pair
    '0x6f48eca74b38d2936b02ab603ff4e36a6c0e3a77') --dai-usdt pair

    group by tx_id

    )

    , uni_only_tx as (
    select
    tx_id,
    count(event_id) as event_count
    from ethereum.udm_events
    where tx_id in (select tx_id from all_tx_list)
    group by tx_id
    having event_count in (3,4)
    )

    , usdc_dai_tx as (
    select
    u.tx_id as tx
    , u.block_timestamp as block_ts
    -- , u.event_type as
    , u.symbol as source_symbol
    , u.amount as source_amount
    , d.symbol as dest_symbol
    , d.amount as dest_amount
    , t.fee_usd as tx_fee_usd
    , t.tx_fee as tx_fee
    , t.gas_used as gas_used
    Run a query to Download Data