openzeppelin_rs/contracts/
ERC2771Context.rs1pub use erc2771_context::*;
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 erc2771_context {
13 #[rustfmt::skip]
14 const __ABI: &str = "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"forwarder\",\"type\":\"address\",\"components\":[]}],\"stateMutability\":\"view\",\"type\":\"function\",\"name\":\"isTrustedForwarder\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\",\"components\":[]}]}]";
15 pub static ERC2771CONTEXT_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 ERC2771Context<M>(::ethers_contract::Contract<M>);
19 impl<M> ::core::clone::Clone for ERC2771Context<M> {
20 fn clone(&self) -> Self {
21 Self(::core::clone::Clone::clone(&self.0))
22 }
23 }
24 impl<M> ::core::ops::Deref for ERC2771Context<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 ERC2771Context<M> {
31 fn deref_mut(&mut self) -> &mut Self::Target {
32 &mut self.0
33 }
34 }
35 impl<M> ::core::fmt::Debug for ERC2771Context<M> {
36 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
37 f.debug_tuple(stringify!(ERC2771Context)).field(&self.address()).finish()
38 }
39 }
40 impl<M: ::ethers_providers::Middleware> ERC2771Context<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 ERC2771CONTEXT_ABI.clone(),
51 client,
52 ),
53 )
54 }
55 pub fn is_trusted_forwarder(
57 &self,
58 forwarder: ::ethers_core::types::Address,
59 ) -> ::ethers_contract::builders::ContractCall<M, bool> {
60 self.0
61 .method_hash([87, 43, 108, 5], forwarder)
62 .expect("method not found (this should never happen)")
63 }
64 }
65 impl<M: ::ethers_providers::Middleware> From<::ethers_contract::Contract<M>>
66 for ERC2771Context<M> {
67 fn from(contract: ::ethers_contract::Contract<M>) -> Self {
68 Self::new(contract.address(), contract.client())
69 }
70 }
71 #[derive(
73 Clone,
74 ::ethers_contract::EthCall,
75 ::ethers_contract::EthDisplay,
76 Default,
77 Debug,
78 PartialEq,
79 Eq,
80 Hash
81 )]
82 #[ethcall(name = "isTrustedForwarder", abi = "isTrustedForwarder(address)")]
83 pub struct IsTrustedForwarderCall {
84 pub forwarder: ::ethers_core::types::Address,
85 }
86 #[derive(
88 Clone,
89 ::ethers_contract::EthAbiType,
90 ::ethers_contract::EthAbiCodec,
91 Default,
92 Debug,
93 PartialEq,
94 Eq,
95 Hash
96 )]
97 pub struct IsTrustedForwarderReturn(pub bool);
98}