Query editor
-- =====================================================================-- 05 - DEPOSIT FEES: every deposit routed through the FeeWrapper4626-- contracts, with the 20 bps entry fee diverted to the fee-- recipient, in the deposit asset and in USD.-- =====================================================================-- NOTE: this is the DEPOSIT (entry) fee, a different revenue line from-- the PERFORMANCE fee tracked in 01_vault_metrics_daily.sql. The same-- recipient (0x83EB..83c6) also receives performance-fee share MINTS-- (Transfer from 0x0) - those are NOT deposit fees and are excluded-- here by construction (see "why the join shape" below).---- ----------------------------------------------------------------------- CONTRACT MECHANISM (verified on-chain, not assumed)-- ----------------------------------------------------------------------- The 7 router addresses are all `FeeWrapper4626` (same creator-- 0xC18D9942..., verified source on Etherscan/Basescan). Their ABI-- exposes exactly ONE event - OwnershipTransferred. There is NO-- Deposit/Fee event: `deposit(address depositContract, address-- depositToken, uint256 amount)` emits nothing of its own.-- => There is no decoded Dune table for these. The only way to-- reconstruct deposits + fees is from raw ERC20 Transfer logs.---- Log shape of a real deposit, verified against Base tx-- 0xf10171f5fcb625f5678a1c7ed0c151ecf84c4a03464a275fc272f8e0c0117ef1-- (router 0x0442..4c84, USDC):-- log 0 Transfer USDC user -> feeRecipient 339,897 <- FEE-- log 1 Transfer USDC user -> router 169,608,808 <- NET-- log 2 Approval USDC router -> vault-- log 3 Transfer USDC router -> vault 169,608,808 <- destination-- log 5 Transfer share 0x0 -> user 150,421,425 (shares out)-- gross = 339,897 + 169,608,808 = 169,948,705-- fee / gross = 339,897 / 169,948,705 = exactly 0.00200000 = 20 bps.---- Two consequences that drive the query shape:-- 1. The fee is pulled DIRECTLY FROM THE DEPOSITOR (from = user), not-- forwarded by the router. So the fee leg and the deposit leg share-- the same `from` address, tx, and token.-- 2. The amount the user parted with is GROSS = net + fee. The router-- only ever receives (and deposits) the NET. `amount` as passed to-- deposit() is the gross; on-chain fee = amount * bps / 10000-- (integer division, floor) and net = amount - fee.---- ----------------------------------------------------------------------- WHY THE JOIN SHAPE-- ----------------------------------------------------------------------- Anchor on the DEPOSIT leg (to = router) and LEFT JOIN the fee leg-- (to = feeRecipient) on (chain, tx, token, depositor). This:-- * excludes performance-fee share mints to the recipient (from 0x0,-- no matching router leg, different token) - they cannot leak in;-- * still returns deposits where the fee was 0 (config disabled, or-- amount too small to round to >=1 wei of fee);-- * is safe if one tx contains several deposits of the same token by-- the same user - both legs are summed per key, so the tx collapses-- to one row rather than fanning out into a cartesian product.---- Native ETH is not possible here: deposit() is nonpayable, so every-- deposit has an ERC20 Transfer leg. (The payable withdraw/ETH rescue-- path on the contract is not a deposit and never hits these joins.)---- Cost: partition floor DATE '2026-03-01' - all 7 routers were created