SocioAnalyticaKryptonite staked over time (SEI -- stSEI)
    Updated 2024-10-10
    with all_txns as (
    select
    block_timestamp,
    tx_id
    from sei.core.fact_msg_attributes
    where attribute_value = 'sei1swe2fy3t49j2c2xl8l64ldjaqyr6khmaya60pl5kr4em2v2jp0ysa3xjum'
    and attribute_key = '_contract_address'
    and msg_type = 'wasm'
    and block_timestamp::date >= '2023-12-28'
    and TX_SUCCEEDED
    )
    , bonded as (
    select
    date_trunc('day', a.block_timestamp) as date,
    sum(attribute_value / 1e6) as bonded
    from sei.core.fact_msg_attributes a
    join all_txns using(tx_id, block_timestamp)
    where a.msg_type = 'wasm'
    and a.attribute_key = 'bonded'
    and a.block_timestamp::date >= '2023-12-28'
    group by 1
    )
    , withdraw as (
    select
    date_trunc('day', a.block_timestamp) as date,
    sum(attribute_value / 1e6) as withdrawn
    from sei.core.fact_msg_attributes a
    join all_txns using(tx_id, block_timestamp)
    where a.msg_type = 'wasm'
    and a.attribute_key = 'unbonded_amount'
    and a.block_timestamp::date >= '2023-12-28'
    group by 1

    )
    , prices as (
    SELECT
    QueryRunArchived: QueryRun has been archived