elsinaTop user with most LOCK Transaction copy copy
    Updated 2024-07-25
    with hourly_prices as (
    select
    date_trunc('day', hour) as d,
    avg(price) as avg_price
    from crosschain.price.ez_prices_hourly
    where symbol = 'OLAS'
    and blockchain = 'ethereum'
    group by d
    ),

    user as (
    SELECT
    tx_hash,
    origin_from_address,
    t.olas_amount * p.avg_price AS volume_in_usd
    FROM
    crosschain.olas.ez_olas_locking t
    JOIN hourly_prices p
    ON BLOCK_TIMESTAMP::date = p.d
    where
    UNLOCK_TIMESTAMP is not null
    )

    SELECT
    origin_from_address,
    count(tx_hash) as tx_count,
    COALESCE(SUM(volume_in_usd), 0) AS total_volume_in_usd
    from user
    group by origin_from_address
    order by total_volume_in_usd desc
    QueryRunArchived: QueryRun has been archived