saeedmznWhat's All The Hubbub for Hubble Protocol? - USDH mints and burn
Updated 2022-10-11
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
›
⌄
with actions as (SELECT
BLOCK_TIMESTAMP::date daily ,
CASE
WHEN inner_instruction:instructions[0]:parsed:info:mint in ('HBB111SCo9jkCejsZfz8Ec8nH7T6THF8KEKSnvwT6XK6','HBbyPnXAZD87i54d9amJxhiREGQUKjtVxFpagXFicCkV') then 'HBB'
WHEN inner_instruction:instructions[0]:parsed:info:mint in ('usdhGSfp3gaciiK9ggMxrNtix1EfyXLWUNAzT56a4ki','USDH1SM1ojwWUga67PGrgFWUHibbjqMvuMaDkRJTgkX') then 'USDH'
end Token,
inner_instruction:instructions[0]:parsed:type action,
-- case when inner_instruction:instructions[0]:parsed:type = 'mintTo' then 'Mint'
-- when inner_instruction:instructions[0]:parsed:type = 'burn' then 'Burn'
-- else inner_instruction:instructions[0]:parsed:type
-- end as action ,
count (distinct tx_id) num_transactions_,
sum (zeroifnull(inner_instruction:instructions[0]:parsed:info:amount/1e6)) amount_
from solana.core.fact_events
where program_id = 'HubbLeXBb7qyLHt3x7gvYaRrxQmmgExb7fCJgDqFuB6T'
and succeeded = true
-- and index = 2
group by 1,2,3 having Token is not NULL
)
select date_trunc(week,daily) weekly ,
action ,
sum (num_transactions_) num_transactions,
sum (amount_) amount ,
sum (num_transactions) over (partition by action order by weekly ) cum_transactions ,
sum (amount) over (partition by action order by weekly ) cum_amount
from actions
where Token = 'USDH'
group by 1 ,2
Run a query to Download Data