Updated 2024-07-08
    with t1 as (select
    ACCOUNT_ADDRESS as user,
    OLAS_AMOUNT as unlock_amount,
    UNLOCK_TIMESTAMP as unlock_date


    from crosschain.olas.ez_olas_locking
    where EVENT_NAME = 'Deposit'
    ),

    t2 as (select
    ACCOUNT_ADDRESS as user,
    OLAS_AMOUNT as lock_amount,
    BLOCK_TIMESTAMP as lock_date


    from crosschain.olas.ez_olas_locking
    where EVENT_NAME = 'Deposit'
    ),

    t3 as (select
    user,
    count(*) as locks
    from t2
    group by 1
    ),

    t4 as (select
    t2.user,
    from t2
    left join t1 on t1.user = t2.user
    where t2.lock_date > t1.unlock_date
    )

    select
    'relock' as action,
    QueryRunArchived: QueryRun has been archived