scottincryptoSaddle Stablecoin V2 Swaps
    Updated 2021-09-18
    with all_tx_list as (
    select
    tx_id
    from ethereum.udm_events
    where event_name = 'TokenSwap'
    and contract_address = '0xacb83e0633d6605c5001e2ab59ef3c745547c8c7'
    and block_timestamp > getdate() - interval'2 month'
    group by tx_id
    )

    , curve_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 = 3
    )

    , 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
    from ethereum.udm_events u
    left join ethereum.udm_events d on (u.tx_id = d.tx_id)
    left join ethereum.transactions t on (u.tx_id = t.tx_id)
    where u.to_address = '0xacb83e0633d6605c5001e2ab59ef3c745547c8c7'
    Run a query to Download Data