MahrooMost used Protocols after bridge
Updated 2022-09-14Copy 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 base1 AS (SELECT origin_from_address, tx_hash, block_timestamp
FROM ethereum.core.ez_token_transfers
WHERE to_address = '0x99c9fc46f92e8a1c0dec1b1747d010903e884be1'
AND block_timestamp > CURRENT_DATE - 30
UNION
SELECT origin_from_address, tx_hash, block_timestamp
FROM ethereum.core.ez_eth_transfers
WHERE eth_to_address = '0x99c9fc46f92e8a1c0dec1b1747d010903e884be1'
AND block_timestamp > CURRENT_DATE - 30),
base2 AS (SELECT origin_from_address, min(block_timestamp) AS first_bridging_date
FROM base1
GROUP BY 1),
base3 AS (SELECT a.origin_from_address, first_bridging_date, block_timestamp AS txns_date
FROM base2 a
JOIN optimism.core.fact_event_logs b
ON a.origin_from_address = b.origin_from_address
HAVING first_bridging_date < txns_date),
base4 AS (SELECT origin_from_address, min(txns_date) AS first_tx
FROM base3
GROUP BY 1),
base5 AS (SELECT b.tx_hash
FROM base4 a
JOIN optimism.core.fact_event_logs b
ON a.first_tx = b.block_timestamp AND a.origin_from_address = b.origin_from_address),
base6 AS (SELECT project_name, COUNT(distinct(tx_hash)) AS tx_count
FROM optimism.core.fact_event_logs a
JOIN optimism.core.dim_labels b
ON origin_to_address = b.address
WHERE tx_hash IN (SELECT tx_hash FROM base5)
Run a query to Download Data