Struct ethers_solc::artifacts::contract::CompactContract
source · pub struct CompactContract {
pub abi: Option<Abi>,
pub bin: Option<BytecodeObject>,
pub bin_runtime: Option<BytecodeObject>,
}
Expand description
The general purpose minimal representation of a contract’s abi with bytecode
Unlike CompactContractSome
all fields are optional so that every possible compiler output can
be represented by it
Fields§
§abi: Option<Abi>
The Ethereum Contract ABI. If empty, it is represented as an empty array. See https://docs.soliditylang.org/en/develop/abi-spec.html
bin: Option<BytecodeObject>
§bin_runtime: Option<BytecodeObject>
Implementations§
source§impl CompactContract
impl CompactContract
sourcepub fn into_parts(self) -> (Option<Abi>, Option<Bytes>, Option<Bytes>)
pub fn into_parts(self) -> (Option<Abi>, Option<Bytes>, Option<Bytes>)
Returns the contents of this type as a single tuple of abi, bytecode and deployed bytecode
sourcepub fn into_parts_or_default(self) -> (Abi, Bytes, Bytes)
pub fn into_parts_or_default(self) -> (Abi, Bytes, Bytes)
Returns the individual parts of this contract.
If the values are None
, then Default
is returned.
sourcepub fn unwrap(self) -> CompactContractSome
pub fn unwrap(self) -> CompactContractSome
Returns the CompactContractSome
if all fields are Some
Panics
Panics if any of the fields euqal None
Example
use ethers_solc::Project;
use ethers_solc::artifacts::*;
let mut output = project.compile().unwrap().output();
let contract: CompactContract = output.remove_first("Greeter").unwrap().into();
let contract = contract.unwrap();
sourcepub fn unwrap_or_default(self) -> CompactContractSome
pub fn unwrap_or_default(self) -> CompactContractSome
Returns the CompactContractSome
if any if the field equals None
the Default
value is
returned
Unlike unwrap
, this function does not panic
Trait Implementations§
source§impl Clone for CompactContract
impl Clone for CompactContract
source§fn clone(&self) -> CompactContract
fn clone(&self) -> CompactContract
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for CompactContract
impl Debug for CompactContract
source§impl Default for CompactContract
impl Default for CompactContract
source§fn default() -> CompactContract
fn default() -> CompactContract
Returns the “default value” for a type. Read more
source§impl<'de> Deserialize<'de> for CompactContract
impl<'de> Deserialize<'de> for CompactContract
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl From<CompactContractBytecode> for CompactContract
impl From<CompactContractBytecode> for CompactContract
source§fn from(c: CompactContractBytecode) -> Self
fn from(c: CompactContractBytecode) -> Self
Converts to this type from the input type.
source§impl<'a> From<CompactContractRef<'a>> for CompactContract
impl<'a> From<CompactContractRef<'a>> for CompactContract
source§fn from(c: CompactContractRef<'a>) -> Self
fn from(c: CompactContractRef<'a>) -> Self
Converts to this type from the input type.
source§impl<'a> From<CompactContractRefSome<'a>> for CompactContract
impl<'a> From<CompactContractRefSome<'a>> for CompactContract
source§fn from(c: CompactContractRefSome<'a>) -> Self
fn from(c: CompactContractRefSome<'a>) -> Self
Converts to this type from the input type.
source§impl From<CompactContractSome> for CompactContract
impl From<CompactContractSome> for CompactContract
source§fn from(c: CompactContractSome) -> Self
fn from(c: CompactContractSome) -> Self
Converts to this type from the input type.
source§impl From<ConfigurableContractArtifact> for CompactContract
impl From<ConfigurableContractArtifact> for CompactContract
source§fn from(artifact: ConfigurableContractArtifact) -> Self
fn from(artifact: ConfigurableContractArtifact) -> Self
Converts to this type from the input type.
source§impl From<Contract> for CompactContract
impl From<Contract> for CompactContract
source§impl From<ContractBytecode> for CompactContract
impl From<ContractBytecode> for CompactContract
source§fn from(c: ContractBytecode) -> Self
fn from(c: ContractBytecode) -> Self
Converts to this type from the input type.
source§impl From<ContractBytecodeSome> for CompactContract
impl From<ContractBytecodeSome> for CompactContract
source§fn from(c: ContractBytecodeSome) -> Self
fn from(c: ContractBytecodeSome) -> Self
Converts to this type from the input type.
source§impl From<HardhatArtifact> for CompactContract
impl From<HardhatArtifact> for CompactContract
source§fn from(artifact: HardhatArtifact) -> Self
fn from(artifact: HardhatArtifact) -> Self
Converts to this type from the input type.
source§impl From<Value> for CompactContract
impl From<Value> for CompactContract
source§impl PartialEq<CompactContract> for CompactContract
impl PartialEq<CompactContract> for CompactContract
source§fn eq(&self, other: &CompactContract) -> bool
fn eq(&self, other: &CompactContract) -> bool
source§impl Serialize for CompactContract
impl Serialize for CompactContract
source§impl TryFrom<CompactContract> for CompactContractSome
impl TryFrom<CompactContract> for CompactContractSome
§type Error = CompactContract
type Error = CompactContract
The type returned in the event of a conversion error.