[][src]Struct ethers_contract::BaseContract

pub struct BaseContract {
    pub methods: HashMap<Selector, (String, usize)>,
    // some fields omitted
}

A reduced form of Contract which just takes the abi and produces ABI encoded data for its functions.

Fields

methods: HashMap<Selector, (String, usize)>

A mapping from method signature to a name-index pair for accessing functions in the contract ABI. This is used to avoid allocation when searching for matching functions by signature.

Implementations

impl BaseContract[src]

pub fn encode<T: Tokenize>(
    &self,
    name: &str,
    args: T
) -> Result<Bytes, AbiError>
[src]

Returns the ABI encoded data for the provided function and arguments

If the function exists multiple times and you want to use one of the overloaded versions, consider using encode_with_selector

pub fn encode_with_selector<T: Tokenize>(
    &self,
    signature: Selector,
    args: T
) -> Result<Bytes, AbiError>
[src]

Returns the ABI encoded data for the provided function selector and arguments

pub fn decode<D: Detokenize, T: AsRef<[u8]>>(
    &self,
    name: &str,
    bytes: T
) -> Result<D, AbiError>
[src]

Decodes the provided ABI encoded function arguments with the selected function name.

If the function exists multiple times and you want to use one of the overloaded versions, consider using decode_with_selector

pub fn decode_event<D: Detokenize>(
    &self,
    name: &str,
    topics: Vec<H256>,
    data: Bytes
) -> Result<D, AbiError>
[src]

Decodes for a given event name, given the log.topics and log.data fields from the transaction receipt

pub fn decode_with_selector<D: Detokenize, T: AsRef<[u8]>>(
    &self,
    signature: Selector,
    bytes: T
) -> Result<D, AbiError>
[src]

Decodes the provided ABI encoded bytes with the selected function selector

pub fn abi(&self) -> &Abi[src]

Returns a reference to the contract's ABI

pub fn into_contract<M: Middleware>(
    self,
    address: Address,
    client: impl Into<Arc<M>>
) -> Contract<M>
[src]

Upgrades a BaseContract into a full fledged contract with an address and middleware.

Trait Implementations

impl AsRef<Contract> for BaseContract[src]

impl Clone for BaseContract[src]

impl Debug for BaseContract[src]

impl From<Contract> for BaseContract[src]

pub fn from(abi: Abi) -> Self[src]

Creates a new BaseContract from the abi.

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Conv for T

impl<T> FmtForward for T

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Pipe for T

impl<T> PipeAsRef for T

impl<T> PipeBorrow for T

impl<T> PipeDeref for T

impl<T> PipeRef for T

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> Tap for T

impl<T, U> TapAsRef<U> for T where
    U: ?Sized

impl<T, U> TapBorrow<U> for T where
    U: ?Sized

impl<T> TapDeref for T

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> TryConv for T

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

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