Sbhn_NPprobable-plum
    Updated 2024-12-11
    with price as (
    select hour::date as datee,
    case when token_address = 'So11111111111111111111111111111111111111112' then 'BeRUj3h7BqkbdfFU7FBNYbodgf8GCHodzKvF9aVjNNfL'
    when token_address = '7vfCXTUXx5WJV5JADk17DUJ4ksgau7utNKj4b963voxs' then 'So11111111111111111111111111111111111111112'
    when token_address = 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v' then 'AKEWE7Bgh87GPp171b4cJPSSZfmZwQ3KaqYqXoKLNAEE' end as token,
    avg(price) as usdprice
    from solana.price.ez_prices_hourly
    group by 1,2
    )

    select

    mint,
    sum(amount/pow(10,decimal)) as deposited,
    sum((amount/pow(10,decimal))*usdprice) as usd
    from eclipse.core.fact_transfers
    join price on block_timestamp::date=datee and mint=token
    where tx_to in ('JBUYTVaQAvp61GKnbgooEEzyTsevG1x5fYDnGoDD2soT','tyvjvUtLxNFQXWxQSerSzZdhTe1YCzq1odtmouLbtXx','DeRTnD4sgiPzNQaiximquqD5yZAhu3Aws2g4n2e8tNuR')
    and tx_id in (select DISTINCT tx_id
    from eclipse.core.fact_transactions
    join lateral flatten(input=>log_messages) f
    where f.value = 'Program log: Instruction: LendingAccountRepay')
    group by 1
    QueryRunArchived: QueryRun has been archived