hamedfarabase-token-transfer-total-supply
Updated 2025-02-23
999
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
›
⌄
-- forked from base-token-transfer @ https://flipsidecrypto.xyz/studio/queries/0a428806-4580-4e35-ab80-c88283732f35
with tab1 as(
select
day,
sum(total_supply) AS total_supply
from
(
select
*
from (
select
date(block_timestamp) as day,
'USDC' as token,
sum(
case when from_address like '0x0000000000000000000000000000000000000000' then RAW_AMOUNT
when to_address like '0x0000000000000000000000000000000000000000' then -RAW_AMOUNT
else 0 end
) / power(10, 6) as net_supply,
sum(net_supply) over (order by day) as total_supply
from base.core.fact_token_transfers
where contract_address like lower('0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913')
group by 1,2
order by 1 desc
)
union all
select
*
from (
select
date(block_timestamp) as day,
'USDT' as token,
sum(
case when from_address like '0x0000000000000000000000000000000000000000' then RAW_AMOUNT
when to_address like '0x0000000000000000000000000000000000000000' then -RAW_AMOUNT
QueryRunArchived: QueryRun has been archived