h4wklend by token
    Updated 23 hours ago
    with latest_price as (
    select hour::date as price_date,
    token_address,
    symbol,
    case when token_address in ('jupSoLaHXQiZZTSfEWMTRRgpnyFm8f6sZdosWBjx93v',
    'HUBsveNpjo5pWqNkH57QzxjQASdTVXcSK7bVKTSZtcSX',
    'picobAEvs6w7QEknPce34wAE4gknZA9v5tTonnmHYdX',
    'Bybit2vBJGhPF52GBdNaQfUJ6ZpThSgHBobjWZpLPb4B',
    'he1iusmfkpAdwvxLNGV8Y1iSbj4rUy6yMhEA3fotn9A',
    'Grass7B4RdKfBCjTKgSqnXkqjwiGvQyFbuSCUJr3XXjs',
    'BNso1VUJnh4zcfpZa6986Ea66P6TCp59hvtNJ8b1X85') then 9
    when token_address in ('Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB',
    'CzLSujWBLFsSjncfkh59rUFqvafWcY5tzedWJSuypump',
    'DBRiDgJAMsM95moTzJs7M9LnkGErpbv9v6CUR1DXnUu5') then 6
    when token_address in ('cbbtcf3aa214zXHbiAZQwf4122FBYbraNdFqgw4iMij') then 8
    else decimals end as decimals,
    avg(price) as price
    from solana.price.ez_prices_hourly
    where hour::date = current_date
    group by all
    )
    , lend_base as (
    select
    block_timestamp,
    'deposit' as type,
    tx_id,
    DECODED_INSTRUCTION:accounts[0]:pubkey as user_addr,
    DECODED_INSTRUCTION:accounts[5]:pubkey as lend_mint,
    symbol,
    DECODED_INSTRUCTION:args:args:amount / pow(10, decimals) as amount,
    amount * price as amount_usd
    from solana.core.ez_events_decoded
    join latest_price on (lend_mint = token_address)
    where 1 = 1
    -- block_timestamp >= '2024-11-05'
    -- tx_id = '4gY2vuyzJSe7bRtUSMxqcivWx92Ch9sscdJP8WbXTRWPfXJGy13kZ6QXrCRvftcU3U21Sbxhir1YiveacuL5jUqe'
    Last run: about 23 hours agoAuto-refreshes every 24 hours
    SYMBOL
    LEND_USD
    WITHDRAW_USD
    NET_LEND_USD
    1
    USDC10287586.35455085840833.364061374446752.99048939
    2
    SOL3105533.980365221255084.843075761850449.13728947
    3
    WBTC511625.75419656181149.62817384330476.12602272
    4
    USDT578542.736908399457466.284961948121076.45194645
    5
    $WEN81971.84189133115294.91383027466676.928061057
    6
    BONK108823.16615213363971.97257006744851.193582066
    7
    ETH26962.3928605693055.78677332323906.606087246
    8
    JUP22549.04021600314334.0751657428214.965050261
    8
    461B
    41s