From e64bb1ba42db2aa0ba6a30d227ebbdc31e269a38 Mon Sep 17 00:00:00 2001 From: Ardis Lu Date: Thu, 4 Jun 2026 23:16:07 -0700 Subject: [PATCH] Check for `viaIR` Solidity prologue --- index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 4c3024e..dbd3757 100644 --- a/index.js +++ b/index.js @@ -32,9 +32,11 @@ async function fetchBytecode(address, rpc) { */ function detectLanguage(bytecode) { const prefix = bytecode.replace('0x', '').substring(0, 10); + const viaIRPrefix = bytecode.replace('0x', '').substring(0, 12); // https://github.com/banteg/erigon-kv/blob/5584ada83c75b244e611641d100ccc647a7f6791/examples/compilers.py#L17 - if (prefix === '6060604052' || prefix === '6080604052') { + // viaIRPrefix happens when optimizer viaIR=true + if (prefix === '6060604052' || prefix === '6080604052' || viaIRPrefix === '608080604052') { return 'solidity'; } else if (prefix === '6004361015' || prefix === '341561000a') { -- 2.47.3