Query editor
-- ===========================================================================-- FSA (Flare Smart Accounts, whole infrastructure = every PersonalAccountCreated PA,-- all wallet ids, agent CR path + direct-mint memo path) fee generation, per stream.-- One row per fee stream: FSA-attributable amount all-time + last 30d, the stream's-- total for the share, and whether it is on FIRE (215357) / Flare Fees SA section (214836).-- Prices: prices.usd_latest, same tokens as query 7785689 (FXRP on bnb, WFLR on flare);-- XRP valued at the FXRP price (as sort 20 does).-- ===========================================================================withpa as (select distinct personalAccount as addr, xrplOwner as ownerfrom fassets_flare.masteraccountcontroller_evt_personalaccountcreated),px_fxrp as (select price from prices.usd_latest where blockchain = 'bnb' and contract_address = 0x1d2f0da169ceb9fc7b3144628db156f3f6c60dbe),px_flr as (select price from prices.usd_latest where blockchain = 'flare' and contract_address = 0x1d80c49bbbcd1c0911346656b529df9e5c2f783d),d30 as (select current_date - interval '30' day as d),-- 1. direct-mint minting fee -> FIRE-FassetMintingFee collector 0xF55b (sort 2)dmsa as (select evt_block_date as bd, cast(mintingFeeUBA as double)/1e6 as feefrom fassets_flare.assetmanager_evt_directmintingexecutedtosmartaccount),f55 as (select evt_block_date as bd, cast(value as double)/1e6 as v from erc20_flare.evt_transferwhere evt_block_date >= date '2026-05-01' and contract_address = 0xad552a648c74d49e10027ab8a618a3ad4901c5beand "to" = 0xF55bcAd5568d1584ab6f013f144e1e433Ee551C7),-- 2. redemption fee mint -> FIRE-FassetRedemption collector 0x6E815 (sort 4), in FSA redemption txsrr as (select evt_tx_hash, evt_block_date as bd, cast(valueUBA as double)/1e6 as val, cast(feeUBA as double)/1e6 as fee,cast(executorFeeNatWei as double)/1e18 as exec_flr, agentVaultfrom fassets_flare.assetmanager_evt_redemptionrequested where redeemer in (select addr from pa)union allselect evt_tx_hash, evt_block_date, cast(valueuba as double)/1e6, cast(feeuba as double)/1e6,cast(executorfeenatwei as double)/1e18, agentvaultfrom fassets_flare.assetmanager_evt_redemptionwithtagrequested where redeemer in (select addr from pa)),rr_tx as (select distinct evt_tx_hash, bd from rr),e6e as (select evt_tx_hash, evt_block_date as bd, cast(value as double)/1e6 as v from erc20_flare.evt_transferwhere evt_block_date >= date '2026-08-01' and contract_address = 0xad552a648c74d49e10027ab8a618a3ad4901c5beand "to" = 0x6E815bB968e32f91C7e273b9e1CDAE2825Bf8F3a),-- 3. XRPL instruction fees -> provider wallet rM2LEys (sort 20 'SACC - XRPL')sacc as (select t.ledger_close_date as bd, coalesce(t.delivered_amount_value, t.amount_value) as v,t.account_address in (select owner from pa) as is_pafrom xrpl.transfers twhere t.ledger_close_date >= date '2026-01-01' and t.destination_address = 'rM2LEysS4isvAJkZFfxKDL5z4aTfWcBTXV'and (t.amount_currency = 'XRP' or t.amount_currency_iso = 'XRP' or t.delivered_amount_currency = 'XRP' or t.delivered_amount_currency_iso = 'XRP')),-- 4. agent-path mints of FSA (MAC CollateralReserved -> MintingExecuted)mcr as (select cast(collateralReservationId as bigint) as crid, evt_tx_hash, evt_block_date as bd,cast(executorFee as double)/1e18 as exec_flr, executorfrom fassets_flare.masteraccountcontroller_evt_collateralreserved),me as (select cast(collateralReservationId as bigint) as crid, evt_block_date as bd, agentVault,cast(agentFeeUBA as double)/1e6 as agent_fee, cast(poolFeeUBA as double)/1e6 as pool_feefrom fassets_flare.assetmanager_evt_mintingexecuted),fsa_me as (select me.* from me join (select distinct crid from mcr) c on c.crid = me.crid),all_me_wk as (select sum(agent_fee) a, sum(pool_fee) p from me where agentVault = 0x09011d2A11A40DB855Cb00B3AA5a0F5F3bd485FD),-- 5. collateral-reservation fee (FLR) on FSA agent mints = native value MAC -> AssetManager in the CR tx, minus the 10 FLR executor feecrv as (select tr.tx_hash, tr.block_date as bd, sum(cast(tr.value as double))/1e18 as vfrom flare.traces trjoin (select distinct evt_tx_hash, bd from mcr) m on m.evt_tx_hash = tr.tx_hash and m.bd = tr.block_datewhere tr.block_date >= date '2026-02-01' and tr."to" = 0x2a3fe068cd92178554cabcf7c95adf49b4b0b6a8and tr.value > uint256 '0' and tr.successgroup by 1, 2),cr_fee as (select c.bd, c.v - coalesce(e.ex, 0) as fee