FatemeTheLady09 Unstake Behavior
    Updated 2025-03-26
    WITH unstake_events AS (
    SELECT
    decoded_log:owner::STRING AS user_address,
    decoded_log:assets::NUMBER / 1e18 AS unstake_amount,
    (SELECT SUM(decoded_log:assets::NUMBER / 1e18)
    FROM avalanche.core.fact_decoded_event_logs d
    WHERE d.decoded_log:owner::STRING = e.decoded_log:owner::STRING
    AND d.EVENT_NAME = 'Deposit') AS total_ever_staked
    FROM avalanche.core.fact_decoded_event_logs e
    WHERE contract_address = LOWER('0x06d47f3fb376649c3a9dafe069b3d6e35572219e')
    AND EVENT_NAME = 'Withdraw'
    )

    SELECT
    CASE
    WHEN unstake_amount >= total_ever_staked * 0.95 THEN 'Full Exit'
    WHEN unstake_amount >= total_ever_staked * 0.5 THEN 'Major Withdrawal'
    ELSE 'Partial Rebalance'
    END AS unstake_type,
    COUNT(*) AS events,
    AVG(unstake_amount) AS avg_amount
    FROM unstake_events
    GROUP BY 1
    Last run: 3 months ago
    UNSTAKE_TYPE
    EVENTS
    AVG_AMOUNT
    1
    Full Exit291390.032262482759
    2
    Major Withdrawal1150756.88685490909
    3
    Partial Rebalance3218410.822307
    3
    116B
    20s