Query editor
-- Daily vault-layer flow for FSA-routed activity (wallet ID byte 01 ∈ {10} ∪ [32,51] (Portal ids; 52 Doppler is an outside app)).-- Combines ClearStar + Monarq deposits and withdraws into a single daily timeline.-- Output filtered to days from 2026-05-17 onwards.---- cumulative_net_vault_flow is the running total of (deposit − withdraw) across ALL history;-- the filter only affects display, not the running sum.---- IMPORTANT: the withdraw attribution math uses the FULL SA-vault history so-- pending-shares stay consistent; only the final daily output is date-filtered.WITH vault_meta AS (SELECT * FROM (VALUES(2, 0x373d7d201c8134d4a2f7b5c63560da217e3dea28),(3, 0x2439d4bb753a0f3777d4c9011afacc475ba6b951)) AS t(vault_id, vault_address)),fsa_instructions AS (SELECTie.evt_tx_hash,ie.evt_block_time,ie.personalAccount,ie.instructionId,ie.paymentReference,varbinary_to_uint256(varbinary_substring(ie.paymentReference, 2, 1)) AS wallet_idFROM fassets_flare.masteraccountcontroller_evt_instructionexecuted ieWHERE (varbinary_to_uint256(varbinary_substring(ie.paymentReference, 2, 1)) = 10 OR varbinary_to_uint256(varbinary_substring(ie.paymentReference, 2, 1)) BETWEEN 32 AND 51)),-- DEPOSITS (both vaults)fsa_deposit_instructions AS (SELECT * FROM fsa_instructions WHERE instructionId IN (32, 33)),deposit_events AS (SELECT d.evt_block_time, d.amountInFROM fsa_deposit_instructions fiINNER JOIN upshift_flare.tokenized_vault_evt_deposit d ON d.evt_tx_hash = fi.evt_tx_hashUNION ALLSELECT d.evt_block_time, d.amountInFROM fsa_deposit_instructions fiINNER JOIN upshift_flare.monarqtokenizedvault_evt_deposit d ON d.evt_tx_hash = fi.evt_tx_hash),deposit_agg AS (SELECTDATE_TRUNC('day', evt_block_time) AS day,COUNT(*) AS deposit_count,SUM(amountIn) / 1e6 AS deposit_amountFROM deposit_eventsGROUP BY 1),-- WITHDRAWS (per-event attribution methodology — uses FULL history for soundness)fsa_request_redeems AS (SELECTfi.evt_block_time,fi.personalAccount,fi.wallet_id,varbinary_to_uint256(varbinary_substring(fi.paymentReference, 15, 2)) AS vault_id,varbinary_to_uint256(varbinary_substring(fi.paymentReference, 3, 10)) AS shares_rawFROM fsa_instructions fi