amir007-Q63RX1Hot Contracts on Osmosis - Top 10 Most Popular Contracts
Updated 2022-07-09
99
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
›
⌄
with cte_token_price as
(
select recorded_at::date as price_date
, symbol as token_name
, dim_labels.address as token_address
, avg(price) as token_price
from osmosis.core.dim_prices
join osmosis.core.dim_labels on dim_prices.symbol = dim_labels.project_name
where recorded_at::date >= '2022-05-01'
group by 1, 2, 3
)
select concat(from_token.token_name, ' & ', to_token.token_name) as "Contract"
, sum((fact_swaps.from_amount * from_token.token_price) + (fact_swaps.from_amount * to_token.token_price)) / 1e18 as "Sum Value of Contract (usd)"
from osmosis.core.fact_swaps
left join cte_token_price from_token on fact_swaps.from_currency = from_token.token_address
and fact_swaps.block_timestamp::date = from_token.price_date
left join cte_token_price to_token on fact_swaps.to_currency = to_token.token_address
and fact_swaps.block_timestamp::date = to_token.price_date
where block_timestamp::date >= '2022-05-01'
and (from_token.token_name is not null and to_token.token_name is not null)
group by 1
order by 2 desc
limit 10
Run a query to Download Data