kiacryptotop 10 - daily
    Updated 2022-10-12
    with top as (
    select
    nft_address as addr,
    sum(price_usd) as volume
    from optimism.core.ez_nft_sales
    where
    block_timestamp::date >= '{{start_date}}' and block_timestamp::date <= '{{end_date}}' and
    event_type = 'sale' and
    price_usd is not null
    group by 1
    order by 2 desc
    limit 10
    ),
    base as (
    select
    case
    when nft_address = '0x0110bb5739a6f82eafc748418e572fc67d854a0f' then 'Early Optimists'
    when nft_address = '0xac3b9b3f5956b52c448158c0a07ddfa9d5c53a3b' then 'OP Delegatooors'
    when nft_address = '0xbf2794adaf7a48a2a24eb344a7ba221a52fe2171' then 'OP Orcas'
    else project_name
    end as name,
    *
    from optimism.core.ez_nft_sales left join optimism.core.dim_labels on address = nft_address
    where nft_address in (select addr from top) and
    block_timestamp::date >= '{{start_date}}' and block_timestamp::date <= '{{end_date}}' and
    event_type = 'sale' and
    price_usd is not null and
    name is not null
    )

    select
    date_trunc('day', block_timestamp) as date,
    name,
    address,
    -- periodly
    sum(price_usd) as sales_volume_usd,
    Run a query to Download Data