HosseinOvertime copy
Updated 2024-05-30
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
›
⌄
-- forked from Overtime @ https://flipsidecrypto.xyz/edit/queries/4a9957e8-c4c3-4eef-9eec-ec8b95181fce
with
t as (
select
hour::date as date,
avg(price) as price_usd
from ethereum.price.ez_hourly_token_prices
where symbol = 'WETH'
group by 1
),
t2 as (
select
tx_hash,
block_timestamp,
amount_in_usd as amount_usd,
origin_from_address as swapper,
tx_fee * price_usd as tx_fee_usd,
case platform
when 'pancakeswap-v2' then 'pancakeswap'
when 'kyberswap-v2' then 'kyberswap'
when 'pancakeswap-v3' then 'pancakeswap'
when 'hashflow-v3' then 'hashflow'
when 'kyberswap-v1' then 'kyberswap'
when 'dodo-v1' then 'dodo'
when 'uniswap-v2' then 'uniswap'
when 'trader-joe-v2' then 'trader-joe'
when 'uniswap-v3' then 'uniswap'
when 'dodo-v2' then 'dodo'
else platform
end as platform
from arbitrum.defi.ez_dex_swaps
join arbitrum.core.fact_transactions
using(tx_hash, block_timestamp)