with prices as (
select date_trunc('day',recorded_at) as pdate,
avg(price) as price
from osmosis.core.dim_prices
where symbol = 'STARS'
and recorded_at >= CURRENT_DATE-7
group by pdate
)
select project_name,
count(distinct tx_id) as swaps,
count(distinct trader) as swappers,
sum(from_amount/1e6 * price) as usd_vol
from osmosis.core.fact_swaps sw
join prices on prices.pdate = date(block_timestamp)
join osmosis.core.dim_labels lb on sw.to_currency = lb.address
where from_currency = 'ibc/987C17B11ABC2B20019178ACE62929FE9840202CE79498E29FE8E5CB02B7C0A4'
group by project_name
order by usd_vol DESC
limit 10