adele23Token Transfers
Updated 2025-03-07
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
›
⌄
with raw as (
select -- all columns below are useful
block_timestamp,
tx_hash,
event_index, -- all transactions and all the events within a block
from_address,
to_address,
contract_address, -- all non-native tokens have contract addresses, for exaple usdt, usdc, weth
symbol,
amount, -- raw_amount (use for obscure, or new tokens) needs to be devided by decimal cases and you get amount
from ethereum.core.ez_token_transfers
where block_timestamp::date >= '2024-08-01'
and contract_address IN (
'0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48' -- usdc
, lower('0xdAC17F958D2ee523a2206206994597C13D831ec7') -- usdt
)
-- and symbol in ('USDT', 'USDC') -- do not do this, symbols are not unique
)
-- the above code filters to usdt and usdc
select
date_trunc('day', block_timestamp) as day,
contract_address,
symbol,
sum(amount) as daily_amount
from raw
group by all -- you can now compare results between the different contact addresses
-- exercise: compare the number of times stablecoins are sent - usdc, usdt, dai, in February 2025
-- exercise: how much % of nfts do the top 5 hold for pudgy penguins