From 520645c48b8eee9fb866d8427d013fec14ee51f4 Mon Sep 17 00:00:00 2001 From: Georgios Konstantopoulos Date: Fri, 3 Sep 2021 17:50:50 +0300 Subject: [PATCH] chore: add changelog for #427 changes (#428) --- CHANGELOG.md | 2 ++ ethers-core/src/utils/solc.rs | 16 ++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 29b91113..a537f377 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,8 @@ ### Unreleased +* Allow configuring the optimizer & passing arbitrary arguments to solc [#427](https://github.com/gakonst/ethers-rs/pull/427) + ### 0.5.2 * Correctly RLP Encode transactions as received from the mempool ([#415](https://github.com/gakonst/ethers-rs/pull/415)) diff --git a/ethers-core/src/utils/solc.rs b/ethers-core/src/utils/solc.rs index e3886169..da4692e7 100644 --- a/ethers-core/src/utils/solc.rs +++ b/ethers-core/src/utils/solc.rs @@ -210,6 +210,22 @@ impl Solc { } /// Sets the optimizer runs (default = 200). None indicates no optimization + /// + /// ```rust,no_run + /// use ethers_core::utils::Solc; + /// + /// // No optimization + /// let contracts = Solc::new("./contracts/*") + /// .optimizer(None) + /// .build().unwrap(); + /// + /// // Some(200) is default, optimizer on with 200 runs + /// // .arg() allows passing arbitrary args to solc command + /// let optimized_contracts = Solc::new("./contracts/*") + /// .optimizer(Some(200)) + /// .arg("--metadata-hash=none") + /// .build().unwrap(); + /// ``` pub fn optimizer(mut self, runs: Option) -> Self { self.optimizer = runs; self