From ade8cd95537d246064b6a5122be5c38122277213 Mon Sep 17 00:00:00 2001 From: joshieDo <93316087+joshieDo@users.noreply.github.com> Date: Thu, 23 Dec 2021 17:03:37 +0200 Subject: [PATCH] add fn settings on CompilerInput (#729) --- ethers-solc/src/artifacts.rs | 7 +++++++ ethers-solc/src/lib.rs | 3 ++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/ethers-solc/src/artifacts.rs b/ethers-solc/src/artifacts.rs index 3ba04a3b..cc92aaea 100644 --- a/ethers-solc/src/artifacts.rs +++ b/ethers-solc/src/artifacts.rs @@ -39,6 +39,13 @@ impl CompilerInput { Self { language: "Solidity".to_string(), sources, settings: Default::default() } } + /// Sets the settings for compilation + #[must_use] + pub fn settings(mut self, settings: Settings) -> Self { + self.settings = settings; + self + } + /// Sets the EVM version for compilation #[must_use] pub fn evm_version(mut self, version: EvmVersion) -> Self { diff --git a/ethers-solc/src/lib.rs b/ethers-solc/src/lib.rs index 082f3291..4056f2db 100644 --- a/ethers-solc/src/lib.rs +++ b/ethers-solc/src/lib.rs @@ -335,6 +335,7 @@ impl Project { paths.extend(map); let input = CompilerInput::with_sources(sources) + .settings(self.solc_config.settings.clone()) .normalize_evm_version(&solc.version()?) .with_remappings(self.paths.remappings.clone()); @@ -397,7 +398,7 @@ impl Project { let sources = paths.set_source_names(sources); let input = CompilerInput::with_sources(sources) - .evm_version(self.solc_config.settings.evm_version.unwrap_or_default()) + .settings(self.solc_config.settings.clone()) .normalize_evm_version(&solc.version()?) .with_remappings(self.paths.remappings.clone());