Alexayn_users on polygon after bridge from eth
Updated 2022-08-01Copy 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
›
⌄
-- https://app.flipsidecrypto.com/velocity/queries/0e711651-23d9-4c9e-9cd7-9f8738588bee
with eth_txn as ( SELECT block_timestamp, from_address,
RANK() OVER(PARTITION BY from_address ORDER BY block_timestamp) as rank
FROM ethereum.core.fact_transactions
WHERE to_address = '0xa0c68c638235ee32657e8f720a23cec1bfc77c77' --PoS Bridge
OR to_address = '0x401F6c983eA34274ec46f84D70b31C151321188b'), -- Plasma Bridge
eth_table as ( select *
from eth_txn
where rank =1),
combined_table as ( select pol.from_address as wallet,
pol.tx_hash,
pol.to_address,
pol.block_timestamp as pol_time,
eth.block_timestamp as eth_time
from polygon.core.fact_transactions pol
inner join eth_table eth
on eth.from_address = pol.from_address AND
pol.block_timestamp > eth.block_timestamp),
destinations as ( SELECT count(DISTINCT t.wallet) as n_users,
count(t.tx_hash) as txns,
t.to_address as address
from combined_table t
group by address)
select t.txns, t.n_users, t.address, CASE
WHEN l.address_name IS NOT NULL THEN l.address_name
WHEN e.address_name is NOT NULL THEN e.address_name END
AS address_name,
CASE
WHEN l.label_type IS NOT NULL THEN l.label_type
WHEN e.label_type IS NOT NULL THEN e.label_type END
Run a query to Download Data