Sandeshnfts data copy
    Updated 2023-02-25
    -- forked from 8a37cf0d-d132-471e-864c-044d4282e3b4
    -- forked from self

    with trades as
    (
    select
    block_timestamp ,
    tx_id,
    signers[0] as user,
    parse_json(post_token_balances[0]):"mint" as nft,
    log_messages[1] as act,
    case when block_timestamp::date <= '2023-02-06' then 'phase 1'
    when block_timestamp::date >= '2023-02-13' then 'phase 2'
    else 'other'
    end as phase
    from solana.core.fact_transactions
    where 1=1
    -- and tx_id='3H6vcnwGKyJgkALQy2oTnwk6TmJ3pXXip33vv5GzUa7y9C4NR55xYNBwronw19PAQbEcwqS5hJ4KpRmD6uSqHQrG'
    and instructions[0]:"programId"='8NvmvWEAw89HnE8Gjo4kHhbHy2PGyeuU9y9QJ1HKiLoR'
    -- and block_timestamp::date between '2022-01-25' and '2022-02-20'
    and block_timestamp > CURRENT_DATE - interval ' 1 month'
    and act='Program log: Instruction: SellNftForBond'
    ),
    temp as
    (
    select
    contract_name as project,phase, count(distinct tx_id) as bonds
    from trades inner join solana.core.dim_nft_metadata nft_data
    on trades.nft = nft_data.mint
    group by contract_name, phase
    -- where phase = 'phase 1'
    )
    select count(DISTINCT project) as number_of_projects from temp


    Run a query to Download Data