0xHaM-dUntitled Query
Updated 2022-10-24Copy 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_price as (
select
hour::date as day,
avg(price) as ETH_Price
from ethereum.core.fact_hourly_token_prices
where symbol = 'WETH'
group by 1
)
, tx as (
SELECT
block_timestamp::date as date,
'Ethereum' as network,
tx_hash,
from_address,
tx_fee as tx_fee_eth,
tx_fee * ETH_Price as tx_fee_usd
from ethereum.core.fact_transactions a join eth_price b on a.block_timestamp::date = b.day
where status = 'SUCCESS'
and block_timestamp::date > CURRENT_DATE - 181
and block_timestamp::date <= CURRENT_DATE - 1
UNION
SELECT
block_timestamp::date as date,
'Optimism' as network,
tx_hash,
from_address,
tx_fee as tx_fee_eth,
tx_fee * ETH_Price as tx_fee_usd
from optimism.core.fact_transactions a join eth_price b on a.block_timestamp::date = b.day
where status = 'SUCCESS'
and block_timestamp::date > CURRENT_DATE - 181
and block_timestamp::date <= CURRENT_DATE - 1
)
, lstTb as (
Run a query to Download Data