keshanUntitled Query
Updated 2022-07-29
99
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
›
⌄
WITH users AS
(SELECT event_inputs:to AS address
FROM ethereum.core.fact_event_logs
WHERE origin_to_address= '0xcf39b7793512f03f2893c16459fd72e65d2ed00c' )
SELECT balance_date,
sum(balance/ pow(10, decimals)) AS aggregated_sum,
sum(amount_usd),
CASE
WHEN contract_address=lower('0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599') THEN 'WBTC'
ELSE 'ETH'
END AS token
FROM flipside_prod_db.ethereum.erc20_balances
WHERE user_address in
(SELECT *
FROM users)
AND balance_date in ('2022-7-10',
'2022-7-11',
'2022-7-12')
AND contract_address in (lower('0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599'),
'ETH')
GROUP BY balance_date,
token
Run a query to Download Data