pub struct Multicall3<M>(/* private fields */);
Available on crate feature abigen only.

Implementations§

source§

impl<M: Middleware> Multicall3<M>

source

pub fn new<T: Into<Address>>(address: T, client: Arc<M>) -> Self

Creates a new contract instance with the specified ethers client at address. The contract derefs to a ethers::Contract object.

source

pub fn aggregate(&self, calls: Vec<Call>) -> ContractCall<M, (U256, Vec<Bytes>)>

Calls the contract’s aggregate (0x252dba42) function

source

pub fn aggregate_3(&self, calls: Vec<Call3>) -> ContractCall<M, Vec<Result>>

Calls the contract’s aggregate3 (0x82ad56cb) function

source

pub fn aggregate_3_value( &self, calls: Vec<Call3Value> ) -> ContractCall<M, Vec<Result>>

Calls the contract’s aggregate3Value (0x174dea71) function

source

pub fn block_and_aggregate( &self, calls: Vec<Call> ) -> ContractCall<M, (U256, [u8; 32], Vec<Result>)>

Calls the contract’s blockAndAggregate (0xc3077fa9) function

source

pub fn get_basefee(&self) -> ContractCall<M, U256>

Calls the contract’s getBasefee (0x3e64a696) function

source

pub fn get_block_hash(&self, block_number: U256) -> ContractCall<M, [u8; 32]>

Calls the contract’s getBlockHash (0xee82ac5e) function

source

pub fn get_block_number(&self) -> ContractCall<M, U256>

Calls the contract’s getBlockNumber (0x42cbb15c) function

source

pub fn get_chain_id(&self) -> ContractCall<M, U256>

Calls the contract’s getChainId (0x3408e470) function

source

pub fn get_current_block_coinbase(&self) -> ContractCall<M, Address>

Calls the contract’s getCurrentBlockCoinbase (0xa8b0574e) function

source

pub fn get_current_block_difficulty(&self) -> ContractCall<M, U256>

Calls the contract’s getCurrentBlockDifficulty (0x72425d9d) function

source

pub fn get_current_block_gas_limit(&self) -> ContractCall<M, U256>

Calls the contract’s getCurrentBlockGasLimit (0x86d516e8) function

source

pub fn get_current_block_timestamp(&self) -> ContractCall<M, U256>

Calls the contract’s getCurrentBlockTimestamp (0x0f28c97d) function

source

pub fn get_eth_balance(&self, addr: Address) -> ContractCall<M, U256>

Calls the contract’s getEthBalance (0x4d2301cc) function

source

pub fn get_last_block_hash(&self) -> ContractCall<M, [u8; 32]>

Calls the contract’s getLastBlockHash (0x27e86d6e) function

source

pub fn try_aggregate( &self, require_success: bool, calls: Vec<Call> ) -> ContractCall<M, Vec<Result>>

Calls the contract’s tryAggregate (0xbce38bd7) function

source

pub fn try_block_and_aggregate( &self, require_success: bool, calls: Vec<Call> ) -> ContractCall<M, (U256, [u8; 32], Vec<Result>)>

Calls the contract’s tryBlockAndAggregate (0x399542e9) function

Methods from Deref<Target = Contract<M>>§

source

pub fn address(&self) -> Address

Available on crate feature providers only.

Returns the contract’s address

source

pub fn abi(&self) -> &Abi

Available on crate feature providers only.

Returns a reference to the contract’s ABI.

source

pub fn client(&self) -> B
where B: Clone,

Available on crate feature providers only.

Returns a pointer to the contract’s client.

source

pub fn client_ref(&self) -> &M

Available on crate feature providers only.

Returns a reference to the contract’s client.

source

pub fn connect<N>(&self, client: Arc<N>) -> ContractInstance<Arc<N>, N>
where N: Middleware,

Available on crate feature providers only.

Returns a new contract instance using the provided client

Clones self internally

source

pub fn connect_with<C, N>(&self, client: C) -> ContractInstance<C, N>
where C: Borrow<N>,

Available on crate feature providers only.

Returns a new contract instance using the provided client

Clones self internally

source

pub fn event_with_filter<D>(&self, filter: Filter) -> Event<B, M, D>

Available on crate feature providers only.

Returns an Event builder with the provided filter.

source

