winnie-fsPrice Lock Orders in First 24h - Collections
    Updated 2024-01-23
    with

    maker_txs as (

    select

    block_timestamp
    , tx_id
    , signers[0] as maker_address
    , fact_events.instruction :accounts[2] as order_address
    , regexp_replace(f_logs.value, '^Program log: Instruction: ') as instruction_log
    , fact_events.instruction :accounts[3] as collection_address
    , case
    when collection_address = '3PJCoXPcswZEx8ZimR2xiQvr6sJGJWTp3cpsLhhc7pmP' then 'MadLads'
    when collection_address = '5SmBrw3z7wqXTZXxxZXRLDoiqY6yRzN57hiLULnRGihA' then 'Sols'
    when collection_address = '5ceCcEQ2PjYMXbsh956GZZPC5R1sZGnw4UBaJpVdDPE4' then 'Froganas'
    when collection_address = 'AgnGG7RtqQncFcdJAT27GhnRWchk3wBDfsESkVXhmejq' then 'Tensorians'
    when collection_address = 'EGdryU8HzwqhT8NpPno6CVT8D2Nr2CL4gJTF57NvX1UV' then 'CryptoUndeads'
    when collection_address = 'EKPqEMbgMuf6qD69FMGnQamW2f5vCssDrqmoXJAiyjW1' then 'FlashTrade'
    else 'unknown'
    end as collection_name
    , case
    when array_contains('Program log: Instruction: DepositLegacy' ::variant, log_messages)
    or array_contains('Program log: Instruction: DepositCompressed' ::variant, log_messages)
    then 'Long'
    else 'Short'
    end as order_direction

    from solana.core.fact_events
    inner join solana.core.fact_transactions
    using(tx_id, block_timestamp, succeeded)
    inner join lateral flatten (input => fact_transactions.log_messages) f_logs
    where succeeded
    and fact_events.program_id ='TLoCKic2wGJm7VhZKumih4Lc35fUhYqVMgA4j389Buk'
    and f_logs.value = 'Program log: Instruction: UpsertOrder'
    and fact_transactions.log_messages[f_logs.index -1] = 'Program TLoCKic2wGJm7VhZKumih4Lc35fUhYqVMgA4j389Buk invoke [1]'
    QueryRunArchived: QueryRun has been archived