Sajjadiii1.hob eth Bridger Destinations
Updated 2022-09-14Copy Reference Fork
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
›
⌄
with Bridge as (
select block_timestamp as send_date ,origin_from_address as eth_user
from ethereum.core.fact_event_logs
where event_inputs:chainId = '10'
and contract_address = '0xb8901acb165ed027e32754e0ffe830802919727f' -- eth
and block_timestamp::date >= CURRENT_DATE() - interval '{{number_of_timeframe }} {{timeframe}}'
),
first_event as (
select a.from_address , tx_hash ,
min(a.block_timestamp) as first_event_time
from optimism.core.fact_transactions a
join Bridge b
on a.from_address = b.eth_user
where a.block_timestamp > b.send_date
and block_timestamp::date >= CURRENT_DATE() - interval '{{number_of_timeframe}} {{timeframe}}'
group by 1,2
order by 3 asc
),
NFT as (
select concat('8.Buy NFT: ', address_name )as Destinations, count (distinct tx_hash)as transactions, count (distinct buyer_address) as users
from optimism.core.ez_nft_sales a
join optimism.core.dim_labels b
on a.nft_address = b.address
where tx_hash in (select tx_hash from first_event)
and buyer_address in (select from_address from first_event)
group by 1
order by 2 desc
limit 3
),
delegations as (
select concat('7.delegate to: ', address_name )as Destinations, count (distinct tx_hash)as transactions, count (distinct delegator) as users
from optimism.core.fact_delegations a
join optimism.core.dim_labels b
Run a query to Download Data