Muzeflashloan instructions
    Updated 2023-04-21
    -- forked from instructions @ https://flipsidecrypto.xyz/edit/queries/d7263adb-9be3-46cf-b534-5c962730b167


    with instructions as (

    select
    date_trunc('day', a.block_timestamp) as day,
    'flashLoanBegin' as instruction,
    count( * ) as count


    from solana.core.fact_transactions a
    left join solana.core.fact_events b on a.tx_id = b.tx_id
    left join lateral flatten (input => log_messages) as messages
    where b.program_id = '4MangoMjqJ2firMokCjjGgoK8d4MXcrgL7XJaL3w6fVg'
    and b.succeeded
    and messages.value::varchar ilike '%Program log: Instruction: flashLoanBegin%'
    and a.block_timestamp >= '2023-01-01'
    group by 1,2

    )

    select
    *
    from instructions
    order by day desc



    Run a query to Download Data