Updated 2022-08-01
    with list as (
    select origin_from_address as address, block_timestamp from ethereum.core.fact_event_logs
    where (ORIGIN_TO_ADDRESS=lower('0x401f6c983ea34274ec46f84d70b31c151321188b') or
    ORIGIN_TO_ADDRESS=lower('0xa0c68c638235ee32657e8f720a23cec1bfc77c77'))
    and (
    origin_function_signature = '0xe3dec8fb' OR
    origin_function_signature = '0x4faa8a26')
    and tx_status = 'SUCCESS'),

    list2 as
    ( SELECT a.event_name, a.tx_hash, ROW_NUMBER() OVER (ORDER BY a.block_timestamp asc) as rn
    FROM polygon.core.fact_event_logs a
    join list on list.address = a.origin_from_address
    where a.tx_status = 'SUCCESS' and a.event_name != '')

    select d.event_name, count(distinct(d.tx_hash)) as tx_num from list2 c
    join list2 d on c.rn + 1 = d.rn
    group by d.event_name
    order by tx_num desc