jackguyNFT Collections Elixir by Sales Activty
    Updated 2023-05-28
    with tab1 as (
    --buy/sell event_table

    -- buy events
    SELECT
    *,
    INNER_instruction['instructions'][13]['parsed'],
    INNER_instruction['instructions'][13]['parsed']['info']['mint'] as token_mint,
    INNER_instruction['instructions'][13]['parsed']['info']['source'] as user,
    'Sell' as event_type2
    FROM solana.core.fact_events
    LEFT outer JOIN solana.core.dim_labels
    on address = INNER_instruction['instructions'][13]['parsed']['info']['mint']
    WHERE block_timestamp > current_date - 90
    AND INNER_instruction['instructions'][13]['program'] = 'spl-associated-token-account'
    AND INNER_instruction['instructions'][13]['parsed']['type'] = 'create'
    AND program_id LIKE 'E1XRkj9fPF2NQUdoq41AHPqwMDHykYfn5PzBXAyDs7Be'

    UNION

    -- sell events
    SELECT
    *,
    INNER_instruction['instructions'][5]['parsed'],
    INNER_instruction['instructions'][5]['parsed']['info']['mint'] as token_mint,
    INNER_instruction['instructions'][5]['parsed']['info']['source'] as user,
    'Buy' as event_type2
    FROM solana.core.fact_events
    LEFT outer JOIN solana.core.dim_labels
    on address = INNER_instruction['instructions'][5]['parsed']['info']['mint']
    WHERE INNER_instruction['instructions'][5]['program'] = 'spl-associated-token-account'
    AND INNER_instruction['instructions'][5]['parsed']['type'] = 'create'
    AND program_id LIKE 'E1XRkj9fPF2NQUdoq41AHPqwMDHykYfn5PzBXAyDs7Be'
    AND block_timestamp > current_date - 90
    )

    Run a query to Download Data