with transactions as (
select
block_timestamp,
tx_hash,
origin_from_address
from ethereum.core.fact_event_logs
where origin_to_address = lower('0x99C9fc46f92E8a1c0deC1b1747d010903E884bE1')
),
info as (
select
block_timestamp,
tx_hash,
origin_from_address,
origin_to_address,
event_name,
contract_name
from optimism.core.fact_event_logs
),
info2 as (
select
b.block_timestamp,
b.tx_hash,
b.event_name,
a.origin_from_address,
b.contract_name,
b.origin_to_address
from transactions a join info b on a.origin_from_address = b.origin_from_address
where b.block_timestamp > a.block_timestamp
),
final as (
select
trunc(block_timestamp,'day') as date,
origin_to_address,
count(DISTINCT tx_hash) as txs,
sum(txs) over(partition by origin_to_address order by date) as cum_txs,
RANK() OVER (PARTITION by date order by txs DESC) as rank