MLDZMNcon2
Updated 2023-01-10
99
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
›
⌄
with t1 as (select
distinct tx:body:messages[0]:contract as contract_name,tx_id,tx_sender,BLOCK_TIMESTAMP
from terra.core.fact_transactions
where TX_SUCCEEDED='TRUE'
)
SELECT
date_trunc('day',BLOCK_TIMESTAMP) as date,
case when PROJECT_NAME ilike '%astro%' then 'Astroport' else PROJECT_NAME end as pp,
count(distinct tx_id) as no_txn,
count(distinct tx_sender) as no_users,
sum(no_txn) over (partition by pp order by date) as cumulative_txn,
sum(no_users) over (partition by pp order by date) as cumulative_users
from t1 s left join terra.core.dim_address_labels b on s.contract_name=b.ADDRESS
where BLOCK_TIMESTAMP>='2022-12-25'
group by 1,2 having pp is not null
QUALIFY DENSE_RANK() OVER (partition by date ORDER BY no_txn DESC) <= 5
Run a query to Download Data