adele23course session 2
    Updated 2025-03-05
    With uniswap AS
    (
    select
    origin_from_address,
    tx_hash,
    count(distinct tx_hash) as n_swaps
    from ethereum.defi.ez_dex_swaps
    where block_timestamp :: date >= current_date - 31
    and
    platform IN ('uniswap-v2','uniswap-v3')
    )

    Select
    uniswap.origin_from_address as user,
    count(distinct uniswap.tx_hash) as n_swaps,
    count(distinct nft.tx_hash) as n_nft_purchase
    from uniswap
    join ethereum.nft.ez_nft_sales nft
    ON uniswap.origin_from_address = nft.buyer_address
    where nft.block_timestamp :: date >= current_date - 31
    group by user
    order by n_nft_purchase
    limit 100;