Query editor
-- Widget: Counter | Title: "wiTRY Holdings on MegaETH (excl. MM) — USD"---- Combines two sources to count wiTRY held by real holders:-- 1. Direct ERC20 on MegaETH — every wallet's Transfer net balance, excluding-- CompositeExchange (custodian) and the burn address. (Read from megaeth.logs.)-- 2. Inside CompositeExchange — per-user `readLedger(userId, 9)` snapshot-- produced every 30 min by the `witry-ce-snapshot` GitHub Action and-- pushed to dataset `dune.ismailemin.witry_ce_holders`. We take only the-- most recent snapshot and exclude the MM wallet.---- Why a snapshot dataset? Per-user CE balances cannot be derived from event logs-- alone: CLOB trades emit `NewTrade` on a separate SpotOrderBook, with packed-- uint256 fields whose layout isn't public. Ground truth is `readLedger()` via RPC,-- which Dune can't call, so we cron the RPC read ourselves.---- Pricing:-- wiTRY/iTRY via Ethena V2 formula on Ethereum (same as query 03). LayerZero OFT-- preserves share price across chains, so MegaETH wiTRY shares the same rate.-- TRY/USD from MegaETH relayer `PriceUpdated` event.---- Contracts (MegaETH):-- wiTRY (OFT): 0x15B271D9012b5820FC42b1c495B4C1e206547De5-- CompositeExchange: 0x5e3Ae52EbA0F9740364Bd5dd39738e1336086A8b-- MM wallets: 0x18E8988A4ec6A67BBe1F464F0f2027c857FF111D,-- 0xA86d1ECf88ca824cfB1Fd9cd86618a2dF1FFb003-- TRY/USD relayer: 0x3Ee3494f5f55c8ab00aaDc7fcba0ABEaf4c1cB15---- Contracts (Ethereum, for wiTRY price):-- iTRY: 0xb492B4aFD9658093694CF9452D5C272e8230F3B0-- wiTRY: 0xE346C29b5B60Ef870b9724c57ccfbBc631e47DEEWITH-- ⚠ Double-count fix: clamp on-chain reads to the latest CE snapshot's-- timestamp, so direct + CE both reflect the same point in time.ce_latest_snapshot AS (SELECT MAX(snapshot_at) AS snap FROM dune.ismailemin.witry_ce_holders),-- 1. Direct ERC20 wallets on MegaETH (exclude CE + burn), AS OF snapshot_atdirect_in AS (SELECT bytearray_substring(topic2, 13, 20) AS addr,CAST(bytearray_to_uint256(data) AS DECIMAL(38,0)) AS deltaFROM megaeth.logsWHERE contract_address = 0x15B271D9012b5820FC42b1c495B4C1e206547De5AND topic0 = 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efAND topic2 IS NOT NULLAND block_time <= (SELECT snap FROM ce_latest_snapshot)AND bytearray_substring(topic2, 13, 20) NOT IN (0x5e3Ae52EbA0F9740364Bd5dd39738e1336086A8b,0x0000000000000000000000000000000000000000,0x18E8988A4ec6A67BBe1F464F0f2027c857FF111D,0xA86d1ECf88ca824cfB1Fd9cd86618a2dF1FFb003)),direct_out AS (SELECT bytearray_substring(topic1, 13, 20) AS addr,-CAST(bytearray_to_uint256(data) AS DECIMAL(38,0)) AS deltaFROM megaeth.logsWHERE contract_address = 0x15B271D9012b5820FC42b1c495B4C1e206547De5