openzeppelin_rs/contracts/
ICrossDomainMessenger.rs

1pub use i_cross_domain_messenger::*;
2/// This module was auto-generated with ethers-rs Abigen.
3/// More information at: <https://github.com/gakonst/ethers-rs>
4#[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 i_cross_domain_messenger {
13    #[rustfmt::skip]
14    const __ABI: &str = "[{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"msgHash\",\"type\":\"bytes32\",\"components\":[],\"indexed\":true}],\"type\":\"event\",\"name\":\"FailedRelayedMessage\",\"outputs\":[],\"anonymous\":false},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"msgHash\",\"type\":\"bytes32\",\"components\":[],\"indexed\":true}],\"type\":\"event\",\"name\":\"RelayedMessage\",\"outputs\":[],\"anonymous\":false},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"target\",\"type\":\"address\",\"components\":[],\"indexed\":true},{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\",\"components\":[],\"indexed\":false},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\",\"components\":[],\"indexed\":false},{\"internalType\":\"uint256\",\"name\":\"messageNonce\",\"type\":\"uint256\",\"components\":[],\"indexed\":false},{\"internalType\":\"uint256\",\"name\":\"gasLimit\",\"type\":\"uint256\",\"components\":[],\"indexed\":false}],\"type\":\"event\",\"name\":\"SentMessage\",\"outputs\":[],\"anonymous\":false},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_target\",\"type\":\"address\",\"components\":[]},{\"internalType\":\"bytes\",\"name\":\"_message\",\"type\":\"bytes\",\"components\":[]},{\"internalType\":\"uint32\",\"name\":\"_gasLimit\",\"type\":\"uint32\",\"components\":[]}],\"stateMutability\":\"nonpayable\",\"type\":\"function\",\"name\":\"sendMessage\",\"outputs\":[]},{\"inputs\":[],\"stateMutability\":\"view\",\"type\":\"function\",\"name\":\"xDomainMessageSender\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\",\"components\":[]}]}]";
15    ///The parsed JSON ABI of the contract.
16    pub static ICROSSDOMAINMESSENGER_ABI: ::ethers_contract::Lazy<
17        ::ethers_core::abi::Abi,
18    > = ::ethers_contract::Lazy::new(|| {
19        ::ethers_core::utils::__serde_json::from_str(__ABI).expect("ABI is always valid")
20    });
21    pub struct ICrossDomainMessenger<M>(::ethers_contract::Contract<M>);
22    impl<M> ::core::clone::Clone for ICrossDomainMessenger<M> {
23        fn clone(&self) -> Self {
24            Self(::core::clone::Clone::clone(&self.0))
25        }
26    }
27    impl<M> ::core::ops::Deref for ICrossDomainMessenger<M> {
28        type Target = ::ethers_contract::Contract<M>;
29        fn deref(&self) -> &Self::Target {
30            &self.0
31        }
32    }
33    impl<M> ::core::ops::DerefMut for ICrossDomainMessenger<M> {
34        fn deref_mut(&mut self) -> &mut Self::Target {
35            &mut self.0
36        }
37    }
38    impl<M> ::core::fmt::Debug for ICrossDomainMessenger<M> {
39        fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
40            f.debug_tuple(stringify!(ICrossDomainMessenger))
41                .field(&self.address())
42                .finish()
43        }
44    }
45    impl<M: ::ethers_providers::Middleware> ICrossDomainMessenger<M> {
46        /// Creates a new contract instance with the specified `ethers` client at
47        /// `address`. The contract derefs to a `ethers::Contract` object.
48        pub fn new<T: Into<::ethers_core::types::Address>>(
49            address: T,
50            client: ::std::sync::Arc<M>,
51        ) -> Self {
52            Self(
53                ::ethers_contract::Contract::new(
54                    address.into(),
55                    ICROSSDOMAINMESSENGER_ABI.clone(),
56                    client,
57                ),
58            )
59        }
60        ///Calls the contract's `sendMessage` (0x3dbb202b) function
61        pub fn send_message(
62            &self,
63            target: ::ethers_core::types::Address,
64            message: ::ethers_core::types::Bytes,
65            gas_limit: u32,
66        ) -> ::ethers_contract::builders::ContractCall<M, ()> {
67            self.0
68                .method_hash([61, 187, 32, 43], (target, message, gas_limit))
69                .expect("method not found (this should never happen)")
70        }
71        ///Calls the contract's `xDomainMessageSender` (0x6e296e45) function
72        pub fn x_domain_message_sender(
73            &self,
74        ) -> ::ethers_contract::builders::ContractCall<
75            M,
76            ::ethers_core::types::Address,
77        > {
78            self.0
79                .method_hash([110, 41, 110, 69], ())
80                .expect("method not found (this should never happen)")
81        }
82        ///Gets the contract's `FailedRelayedMessage` event
83        pub fn failed_relayed_message_filter(
84            &self,
85        ) -> ::ethers_contract::builders::Event<
86            ::std::sync::Arc<M>,
87            M,
88            FailedRelayedMessageFilter,
89        > {
90            self.0.event()
91        }
92        ///Gets the contract's `RelayedMessage` event
93        pub fn relayed_message_filter(
94            &self,
95        ) -> ::ethers_contract::builders::Event<
96            ::std::sync::Arc<M>,
97            M,
98            RelayedMessageFilter,
99        > {
100            self.0.event()
101        }
102        ///Gets the contract's `SentMessage` event
103        pub fn sent_message_filter(
104            &self,
105        ) -> ::ethers_contract::builders::Event<
106            ::std::sync::Arc<M>,
107            M,
108            SentMessageFilter,
109        > {
110            self.0.event()
111        }
112        /// Returns an `Event` builder for all the events of this contract.
113        pub fn events(
114            &self,
115        ) -> ::ethers_contract::builders::Event<
116            ::std::sync::Arc<M>,
117            M,
118            ICrossDomainMessengerEvents,
119        > {
120            self.0.event_with_filter(::core::default::Default::default())
121        }
122    }
123    impl<M: ::ethers_providers::Middleware> From<::ethers_contract::Contract<M>>
124    for ICrossDomainMessenger<M> {
125        fn from(contract: ::ethers_contract::Contract<M>) -> Self {
126            Self::new(contract.address(), contract.client())
127        }
128    }
129    #[derive(
130        Clone,
131        ::ethers_contract::EthEvent,
132        ::ethers_contract::EthDisplay,
133        Default,
134        Debug,
135        PartialEq,
136        Eq,
137        Hash
138    )]
139    #[ethevent(name = "FailedRelayedMessage", abi = "FailedRelayedMessage(bytes32)")]
140    pub struct FailedRelayedMessageFilter {
141        #[ethevent(indexed)]
142        pub msg_hash: [u8; 32],
143    }
144    #[derive(
145        Clone,
146        ::ethers_contract::EthEvent,
147        ::ethers_contract::EthDisplay,
148        Default,
149        Debug,
150        PartialEq,
151        Eq,
152        Hash
153    )]
154    #[ethevent(name = "RelayedMessage", abi = "RelayedMessage(bytes32)")]
155    pub struct RelayedMessageFilter {
156        #[ethevent(indexed)]
157        pub msg_hash: [u8; 32],
158    }
159    #[derive(
160        Clone,
161        ::ethers_contract::EthEvent,
162        ::ethers_contract::EthDisplay,
163        Default,
164        Debug,
165        PartialEq,
166        Eq,
167        Hash
168    )]
169    #[ethevent(
170        name = "SentMessage",
171        abi = "SentMessage(address,address,bytes,uint256,uint256)"
172    )]
173    pub struct SentMessageFilter {
174        #[ethevent(indexed)]
175        pub target: ::ethers_core::types::Address,
176        pub sender: ::ethers_core::types::Address,
177        pub message: ::ethers_core::types::Bytes,
178        pub message_nonce: ::ethers_core::types::U256,
179        pub gas_limit: ::ethers_core::types::U256,
180    }
181    ///Container type for all of the contract's events
182    #[derive(Clone, ::ethers_contract::EthAbiType, Debug, PartialEq, Eq, Hash)]
183    pub enum ICrossDomainMessengerEvents {
184        FailedRelayedMessageFilter(FailedRelayedMessageFilter),
185        RelayedMessageFilter(RelayedMessageFilter),
186        SentMessageFilter(SentMessageFilter),
187    }
188    impl ::ethers_contract::EthLogDecode for ICrossDomainMessengerEvents {
189        fn decode_log(
190            log: &::ethers_core::abi::RawLog,
191        ) -> ::core::result::Result<Self, ::ethers_core::abi::Error> {
192            if let Ok(decoded) = FailedRelayedMessageFilter::decode_log(log) {
193                return Ok(
194                    ICrossDomainMessengerEvents::FailedRelayedMessageFilter(decoded),
195                );
196            }
197            if let Ok(decoded) = RelayedMessageFilter::decode_log(log) {
198                return Ok(ICrossDomainMessengerEvents::RelayedMessageFilter(decoded));
199            }
200            if let Ok(decoded) = SentMessageFilter::decode_log(log) {
201                return Ok(ICrossDomainMessengerEvents::SentMessageFilter(decoded));
202            }
203            Err(::ethers_core::abi::Error::InvalidData)
204        }
205    }
206    impl ::core::fmt::Display for ICrossDomainMessengerEvents {
207        fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
208            match self {
209                Self::FailedRelayedMessageFilter(element) => {
210                    ::core::fmt::Display::fmt(element, f)
211                }
212                Self::RelayedMessageFilter(element) => {
213                    ::core::fmt::Display::fmt(element, f)
214                }
215                Self::SentMessageFilter(element) => ::core::fmt::Display::fmt(element, f),
216            }
217        }
218    }
219    impl ::core::convert::From<FailedRelayedMessageFilter>
220    for ICrossDomainMessengerEvents {
221        fn from(value: FailedRelayedMessageFilter) -> Self {
222            Self::FailedRelayedMessageFilter(value)
223        }
224    }
225    impl ::core::convert::From<RelayedMessageFilter> for ICrossDomainMessengerEvents {
226        fn from(value: RelayedMessageFilter) -> Self {
227            Self::RelayedMessageFilter(value)
228        }
229    }
230    impl ::core::convert::From<SentMessageFilter> for ICrossDomainMessengerEvents {
231        fn from(value: SentMessageFilter) -> Self {
232            Self::SentMessageFilter(value)
233        }
234    }
235    ///Container type for all input parameters for the `sendMessage` function with signature `sendMessage(address,bytes,uint32)` and selector `0x3dbb202b`
236    #[derive(
237        Clone,
238        ::ethers_contract::EthCall,
239        ::ethers_contract::EthDisplay,
240        Default,
241        Debug,
242        PartialEq,
243        Eq,
244        Hash
245    )]
246    #[ethcall(name = "sendMessage", abi = "sendMessage(address,bytes,uint32)")]
247    pub struct SendMessageCall {
248        pub target: ::ethers_core::types::Address,
249        pub message: ::ethers_core::types::Bytes,
250        pub gas_limit: u32,
251    }
252    ///Container type for all input parameters for the `xDomainMessageSender` function with signature `xDomainMessageSender()` and selector `0x6e296e45`
253    #[derive(
254        Clone,
255        ::ethers_contract::EthCall,
256        ::ethers_contract::EthDisplay,
257        Default,
258        Debug,
259        PartialEq,
260        Eq,
261        Hash
262    )]
263    #[ethcall(name = "xDomainMessageSender", abi = "xDomainMessageSender()")]
264    pub struct XdomainMessageSenderCall;
265    ///Container type for all of the contract's call
266    #[derive(Clone, ::ethers_contract::EthAbiType, Debug, PartialEq, Eq, Hash)]
267    pub enum ICrossDomainMessengerCalls {
268        SendMessage(SendMessageCall),
269        XdomainMessageSender(XdomainMessageSenderCall),
270    }
271    impl ::ethers_core::abi::AbiDecode for ICrossDomainMessengerCalls {
272        fn decode(
273            data: impl AsRef<[u8]>,
274        ) -> ::core::result::Result<Self, ::ethers_core::abi::AbiError> {
275            let data = data.as_ref();
276            if let Ok(decoded)
277                = <SendMessageCall as ::ethers_core::abi::AbiDecode>::decode(data) {
278                return Ok(Self::SendMessage(decoded));
279            }
280            if let Ok(decoded)
281                = <XdomainMessageSenderCall as ::ethers_core::abi::AbiDecode>::decode(
282                    data,
283                ) {
284                return Ok(Self::XdomainMessageSender(decoded));
285            }
286            Err(::ethers_core::abi::Error::InvalidData.into())
287        }
288    }
289    impl ::ethers_core::abi::AbiEncode for ICrossDomainMessengerCalls {
290        fn encode(self) -> Vec<u8> {
291            match self {
292                Self::SendMessage(element) => {
293                    ::ethers_core::abi::AbiEncode::encode(element)
294                }
295                Self::XdomainMessageSender(element) => {
296                    ::ethers_core::abi::AbiEncode::encode(element)
297                }
298            }
299        }
300    }
301    impl ::core::fmt::Display for ICrossDomainMessengerCalls {
302        fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
303            match self {
304                Self::SendMessage(element) => ::core::fmt::Display::fmt(element, f),
305                Self::XdomainMessageSender(element) => {
306                    ::core::fmt::Display::fmt(element, f)
307                }
308            }
309        }
310    }
311    impl ::core::convert::From<SendMessageCall> for ICrossDomainMessengerCalls {
312        fn from(value: SendMessageCall) -> Self {
313            Self::SendMessage(value)
314        }
315    }
316    impl ::core::convert::From<XdomainMessageSenderCall> for ICrossDomainMessengerCalls {
317        fn from(value: XdomainMessageSenderCall) -> Self {
318            Self::XdomainMessageSender(value)
319        }
320    }
321    ///Container type for all return fields from the `xDomainMessageSender` function with signature `xDomainMessageSender()` and selector `0x6e296e45`
322    #[derive(
323        Clone,
324        ::ethers_contract::EthAbiType,
325        ::ethers_contract::EthAbiCodec,
326        Default,
327        Debug,
328        PartialEq,
329        Eq,
330        Hash
331    )]
332    pub struct XdomainMessageSenderReturn(pub ::ethers_core::types::Address);
333}