kimmayyer-5963bridg2
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 users_eth as (
select
origin_from_address,
tx_hash,
block_timestamp
from ethereum.core.fact_event_logs
WHERE origin_to_address = '0xa0c68c638235ee32657e8f720a23cec1bfc77c77'--polygon bridge
),
first_tx as (
SELECT
origin_from_address,
origin_to_address,
tx_hash,
block_timestamp,
event_name,
contract_name
FROM polygon.core.fact_event_logs
),
combine as (
SELECT
a.origin_from_address,
b.tx_hash,
b.event_name,
b.contract_name,
b.origin_to_address,
min(b.block_timestamp) as first_dis
FROM users_eth a INNER JOIN first_tx b ON a.origin_from_address = b.origin_from_address
WHERE b.block_timestamp > a.block_timestamp
GROUP BY 1,2,3,4,5
)
SELECT
COUNT(DISTINCT tx_hash) as txn,
origin_to_address,
project_name
FROM combine a INNER JOIN polygon.core.dim_labels b on a.origin_to_address = b.address
GROUP BY 2 ,3