0xasmrUntitled Query
Updated 2022-09-07Copy 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 eth_deposits_raw AS (
SELECT
block_timestamp,
eth_value AS eth_deposited
FROM ethereum.core.fact_transactions
WHERE to_address = '0x3b968d2d299b895a5fcf3bba7a64ad0f566e6f88'
AND origin_function_signature = '0x58c22be7'
AND block_timestamp >= CURRENT_DATE - interval '1 month'
),
eth_withdrawals_raw AS (
SELECT
block_timestamp,
(ethereum.public.udf_hex_to_int(data)/pow(10, 18)) AS eth_withdrawn
FROM ethereum.core.fact_event_logs
WHERE contract_address = '0x70b97a0da65c15dfb0ffa02aee6fa36e507c2762'
AND origin_to_address = '0x3b968d2d299b895a5fcf3bba7a64ad0f566e6f88'
AND origin_function_signature = '0x36118b52'
AND topics[0] = '0x3ed4ee04a905a278b050a856bbe7ddaaf327a30514373e65aa6103beeae488c3'
AND block_timestamp >= CURRENT_DATE - interval '1 month'
),
total_eth_withdrawals AS(
SELECT
date_trunc('day', block_timestamp) AS date,
SUM(eth_withdrawn) AS total_eth_withdrawn
FROM eth_withdrawals_raw
GROUP BY 1
),
total_eth_deposits AS (
SELECT
date_trunc('day', block_timestamp) AS date,
SUM(eth_deposited) AS total_eth_deposited
FROM eth_deposits_raw
GROUP BY 1
)
SELECT
d.date,
Run a query to Download Data