openzeppelin_rs/contracts/
Multicall.rs1pub use multicall::*;
2#[allow(
5 clippy::enum_variant_names,
6 clippy::too_many_arguments,
7 clippy::upper_case_acronyms,
8 clippy::type_complexity,
9 dead_code,
10 non_camel_case_types,
11)]
12pub mod multicall {
13 #[rustfmt::skip]
14 const __ABI: &str = "[{\"inputs\":[{\"internalType\":\"bytes[]\",\"name\":\"data\",\"type\":\"bytes[]\",\"components\":[]}],\"stateMutability\":\"nonpayable\",\"type\":\"function\",\"name\":\"multicall\",\"outputs\":[{\"internalType\":\"bytes[]\",\"name\":\"results\",\"type\":\"bytes[]\",\"components\":[]}]}]";
15 pub static MULTICALL_ABI: ::ethers_contract::Lazy<::ethers_core::abi::Abi> = ::ethers_contract::Lazy::new(||
17 ::ethers_core::utils::__serde_json::from_str(__ABI).expect("ABI is always valid"));
18 pub struct Multicall<M>(::ethers_contract::Contract<M>);
19 impl<M> ::core::clone::Clone for Multicall<M> {
20 fn clone(&self) -> Self {
21 Self(::core::clone::Clone::clone(&self.0))
22 }
23 }
24 impl<M> ::core::ops::Deref for Multicall<M> {
25 type Target = ::ethers_contract::Contract<M>;
26 fn deref(&self) -> &Self::Target {
27 &self.0
28 }
29 }
30 impl<M> ::core::ops::DerefMut for Multicall<M> {
31 fn deref_mut(&mut self) -> &mut Self::Target {
32 &mut self.0
33 }
34 }
35 impl<M> ::core::fmt::Debug for Multicall<M> {
36 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
37 f.debug_tuple(stringify!(Multicall)).field(&self.address()).finish()
38 }
39 }
40 impl<M: ::ethers_providers::Middleware> Multicall<M> {
41 pub fn new<T: Into<::ethers_core::types::Address>>(
44 address: T,
45 client: ::std::sync::Arc<M>,
46 ) -> Self {
47 Self(
48 ::ethers_contract::Contract::new(
49 address.into(),
50 MULTICALL_ABI.clone(),
51 client,
52 ),
53 )
54 }
55 pub fn multicall(
57 &self,
58 data: ::std::vec::Vec<::ethers_core::types::Bytes>,
59 ) -> ::ethers_contract::builders::ContractCall<
60 M,
61 ::std::vec::Vec<::ethers_core::types::Bytes>,
62 > {
63 self.0
64 .method_hash([172, 150, 80, 216], data)
65 .expect("method not found (this should never happen)")
66 }
67 }
68 impl<M: ::ethers_providers::Middleware> From<::ethers_contract::Contract<M>>
69 for Multicall<M> {
70 fn from(contract: ::ethers_contract::Contract<M>) -> Self {
71 Self::new(contract.address(), contract.client())
72 }
73 }
74 #[derive(
76 Clone,
77 ::ethers_contract::EthCall,
78 ::ethers_contract::EthDisplay,
79 Default,
80 Debug,
81 PartialEq,
82 Eq,
83 Hash
84 )]
85 #[ethcall(name = "multicall", abi = "multicall(bytes[])")]
86 pub struct MulticallCall {
87 pub data: ::std::vec::Vec<::ethers_core::types::Bytes>,
88 }
89 #[derive(
91 Clone,
92 ::ethers_contract::EthAbiType,
93 ::ethers_contract::EthAbiCodec,
94 Default,
95 Debug,
96 PartialEq,
97 Eq,
98 Hash
99 )]
100 pub struct MulticallReturn {
101 pub results: ::std::vec::Vec<::ethers_core::types::Bytes>,
102 }
103}