Query editor
WITH latest_state_commit AS (SELECT inputFROM {{ethereum}}.tracesWHERE block_date >= TIMESTAMP '{{recent}}'AND to = {{m3terchain}}AND STARTS_WITH(input, 0x12d8317d)AND success = trueORDER BY block_time DESCLIMIT 1),parsed AS (SELECTinput,varbinary_to_bigint(varbinary_substring(input, 33, 4)) AS account_offset,varbinary_to_bigint(varbinary_substring(input, 65, 4)) AS nonce_offsetFROM latest_state_commit),blobs AS (SELECTvarbinary_substring(input,5 + account_offset + 32,varbinary_to_bigint(varbinary_substring(input, 5 + account_offset + 28, 4))) AS account_blob,varbinary_substring(input,5 + nonce_offset + 32,varbinary_to_bigint(varbinary_substring(input, 5 + nonce_offset + 28, 4))) AS nonce_blobFROM parsed),padded AS (SELECTvarbinary_concat(0x00, account_blob) AS account_padded,varbinary_concat(0x00, nonce_blob) AS nonce_padded,(LENGTH(account_blob) / 6) + 1 AS num_m3tersFROM blobs)SELECTcount(idx - 1) AS id,sum(CAST(varbinary_to_bigint(varbinary_substring(account_padded, (idx - 1) * 6 + 1, 6)) AS DECIMAL(38, 6)) / 1000000) AS accountFROM paddedCROSS JOIN unnest(sequence(1, num_m3ters)) AS t(idx)ORDER BY id;