0xasmrUntitled Query
Updated 2022-09-07
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
›
⌄
WITH eth_withdrawals_raw AS (
SELECT
origin_from_address AS user,
date_trunc('hour', block_timestamp) AS hour,
(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'
),
eth_withdrawals_usd AS(
SELECT
w.user,
w.eth_withdrawn,
p.price
FROM eth_withdrawals_raw w
INNER JOIN ethereum.core.fact_hourly_token_prices p
ON p.hour = w.hour
WHERE p.symbol = 'WETH'
),
withdrawals_users AS(
SELECT
user,
SUM(eth_withdrawn) AS total_eth_withdrawn,
SUM(eth_withdrawn*price) AS total_eth_withdrawn_usd
FROM eth_withdrawals_usd
GROUP BY 1
)
SELECT
median(total_eth_withdrawn)
FROM withdrawals_users
Run a query to Download Data