Query editor
-- bankr-robinhood-token-metrics: Robinhood analogue of Base bankr-trending-unified (query_6900376).-- One master query for all trending tabs: per-token mcap, 24h volume, 24h USD price change, and-- fees, pre-ranked (rank_fees / rank_mcap / rank_volume / rank_change).-- Universe: all Bankr RH tokens with >= 1 user swap in a standard Bankr pool-- (do NOT filter to fee > 0 here).---- PERF (2026-07-26): the universe now reads the MATERIALIZED VIEW-- dune.bankrofficial.result_bankr_rh_token_list instead of query_7904569. Dune inlines a-- query_NNNN ref as a SQL view and re-plans it on every reference, and this query references-- the universe CTE 5x — that expansion is what pushed this query past Trino's stage limit-- ("too many stages"). The matview is a plain table scan, so the subtree disappears from the-- plan. Tradeoff: the matview lags live by ~1.5h (refresh cadence), i.e. the newest ~0.4% of-- tokens appear one refresh late. They have no meaningful volume/fees yet, so leaderboards and-- fee rollups are unaffected. Keep the matview refresh MORE frequent than any downstream-- matview built on this query.---- STOCK-PAIRED launches included: pools whose numeraire is a tokenized stock (18-dec) instead of-- WETH. Stock pools MUST be gated on hooks = 0x4e3468951d49f2eea976ed0d6e75ffcb44a9a544 (Doppler-- initializer) + fee = 8388608 — competing scam/organic pools exist on the SAME token/stock pairs-- with hooks=0x0. Stock numeraire legs are valued at daily stock USD prices (query_8038736,-- RFQ-fill derived, floor 2026-07-12); WETH legs keep per-minute mainnet ETH pricing. Rollup-- columns are INCLUSIVE (WETH + stock); _stock breakout columns are additive observability only.---- CONTRACT-VERIFIED fee model (2026-07-17; validated against on-chain FeesManager pull totals:-- accrual formula matches collected pools at median ratio 1.0000; creator claims = 0.95 x pulls):-- bankr_fees_usd = measured numeraire transfers fee-router (0x6f02...) -> integrator (0xF60633...),-- attributed to a token per swap tx. Always measured, never imputed: the-- hook fee is 0.625% of the swap OUTPUT leg steady-state but-- decays 100% -> 0.625% over the pool's FIRST 10 SECONDS-- (anti-snipe, durationSeconds=10), so fee/volume is non-constant at launch.-- On stock pools the router pays the integrator IN THE STOCK TOKEN and-- amount_usd is NULL — those legs are valued as amount-- (decimal-normalized) x stock_usd.-- creator_fees_usd = 95% of the per-swap LP fee charged on BOTH input legs, using the per-swap-- 'fee' field (7000 = 0.700% on ~95% of swaps, but NOT all — never a constant):-- buys (user pays numeraire): num_in x fee/1e6 (accrues in numeraire)-- sells (user pays token): num_out x fee/(1e6 - fee) (accrues in-kind in-- the token, valued in numeraire at swap time; claimable by the creator).-- The creator side is ALWAYS exactly 95% of the LP fee; custom splits only-- subdivide it among wallets. PLUS the quote-only term below.-- total_fees_usd = bankr + creator (protocol's 5% of the LP fee intentionally excluded).-- Pools are restricted to the v4 DYNAMIC-fee flag (fee = 8388608): that is the standard Bankr-- Doppler launch config and carries 99.9997% of measured bankr revenue ($502,534 vs $1.62 in-- all 92 static-fee pools combined, verified 2026-07-16). Static-fee pools under the same hook-- (e.g. six fee=10 pools initialized ~1,000x above launch price by one wallet) forward nothing-- to the router and exist to game the mcap leaderboard. Within this dynamic-only universe the-- per-swap fee field is still the correct fee basis.-- Router fee-conversion swaps (sender = 0x6f02...) are EXCLUDED from volume/price/supply math:-- they are the hook selling collected token fees, not user trades (~200k rows; verified-- 2026-07-16: 200,148 conversion vs 376,923 user swaps). They DO pay the LP fee on their token-- input, so they enter the sell-side creator-fee term (and ONLY that term). Same rule on the-- stock leg.-- The FeesManager -> PoolManager WETH flow is a zero-net settlement wash of the hook fee and is-- never counted anywhere.-- Direction convention verified: token-side amount > 0 = buy (lifetime buy 16,997 WETH > sell-- 16,393 WETH; txs containing a conversion swap are 99.3% buy-classified).-- price_change_24h is a FRACTION (0.05 = +5%), USD-denominated: each leg converts at its own-- minute's ETH price (daily stock price on stock pools) so numeraire drift doesn't masquerade-- as token movement (same as query_7904618).--