pub fn event<D: EthEvent>(&self) -> Event<B, M, D>

Available on crate feature providers only.

Returns an Event builder for the provided event.

source

pub fn event_for_name<D>(&self, name: &str) -> Result<Event<B, M, D>, Error>

Available on crate feature providers only.

Returns an Event builder with the provided name.

source

pub fn method_hash<T: Tokenize, D: Detokenize>( &self, signature: Selector, args: T ) -> Result<FunctionCall<B, M, D>, AbiError>

Available on crate feature providers only.

Returns a transaction builder for the selected function signature. This should be preferred if there are overloaded functions in your smart contract

source

pub fn method<T: Tokenize, D: Detokenize>( &self, name: &str, args: T ) -> Result<FunctionCall<B, M, D>, AbiError>

Available on crate feature providers only.

Returns a transaction builder for the provided function name. If there are multiple functions with the same name due to overloading, consider using the method_hash method instead, since this will use the first match.

source

pub fn at<T: Into<Address>>(&self, address: T) -> Self

Available on crate feature providers only.

Returns a new contract instance at address.

Clones self internally

Methods from Deref<Target = BaseContract>§

source

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

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

source

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

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

source

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

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

source

pub fn decode_raw<T: AsRef<[u8]>>( &self, name: &str, bytes: T ) -> Result<Vec<Token>, AbiError>

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

Returns a Token vector, which lets you decode function arguments dynamically without knowing the return type.

source

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

Decodes the provided ABI encoded function output 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

source

pub fn decode_output_raw<T: AsRef<[u8]>>( &self, name: &str, bytes: T ) -> Result<Vec<Token>, AbiError>

Decodes the provided ABI encoded function output 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

Returns a Token vector, which lets you decode function arguments dynamically without knowing the return type.

source

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

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

source

pub fn decode_event_raw( &self, name: &str, topics: Vec<H256>, data: Bytes ) -> Result<Vec<Token>, AbiError>

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

Returns a Token vector, which lets you decode function arguments dynamically without knowing the return type.

source

pub fn decode_with_selector_raw<T: AsRef<[u8]>>( &self, signature: Selector, bytes: T ) -> Result<Vec<Token>, AbiError>

Decodes the provided ABI encoded bytes with the selected function selector

Returns a Token vector, which lets you decode function arguments dynamically without knowing the return type.

source

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

Decodes the provided ABI encoded bytes with the selected function selector

source

pub fn decode_input_raw<T: AsRef<[u8]>>( &self, bytes: T ) -> Result<Vec<Token>, AbiError>

Decodes the provided ABI encoded input bytes

Returns a Token vector, which lets you decode function arguments dynamically without knowing the return type.

source

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

Decodes the provided ABI encoded input bytes

source

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

Decode the provided ABI encoded bytes as the output of the provided function selector

source

pub fn decode_output_with_selector_raw<T: AsRef<[u8]>>( &self, signature: Selector, bytes: T ) -> Result<Vec<Token>, AbiError>

Decodes the provided ABI encoded bytes with the selected function selector

Returns a Token vector, which lets you decode function arguments dynamically without knowing the return type.

source

pub fn abi(&self) -> &Abi

Returns a reference to the contract’s ABI

Trait Implementations§

source§

impl<M> Clone for Multicall3<M>

source§

fn clone(&self) -> Self

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<M> Debug for Multicall3<M>

source§

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

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

impl<M> Deref for Multicall3<M>

§

type Target = ContractInstance<Arc<M>, M>

The resulting type after dereferencing.
source§

fn deref(&self) -> &Self::Target

Dereferences the value.
source§

impl<M> DerefMut for Multicall3<M>

source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.
source§

impl<M: Middleware> From<ContractInstance<Arc<M>, M>> for Multicall3<M>

source§

fn from(contract: Contract<M>) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

§

impl<M> RefUnwindSafe for Multicall3<M>
where M: RefUnwindSafe,

§

impl<M> Send for Multicall3<M>
where M: Sync + Send,

§

impl<M> Sync for Multicall3<M>
where M: Sync + Send,

§

impl<M> Unpin for Multicall3<M>
where M: Unpin,

§

impl<M> UnwindSafe for Multicall3<M>

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> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

impl<T> JsonSchemaMaybe for T