FlorentGsharkfi history
    WITH defaults as (
    SELECT TX_ID,
    INSTRUCTIONS[1]['accounts'][0] as loan_id,
    INSTRUCTIONS[1]['accounts'][5] as nft,
    BLOCK_TIMESTAMP
    FROM solana.core.fact_transactions
    WHERE date(BLOCK_TIMESTAMP) > current_date() - INTERVAL '7 DAYS'
    AND LEFT(INSTRUCTIONS[1]['data'], 6) = 'CRZUQQ'
    AND SUCCEEDED = 'true'
    ),

    offers as (
    SELECT TX_ID,
    o.signers[0] as lender,
    o.INSTRUCTIONS[0]['accounts'][6] as ob_pubkey,
    o.INSTRUCTIONS[0]['accounts'][3] as loan_id,
    o.PRE_BALANCES[0] - o.POST_BALANCES[0] as principal
    FROM solana.core.fact_transactions o
    WHERE date(o.BLOCK_TIMESTAMP) > current_date() - INTERVAL '5 DAYS'
    AND o.signers[0] = '6QvvZKGEHxyTKgkHQpfpJXPAgWUAzefXVHYPBFrJGPYP'
    AND LEFT(o.INSTRUCTIONS[0]['data'], 6) = '2pxy3Z'
    AND o.SUCCEEDED = 'true'
    ),

    takes as (
    SELECT TX_ID,
    signers[0] as borrower,
    o.INSTRUCTIONS[1]['accounts'][4] as loan_id
    FROM solana.core.fact_transactions o
    WHERE date(o.BLOCK_TIMESTAMP) > current_date() - INTERVAL '2 DAYS'
    AND LEFT(o.INSTRUCTIONS[1]['data'], 6) in ('3UZGzC', 'ZXRU1S')
    AND o.SUCCEEDED = 'true'
    ),

    repays as (
    SELECT *,
    Run a query to Download Data