ethers-solc: add immutableReferences output selector (#1523)

* 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 <contract-name> immutableReferences`.

* chore: update changelog
This commit is contained in:
Mark Tyneway 2022-07-28 11:07:24 -07:00 committed by GitHub
parent 81a2a5ed68
commit 16f686df26
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 0 deletions

View File

@ -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)

View File

@ -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
)
}
}