Query editor
-- Jupiter Lend Earn share tokens: daily supply, exchange rate, price and market cap in both-- USD and SOL. Covers JUICED (onchain symbol jlJUPUSD), jlUSDC, jlUSDT, jlWSOL, jlUSDG,-- jlUSDS, jlEURC.---- >> REQUIRES blockworks_research.jupiter_lend_v1_solana__silver_exchange_rates_daily <<-- That view ships in PR "Add Jupiter Lend Earn exchange-rate models". Until it is merged AND-- backfilled from 2025-07-01, this query errors on a missing table -- that is expected.---- The 4 core Jupiter tokens (JUP / JLP / jupSOL / JupUSD) are deliberately NOT here. They are-- already served Studio-side by bwr.tokens__rpt_solana, which carries supply and price and-- costs no Dune credits. Studio UNIONs the two halves; both live in Studio Postgres, which is-- why this split is legal (bwr.* and dune.* are Studio-side, blockworks_research.* is Dune).---- SOURCES AND WHY:-- * exchange rate -- read from the silver view. Computing it inline here does NOT work: the-- full-history tx-level join (~1M share-mints grouped by tx_id against-- ~500k deposits on 88-char base58 keys) did not complete in 3 attempts-- at 15+ min each on the large tier. That is exactly what the incremental-- bronze exists to avoid -- 0.412 credits/day vs 135 to rebuild.-- * supply -- tokens_solana.transfers mint/burn cumulative. Validated 2026-08-07 to-- 0.0036% against Jupiter's API (jlUSDC 396,650,393 vs 396,636,207).-- NOT solana_utils.latest_balances (+3.1% on jlUSDC; unreliable on-- high-churn mints) and NOT dune.jup_lend_market_balances, which is keyed-- on the UNDERLYING asset and measures liquidity-layer supply INCLUDING-- vault collateral -- 10.7x too high for jlWSOL (2,510,840 SOL vs the-- vault's actual 234,460). It happens to match for jlUSDC only because-- that market is Earn-dominated.-- * price -- underlying_price x exchange_rate. 6 of these 7 mints have NO row in-- prices.day at all, so a direct feed is not an option.---- COST NOTE: transfers is referenced exactly ONCE below. Trino inlines CTEs rather than-- materialising them, so each extra reference is another full scan -- the earlier version-- referenced it three times.WITH rates AS (-- already a dense daily series per token, forward-filled and monotonic-clampedSELECT block_date, token_mint, token_symbol, underlying_mint, exchange_rateFROM dune.blockworks_research.jupiter_lend_v1_solana__silver_exchange_rates_daily), supply_change AS (SELECT block_date, token_mint_address, SUM(CASE WHEN action = 'mint' THEN amount_display ELSE -amount_display END) AS supply_changeFROM delta_prod.tokens_solana.transfersWHERE block_date >= DATE '2025-07-01'AND action IN ('mint','burn')AND token_mint_address IN ('7GxATsNMnaC88vdwd2t3mwrFuQwwGvmYPrUQ4D6FotXk' -- JUICED / jlJUPUSD, '9BEcn9aPEmhSPbPQeFGjidRiEKki46fVQDyPpSQXPA2D' -- jlUSDC, 'Cmn4v2wipYV41dkakDvCgFJpxhtaaKt11NyWV8pjSE8A' -- jlUSDT, '2uQsyo1fXXQkDtcpXnLofWy88PxcvnfH2L8FPSE62FVU' -- jlWSOL, '9fvHrYNw1A8Evpcj7X2yy4k4fT7nNHcA9L6UsamNHAif' -- jlUSDG, 'j14XLJZSVMcUYpAfajdZRpnfHUpJieZHS4aPektLWvh' -- jlUSDS, 'GcV9tEj62VncGithz4o4N9x6HWXARxuRgEAYk9zahNA8' -- jlEURC)GROUP BY 1, 2), underlying_px AS (SELECT DATE(timestamp) AS block_date, contract_address_varchar AS mint, AVG(price) AS price_usd