Query editor
-- USDC reserve on Tydro (Ink)-- USDC: 0x2d270e6886d130d724215a266106e6832161eaed (6 decimals)-- aUSDC: 0x70a38b0c90441e991346b7a0cd98c8528dd1c234-- Identity: total_usdc_supply(t) = total_usdc_supply(t-1) + net_supply_change - repaid_from_supply + interest-- interest is derived from the liquidity index, not as a plug, so reconciliation_diff is a real check (~0).WITH pool_flows AS (SELECT evt_block_date AS day, amount / 1e6 AS supplied, 0 AS withdrawn, 0 AS repaidFROM tydro_ink.l2poolinstance_evt_supplyWHERE reserve = 0x2d270e6886d130d724215a266106e6832161eaedUNION ALLSELECT evt_block_date, 0, amount / 1e6, 0FROM tydro_ink.l2poolinstance_evt_withdrawWHERE reserve = 0x2d270e6886d130d724215a266106e6832161eaedUNION ALL-- repayWithATokens burns aUSDC without a Withdraw eventSELECT evt_block_date, 0, 0, amount / 1e6FROM tydro_ink.l2poolinstance_evt_repayWHERE reserve = 0x2d270e6886d130d724215a266106e6832161eaed AND useATokens),pool_daily AS (SELECT day, sum(supplied) AS supplied, sum(withdrawn) AS withdrawn, sum(repaid) AS repaidFROM pool_flowsGROUP BY 1),treasury_daily AS (-- reserve-factor share of interest, minted to the treasury as aUSDCSELECT evt_block_date AS day, sum(amountMinted) / 1e6 AS treasury_mintedFROM tydro_ink.l2poolinstance_evt_mintedtotreasuryWHERE reserve = 0x2d270e6886d130d724215a266106e6832161eaedGROUP BY 1),-- aUSDC Mint/Burn events: signed principal amount and the liquidity index it was applied atatoken_events AS (SELECTblock_date AS day,block_number,index AS log_index,CASE WHEN topic0 = 0x458f5fa412d0f69b08dd84872b0215675cc67bc1d5b6fd93300a1c3878b86196 -- MintTHEN value - balance_increaseELSE -(value + balance_increase) END AS amount,liq_indexFROM (SELECTblock_date, block_number, index, topic0,CAST(bytearray_to_uint256(bytearray_substring(data, 1, 32)) AS double) AS value,CAST(bytearray_to_uint256(bytearray_substring(data, 33, 32)) AS double) AS balance_increase,CAST(bytearray_to_uint256(bytearray_substring(data, 65, 32)) AS double) AS liq_indexFROM ink.logsWHERE contract_address = 0x70a38b0c90441e991346b7a0cd98c8528dd1c234AND block_date >= DATE '2025-11-24'AND topic0 IN (0x458f5fa412d0f69b08dd84872b0215675cc67bc1d5b6fd93300a1c3878b86196, -- Mint0x4cf25bc1d991c17529c25213d3cc0cda295eeaad5f13f361969b12ea48015f90 -- Burn))),atoken_eod_index AS (SELECT day, max_by(liq_index, (block_number, log_index)) AS eod_indexFROM atoken_eventsGROUP BY 1