sepehrmhz8Untitled Query
Updated 2022-11-28
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
›
⌄
select 'Ethereum' as Net,
date_trunc('week',block_timestamp) as date,
tx_status,
count (distinct tx_hash) as Swap_Count,
count (distinct Origin_from_address) as Swappers_Count,
count (distinct contract_address) as Pools_Count,
sum(Swap_Count) over (order by date) as cumulative_Swap_Count,
sum(Swappers_Count) over (order by date) as cumulative_Swappers_Count
from ethereum.core.fact_event_logs
where origin_to_address = '0xdef171fe48cf0115b1d80b88dc8eab59176fee57'
and event_name = 'Swap'
and block_timestamp::date >= '2022-07-10'
group by 1,2,3
union all
select 'Optimism' as Net,
date_trunc('week',block_timestamp) as date,
count (distinct tx_hash) as Swap_Count,
count (distinct Origin_from_address) as Swappers_Count,
count (distinct contract_address) as Pools_Count,
count (case when tx_status != 'SUCCESS' then 1 end) as Failed_TX,
count (case when tx_status = 'SUCCESS' then 1 end) as Success_TX,
(Success_TX / (Success_TX + Failed_TX)) * 100 as Success_Rate,
sum(Swap_Count) over (order by date) as cumulative_Swap_Count,
sum(Swappers_Count) over (order by date) as cumulative_Swappers_Count
from optimism.core.fact_event_logs
where origin_to_address = '0xdef171fe48cf0115b1d80b88dc8eab59176fee57'
and event_name = 'Swap'
and block_timestamp::date >= '2022-07-10'
group by 1,2
union all
select 'Arbitrum' as Net,
date_trunc('week',block_timestamp) as date,