Skip to main content

revive_solc_json_interface/standard_json/input/settings/
metadata.rs

1//! The `solc --standard-json` input settings metadata.
2
3use serde::Deserialize;
4use serde::Serialize;
5
6use crate::standard_json::input::settings::metadata_hash::MetadataHash;
7
8/// The `solc --standard-json` input settings metadata.
9#[derive(Clone, Debug, Default, Serialize, Deserialize)]
10#[serde(rename_all = "camelCase")]
11pub struct Metadata {
12    /// The bytecode hash mode.
13    #[serde(skip_serializing_if = "Option::is_none")]
14    pub bytecode_hash: Option<MetadataHash>,
15}
16
17impl Metadata {
18    /// A shortcut constructor.
19    pub fn new(bytecode_hash: MetadataHash) -> Self {
20        Self {
21            bytecode_hash: Some(bytecode_hash),
22        }
23    }
24}