0xHaM-dAfter Annonce
    Updated 2023-03-18
    -- SQL credit: https://flipsidecrypto.xyz/sintenshin/q/2023-03-10-04-45-am-eMjYKD
    WITH base AS (
    select
    txs.block_timestamp,
    CASE
    WHEN txs.block_timestamp < '2023-03-06' THEN 'Season I'
    ELSE 'Season II' end as duration,
    txs.tx_id,
    txs.signers[0] AS owner,
    case
    when log.value = 'Program log: Instruction: BuySingleListing' then 'Buy NFT from Listing'
    when log.value = 'Program log: Instruction: BuyNft' then 'Buy NFT from Pool'
    when log.value = 'Program log: Instruction: SellNftTokenPool' then 'Sell NFT to Pool'
    when log.value = 'Program log: Instruction: SellNftTradePool' then 'Sell NFT to Pool'
    when log.value = 'Program log: Instruction: List' then 'List'
    when log.value = 'Program log: Instruction: Delist' then 'Delist'
    when log.value = 'Program log: Instruction: InitPool' then 'Initiate Pool'
    when log.value = 'Program log: Instruction: ClosePool' then 'Close Pool'
    end as ACTION_type
    FROM solana.core.fact_transactions txs
    INNER JOIN lateral flatten (input => log_messages) log
    WHERE succeeded = 'TRUE'
    and log.value in (
    'Program log: Instruction: List',
    'Program log: Instruction: InitPool',
    'Program log: Instruction: ClosePool',
    'Program log: Instruction: Delist',
    'Program log: Instruction: BuySingleListing',
    'Program log: Instruction: BuyNft',
    'Program log: Instruction: SellNftTokenPool',
    'Program log: Instruction: SellNftTradePool')
    and log_messages[log.index -1] like '%TSWAPaqyCSx2KABk68Shruf4rp7CxcNi8hAsbdwmHbN%'
    )
    SELECT
    date_trunc('day', block_timestamp) AS date,
    ACTION_type,
    Run a query to Download Data