RayyykMost swap from asset by users after bridging from Ethereum by number of swaps
Updated 2022-08-01
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 table_1 as (select min(block_timestamp) as initial,
origin_from_address as bridger
from ethereum.core.fact_event_logs
where tx_status = 'SUCCESS'
and origin_to_address = lower('0xa0c68C638235ee32657E8f720a23cec1bfc77c77')
group by 2),
table_2 as (select min(block_timestamp) as poly_initial,
bridger
from table_1 g
join polygon.core.fact_event_logs h on g.bridger = h.origin_from_address
where tx_status = 'SUCCESS'
group by 2),
table_3 as (select poly_initial,
g.bridger
from table_2 g
join table_1 h on g.bridger = h.bridger
where poly_initial > initial),
table_4 as (select *
from polygon.core.fact_event_logs g
join table_3 h on g.origin_from_address = h.bridger and g.block_timestamp = h.poly_initial
where tx_status = 'SUCCESS'),
table_5 as (select tx_hash
from polygon.core.dim_labels g
join table_4 h on g.address = h.origin_to_address
where tx_status = 'SUCCESS'
and not label_subtype = 'bridge'
and label_subtype = 'swap_contract')
select symbol_in,
count(distinct(g.tx_hash)) swap_from_count
from polygon.sushi.ez_swaps g
join table_5 h on g.tx_hash = h.tx_hash
Run a query to Download Data