Struct ethers_contract::MulticallContract
source · pub struct MulticallContract<M>(_);
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 the given Address
. The contract derefs to a crate
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 event<D: EthEvent>(&self) -> Event<'_, M, D>
pub fn event<D: EthEvent>(&self) -> Event<'_, M, D>
Returns an Event
builder for the provided event.
sourcepub fn event_with_filter<D: EthLogDecode>(
&self,
filter: Filter
) -> Event<'_, M, D>
pub fn event_with_filter<D: EthLogDecode>(
&self,
filter: Filter
) -> Event<'_, M, D>
Returns an Event
builder with the provided filter.
sourcepub fn event_for_name<D: EthLogDecode>(
&self,
name: &str
) -> Result<Event<'_, M, D>, Error>
pub fn event_for_name<D: EthLogDecode>(
&self,
name: &str
) -> Result<Event<'_, M, D>, Error>
Returns an Event
builder with the provided name.
sourcepub fn method<T: Tokenize, D: Detokenize>(
&self,
name: &str,
args: T
) -> Result<ContractCall<M, D>, AbiError>
pub fn method<T: Tokenize, D: Detokenize>(
&self,
name: &str,
args: T
) -> Result<ContractCall<M, D>, AbiError>
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.
sourcepub fn method_hash<T: Tokenize, D: Detokenize>(
&self,
signature: Selector,
args: T
) -> Result<ContractCall<M, D>, AbiError>
pub fn method_hash<T: Tokenize, D: Detokenize>(
&self,
signature: Selector,
args: T
) -> Result<ContractCall<M, D>, AbiError>
Returns a transaction builder for the selected function signature. This should be preferred if there are overloaded functions in your smart contract
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
pub fn decode_output_with_selector<D: Detokenize, T: AsRef<[u8]>>(
&self,
signature: Selector,
bytes: T
) -> Result<D, AbiError>
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.