MoDeFiGPC - tokens holders over time
Updated 2025-02-24
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 tokens_data as (
select *
from $query('75f58bb3-b2cd-4208-85e9-e3d75d901a1c')),
tokens_daily_price as (
select day, token_address, derived_price as price
from $query('db72c7d6-386f-4842-8010-15dd2277c96a')
),
date_start as (
with dates AS (
SELECT CAST('2025-01-27' AS DATE) AS start_date
UNION ALL
SELECT DATEADD(day, 1, start_date)
FROM dates
WHERE start_date < CURRENT_DATE())
SELECT date_trunc(day, start_date) AS start_date
FROM dates),
holders_balance_change as (
select date_trunc(day, block_timestamp) as date, user, contract, sum(amount) as balance_change
from
(
select block_timestamp, from_address as user, -RAW_AMOUNT_PRECISE as amount, tx_hash, contract
from polygon.core.fact_token_transfers
join tokens_data b
on contract=CONTRACT_ADDRESS
where BLOCK_TIMESTAMP::date>=start_date
union all
select block_timestamp, to_address, RAW_AMOUNT_PRECISE, tx_hash, contract
from polygon.core.fact_token_transfers
join tokens_data
on contract=CONTRACT_ADDRESS
where BLOCK_TIMESTAMP::date>=start_date)
group by 1,2,3),
QueryRunArchived: QueryRun has been archived