Sbhn_NPsushi uni main
    Updated 2023-03-11
    select 'Sushiswap' as type,
    date_trunc('{{Date}}',block_timestamp) as date,
    count(DISTINCT tx_hash) as swaps,
    count(DISTINCT origin_from_address) as swappers,
    sum(amount_out_usd) as usd_volume,
    avg(amount_out_usd) as avg_usd_volume
    from ethereum.sushi.ez_swaps
    where date>= '2022-06-01'
    group by 1,2

    UNION ALL

    select 'Uniswap' as type,
    date_trunc('{{Date}}',block_timestamp) as date,
    count(DISTINCT tx_hash) as swaps,
    count(DISTINCT from_address) as swappers,
    sum(amount1_usd) as usd_volume,
    avg(amount1_usd) as avg_usd_volume
    from ethereum.uniswapv3.ez_swaps
    join ethereum.core.fact_transactions using(tx_hash)
    where date>= '2022-06-01'
    and amount1_usd>0
    group by 1,2

    Run a query to Download Data