with claimerst as (
select block_timestamp as claimdate,
event_inputs:recipient as Claimer,
event_inputs:amount/1e18 as Claimed_Volume
from optimism.core.fact_event_logs
where origin_to_address = '0xfedfaf1a10335448b7fa0268f56d2b44dbd357de'
and origin_function_signature = '0x2e7ba6ef'
and event_name = 'Claimed')
select origin_to_address,
case when origin_to_address = '0xdef1abe32c034e558cdd535791643c58a13acc10' then '0x decentralized exchange'
when origin_to_address = '0x5130f6ce257b8f9bf7fac0a0b519bd588120ed40' then 'Clipper'
when origin_to_address = '0x1111111254760f7ab3f16433eea9304126dcd199' then '1inch Exchange'
when origin_to_address = '0xc78a09d6a4badecc7614a339fd264b7290361ef1' then 'Quixotic Seaport'
when origin_to_address in ('0x9c12939390052919af3155f41bf4160fd3666a6f','0xa132dab612db5cb9fc9ac426a0cc215a3423f9c9','0xa6baa075fb5cf4721b43fe068ee81b56f34fa06d','0x09236cff45047dbee6b921e00704bed6d6b8cf7e') then 'Velodrome'
else initcap(address_name) end as destination,
count (distinct tx_hash) as TX_Count,
count (distinct origin_from_address) as Users_Count
from optimism.core.fact_event_logs t1 join claimerst t2 on t1.origin_from_address = t2.claimer
full outer join optimism.core.dim_labels t3 on t1.origin_to_address = t3.address
where contract_address = '0x4200000000000000000000000000000000000042'
--and origin_from_address = event_inputs:from
and t1.block_timestamp > t2.claimdate
group by 1,2
order by 3 DESC
limit 10