Query editor
-- v6 (2026-11-08): resolve the claimed token.-- UiFeesClaimed has no token field (FeeUtils.emitUiFeesClaimed emits uiFeeReceiver, market, receiver,-- feeAmount, nextPoolValue). The token is chosen by the caller of batchClaimUiFees and paid out as an-- ERC-20 transfer from the market contract to `receiver` for exactly feeAmount in the same transaction.-- We find that transfer (1:1 pairing) to get the token, then apply its real decimals.-- Zero-amount claims have no transfer, so token / next_pool_value stay NULL for them.-- Existing columns keep their names; token, token_symbol and fee_amount_usd are appended.WITH ui_fee_claimed AS (SELECT *FROM query_9091161UNION ALLSELECT *FROM query_9091159), claims_ranked AS (SELECTc.*, ROW_NUMBER() OVER (PARTITION BY blockchain, tx_hash, market, receiver, fee_amount_rawORDER BY index) AS pair_rnFROM ui_fee_claimed AS c), payout_transfers AS (SELECTtr.blockchain, tr.tx_hash, tr.contract_address AS token, tr.symbol, tr."from", tr."to", tr.amount_raw, tr.amount_usd, ROW_NUMBER() OVER (PARTITION BY tr.blockchain, tr.tx_hash, tr."from", tr."to", tr.amount_rawORDER BY tr.evt_index) AS pair_rnFROM tokens.transfers AS trWHERE tr.blockchain IN ('arbitrum', 'avalanche_c')AND tr.block_date IN (SELECT DISTINCT block_date FROM ui_fee_claimed WHERE fee_amount_raw > 0)AND tr.tx_hash IN (SELECT tx_hash FROM ui_fee_claimed WHERE fee_amount_raw > 0)), resolved AS (SELECTc.*, t.token, t.symbol AS token_symbol, t.amount_usd AS fee_amount_usd, erc20.decimals AS token_decimalsFROM claims_ranked AS cLEFT JOIN payout_transfers AS tON t.blockchain = c.blockchainAND t.tx_hash = c.tx_hashAND t."from" = c.marketAND t."to" = c.receiver