Specterdistribution of w v
    Updated 2025-03-03
    WITH Ncprice AS (
    SELECT
    trunc(hour, 'day') AS day,
    AVG(price) AS price
    FROM
    near.price.ez_prices_hourly
    WHERE
    token_address = 'wrap.near'
    GROUP BY
    day
    ),

    -- DEPOSIT
    Deposits AS (
    SELECT
    d.signer_id AS owner,
    try_parse_json(d.CLEAN_LOG) AS log,
    log:data[0]:amounts[0] / 1e24 AS amount_adj,
    (log:data[0]:amounts[0] / 1e24) * p.price AS amount_usd
    FROM near.core.fact_logs d
    LEFT JOIN Ncprice p
    ON trunc(d.block_timestamp, 'day') = p.day
    WHERE d.predecessor_id = 'wrap.near'
    AND d.receiver_id = 'intents.near'
    AND d.receipt_succeeded = 1
    ),

    -- WITHDRAW
    Withdrawals AS (
    SELECT try_parse_json(d.CLEAN_LOG) AS log,
    log:data[0]:owner_id AS owner,
    log:data[0]:amounts[0] / 1e24 AS amount_adj,
    (log:data[0]:amounts[0] / 1e24) * p.price AS amount_usd
    FROM near.core.fact_logs d
    LEFT JOIN Ncprice p
    ON trunc(d.block_timestamp, 'day') = p.day
    Last run: 3 months ago
    AMOUNT_BUCKET
    COUNT(*)
    1
    <= 100 USD329
    2
    500-1K USD30
    3
    > 1K USD68
    4
    100-500 USD66
    4
    73B
    39s