adambalaacros
Updated 2022-10-22Copy 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
OP_TO as
(select
BLOCK_TIMESTAMP ,
TX_HASH ,
FROM_ADDRESS as sender ,
CONTRACT_ADDRESS as token ,
SYMBOL,
(RAW_AMOUNT/pow(10, DECIMALS)) as volume ,
(RAW_AMOUNT/pow(10, DECIMALS)) * avg(PRICE) as USD
from optimism.core.fact_token_transfers inner join optimism.core.fact_hourly_token_prices
on TOKEN_ADDRESS = CONTRACT_ADDRESS
where lower(ORIGIN_TO_ADDRESS)=lower('0xa420b2d1c0841415A695b81E5B867BCD07Dff8C9')
and HOUR::date = BLOCK_TIMESTAMP::date
--and tx_hash ='0xbd7f683384e0a6750a5ce14b847efcfffff4f6e542556eed2683393660eb3547'
group by 1,2,3,4,5,6),
TO_OP as
(select
BLOCK_TIMESTAMP ,
TX_HASH ,
TO_ADDRESS as sender ,
CONTRACT_ADDRESS as token ,
SYMBOL,
(RAW_AMOUNT/pow(10, DECIMALS)) as volume ,
(RAW_AMOUNT/pow(10, DECIMALS)) * avg(PRICE) as USD
from optimism.core.fact_token_transfers inner join optimism.core.fact_hourly_token_prices
on TOKEN_ADDRESS = CONTRACT_ADDRESS
where lower(ORIGIN_TO_ADDRESS)=lower('0xa420b2d1c0841415A695b81E5B867BCD07Dff8C9')
and HOUR::date = BLOCK_TIMESTAMP::date
--and tx_hash ='0xbd7f683384e0a6750a5ce14b847efcfffff4f6e542556eed2683393660eb3547'
group by 1,2,3,4,5,6)
select
TO_OP.BLOCK_TIMESTAMP::date as date ,
Run a query to Download Data