ravelchog holders
Updated 2025-03-19Copy Reference Fork
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 transfers AS (
SELECT
tx_hash,
block_timestamp,
tx_position,
event_index,
'0x' || SUBSTR(topics[1], 27) AS from_address,
'0x' || SUBSTR(topics[2], 27) AS to_address,
CAST(utils.udf_hex_to_int(SUBSTR(data, 3)) AS DECIMAL(38,0)) AS amount, -- Cast only once
ROW_NUMBER() OVER (
PARTITION BY '0x' || SUBSTR(topics[1], 27)
ORDER BY block_timestamp, tx_position, event_index
) AS from_tx_sequence,
ROW_NUMBER() OVER (
PARTITION BY '0x' || SUBSTR(topics[2], 27)
ORDER BY block_timestamp, tx_position, event_index
) AS to_tx_sequence
FROM monad.testnet.fact_event_logs
WHERE contract_address = LOWER('0xC56B5dfc1A6E73246a053f6eeb9Ebae33A82a1EA')
AND block_timestamp >= DATEADD(day, -30, CURRENT_TIMESTAMP())
AND topic_0 = '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef'
)
,balance_changes AS (
SELECT
block_timestamp,
from_address AS address,
-amount AS amount_change, -- Already numeric from `transfers`
from_tx_sequence AS tx_sequence
FROM transfers
UNION ALL
SELECT
block_timestamp,
to_address AS address,
amount AS amount_change, -- Already numeric from `transfers`
QueryRunArchived: QueryRun has been archived