Query editor
WITH logs AS (SELECT block_time, block_number, "index" AS log_index, tx_hash, topic0, data,'Ethereum -> Tron' AS direction,30420 AS target_eid,193 AS cs_off, -- CreditsSent word 6 -> byte 192, 1-based 193171 AS cr_off -- CreditsReceived msg@128 +2 +5*8 = byte 170, 1-based 171FROM ethereum.logsWHERE contract_address = 0x1f748c76de468e9d11bd340fa9d5cbadf315dfb0AND block_time >= TIMESTAMP '2025-08-01'AND topic0 IN (0x85496b760a4b7f8d66384b9df21b381f5d1b1e79f229a47aaf4c232edc2fe59a,0xae78c0998033609cfa2f64f69e372f29866387bba2fc35df565036d505f7d1a1,0x46c538f0a542429041065e8cfac9625dd8d28ce0587bad7dcca2f41dff9982a1,0x3db8474102b857712fc19a9142f559c0b9c2dd375fa0c50626bfa44eab474801)UNION ALL-- TFG4wBaDQ8sHWWP1ACeSGnoNR6RRzevLPt with the 0x41 prefix droppedSELECT block_time, block_number, "index" AS log_index, tx_hash, topic0, data,'Tron -> Ethereum' AS direction,30101 AS target_eid,97 AS cs_off, -- CreditsSent word 3 -> byte 96, 1-based 97147 AS cr_off -- CreditsReceived msg@128 +2 +2*8 = byte 146, 1-based 147FROM tron.logsWHERE contract_address = 0x3a08f76772e200653bb55c2a92998daca62e0e97AND block_time >= TIMESTAMP '2025-08-01'AND topic0 IN (0x85496b760a4b7f8d66384b9df21b381f5d1b1e79f229a47aaf4c232edc2fe59a,0xae78c0998033609cfa2f64f69e372f29866387bba2fc35df565036d505f7d1a1,0x46c538f0a542429041065e8cfac9625dd8d28ce0587bad7dcca2f41dff9982a1,0x3db8474102b857712fc19a9142f559c0b9c2dd375fa0c50626bfa44eab474801)),deltas AS ( -- varbinary_substring is 1-basedSELECT block_time, block_number, log_index, tx_hash, direction,CASE topic0WHEN 0x85496b760a4b7f8d66384b9df21b381f5d1b1e79f229a47aaf4c232edc2fe59a THEN 'OFTSent'WHEN 0xae78c0998033609cfa2f64f69e372f29866387bba2fc35df565036d505f7d1a1 THEN 'RemoteWithdrawn'WHEN 0x46c538f0a542429041065e8cfac9625dd8d28ce0587bad7dcca2f41dff9982a1 THEN 'CreditsSent'WHEN 0x3db8474102b857712fc19a9142f559c0b9c2dd375fa0c50626bfa44eab474801 THEN 'CreditsReceived'END AS event_name,CASE-- OFTSent: data words [0]=dstEid [1]=amountSentLD [2]=amountReceivedLD-- credit moves by amountReceivedLD (word 2) — the gap to word 1 is the fee.WHEN topic0 = 0x85496b760a4b7f8d66384b9df21b381f5d1b1e79f229a47aaf4c232edc2fe59aAND varbinary_to_uint256(varbinary_substring(data, 1, 32)) = target_eidTHEN -CAST(varbinary_to_uint256(varbinary_substring(data, 65, 32)) AS DECIMAL(38,0))-- RemoteWithdrawn: data words [0]=guid [1]=dstEid [2]=amountWHEN topic0 = 0xae78c0998033609cfa2f64f69e372f29866387bba2fc35df565036d505f7d1a1AND varbinary_to_uint256(varbinary_substring(data, 33, 32)) = target_eidTHEN -CAST(varbinary_to_uint256(varbinary_substring(data, 65, 32)) AS DECIMAL(38,0))-- CreditsSent: [0]=dstEid then the 6-credit vector. Deliberately NOT filtered on-- dstEid: the vector moves credits for X even when the counterparty is a 3rd chain.WHEN topic0 = 0x46c538f0a542429041065e8cfac9625dd8d28ce0587bad7dcca2f41dff9982a1THEN -CAST(varbinary_to_uint256(varbinary_substring(data, cs_off, 32)) AS DECIMAL(38,0))-- CreditsReceived: [0]=guid [1]=srcEid [2]=offset [3]=len, message at byte 128WHEN topic0 = 0x3db8474102b857712fc19a9142f559c0b9c2dd375fa0c50626bfa44eab474801THEN CAST(varbinary_to_uint256(varbinary_substring(data, cr_off, 8)) AS DECIMAL(38,0))ELSE CAST(0 AS DECIMAL(38,0))END AS delta_rawFROM logs),-- Running level accumulates from deployment (credits started at 0), so it is absolute.