Skip to content
This repository has been archived by the owner on Oct 19, 2024. It is now read-only.

fix: naming and default impl #665

Merged
merged 1 commit into from
Dec 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions ethers-solc/src/artifacts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ impl Default for Settings {
optimizer: Default::default(),
metadata: None,
output_selection: Self::default_output_selection(),
evm_version: Some(EvmVersion::Istanbul),
evm_version: Some(EvmVersion::default()),
libraries: Default::default(),
remappings: Default::default(),
}
Expand Down Expand Up @@ -225,15 +225,21 @@ impl Default for Optimizer {
pub enum EvmVersion {
Homestead,
TangerineWhistle,
SpuriusDragon,
SpuriousDragon,
Byzantium,
Constantinople,
Petersburg,
Istanbul,
Berlin,
Byzantium,
London,
}

impl Default for EvmVersion {
fn default() -> Self {
Self::London
}
}

impl EvmVersion {
/// Checks against the given solidity `semver::Version`
pub fn normalize_version(self, version: &Version) -> Option<EvmVersion> {
Expand Down Expand Up @@ -267,7 +273,7 @@ impl fmt::Display for EvmVersion {
let string = match self {
EvmVersion::Homestead => "homestead",
EvmVersion::TangerineWhistle => "tangerineWhistle",
EvmVersion::SpuriusDragon => "spuriusDragon",
EvmVersion::SpuriousDragon => "spuriousDragon",
EvmVersion::Constantinople => "constantinople",
EvmVersion::Petersburg => "petersburg",
EvmVersion::Istanbul => "istanbul",
Expand All @@ -286,7 +292,7 @@ impl FromStr for EvmVersion {
match s {
"homestead" => Ok(EvmVersion::Homestead),
"tangerineWhistle" => Ok(EvmVersion::TangerineWhistle),
"spuriusDragon" => Ok(EvmVersion::SpuriusDragon),
"spuriousDragon" => Ok(EvmVersion::SpuriousDragon),
"constantinople" => Ok(EvmVersion::Constantinople),
"petersburg" => Ok(EvmVersion::Petersburg),
"istanbul" => Ok(EvmVersion::Istanbul),
Expand Down
1 change: 1 addition & 0 deletions ethers-solc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,7 @@ impl<Artifacts: ArtifactOutput> Project<Artifacts> {
let sources = paths.set_source_names(sources);

let input = CompilerInput::with_sources(sources)
.evm_version(self.solc_config.settings.evm_version.unwrap_or_default())
.normalize_evm_version(&solc.version()?)
.with_remappings(self.paths.remappings.clone());

Expand Down