Updated 2022-08-11
    with bridge as (
    select
    a.block_timestamp::date as date,
    tx_hash,
    a.from_address as wallet
    from ethereum.core.fact_transactions a
    where a.to_address = lower('0x3ee18b2214aff97000d974cf647e7c347e8fa585')
    and a.origin_function_signature = '0x0f5287b0' AND a.status = 'SUCCESS'
    AND date >='2022-01-01'

    ),

    first_transaction as (
    select
    wallet,
    a.tx_hash ,
    datediff('day', date, block_timestamp) as Date_Dif
    from ethereum.core.fact_transactions a join bridge b on a.from_address = b.wallet
    where date > block_timestamp
    group by 1,2,3
    ) ,


    second_tranasaction as (
    select wallet, tx_hash, min(Date_Dif) from first_transaction
    group by 1,2

    ),


    event_function as (
    select

    a.BLOCK_TIMESTAMP,
    a.FROM_ADDRESS,
    Run a query to Download Data