Hossein2024-06-10 09:38 PM
Updated 2024-06-10
999
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
prices as (
select
hour::date as date,
symbol,
avg(price) as price_usd
from ethereum.price.ez_prices_hourly
where symbol in ('WMATIC', 'WETH', 'WBNB')
and date >= '2024-01-01'
group by 1, 2
),
main as (
select
tx_hash,
block_timestamp,
nvl(amount_in_usd, amount_out_usd) as amount_usd,
'L2' as type,
origin_from_address as user,
tx_fee,
gas_used,
tx_fee * price_usd as tx_fee_usd
from polygon.defi.ez_dex_swaps
join polygon.core.fact_transactions
using (tx_hash, block_timestamp)
left join prices on block_timestamp::date = date and symbol = 'WMATIC'
where status = 'SUCCESS'
and platform ilike 'uniswap%'
and block_timestamp >= '2024-01-01'
union all
select
tx_hash,
block_timestamp,
QueryRunArchived: QueryRun has been archived