binhachonCopy of Stability Fee - DAI mint burn
Updated 2022-01-16
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 psm_transactions as (
select
distinct tx_id
from ethereum.udm_events
where to_address in ('0x0a59649758aa4d66e25f08dd01271e891fe52199', '0x92498f5a2878a2d7d6f29ccdba5b52273b29a2d9') -- USDC & PAX PSM
union all
select
distinct tx_id
from ethereum.udm_events
where from_address in ('0x0a59649758aa4d66e25f08dd01271e891fe52199', '0x92498f5a2878a2d7d6f29ccdba5b52273b29a2d9') -- USDC & PAX PSM
),
DAI_mint_burn_raw as (
select
date_trunc('day', block_timestamp) as blocktime,
sum(amount) as amount
from ethereum.udm_events
where contract_address = '0x6b175474e89094c44da98b954eedeac495271d0f'
and from_address = '0x0000000000000000000000000000000000000000'
and tx_id not in (select tx_id from psm_transactions)
group by blocktime
union all
select
date_trunc('day', block_timestamp) as blocktime,
-sum(amount) as amount
from ethereum.udm_events
where contract_address = '0x6b175474e89094c44da98b954eedeac495271d0f'
and to_address = '0x0000000000000000000000000000000000000000'
and tx_id not in (select tx_id from psm_transactions)
group by blocktime
),
DAI_mint_burn as (
select
blocktime,
sum(case when amount > 0 then amount else 0 end) as mint_amount,
sum(case when amount < 0 then amount else 0 end) as burn_amount,
sum(amount) as net_mint_amount
Run a query to Download Data