tkvresearch2024-05-04 08:27 PM
Updated 2024-05-04
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 full_date as
(select
dateadd(
day,
'-' || row_number() over (order by null),
dateadd(day, '+1', current_date())
) as date
from table (generator(rowcount => 500))
),
data_with_gap as
(select datetime,
user,
balance,
lead(datetime,1,current_date) over (partition by user order by datetime) as next_day
from
(select date(BLOCK_TIMESTAMP) as datetime,
user,
sum(sum(amt)) over (partition by user order by date(BLOCK_TIMESTAMP)) as balance
from
(select BLOCK_TIMESTAMP,
FROM_ADDRESS as user,
-AMOUNT as amt
from bsc.core.ez_token_transfers
where contract_address = lower('0x4aae823a6a0b376De6A78e74eCC5b079d38cBCf7')
union all
select BLOCK_TIMESTAMP,
TO_ADDRESS,
AMOUNT
from bsc.core.ez_token_transfers
where contract_address = lower('0x4aae823a6a0b376De6A78e74eCC5b079d38cBCf7'))
group by 1,2)
where user != '0x0000000000000000000000000000000000000000'
having balance > 0),
prices as (
QueryRunArchived: QueryRun has been archived