From e8cab82740b1c0d80188c82b5b2b574072dac63f Mon Sep 17 00:00:00 2001 From: Mark Tyneway Date: Wed, 27 Jul 2022 18:38:24 -0700 Subject: [PATCH 1/2] ethers-solc: add immutableReferences output selector It is a property on the deployed bytecode object on the compiler output. This is the precursor for `forge inspect immutableReferences`. --- ethers-solc/src/artifacts/output_selection.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/ethers-solc/src/artifacts/output_selection.rs b/ethers-solc/src/artifacts/output_selection.rs index b55463505..a016b6efb 100644 --- a/ethers-solc/src/artifacts/output_selection.rs +++ b/ethers-solc/src/artifacts/output_selection.rs @@ -427,6 +427,7 @@ pub enum DeployedBytecodeOutputSelection { SourceMap, LinkReferences, GeneratedSources, + ImmutableReferences, } impl Serialize for DeployedBytecodeOutputSelection { @@ -465,6 +466,9 @@ impl fmt::Display for DeployedBytecodeOutputSelection { DeployedBytecodeOutputSelection::GeneratedSources => { f.write_str("evm.deployedBytecode.generatedSources") } + DeployedBytecodeOutputSelection::ImmutableReferences => { + f.write_str("evm.deployedBytecode.immutableReferences") + } } } } @@ -487,6 +491,9 @@ impl FromStr for DeployedBytecodeOutputSelection { "evm.deployedBytecode.generatedSources" => { Ok(DeployedBytecodeOutputSelection::GeneratedSources) } + "evm.deployedBytecode.immutableReferences" => { + Ok(DeployedBytecodeOutputSelection::ImmutableReferences) + } s => Err(format!("Invalid deployedBytecode selection: {}", s)), } } @@ -573,4 +580,13 @@ mod tests { let s = serde_json::to_string(&empty).unwrap(); assert_eq!(s, r#"{"contract.sol":{"*":[]}}"#); } + + #[test] + fn deployed_bytecode_from_str() { + assert_eq!( + DeployedBytecodeOutputSelection::from_str("evm.deployedBytecode.immutableReferences") + .unwrap(), + DeployedBytecodeOutputSelection::ImmutableReferences + ) + } } From 7d1781e1b3e8a9c42782f7ddffb4f6257ee8a56d Mon Sep 17 00:00:00 2001 From: Mark Tyneway Date: Wed, 27 Jul 2022 18:43:23 -0700 Subject: [PATCH 2/2] chore: update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index fefd41127..86013cc18 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ ### Unreleased +- Add `evm.deployedBytecode.immutableReferences` output selector [#1523](https://github.com/gakonst/ethers-rs/pull/1523) - Added `get_erc1155_token_transfer_events` function for etherscan client [#1503](https://github.com/gakonst/ethers-rs/pull/1503) - Add support for Geth `debug_traceTransaction` [#1469](https://github.com/gakonst/ethers-rs/pull/1469) - Use correct, new transaction type for `typool_content` RPC endpoint [#1501](https://github.com/gakonst/ethers-rs/pull/1501)