misaghlbWhat's All The Hubbub for Hubble Protocol? - ratio
Updated 2022-10-09Copy Reference Fork
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
25
26
27
28
29
30
31
32
33
34
35
36
›
⌄
with bm as (
select
date(block_timestamp) as date,
COUNT(DISTINCT tx_id) as tx_count,
case when inner_instruction:instructions[0]:parsed:type = 'burn' then 'Burn' else 'Mint' END as type
from solana.core.fact_events
where program_id = 'HubbLeXBb7qyLHt3x7gvYaRrxQmmgExb7fCJgDqFuB6T'
and (inner_instruction:instructions[0]:parsed:type = 'burn' or inner_instruction:instructions[0]:parsed:type = 'mintTo')
and succeeded = TRUE
group by date, type
),
s as (
select
date(block_timestamp) as date,
count (distinct tx_id) as tx_count,
'Swap' as type
from solana.core.fact_swaps
where succeeded = TRUE
AND (swap_from_mint = 'USDH1SM1ojwWUga67PGrgFWUHibbjqMvuMaDkRJTgkX' OR swap_to_mint = 'USDH1SM1ojwWUga67PGrgFWUHibbjqMvuMaDkRJTgkX' )
group by date, type
),
allt as (
select
date(block_timestamp) as date,
count (distinct tx_id) as tx_count
from solana.core.fact_events
where program_id = 'HubbLeXBb7qyLHt3x7gvYaRrxQmmgExb7fCJgDqFuB6T'
and succeeded = 'TRUE'
GROUP by date
)
SELECT allt.date, (allt.tx_count - bm.tx_count) as trx, 'Other' as type
from allt join s using(date) join bm using(date)
UNION ALL
Run a query to Download Data