Struct ethers_core::abi::Contract

source ·
pub struct Contract {
    pub constructor: Option<Constructor>,
    pub functions: BTreeMap<String, Vec<Function>>,
    pub events: BTreeMap<String, Vec<Event>>,
    pub errors: BTreeMap<String, Vec<Error>>,
    pub receive: bool,
    pub fallback: bool,
}
Expand description

API building calls to contracts ABI.

Fields§

§constructor: Option<Constructor>

Contract constructor.

§functions: BTreeMap<String, Vec<Function>>

Contract functions.

§events: BTreeMap<String, Vec<Event>>

Contract events, maps signature to event.

§errors: BTreeMap<String, Vec<Error>>

Contract errors, maps signature to error.

§receive: bool

Contract has receive function.

§fallback: bool

Contract has fallback function.

Implementations§

source§

impl Contract

source

pub fn load<T>(reader: T) -> Result<Contract, Error>
where T: Read,

Available on crate feature full-serde only.

Loads contract from json.

source

pub fn constructor(&self) -> Option<&Constructor>

Creates constructor call builder.

source

pub fn function(&self, name: &str) -> Result<&Function, Error>

Get the function named name, the first if there are overloaded versions of the same function.

source

pub fn event(&self, name: &str) -> Result<&Event, Error>

Get the contract event named name, the first if there are multiple.

source

pub fn error(&self, name: &str) -> Result<&Error, Error>

Get the contract error named name, the first if there are multiple.

source

pub fn events_by_name(&self, name: &str) -> Result<&Vec<Event>, Error>

Get all contract events named name.

source

pub fn functions_by_name(&self, name: &str) -> Result<&Vec<Function>, Error>

Get all functions named name.

source

pub fn errors_by_name(&self, name: &str) -> Result<&Vec<Error>, Error>

Get all errors named name.

source

pub fn functions(&self) -> Functions<'_>

Iterate over all functions of the contract in arbitrary order.

source

pub fn events(&self) -> Events<'_>

Iterate over all events of the contract in arbitrary order.

source

pub fn errors(&self) -> AbiErrors<'_>

Iterate over all errors of the contract in arbitrary order.

Trait Implementations§

source§

impl Clone for Contract

source§

fn clone(&self) -> Contract

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Contract

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
source§

impl Default for Contract

source§

fn default() -> Contract

Returns the “default value” for a type. Read more
source§

impl<'a> Deserialize<'a> for Contract

Available on crate feature serde only.
source§

fn deserialize<D>( deserializer: D ) -> Result<Contract, <D as Deserializer<'a>>::Error>
where D: Deserializer<'a>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl PartialEq for Contract

source§

fn eq(&self, other: &Contract) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Serialize for Contract

Available on crate feature serde only.
source§

fn serialize<S>( &self, serializer: S ) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl StructuralPartialEq for Contract

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V

source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

source§

impl<T> JsonSchemaMaybe for T