Hessishast - tx type
    Updated 2025-03-16
    WITH all_events AS (
    SELECT
    tx_id,
    CASE
    WHEN value ILIKE '%LendingAccountDeposit%' THEN 'deposit'
    WHEN value ILIKE '%LendingAccountBorrow%' THEN 'borrow'
    WHEN value ILIKE '%LendingAccountWithdraw%' THEN 'withdraw'
    WHEN value ILIKE '%LendingAccountRepay%' THEN 'repay'
    END AS action
    FROM eclipse.core.fact_transactions,
    TABLE(FLATTEN(input => LOG_MESSAGES))
    WHERE tx_id IN (
    SELECT DISTINCT tx_id
    FROM eclipse.core.fact_events_inner
    WHERE INSTRUCTION_PROGRAM_ID = 'Astro1oWvtB7cBTwi3efLMFB47WXx7DJDQeoxi235kA'
    )
    AND (value ILIKE '%LendingAccountDeposit%'
    OR value ILIKE '%LendingAccountBorrow%'
    OR value ILIKE '%LendingAccountWithdraw%'
    OR value ILIKE '%LendingAccountRepay%')
    ),


    prices as
    ( SELECT date_trunc('day',hour) as day, avg(close) as pr, case
    when ASSET_ID = 'ethereum' then 'ETH'
    when ASSET_ID = 'usd-coin' then 'USDC'
    when ASSET_ID = 'solana' then 'SOL'
    when ASSET_ID = 'turbo-eth' then 'tETH'
    when ASSET_ID = 'celestia' then 'TIA'
    end as Eclipse_cr
    from crosschain.price.fact_prices_ohlc_hourly
    where hour::date >= '2024-10-01' and
    ASSET_ID in ('ethereum', 'solana', 'usd-coin','turbo-eth','celestia')
    and PROVIDER = 'coingecko'
    GROUP by all ),
    Last run: 2 months ago
    TIME
    TYPE
    TOKEN
    AMOUNT
    AMOUNT_USD
    TXS
    1
    2025-03-28 00:00:00.000WithdrawalsETH700.908353271344132.825201323557
    2
    2024-12-21 00:00:00.000WithdrawalsETH0.8558359942933.61286773517
    3
    2025-01-29 00:00:00.000BorrowsETH8.82652119327554.519851075115
    4
    2024-12-26 00:00:00.000DepositsETH0.13523092458.1207171069
    5
    2025-01-05 00:00:00.000DepositsUSDC403258.169536403214.3992221821965
    6
    2025-02-08 00:00:00.000DepositsUSDC248807.023829248796.231824341187
    7
    2025-02-15 00:00:00.000BorrowstETH0.7821124782151.93588234921
    8
    2025-03-10 00:00:00.000WithdrawalsETH234.817760922473716.9480510261712
    9
    2025-03-04 00:00:00.000RepaymentstETH4.6633277359984.7423369146
    10
    2025-01-11 00:00:00.000WithdrawalsSOL7.7379103041445.3836104611
    11
    2025-03-17 00:00:00.000WithdrawalsSOL48.2179747776192.59431896446
    12
    2025-01-26 00:00:00.000BorrowsETH6.46881449821491.431352905108
    13
    2025-01-28 00:00:00.000WithdrawalsSOL5.0571723861190.80395311122
    14
    2025-01-29 00:00:00.000DepositsSOL8.3082266931916.62481580842
    15
    2025-03-26 00:00:00.000WithdrawalsTIA1.0004973.6188810241
    16
    2025-03-28 00:00:00.000WithdrawalsUSDC5470048.1528415469385.36533981898
    17
    2025-01-09 00:00:00.000RepaymentsUSDC29194.09968429192.834606347228
    18
    2025-02-17 00:00:00.000RepaymentstETH0.233371563643.37943660515
    19
    2025-01-21 00:00:00.000BorrowsETH39.332807465129163.81006142381
    20
    2025-03-06 00:00:00.000DepositsUSDC464764.608267464705.58316175416
    ...
    1806
    138KB
    567s