with bridget as (
select origin_from_address,
min (block_timestamp) as min_bridge_date
from ethereum.core.fact_event_logs
where origin_to_address = '0x99c9fc46f92e8a1c0dec1b1747d010903e884be1'
and tx_status = 'SUCCESS'
group by 1),
actiont as (
select t1.origin_from_address,
min_bridge_date,
min (block_timestamp) as min_action_date
from optimism.core.fact_event_logs t1 join bridget t2 on t1.origin_from_address = t2.origin_from_address
where tx_status = 'SUCCESS'
group by 1,2
having min_bridge_date < min_action_date)
select address_name,
label_type,
label_subtype,
project_name,
count (distinct tx_hash) as TX_Count,
count (distinct t1.origin_from_address) as Users_Count
from optimism.core.fact_event_logs t1 join actiont t2 on t1.origin_from_address = t2.origin_from_address and t1.block_timestamp = t2.min_action_date
join optimism.core.dim_labels t3 on t1.origin_to_address = t3.address
where label_subtype != 'bridge'
group by 1,2,3,4
order by Users_Count desc
limit 10