Struct ethers_contract::multicall_contract::Multicall3
source · pub struct Multicall3<M>(/* private fields */);
abigen
only.Implementations§
source§impl<M: Middleware> Multicall3<M>
impl<M: Middleware> Multicall3<M>
sourcepub fn new<T: Into<Address>>(address: T, client: Arc<M>) -> Self
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.
sourcepub fn aggregate(&self, calls: Vec<Call>) -> ContractCall<M, (U256, Vec<Bytes>)>
pub fn aggregate(&self, calls: Vec<Call>) -> ContractCall<M, (U256, Vec<Bytes>)>
Calls the contract’s aggregate
(0x252dba42) function
sourcepub fn aggregate_3(&self, calls: Vec<Call3>) -> ContractCall<M, Vec<Result>>
pub fn aggregate_3(&self, calls: Vec<Call3>) -> ContractCall<M, Vec<Result>>
Calls the contract’s aggregate3
(0x82ad56cb) function
sourcepub fn aggregate_3_value(
&self,
calls: Vec<Call3Value>
) -> ContractCall<M, Vec<Result>>
pub fn aggregate_3_value( &self, calls: Vec<Call3Value> ) -> ContractCall<M, Vec<Result>>
Calls the contract’s aggregate3Value
(0x174dea71) function
sourcepub fn block_and_aggregate(
&self,
calls: Vec<Call>
) -> ContractCall<M, (U256, [u8; 32], Vec<Result>)>
pub fn block_and_aggregate( &self, calls: Vec<Call> ) -> ContractCall<M, (U256, [u8; 32], Vec<Result>)>
Calls the contract’s blockAndAggregate
(0xc3077fa9) function
sourcepub fn get_basefee(&self) -> ContractCall<M, U256>
pub fn get_basefee(&self) -> ContractCall<M, U256>
Calls the contract’s getBasefee
(0x3e64a696) function
sourcepub fn get_block_hash(&self, block_number: U256) -> ContractCall<M, [u8; 32]>
pub fn get_block_hash(&self, block_number: U256) -> ContractCall<M, [u8; 32]>
Calls the contract’s getBlockHash
(0xee82ac5e) function
sourcepub fn get_block_number(&self) -> ContractCall<M, U256>
pub fn get_block_number(&self) -> ContractCall<M, U256>
Calls the contract’s getBlockNumber
(0x42cbb15c) function
sourcepub fn get_chain_id(&self) -> ContractCall<M, U256>
pub fn get_chain_id(&self) -> ContractCall<M, U256>
Calls the contract’s getChainId
(0x3408e470) function
sourcepub fn get_current_block_coinbase(&self) -> ContractCall<M, Address>
pub fn get_current_block_coinbase(&self) -> ContractCall<M, Address>
Calls the contract’s getCurrentBlockCoinbase
(0xa8b0574e) function
sourcepub fn get_current_block_difficulty(&self) -> ContractCall<M, U256>
pub fn get_current_block_difficulty(&self) -> ContractCall<M, U256>
Calls the contract’s getCurrentBlockDifficulty
(0x72425d9d) function
sourcepub fn get_current_block_gas_limit(&self) -> ContractCall<M, U256>
pub fn get_current_block_gas_limit(&self) -> ContractCall<M, U256>
Calls the contract’s getCurrentBlockGasLimit
(0x86d516e8) function
sourcepub fn get_current_block_timestamp(&self) -> ContractCall<M, U256>
pub fn get_current_block_timestamp(&self) -> ContractCall<M, U256>
Calls the contract’s getCurrentBlockTimestamp
(0x0f28c97d) function
sourcepub fn get_eth_balance(&self, addr: Address) -> ContractCall<M, U256>
pub fn get_eth_balance(&self, addr: Address) -> ContractCall<M, U256>
Calls the contract’s getEthBalance
(0x4d2301cc) function
sourcepub fn get_last_block_hash(&self) -> ContractCall<M, [u8; 32]>
pub fn get_last_block_hash(&self) -> ContractCall<M, [u8; 32]>
Calls the contract’s getLastBlockHash
(0x27e86d6e) function
sourcepub fn try_aggregate(
&self,
require_success: bool,
calls: Vec<Call>
) -> ContractCall<M, Vec<Result>>
pub fn try_aggregate( &self, require_success: bool, calls: Vec<Call> ) -> ContractCall<M, Vec<Result>>
Calls the contract’s tryAggregate
(0xbce38bd7) function
Methods from Deref<Target = Contract<M>>§
sourcepub fn address(&self) -> Address
Available on crate feature providers
only.
pub fn address(&self) -> Address
providers
only.Returns the contract’s address
sourcepub fn abi(&self) -> &Abi
Available on crate feature providers
only.
pub fn abi(&self) -> &Abi
providers
only.Returns a reference to the contract’s ABI.
sourcepub fn client(&self) -> Bwhere
B: Clone,
Available on crate feature providers
only.
pub fn client(&self) -> Bwhere
B: Clone,
providers
only.Returns a pointer to the contract’s client.
sourcepub fn client_ref(&self) -> &M
Available on crate feature providers
only.
pub fn client_ref(&self) -> &M
providers
only.Returns a reference to the contract’s client.
sourcepub fn connect<N>(&self, client: Arc<N>) -> ContractInstance<Arc<N>, N>where
N: Middleware,
Available on crate feature providers
only.
pub fn connect<N>(&self, client: Arc<N>) -> ContractInstance<Arc<N>, N>where
N: Middleware,
providers
only.Returns a new contract instance using the provided client
Clones self
internally
sourcepub fn connect_with<C, N>(&self, client: C) -> ContractInstance<C, N>where
C: Borrow<N>,
Available on crate feature providers
only.
pub fn connect_with<C, N>(&self, client: C) -> ContractInstance<C, N>where
C: Borrow<N>,
providers
only.Returns a new contract instance using the provided client
Clones self
internally
sourcepub fn event_with_filter<D>(&self, filter: Filter) -> Event<B, M, D>
Available on crate feature providers
only.
pub fn event_with_filter<D>(&self, filter: Filter) -> Event<B, M, D>
providers
only.Returns an Event
builder with the provided filter.
sourcepub fn event<D: EthEvent>(&self) -> Event<B, M, D>
Available on crate feature providers
only.
pub fn event<D: EthEvent>(&self) -> Event<B, M, D>
providers
only.Returns an Event
builder for the provided event.
sourcepub fn event_for_name<D>(&self, name: &str) -> Result<Event<B, M, D>, Error>
Available on crate feature providers
only.
pub fn event_for_name<D>(&self, name: &str) -> Result<Event<B, M, D>, Error>
providers
only.Returns an Event
builder with the provided name.
sourcepub fn method_hash<T: Tokenize, D: Detokenize>(
&self,
signature: Selector,
args: T
) -> Result<FunctionCall<B, M, D>, AbiError>
Available on crate feature providers
only.
pub fn method_hash<T: Tokenize, D: Detokenize>( &self, signature: Selector, args: T ) -> Result<FunctionCall<B, M, D>, AbiError>
providers
only.Returns a transaction builder for the selected function signature. This should be preferred if there are overloaded functions in your smart contract
sourcepub fn method<T: Tokenize, D: Detokenize>(
&self,
name: &str,
args: T
) -> Result<FunctionCall<B, M, D>, AbiError>
Available on crate feature providers
only.
pub fn method<T: Tokenize, D: Detokenize>( &self, name: &str, args: T ) -> Result<FunctionCall<B, M, D>, AbiError>
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.
Methods from Deref<Target = BaseContract>§
sourcepub fn encode<T: Tokenize>(
&self,
name: &str,
args: T
) -> Result<Bytes, AbiError>
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
sourcepub fn encode_with_selector<T: Tokenize>(
&self,
signature: Selector,
args: T
) -> Result<Bytes, AbiError>
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
sourcepub fn decode<D: Detokenize, T: AsRef<[u8]>>(
&self,
name: &str,
bytes: T
) -> Result<D, AbiError>
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
sourcepub fn decode_raw<T: AsRef<[u8]>>(
&self,
name: &str,
bytes: T
) -> Result<Vec<Token>, AbiError>
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.
sourcepub fn decode_output<D: Detokenize, T: AsRef<[u8]>>(
&self,
name: &str,
bytes: T
) -> Result<D, AbiError>
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
sourcepub fn decode_output_raw<T: AsRef<[u8]>>(
&self,
name: &str,
bytes: T
) -> Result<Vec<Token>, AbiError>
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.
sourcepub fn decode_event<D: Detokenize>(
&self,
name: &str,
topics: Vec<H256>,
data: Bytes
) -> Result<D, AbiError>
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
sourcepub fn decode_event_raw(
&self,
name: &str,
topics: Vec<H256>,
data: Bytes
) -> Result<Vec<Token>, AbiError>
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.
sourcepub fn decode_with_selector_raw<T: AsRef<[u8]>>(
&self,
signature: Selector,
bytes: T
) -> Result<Vec<Token>, AbiError>
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.
sourcepub fn decode_with_selector<D: Detokenize, T: AsRef<[u8]>>(
&self,
signature: Selector,
bytes: T
) -> Result<D, AbiError>
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
sourcepub fn decode_input_raw<T: AsRef<[u8]>>(
&self,
bytes: T
) -> Result<Vec<Token>, AbiError>
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.
sourcepub fn decode_input<D: Detokenize, T: AsRef<[u8]>>(
&self,
bytes: T
) -> Result<D, AbiError>
pub fn decode_input<D: Detokenize, T: AsRef<[u8]>>( &self, bytes: T ) -> Result<D, AbiError>
Decodes the provided ABI encoded input bytes
sourcepub fn decode_output_with_selector<D: Detokenize, T: AsRef<[u8]>>(
&self,
signature: Selector,
bytes: T
) -> Result<D, AbiError>
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
sourcepub fn decode_output_with_selector_raw<T: AsRef<[u8]>>(
&self,
signature: Selector,
bytes: T
) -> Result<Vec<Token>, AbiError>
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.