openzeppelin_rs/contracts/
DoubleEndedQueue.rs

1pub use double_ended_queue::*;
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 double_ended_queue {
13    #[rustfmt::skip]
14    const __ABI: &str = "[{\"inputs\":[],\"type\":\"error\",\"name\":\"Empty\",\"outputs\":[]},{\"inputs\":[],\"type\":\"error\",\"name\":\"OutOfBounds\",\"outputs\":[]}]";
15    ///The parsed JSON ABI of the contract.
16    pub static DOUBLEENDEDQUEUE_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    #[rustfmt::skip]
19    const __BYTECODE: &[u8] = &[
20        96,
21        86,
22        96,
23        55,
24        96,
25        11,
26        130,
27        130,
28        130,
29        57,
30        128,
31        81,
32        96,
33        0,
34        26,
35        96,
36        115,
37        20,
38        96,
39        42,
40        87,
41        99,
42        78,
43        72,
44        123,
45        113,
46        96,
47        224,
48        27,
49        96,
50        0,
51        82,
52        96,
53        0,
54        96,
55        4,
56        82,
57        96,
58        36,
59        96,
60        0,
61        253,
62        91,
63        48,
64        96,
65        0,
66        82,
67        96,
68        115,
69        129,
70        83,
71        130,
72        129,
73        243,
74        254,
75        115,
76        0,
77        0,
78        0,
79        0,
80        0,
81        0,
82        0,
83        0,
84        0,
85        0,
86        0,
87        0,
88        0,
89        0,
90        0,
91        0,
92        0,
93        0,
94        0,
95        0,
96        48,
97        20,
98        96,
99        128,
100        96,
101        64,
102        82,
103        96,
104        0,
105        128,
106        253,
107        254,
108        162,
109        100,
110        105,
111        112,
112        102,
113        115,
114        88,
115        34,
116        18,
117        32,
118        129,
119        13,
120        150,
121        190,
122        89,
123        39,
124        227,
125        74,
126        218,
127        189,
128        96,
129        104,
130        249,
131        206,
132        107,
133        74,
134        209,
135        244,
136        179,
137        123,
138        86,
139        246,
140        78,
141        88,
142        233,
143        0,
144        21,
145        152,
146        7,
147        144,
148        165,
149        42,
150        100,
151        115,
152        111,
153        108,
154        99,
155        67,
156        0,
157        8,
158        13,
159        0,
160        51,
161    ];
162    ///The bytecode of the contract.
163    pub static DOUBLEENDEDQUEUE_BYTECODE: ::ethers_core::types::Bytes = ::ethers_core::types::Bytes::from_static(
164        __BYTECODE,
165    );
166    #[rustfmt::skip]
167    const __DEPLOYED_BYTECODE: &[u8] = &[
168        115,
169        0,
170        0,
171        0,
172        0,
173        0,
174        0,
175        0,
176        0,
177        0,
178        0,
179        0,
180        0,
181        0,
182        0,
183        0,
184        0,
185        0,
186        0,
187        0,
188        0,
189        48,
190        20,
191        96,
192        128,
193        96,
194        64,
195        82,
196        96,
197        0,
198        128,
199        253,
200        254,
201        162,
202        100,
203        105,
204        112,
205        102,
206        115,
207        88,
208        34,
209        18,
210        32,
211        129,
212        13,
213        150,
214        190,
215        89,
216        39,
217        227,
218        74,
219        218,
220        189,
221        96,
222        104,
223        249,
224        206,
225        107,
226        74,
227        209,
228        244,
229        179,
230        123,
231        86,
232        246,
233        78,
234        88,
235        233,
236        0,
237        21,
238        152,
239        7,
240        144,
241        165,
242        42,
243        100,
244        115,
245        111,
246        108,
247        99,
248        67,
249        0,
250        8,
251        13,
252        0,
253        51,
254    ];
255    ///The deployed bytecode of the contract.
256    pub static DOUBLEENDEDQUEUE_DEPLOYED_BYTECODE: ::ethers_core::types::Bytes = ::ethers_core::types::Bytes::from_static(
257        __DEPLOYED_BYTECODE,
258    );
259    pub struct DoubleEndedQueue<M>(::ethers_contract::Contract<M>);
260    impl<M> ::core::clone::Clone for DoubleEndedQueue<M> {
261        fn clone(&self) -> Self {
262            Self(::core::clone::Clone::clone(&self.0))
263        }
264    }
265    impl<M> ::core::ops::Deref for DoubleEndedQueue<M> {
266        type Target = ::ethers_contract::Contract<M>;
267        fn deref(&self) -> &Self::Target {
268            &self.0
269        }
270    }
271    impl<M> ::core::ops::DerefMut for DoubleEndedQueue<M> {
272        fn deref_mut(&mut self) -> &mut Self::Target {
273            &mut self.0
274        }
275    }
276    impl<M> ::core::fmt::Debug for DoubleEndedQueue<M> {
277        fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
278            f.debug_tuple(stringify!(DoubleEndedQueue)).field(&self.address()).finish()
279        }
280    }
281    impl<M: ::ethers_providers::Middleware> DoubleEndedQueue<M> {
282        /// Creates a new contract instance with the specified `ethers` client at
283        /// `address`. The contract derefs to a `ethers::Contract` object.
284        pub fn new<T: Into<::ethers_core::types::Address>>(
285            address: T,
286            client: ::std::sync::Arc<M>,
287        ) -> Self {
288            Self(
289                ::ethers_contract::Contract::new(
290                    address.into(),
291                    DOUBLEENDEDQUEUE_ABI.clone(),
292                    client,
293                ),
294            )
295        }
296        /// Constructs the general purpose `Deployer` instance based on the provided constructor arguments and sends it.
297        /// Returns a new instance of a deployer that returns an instance of this contract after sending the transaction
298        ///
299        /// Notes:
300        /// - If there are no constructor arguments, you should pass `()` as the argument.
301        /// - The default poll duration is 7 seconds.
302        /// - The default number of confirmations is 1 block.
303        ///
304        ///
305        /// # Example
306        ///
307        /// Generate contract bindings with `abigen!` and deploy a new contract instance.
308        ///
309        /// *Note*: this requires a `bytecode` and `abi` object in the `greeter.json` artifact.
310        ///
311        /// ```ignore
312        /// # async fn deploy<M: ethers::providers::Middleware>(client: ::std::sync::Arc<M>) {
313        ///     abigen!(Greeter, "../greeter.json");
314        ///
315        ///    let greeter_contract = Greeter::deploy(client, "Hello world!".to_string()).unwrap().send().await.unwrap();
316        ///    let msg = greeter_contract.greet().call().await.unwrap();
317        /// # }
318        /// ```
319        pub fn deploy<T: ::ethers_core::abi::Tokenize>(
320            client: ::std::sync::Arc<M>,
321            constructor_args: T,
322        ) -> ::core::result::Result<
323            ::ethers_contract::builders::ContractDeployer<M, Self>,
324            ::ethers_contract::ContractError<M>,
325        > {
326            let factory = ::ethers_contract::ContractFactory::new(
327                DOUBLEENDEDQUEUE_ABI.clone(),
328                DOUBLEENDEDQUEUE_BYTECODE.clone().into(),
329                client,
330            );
331            let deployer = factory.deploy(constructor_args)?;
332            let deployer = ::ethers_contract::ContractDeployer::new(deployer);
333            Ok(deployer)
334        }
335    }
336    impl<M: ::ethers_providers::Middleware> From<::ethers_contract::Contract<M>>
337    for DoubleEndedQueue<M> {
338        fn from(contract: ::ethers_contract::Contract<M>) -> Self {
339            Self::new(contract.address(), contract.client())
340        }
341    }
342    ///Custom Error type `Empty` with signature `Empty()` and selector `0x3db2a12a`
343    #[derive(
344        Clone,
345        ::ethers_contract::EthError,
346        ::ethers_contract::EthDisplay,
347        Default,
348        Debug,
349        PartialEq,
350        Eq,
351        Hash
352    )]
353    #[etherror(name = "Empty", abi = "Empty()")]
354    pub struct Empty;
355    ///Custom Error type `OutOfBounds` with signature `OutOfBounds()` and selector `0xb4120f14`
356    #[derive(
357        Clone,
358        ::ethers_contract::EthError,
359        ::ethers_contract::EthDisplay,
360        Default,
361        Debug,
362        PartialEq,
363        Eq,
364        Hash
365    )]
366    #[etherror(name = "OutOfBounds", abi = "OutOfBounds()")]
367    pub struct OutOfBounds;
368    ///Container type for all of the contract's custom errors
369    #[derive(Clone, ::ethers_contract::EthAbiType, Debug, PartialEq, Eq, Hash)]
370    pub enum DoubleEndedQueueErrors {
371        Empty(Empty),
372        OutOfBounds(OutOfBounds),
373        /// The standard solidity revert string, with selector
374        /// Error(string) -- 0x08c379a0
375        RevertString(::std::string::String),
376    }
377    impl ::ethers_core::abi::AbiDecode for DoubleEndedQueueErrors {
378        fn decode(
379            data: impl AsRef<[u8]>,
380        ) -> ::core::result::Result<Self, ::ethers_core::abi::AbiError> {
381            let data = data.as_ref();
382            if let Ok(decoded)
383                = <::std::string::String as ::ethers_core::abi::AbiDecode>::decode(
384                    data,
385                ) {
386                return Ok(Self::RevertString(decoded));
387            }
388            if let Ok(decoded) = <Empty as ::ethers_core::abi::AbiDecode>::decode(data) {
389                return Ok(Self::Empty(decoded));
390            }
391            if let Ok(decoded)
392                = <OutOfBounds as ::ethers_core::abi::AbiDecode>::decode(data) {
393                return Ok(Self::OutOfBounds(decoded));
394            }
395            Err(::ethers_core::abi::Error::InvalidData.into())
396        }
397    }
398    impl ::ethers_core::abi::AbiEncode for DoubleEndedQueueErrors {
399        fn encode(self) -> ::std::vec::Vec<u8> {
400            match self {
401                Self::Empty(element) => ::ethers_core::abi::AbiEncode::encode(element),
402                Self::OutOfBounds(element) => {
403                    ::ethers_core::abi::AbiEncode::encode(element)
404                }
405                Self::RevertString(s) => ::ethers_core::abi::AbiEncode::encode(s),
406            }
407        }
408    }
409    impl ::ethers_contract::ContractRevert for DoubleEndedQueueErrors {
410        fn valid_selector(selector: [u8; 4]) -> bool {
411            match selector {
412                [0x08, 0xc3, 0x79, 0xa0] => true,
413                _ if selector == <Empty as ::ethers_contract::EthError>::selector() => {
414                    true
415                }
416                _ if selector
417                    == <OutOfBounds as ::ethers_contract::EthError>::selector() => true,
418                _ => false,
419            }
420        }
421    }
422    impl ::core::fmt::Display for DoubleEndedQueueErrors {
423        fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
424            match self {
425                Self::Empty(element) => ::core::fmt::Display::fmt(element, f),
426                Self::OutOfBounds(element) => ::core::fmt::Display::fmt(element, f),
427                Self::RevertString(s) => ::core::fmt::Display::fmt(s, f),
428            }
429        }
430    }
431    impl ::core::convert::From<::std::string::String> for DoubleEndedQueueErrors {
432        fn from(value: String) -> Self {
433            Self::RevertString(value)
434        }
435    }
436    impl ::core::convert::From<Empty> for DoubleEndedQueueErrors {
437        fn from(value: Empty) -> Self {
438            Self::Empty(value)
439        }
440    }
441    impl ::core::convert::From<OutOfBounds> for DoubleEndedQueueErrors {
442        fn from(value: OutOfBounds) -> Self {
443            Self::OutOfBounds(value)
444        }
445    }
446}