fix: naming and default impl (#665)
This commit is contained in:
parent
adc3d858d2
commit
991cda3f33
|
@ -185,7 +185,7 @@ impl Default for Settings {
|
||||||
optimizer: Default::default(),
|
optimizer: Default::default(),
|
||||||
metadata: None,
|
metadata: None,
|
||||||
output_selection: Self::default_output_selection(),
|
output_selection: Self::default_output_selection(),
|
||||||
evm_version: Some(EvmVersion::Istanbul),
|
evm_version: Some(EvmVersion::default()),
|
||||||
libraries: Default::default(),
|
libraries: Default::default(),
|
||||||
remappings: Default::default(),
|
remappings: Default::default(),
|
||||||
}
|
}
|
||||||
|
@ -225,15 +225,21 @@ impl Default for Optimizer {
|
||||||
pub enum EvmVersion {
|
pub enum EvmVersion {
|
||||||
Homestead,
|
Homestead,
|
||||||
TangerineWhistle,
|
TangerineWhistle,
|
||||||
SpuriusDragon,
|
SpuriousDragon,
|
||||||
|
Byzantium,
|
||||||
Constantinople,
|
Constantinople,
|
||||||
Petersburg,
|
Petersburg,
|
||||||
Istanbul,
|
Istanbul,
|
||||||
Berlin,
|
Berlin,
|
||||||
Byzantium,
|
|
||||||
London,
|
London,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Default for EvmVersion {
|
||||||
|
fn default() -> Self {
|
||||||
|
Self::London
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl EvmVersion {
|
impl EvmVersion {
|
||||||
/// Checks against the given solidity `semver::Version`
|
/// Checks against the given solidity `semver::Version`
|
||||||
pub fn normalize_version(self, version: &Version) -> Option<EvmVersion> {
|
pub fn normalize_version(self, version: &Version) -> Option<EvmVersion> {
|
||||||
|
@ -267,7 +273,7 @@ impl fmt::Display for EvmVersion {
|
||||||
let string = match self {
|
let string = match self {
|
||||||
EvmVersion::Homestead => "homestead",
|
EvmVersion::Homestead => "homestead",
|
||||||
EvmVersion::TangerineWhistle => "tangerineWhistle",
|
EvmVersion::TangerineWhistle => "tangerineWhistle",
|
||||||
EvmVersion::SpuriusDragon => "spuriusDragon",
|
EvmVersion::SpuriousDragon => "spuriousDragon",
|
||||||
EvmVersion::Constantinople => "constantinople",
|
EvmVersion::Constantinople => "constantinople",
|
||||||
EvmVersion::Petersburg => "petersburg",
|
EvmVersion::Petersburg => "petersburg",
|
||||||
EvmVersion::Istanbul => "istanbul",
|
EvmVersion::Istanbul => "istanbul",
|
||||||
|
@ -286,7 +292,7 @@ impl FromStr for EvmVersion {
|
||||||
match s {
|
match s {
|
||||||
"homestead" => Ok(EvmVersion::Homestead),
|
"homestead" => Ok(EvmVersion::Homestead),
|
||||||
"tangerineWhistle" => Ok(EvmVersion::TangerineWhistle),
|
"tangerineWhistle" => Ok(EvmVersion::TangerineWhistle),
|
||||||
"spuriusDragon" => Ok(EvmVersion::SpuriusDragon),
|
"spuriousDragon" => Ok(EvmVersion::SpuriousDragon),
|
||||||
"constantinople" => Ok(EvmVersion::Constantinople),
|
"constantinople" => Ok(EvmVersion::Constantinople),
|
||||||
"petersburg" => Ok(EvmVersion::Petersburg),
|
"petersburg" => Ok(EvmVersion::Petersburg),
|
||||||
"istanbul" => Ok(EvmVersion::Istanbul),
|
"istanbul" => Ok(EvmVersion::Istanbul),
|
||||||
|
|
|
@ -372,6 +372,7 @@ impl<Artifacts: ArtifactOutput> Project<Artifacts> {
|
||||||
let sources = paths.set_source_names(sources);
|
let sources = paths.set_source_names(sources);
|
||||||
|
|
||||||
let input = CompilerInput::with_sources(sources)
|
let input = CompilerInput::with_sources(sources)
|
||||||
|
.evm_version(self.solc_config.settings.evm_version.unwrap_or_default())
|
||||||
.normalize_evm_version(&solc.version()?)
|
.normalize_evm_version(&solc.version()?)
|
||||||
.with_remappings(self.paths.remappings.clone());
|
.with_remappings(self.paths.remappings.clone());
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue