Aephiamonth test
    Updated 2024-05-06
    select
    --*
    date_trunc('day', block_timestamp::date) as date,

    ---COLLECTIBLES---
    sum(case when inner_instruction:instructions[0]:parsed:info:mint = '7YNMhgmG7ZEQDvKVwsvN2GyUPaDpKYQ3VtzdkEskcAAe' AND inner_instruction:instructions[0]:parsed:info:authority != 'MRKT9mCmNU2R4KnZt9BV5uh9MESj7Phxws4AR7fUhRc' AND inner_instruction:instructions[1]:parsed:info:mint = 'ATLASXmbPQxBUYbxPsV97usA3fPQYEqzQBUHgiFCUsXx' then inner_instruction:instructions[1]:parsed:info:tokenAmount:uiAmount + inner_instruction:instructions[2]:parsed:info:tokenAmount:uiAmount when inner_instruction:instructions[2]:parsed:info:mint = '7YNMhgmG7ZEQDvKVwsvN2GyUPaDpKYQ3VtzdkEskcAAe' AND inner_instruction:instructions[2]:parsed:info:authority != 'MRKT9mCmNU2R4KnZt9BV5uh9MESj7Phxws4AR7fUhRc' AND inner_instruction:instructions[0]:parsed:info:mint = 'ATLASXmbPQxBUYbxPsV97usA3fPQYEqzQBUHgiFCUsXx' then inner_instruction:instructions[0]:parsed:info:tokenAmount:uiAmount + inner_instruction:instructions[1]:parsed:info:tokenAmount:uiAmount when inner_instruction:instructions[4]:parsed:info:mint = '7YNMhgmG7ZEQDvKVwsvN2GyUPaDpKYQ3VtzdkEskcAAe' AND inner_instruction:instructions[4]:parsed:info:authority != 'MRKT9mCmNU2R4KnZt9BV5uh9MESj7Phxws4AR7fUhRc' AND inner_instruction:instructions[3]:parsed:info:mint = 'ATLASXmbPQxBUYbxPsV97usA3fPQYEqzQBUHgiFCUsXx' then inner_instruction:instructions[1]:parsed:info:amount / POW(10,8) + inner_instruction:instructions[3]:parsed:info:tokenAmount:uiAmount end) AS FM_PLG_atlas,
    sum(case when inner_instruction:instructions[0]:parsed:info:mint = '7YNMhgmG7ZEQDvKVwsvN2GyUPaDpKYQ3VtzdkEskcAAe' AND inner_instruction:instructions[0]:parsed:info:authority != 'MRKT9mCmNU2R4KnZt9BV5uh9MESj7Phxws4AR7fUhRc' AND inner_instruction:instructions[1]:parsed:info:mint = 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v' then zeroifnull(inner_instruction:instructions[1]:parsed:info:tokenAmount:uiAmount) + zeroifnull(inner_instruction:instructions[2]:parsed:info:tokenAmount:uiAmount) when inner_instruction:instructions[2]:parsed:info:mint = '7YNMhgmG7ZEQDvKVwsvN2GyUPaDpKYQ3VtzdkEskcAAe' AND inner_instruction:instructions[2]:parsed:info:authority != 'MRKT9mCmNU2R4KnZt9BV5uh9MESj7Phxws4AR7fUhRc' AND inner_instruction:instructions[0]:parsed:info:mint = 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v' then inner_instruction:instructions[0]:parsed:info:tokenAmount:uiAmount + inner_instruction:instructions[1]:parsed:info:tokenAmount:uiAmount when inner_instruction:instructions[4]:parsed:info:mint = '7YNMhgmG7ZEQDvKVwsvN2GyUPaDpKYQ3VtzdkEskcAAe' AND inner_instruction:instructions[4]:parsed:info:authority != 'MRKT9mCmNU2R4KnZt9BV5uh9MESj7Phxws4AR7fUhRc' AND inner_instruction:instructions[3]:parsed:info:mint = 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v' then inner_instruction:instructions[1]:parsed:info:amount / POW(10,6) + inner_instruction:instructions[3]:parsed:info:tokenAmount:uiAmount end) AS FM_PLG_usdc,
    sum(case when inner_instruction:instructions[0]:parsed:info:mint = '7YNMhgmG7ZEQDvKVwsvN2GyUPaDpKYQ3VtzdkEskcAAe' AND inner_instruction:instructions[0]:parsed:info:authority != 'MRKT9mCmNU2R4KnZt9BV5uh9MESj7Phxws4AR7fUhRc' AND (inner_instruction:instructions[1]:parsed:info:mint = 'ATLASXmbPQxBUYbxPsV97usA3fPQYEqzQBUHgiFCUsXx' OR inner_instruction:instructions[1]:parsed:info:mint = 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v') then inner_instruction:instructions[0]:parsed:info:tokenAmount:uiAmount when inner_instruction:instructions[2]:parsed:info:mint = '7YNMhgmG7ZEQDvKVwsvN2GyUPaDpKYQ3VtzdkEskcAAe' AND inner_instruction:instructions[2]:parsed:info:authority != 'MRKT9mCmNU2R4KnZt9BV5uh9MESj7Phxws4AR7fUhRc' AND (inner_instruction:instructions[0]:parsed:info:mint = 'ATLASXmbPQxBUYbxPsV97usA3fPQYEqzQBUHgiFCUsXx' OR inner_instruction:instructions[0]:parsed:info:mint = 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v') then inner_instruction:instructions[2]:parsed:info:tokenAmount:uiAmount when inner_instruction:instructions[4]:parsed:info:mint = '7YNMhgmG7ZEQDvKVwsvN2GyUPaDpKYQ3VtzdkEskcAAe' AND inner_instruction:instructions[4]:parsed:info:authority != 'MRKT9mCmNU2R4KnZt9BV5uh9MESj7Phxws4AR7fUhRc' AND (inner_instruction:instructions[3]:parsed:info:mint = 'ATLASXmbPQxBUYbxPsV97usA3fPQYEqzQBUHgiFCUsXx' OR inner_instruction:instructions[3]:parsed:info:mint = 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v') then inner_instruction:instructions[4]:parsed:info:tokenAmount:uiAmount end) AS FM_PLG



    from solana.core.fact_events
    WHERE program_id = 'traderDnaR5w6Tcoi3NFm53i48FTDNbGjBSZwWXDRrg'
    AND succeeded = 'true'
    --AND inner_instruction:instructions[0]:parsed:info:tokenAmount:uiAmount >= 0
    --AND inner_instruction:instructions[1]:parsed:info:tokenAmount:uiAmount != 0
    --AND inner_instruction:instructions[2]:parsed:info:tokenAmount:uiAmount != 0
    --AND inner_instruction[0]:instructions[2]:parsed:info:mint::string = 'fueL3hBZjLLLJHiFH9cqZoozTG3XQZ53diwFPwbzNim'
    --AND log_messages::string LIKE '%ProcessExchange%'
    --AND tx_id = 'yVyU5pWLe5Uh8gMj2nwMSWZp1G8sGFdhpurG9mirgNNHTm8kG6Benk7m1gPParfZJvY8W8vTiaZWZchkDZKmVjL'
    --AND inner_instructions[0]:instructions[1]:parsed:info:mint::string = 'ATLASXmbPQxBUYbxPsV97usA3fPQYEqzQBUHgiFCUsXx'
    AND block_timestamp > date_trunc('day', current_timestamp) - interval '130 days'

    --limit 100
    group by 1
    QueryRunArchived: QueryRun has been archived