Updated 2024-03-21
    with sei_network as (
    with transfers as (
    select
    tx_id,
    block_timestamp
    from sei.core.fact_msg_attributes
    where block_timestamp::date >= dateadd('day', -{{past_days}}, current_date)
    and msg_type = 'message'
    and ATTRIBUTE_KEY = 'module'
    and ATTRIBUTE_VALUE = 'bank'
    and TX_SUCCEEDED
    intersect
    SELECT
    tx_id,
    block_timestamp
    from sei.core.fact_transfers
    where block_timestamp::date >= dateadd('day', -{{past_days}}, current_date)
    and transfer_type = 'SEI'
    and sender != receiver
    and amount != 1 -- filter mint inscription

    )
    -- ,

    -- sei_price as (
    -- SELECT 'SEI' as network,
    -- TO_TIMESTAMP(value[0]::string) as date,
    -- value[1] as last_price
    -- FROM (
    -- SELECT livequery.live.udf_api(
    -- 'https://api.coingecko.com/api/v3/coins/sei-network/market_chart?vs_currency=usd&days=30') as response
    -- ),LATERAL FLATTEN (input => response:data:prices)
    -- qualify row_number () over (order by date DESC) = 1
    -- )
    ,
    sei_price as (
    QueryRunArchived: QueryRun has been archived