Query editor
-- USDG lending across the three material venues, with the measurement basis per row.-- Jupiter Lend is excluded: ~$7M, immaterial against a $449M book.---- Every quantity computed onchain.-- Morpho Blue: market events incl. AccrueInterest, so the split is exact.-- Aave v4: CoreHub shares x index recovered from the latest amount/shares ratio. Shares are-- index-invariant, so the split is exact.-- Kamino: cToken supply x exchange rate across its 8 USDG markets. The rate carries accrued-- interest, which flow-based methods cannot see -- they understated both legs by-- ~$29M each while still satisfying supplied - borrowed = balance, because that-- identity is insensitive to equal errors on both sides. cToken supply is taken from-- holder balances (agrees with mint/burn history to 0.5%, far cheaper to compute).WITH morpho_markets AS (SELECT chain, idFROM morpho_blue_multichain.morphoblue_evt_createmarketWHERE LOWER(JSON_EXTRACT_SCALAR(marketParams, '$.loanToken')) IN ('0x5fc5360d0400a0fd4f2af552add042d716f1d168','0xe343167631d89b6ffc58b88d6b7fb0228795491d','0x4ae46a509f6b1d9056937ba4500cb143933d2dc8')),morpho_ev AS (SELECT chain, id, CAST(assets AS double) AS s, 0e0 AS b FROM morpho_blue_multichain.morphoblue_evt_supplyUNION ALLSELECT chain, id, -CAST(assets AS double), 0e0 FROM morpho_blue_multichain.morphoblue_evt_withdrawUNION ALLSELECT chain, id, 0e0, CAST(assets AS double) FROM morpho_blue_multichain.morphoblue_evt_borrowUNION ALLSELECT chain, id, 0e0, -CAST(assets AS double) FROM morpho_blue_multichain.morphoblue_evt_repayUNION ALLSELECT chain, id, CAST(interest AS double), CAST(interest AS double) FROM morpho_blue_multichain.morphoblue_evt_accrueinterest),morpho AS (SELECT'Morpho Blue' AS venue,'Market events incl. AccrueInterest' AS basis,SUM(e.s) / 1e6 AS supplied,SUM(e.b) / 1e6 AS borrowedFROM morpho_ev eINNER JOIN morpho_markets m ON m.id = e.id AND m.chain = e.chain),aave_supply_ev AS (SELECT CAST(shares AS double) AS sh, CAST(amount AS double) AS amt, evt_block_timeFROM aave_v4_ethereum.corehub_evt_add WHERE assetId = UINT256 '8'UNION ALLSELECT -CAST(shares AS double), -CAST(amount AS double), evt_block_timeFROM aave_v4_ethereum.corehub_evt_remove WHERE assetId = UINT256 '8'),aave_borrow_ev AS (SELECT CAST(drawnShares AS double) AS sh, CAST(drawnAmount AS double) AS amt, evt_block_timeFROM aave_v4_ethereum.corehub_evt_draw WHERE assetId = UINT256 '8'UNION ALLSELECT -CAST(drawnShares AS double), -CAST(drawnAmount AS double), evt_block_timeFROM aave_v4_ethereum.corehub_evt_restore WHERE assetId = UINT256 '8'),