winnie-fsRollbit 2 copy
Updated 2024-06-16
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
›
⌄
-- forked from jackguy / Rollbit 2 @ https://flipsidecrypto.xyz/jackguy/q/2023-04-30-10-17-am-_Kpa1u
WITH weekly_transactions AS (
SELECT
DATE_TRUNC('WEEK', BLOCK_TIMESTAMP) AS week_start,
ETH_FROM_ADDRESS AS sender,
ETH_TO_ADDRESS AS receiver,
AMOUNT AS amount
FROM
ethereum.core.ez_eth_transfers
WHERE
ETH_TO_ADDRESS = lower('0xCBD6832Ebc203e49E2B771897067fce3c58575ac')
OR ETH_FROM_ADDRESS = lower('0xCBD6832Ebc203e49E2B771897067fce3c58575ac')
),
weekly_deposits AS (
SELECT
COUNT(DISTINCT sender) AS depositors,
SUM(amount) AS deposit_volume
FROM
weekly_transactions
WHERE
receiver = lower('0xCBD6832Ebc203e49E2B771897067fce3c58575ac')
),
weekly_withdrawals AS (
SELECT
COUNT(DISTINCT receiver) AS withdrawers,
SUM(amount) AS withdrawal_volume
FROM
weekly_transactions
WHERE
sender = lower('0xCBD6832Ebc203e49E2B771897067fce3c58575ac')