Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ethers-solc: add immutableReferences output selector #1523

Merged
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
16 changes: 16 additions & 0 deletions ethers-solc/src/artifacts/output_selection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,7 @@ pub enum DeployedBytecodeOutputSelection {
SourceMap,
LinkReferences,
GeneratedSources,
ImmutableReferences,
}

impl Serialize for DeployedBytecodeOutputSelection {
Expand Down Expand Up @@ -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")
}
}
}
}
Expand All @@ -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)),
}
}
Expand Down Expand Up @@ -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
)
}
}