Query editor
-- ============================================================================-- v107 (2026-11-22) — TRUST WALLET VIA CoW PROTOCOL ADDED (tw_cow_trades)-- ============================================================================-- Ground truth: owner's Trust Wallet swaps 2026-11-22 — ETH USDT->USDC (settlement-- 0xd20e9bb3) and Base USDC->USDT (0x8b3e3a99) both settled on CoW with NO dex.trades-- leg and no fee transfer; Base USDT->ETH (0x4e03ab70) went Rango at 70.5 bps.-- Research: 9170359 (decode), 9170363/69 (appData), 9170374/80 (hash universe), 9170387.-- 1. THE ANCHOR IS appData. Every CoW order carries appData = keccak256 of a canonical-- JSON document. Trust Wallet's document (resolved via api.cow.fi/<chain>/api/v1/app_data):-- {"appCode":"Trust wallet","metadata":{"orderClass":{"orderClass":"market"},-- "partnerFee":[{"volumeBps":<0|70>,"recipient":"0xea5B5991f761Ced44Ffa99bEaCb72d691ee334ec"}],-- "quote":{"slippageBips":<user setting>,"smartSlippage":false}},"version":"1.8.0"}-- Only volumeBps (70 normally, 0 on some stable pairs) and slippageBips (user slippage)-- vary, so the full hash set is ENUMERATED IN SQL (tw_cow_appdata: keccak over-- slippage 0..5000 x bps {0,70} x smartSlippage {false,true}); nothing is hard-coded.-- Verified on the four hashes seen in the wild (0xbc420e95 = 70/100, 0x4ece77ad = 0/100,-- 0x02da01c2 = 70/200, 0xd53573a7 = 70/300). If TW bumps "version" or changes the fee-- recipient, this branch goes to zero — check the hash universe (9170380) when it does.-- 2. SOURCE TABLE = cow_protocol_<chain>.trades, NOT dex.trades. CoW settlements are solver--- signed (tx_from = solver, tx_to = GPv2Settlement 0x9008d19f) and are frequently matched-- peer-to-peer with no AMM leg, so dex.trades sees nothing. One row per order; value =-- usd_value (sell side, else buy side). Chains with a spell: ethereum, base, bnb,-- arbitrum, polygon, avalanche_c (no robinhood).-- 3. DISJOINT BY CONSTRUCTION from the other TW branches (they key on fee transfers to-- 0xAD01 / 0xcc01 / 0x73691cee inside user-signed txs). No not-exists guard: adding-- three of them hit Dune's "too many stages" limit (first v107 run), see v104 §12.-- The CoW partner fee (0.70%) accrues inside the settlement contract and is paid out to-- 0xea5B5991 in batches, so there is NO per-trade fee transfer to anchor on.-- 4. SCALE (7d to 2026-11-22): ethereum $8.12M / 15.5K orders / 9.3K traders, bnb $1.02M /-- 38.4K / 19.5K, arbitrum $248K, base $29K, polygon $15K, avalanche_c $6K => $0.9-2.3M/day,-- i.e. roughly doubles TW's daily total. This is where TW's stable<->stable flow lives-- (owner's hypothesis 2026-11-20, confirmed).-- 5. KNOWN NON-TW appData in the same tables: 0x1e558dd6 / 0x297a23ed / 0x4579a31c = CoW Swap-- front end; 0x75847fd3 / 0x16e4e0f1 = amahub; 0x75cd9eb7 = TokenPocket Limit Order-- (30 bps); 0x2b4a4c43 = Bitget Wallet (50 bps -> 0xD639f137). Not attributed here.-- 6. The bnb CoW spell labels the native buy token (0xeeee...) as 'POL'; tw_cow_trades-- maps 0xeeee... to the chain's own native symbol for the pair label.-- Rollback point: v106 via Dune version history.-- ============================================================================-- ============================================================================-- v106 (2026-11-18) — TRUST WALLET: SOLANA ANCHOR REPLACED, RANGO BAND WIDENED-- ============================================================================-- Ground truth: owner's Trust Wallet swaps on 2026-11-17 (BSC 0xac1538bf, 0xee8498c1;-- Solana 5fscSqaf, zzjAAvie, 2mcQKuTW, 2hhcMhVj). Research: 9140537/43/51, 9143412/19.-- 1. SOLANA ANCHOR. The v105 anchor (owner 7mrkSxsh, WSOL) had gone to ZERO: TW now routes-- Solana swaps through Rango's program and charges 0.70% in the input token, paid to-- owner Gzm9sVa1bKeLfa3Qz8E1GXS8TeakPRT37nL8w9pSqQvd. tw_sol_tx now keys on that owner-- (any token). 7-day scale: 4.7-6.0K tx/day, $3.8-9.8K fee/day => $0.5-1.4M/day.-- 2. COVERAGE FALLBACK. dex_solana.trades indexes only ~65% of those txs (1 of the owner's-- 4). Txs with the TW fee but no dex row are valued at fee / 0.007 (tw_sol_fallback),-- pair = '<input token>-?'. This is the first branch that values by fee reconstruction;-- it is marked by the '-?' pair suffix so it can be separated downstream.-- 3. OKX / BINANCE COLLISION. Rango routes 10-14% of TW's Solana swaps through OKX's DEX-- program (proVF4...), and dex_solana.trades records trade_source = OKX for them (the-- owner's zzjAAvie). sol_base now gives the TW fee priority: is_tw excludes the tx from-- 'OKX' (and 'BinanceWallet'); 'OKX Exclusive' already excluded is_tw.-- 4. EVM RANGO BAND 60-76 -> 60-90 bps. The 80.7 bps band on 0xcc01 that v104 called-- "another integrator" is TW: the owner's BSC Cake->SOL swap paid 80.6 bps. 70.5 appears-- only on base/bnb/robinhood same-chain routes; 80.7 appears on all 7 chains, same-chain-- and cross-chain (Mayan / Relay). dt=2026-11-16 dex-leg volume in the new band ~$402K.