marquprimary asset deposits - save (solend)
    Updated 2024-11-29
    with

    deposit_txs as (

    select
    fact_events.block_timestamp
    , fact_events.tx_id
    , fact_transfers.amount
    , fact_transfers.mint
    from solana.core.fact_events
    left join solana.core.fact_token_account_owners
    on fact_events.instruction :accounts[0] = fact_token_account_owners.account_address
    left join solana.core.fact_transfers
    using(block_timestamp, tx_id)
    where fact_events.program_id = 'So1endDq2YkqhipRh3WViPa8hdiSpxWy6z3Z6tMCpAo'
    and utils.udf_hex_to_int(substr(utils.udf_base58_to_hex(fact_events.instruction :data), 3, 2)) in (4, 14)
    and fact_transfers.tx_from = fact_token_account_owners.owner
    and not fact_transfers.mint = fact_events.instruction :accounts[4]
    and block_timestamp ::date > current_date() - interval '30 days'

    union all

    select
    fact_events_inner.block_timestamp
    , fact_events_inner.tx_id
    , fact_transfers.amount
    , fact_transfers.mint
    from solana.core.fact_events_inner
    left join solana.core.fact_token_account_owners
    on fact_events_inner.instruction :accounts[0] = fact_token_account_owners.account_address
    left join solana.core.fact_transfers
    using(block_timestamp, tx_id)
    QueryRunArchived: QueryRun has been archived