From d256b45e7f967f7320e96aab3009a5b976c25eaa Mon Sep 17 00:00:00 2001 From: DaniPopes <57450786+DaniPopes@users.noreply.github.com> Date: Thu, 18 Jan 2024 20:22:54 +0100 Subject: [PATCH 1/2] feat: add viaIR to etherscan verification input --- Cargo.lock | 4 ++-- crates/forge/bin/cmd/verify/etherscan/mod.rs | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a913af40aae8..5721bb596ae3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2919,9 +2919,9 @@ dependencies = [ [[package]] name = "foundry-block-explorers" -version = "0.2.0" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e3511658a04060f9c28b45ef0f3a483f605ba2f7a3563f993476115e247eef9" +checksum = "3388fca613939d3431dcf951a349753c00478bc839821ce1b0910563cce41a99" dependencies = [ "alloy-chains", "alloy-json-abi", diff --git a/crates/forge/bin/cmd/verify/etherscan/mod.rs b/crates/forge/bin/cmd/verify/etherscan/mod.rs index ec7e72b1dfcb..44cbaaa6b400 100644 --- a/crates/forge/bin/cmd/verify/etherscan/mod.rs +++ b/crates/forge/bin/cmd/verify/etherscan/mod.rs @@ -321,7 +321,8 @@ impl EtherscanVerificationProvider { let mut verify_args = VerifyContract::new(args.address, contract_name, source, compiler_version) .constructor_arguments(constructor_args) - .code_format(code_format); + .code_format(code_format) + .via_ir(args.via_ir); if code_format == CodeFormat::SingleFile { verify_args = if let Some(optimizations) = args.num_of_optimizations { From 4b7b5beb746e1b6f340749ab33e38da1a5fe3ae5 Mon Sep 17 00:00:00 2001 From: Matthias Seitz Date: Thu, 18 Jan 2024 21:05:38 +0100 Subject: [PATCH 2/2] chore: set via ir to true if provided --- crates/forge/bin/cmd/verify/etherscan/mod.rs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/crates/forge/bin/cmd/verify/etherscan/mod.rs b/crates/forge/bin/cmd/verify/etherscan/mod.rs index 44cbaaa6b400..956e583ab2d6 100644 --- a/crates/forge/bin/cmd/verify/etherscan/mod.rs +++ b/crates/forge/bin/cmd/verify/etherscan/mod.rs @@ -321,8 +321,15 @@ impl EtherscanVerificationProvider { let mut verify_args = VerifyContract::new(args.address, contract_name, source, compiler_version) .constructor_arguments(constructor_args) - .code_format(code_format) - .via_ir(args.via_ir); + .code_format(code_format); + + if args.via_ir { + // we explicitly set this __undocumented__ argument to true if provided by the user, + // though this info is also available in the compiler settings of the standard json + // object if standard json is used + // unclear how etherscan interprets this field in standard-json mode + verify_args = verify_args.via_ir(true); + } if code_format == CodeFormat::SingleFile { verify_args = if let Some(optimizations) = args.num_of_optimizations {