greyswanTexture extends
    Updated 2024-05-27
    -- forked from 2024-02-02 06:52 PM @ https://flipsidecrypto.xyz/edit/queries/5a4cd77e-f727-462f-b28a-9cd7cac994da

    select
    a.block_timestamp,
    a.signers [0] as user,
    index,
    instruction:accounts [3] as lender,
    inner_instruction:instructions [5].parsed.info.amount / 1000000000 as sol_borrowed,
    instruction:accounts [11] as pair,
    a.tx_id,
    date_trunc('week', a.block_timestamp) as week
    from
    solana.core.fact_events a
    left join solana.core.fact_transactions b on a.tx_id = b.tx_id
    where
    a.PROGRAM_ID = 'MLENdNkmK61mGd4Go8BJX9PhYPN3azrAKRQsAC7u55v'
    and a.SUCCEEDED = 'true'
    and b.SUCCEEDED = 'true'
    and a.BLOCK_TIMESTAMP >= current_date - 2
    and b.BLOCK_TIMESTAMP >= current_date - 2
    and array_contains(
    to_variant('Program log: extend const collateral ix'),
    log_messages
    )
    and index not in ('1')
    order by
    a.BLOCK_TIMESTAMP desc


    QueryRunArchived: QueryRun has been archived