From b579dc183a21ebe4b25a8c3eb69073d40a169752 Mon Sep 17 00:00:00 2001 From: Matthias Seitz Date: Thu, 17 Mar 2022 12:24:50 +0100 Subject: [PATCH] feat(solc): add viaIR option (#1049) --- ethers-solc/src/artifacts/mod.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/ethers-solc/src/artifacts/mod.rs b/ethers-solc/src/artifacts/mod.rs index ef9d230d..79b82dd8 100644 --- a/ethers-solc/src/artifacts/mod.rs +++ b/ethers-solc/src/artifacts/mod.rs @@ -158,6 +158,10 @@ pub struct Settings { skip_serializing_if = "Option::is_none" )] pub evm_version: Option, + /// Change compilation pipeline to go through the Yul intermediate representation. This is + /// false by default. + #[serde(rename = "viaIR", default, skip_serializing_if = "Option::is_none")] + pub via_ir: Option, #[serde(default, skip_serializing_if = "::std::collections::BTreeMap::is_empty")] pub libraries: BTreeMap>, } @@ -240,6 +244,19 @@ impl Settings { .insert(key.into(), values.into_iter().map(|s| s.to_string()).collect()); } + /// Sets the ``viaIR` valu + #[must_use] + pub fn set_via_ir(mut self, via_ir: bool) -> Self { + self.via_ir = Some(via_ir); + self + } + + /// Enables `viaIR` + #[must_use] + pub fn with_via_ir(self) -> Self { + self.set_via_ir(true) + } + /// Adds `ast` to output #[must_use] pub fn with_ast(mut self) -> Self { @@ -258,6 +275,7 @@ impl Default for Settings { metadata: None, output_selection: OutputSelection::default_output_selection(), evm_version: Some(EvmVersion::default()), + via_ir: None, libraries: Default::default(), remappings: Default::default(), }