fluence_marketplace_api_draft/
misc.rs

1/**
2
3Generated by the following Solidity interface...
4```solidity
5interface Misc {
6    error InvalidCodec(uint64);
7    error MethodNotHandled(uint64);
8}
9```
10
11...which was generated by the following JSON ABI:
12```json
13[
14  {
15    "type": "error",
16    "name": "InvalidCodec",
17    "inputs": [
18      {
19        "name": "",
20        "type": "uint64",
21        "internalType": "uint64"
22      }
23    ]
24  },
25  {
26    "type": "error",
27    "name": "MethodNotHandled",
28    "inputs": [
29      {
30        "name": "",
31        "type": "uint64",
32        "internalType": "uint64"
33      }
34    ]
35  }
36]
37```*/
38#[allow(
39    non_camel_case_types,
40    non_snake_case,
41    clippy::pub_underscore_fields,
42    clippy::style,
43    clippy::empty_structs_with_brackets
44)]
45pub mod Misc {
46    use super::*;
47    use alloy::sol_types as alloy_sol_types;
48    /// The creation / init bytecode of the contract.
49    ///
50    /// ```text
51    ///0x6080806040523460175760399081601c823930815050f35b5f80fdfe5f80fdfea2646970667358221220f5522083012c63da0038129dd122abadbde86156a244242029195bb123502a6c64736f6c634300081c0033
52    /// ```
53    #[rustfmt::skip]
54    #[allow(clippy::all)]
55    pub static BYTECODE: alloy_sol_types::private::Bytes = alloy_sol_types::private::Bytes::from_static(
56        b"`\x80\x80`@R4`\x17W`9\x90\x81`\x1C\x8290\x81PP\xF3[_\x80\xFD\xFE_\x80\xFD\xFE\xA2dipfsX\"\x12 \xF5R \x83\x01,c\xDA\08\x12\x9D\xD1\"\xAB\xAD\xBD\xE8aV\xA2D$ )\x19[\xB1#P*ldsolcC\0\x08\x1C\x003",
57    );
58    /// The runtime bytecode of the contract, as deployed on the network.
59    ///
60    /// ```text
61    ///0x5f80fdfea2646970667358221220f5522083012c63da0038129dd122abadbde86156a244242029195bb123502a6c64736f6c634300081c0033
62    /// ```
63    #[rustfmt::skip]
64    #[allow(clippy::all)]
65    pub static DEPLOYED_BYTECODE: alloy_sol_types::private::Bytes = alloy_sol_types::private::Bytes::from_static(
66        b"_\x80\xFD\xFE\xA2dipfsX\"\x12 \xF5R \x83\x01,c\xDA\08\x12\x9D\xD1\"\xAB\xAD\xBD\xE8aV\xA2D$ )\x19[\xB1#P*ldsolcC\0\x08\x1C\x003",
67    );
68    /**Custom error with signature `InvalidCodec(uint64)` and selector `0xf1f6bced`.
69```solidity
70error InvalidCodec(uint64);
71```*/
72    #[allow(non_camel_case_types, non_snake_case, clippy::pub_underscore_fields)]
73    #[derive(Clone)]
74    pub struct InvalidCodec {
75        #[allow(missing_docs)]
76        pub _0: u64,
77    }
78    #[allow(
79        non_camel_case_types,
80        non_snake_case,
81        clippy::pub_underscore_fields,
82        clippy::style
83    )]
84    const _: () = {
85        use alloy::sol_types as alloy_sol_types;
86        #[doc(hidden)]
87        type UnderlyingSolTuple<'a> = (alloy::sol_types::sol_data::Uint<64>,);
88        #[doc(hidden)]
89        type UnderlyingRustTuple<'a> = (u64,);
90        #[cfg(test)]
91        #[allow(dead_code, unreachable_patterns)]
92        fn _type_assertion(
93            _t: alloy_sol_types::private::AssertTypeEq<UnderlyingRustTuple>,
94        ) {
95            match _t {
96                alloy_sol_types::private::AssertTypeEq::<
97                    <UnderlyingSolTuple as alloy_sol_types::SolType>::RustType,
98                >(_) => {}
99            }
100        }
101        #[automatically_derived]
102        #[doc(hidden)]
103        impl ::core::convert::From<InvalidCodec> for UnderlyingRustTuple<'_> {
104            fn from(value: InvalidCodec) -> Self {
105                (value._0,)
106            }
107        }
108        #[automatically_derived]
109        #[doc(hidden)]
110        impl ::core::convert::From<UnderlyingRustTuple<'_>> for InvalidCodec {
111            fn from(tuple: UnderlyingRustTuple<'_>) -> Self {
112                Self { _0: tuple.0 }
113            }
114        }
115        #[automatically_derived]
116        impl alloy_sol_types::SolError for InvalidCodec {
117            type Parameters<'a> = UnderlyingSolTuple<'a>;
118            type Token<'a> = <Self::Parameters<
119                'a,
120            > as alloy_sol_types::SolType>::Token<'a>;
121            const SIGNATURE: &'static str = "InvalidCodec(uint64)";
122            const SELECTOR: [u8; 4] = [241u8, 246u8, 188u8, 237u8];
123            #[inline]
124            fn new<'a>(
125                tuple: <Self::Parameters<'a> as alloy_sol_types::SolType>::RustType,
126            ) -> Self {
127                tuple.into()
128            }
129            #[inline]
130            fn tokenize(&self) -> Self::Token<'_> {
131                (
132                    <alloy::sol_types::sol_data::Uint<
133                        64,
134                    > as alloy_sol_types::SolType>::tokenize(&self._0),
135                )
136            }
137        }
138    };
139    /**Custom error with signature `MethodNotHandled(uint64)` and selector `0xfa093761`.
140```solidity
141error MethodNotHandled(uint64);
142```*/
143    #[allow(non_camel_case_types, non_snake_case, clippy::pub_underscore_fields)]
144    #[derive(Clone)]
145    pub struct MethodNotHandled {
146        #[allow(missing_docs)]
147        pub _0: u64,
148    }
149    #[allow(
150        non_camel_case_types,
151        non_snake_case,
152        clippy::pub_underscore_fields,
153        clippy::style
154    )]
155    const _: () = {
156        use alloy::sol_types as alloy_sol_types;
157        #[doc(hidden)]
158        type UnderlyingSolTuple<'a> = (alloy::sol_types::sol_data::Uint<64>,);
159        #[doc(hidden)]
160        type UnderlyingRustTuple<'a> = (u64,);
161        #[cfg(test)]
162        #[allow(dead_code, unreachable_patterns)]
163        fn _type_assertion(
164            _t: alloy_sol_types::private::AssertTypeEq<UnderlyingRustTuple>,
165        ) {
166            match _t {
167                alloy_sol_types::private::AssertTypeEq::<
168                    <UnderlyingSolTuple as alloy_sol_types::SolType>::RustType,
169                >(_) => {}
170            }
171        }
172        #[automatically_derived]
173        #[doc(hidden)]
174        impl ::core::convert::From<MethodNotHandled> for UnderlyingRustTuple<'_> {
175            fn from(value: MethodNotHandled) -> Self {
176                (value._0,)
177            }
178        }
179        #[automatically_derived]
180        #[doc(hidden)]
181        impl ::core::convert::From<UnderlyingRustTuple<'_>> for MethodNotHandled {
182            fn from(tuple: UnderlyingRustTuple<'_>) -> Self {
183                Self { _0: tuple.0 }
184            }
185        }
186        #[automatically_derived]
187        impl alloy_sol_types::SolError for MethodNotHandled {
188            type Parameters<'a> = UnderlyingSolTuple<'a>;
189            type Token<'a> = <Self::Parameters<
190                'a,
191            > as alloy_sol_types::SolType>::Token<'a>;
192            const SIGNATURE: &'static str = "MethodNotHandled(uint64)";
193            const SELECTOR: [u8; 4] = [250u8, 9u8, 55u8, 97u8];
194            #[inline]
195            fn new<'a>(
196                tuple: <Self::Parameters<'a> as alloy_sol_types::SolType>::RustType,
197            ) -> Self {
198                tuple.into()
199            }
200            #[inline]
201            fn tokenize(&self) -> Self::Token<'_> {
202                (
203                    <alloy::sol_types::sol_data::Uint<
204                        64,
205                    > as alloy_sol_types::SolType>::tokenize(&self._0),
206                )
207            }
208        }
209    };
210    ///Container for all the [`Misc`](self) custom errors.
211    pub enum MiscErrors {
212        #[allow(missing_docs)]
213        InvalidCodec(InvalidCodec),
214        #[allow(missing_docs)]
215        MethodNotHandled(MethodNotHandled),
216    }
217    #[automatically_derived]
218    impl MiscErrors {
219        /// All the selectors of this enum.
220        ///
221        /// Note that the selectors might not be in the same order as the variants.
222        /// No guarantees are made about the order of the selectors.
223        ///
224        /// Prefer using `SolInterface` methods instead.
225        pub const SELECTORS: &'static [[u8; 4usize]] = &[
226            [241u8, 246u8, 188u8, 237u8],
227            [250u8, 9u8, 55u8, 97u8],
228        ];
229    }
230    #[automatically_derived]
231    impl alloy_sol_types::SolInterface for MiscErrors {
232        const NAME: &'static str = "MiscErrors";
233        const MIN_DATA_LENGTH: usize = 32usize;
234        const COUNT: usize = 2usize;
235        #[inline]
236        fn selector(&self) -> [u8; 4] {
237            match self {
238                Self::InvalidCodec(_) => {
239                    <InvalidCodec as alloy_sol_types::SolError>::SELECTOR
240                }
241                Self::MethodNotHandled(_) => {
242                    <MethodNotHandled as alloy_sol_types::SolError>::SELECTOR
243                }
244            }
245        }
246        #[inline]
247        fn selector_at(i: usize) -> ::core::option::Option<[u8; 4]> {
248            Self::SELECTORS.get(i).copied()
249        }
250        #[inline]
251        fn valid_selector(selector: [u8; 4]) -> bool {
252            Self::SELECTORS.binary_search(&selector).is_ok()
253        }
254        #[inline]
255        #[allow(non_snake_case)]
256        fn abi_decode_raw(
257            selector: [u8; 4],
258            data: &[u8],
259            validate: bool,
260        ) -> alloy_sol_types::Result<Self> {
261            static DECODE_SHIMS: &[fn(
262                &[u8],
263                bool,
264            ) -> alloy_sol_types::Result<MiscErrors>] = &[
265                {
266                    fn InvalidCodec(
267                        data: &[u8],
268                        validate: bool,
269                    ) -> alloy_sol_types::Result<MiscErrors> {
270                        <InvalidCodec as alloy_sol_types::SolError>::abi_decode_raw(
271                                data,
272                                validate,
273                            )
274                            .map(MiscErrors::InvalidCodec)
275                    }
276                    InvalidCodec
277                },
278                {
279                    fn MethodNotHandled(
280                        data: &[u8],
281                        validate: bool,
282                    ) -> alloy_sol_types::Result<MiscErrors> {
283                        <MethodNotHandled as alloy_sol_types::SolError>::abi_decode_raw(
284                                data,
285                                validate,
286                            )
287                            .map(MiscErrors::MethodNotHandled)
288                    }
289                    MethodNotHandled
290                },
291            ];
292            let Ok(idx) = Self::SELECTORS.binary_search(&selector) else {
293                return Err(
294                    alloy_sol_types::Error::unknown_selector(
295                        <Self as alloy_sol_types::SolInterface>::NAME,
296                        selector,
297                    ),
298                );
299            };
300            DECODE_SHIMS[idx](data, validate)
301        }
302        #[inline]
303        fn abi_encoded_size(&self) -> usize {
304            match self {
305                Self::InvalidCodec(inner) => {
306                    <InvalidCodec as alloy_sol_types::SolError>::abi_encoded_size(inner)
307                }
308                Self::MethodNotHandled(inner) => {
309                    <MethodNotHandled as alloy_sol_types::SolError>::abi_encoded_size(
310                        inner,
311                    )
312                }
313            }
314        }
315        #[inline]
316        fn abi_encode_raw(&self, out: &mut alloy_sol_types::private::Vec<u8>) {
317            match self {
318                Self::InvalidCodec(inner) => {
319                    <InvalidCodec as alloy_sol_types::SolError>::abi_encode_raw(
320                        inner,
321                        out,
322                    )
323                }
324                Self::MethodNotHandled(inner) => {
325                    <MethodNotHandled as alloy_sol_types::SolError>::abi_encode_raw(
326                        inner,
327                        out,
328                    )
329                }
330            }
331        }
332    }
333    use alloy::contract as alloy_contract;
334    /**Creates a new wrapper around an on-chain [`Misc`](self) contract instance.
335
336See the [wrapper's documentation](`MiscInstance`) for more details.*/
337    #[inline]
338    pub const fn new<
339        T: alloy_contract::private::Transport + ::core::clone::Clone,
340        P: alloy_contract::private::Provider<T, N>,
341        N: alloy_contract::private::Network,
342    >(address: alloy_sol_types::private::Address, provider: P) -> MiscInstance<T, P, N> {
343        MiscInstance::<T, P, N>::new(address, provider)
344    }
345    /**Deploys this contract using the given `provider` and constructor arguments, if any.
346
347Returns a new instance of the contract, if the deployment was successful.
348
349For more fine-grained control over the deployment process, use [`deploy_builder`] instead.*/
350    #[inline]
351    pub fn deploy<
352        T: alloy_contract::private::Transport + ::core::clone::Clone,
353        P: alloy_contract::private::Provider<T, N>,
354        N: alloy_contract::private::Network,
355    >(
356        provider: P,
357    ) -> impl ::core::future::Future<
358        Output = alloy_contract::Result<MiscInstance<T, P, N>>,
359    > {
360        MiscInstance::<T, P, N>::deploy(provider)
361    }
362    /**Creates a `RawCallBuilder` for deploying this contract using the given `provider`
363and constructor arguments, if any.
364
365This is a simple wrapper around creating a `RawCallBuilder` with the data set to
366the bytecode concatenated with the constructor's ABI-encoded arguments.*/
367    #[inline]
368    pub fn deploy_builder<
369        T: alloy_contract::private::Transport + ::core::clone::Clone,
370        P: alloy_contract::private::Provider<T, N>,
371        N: alloy_contract::private::Network,
372    >(provider: P) -> alloy_contract::RawCallBuilder<T, P, N> {
373        MiscInstance::<T, P, N>::deploy_builder(provider)
374    }
375    /**A [`Misc`](self) instance.
376
377Contains type-safe methods for interacting with an on-chain instance of the
378[`Misc`](self) contract located at a given `address`, using a given
379provider `P`.
380
381If the contract bytecode is available (see the [`sol!`](alloy_sol_types::sol!)
382documentation on how to provide it), the `deploy` and `deploy_builder` methods can
383be used to deploy a new instance of the contract.
384
385See the [module-level documentation](self) for all the available methods.*/
386    #[derive(Clone)]
387    pub struct MiscInstance<T, P, N = alloy_contract::private::Ethereum> {
388        address: alloy_sol_types::private::Address,
389        provider: P,
390        _network_transport: ::core::marker::PhantomData<(N, T)>,
391    }
392    #[automatically_derived]
393    impl<T, P, N> ::core::fmt::Debug for MiscInstance<T, P, N> {
394        #[inline]
395        fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
396            f.debug_tuple("MiscInstance").field(&self.address).finish()
397        }
398    }
399    /// Instantiation and getters/setters.
400    #[automatically_derived]
401    impl<
402        T: alloy_contract::private::Transport + ::core::clone::Clone,
403        P: alloy_contract::private::Provider<T, N>,
404        N: alloy_contract::private::Network,
405    > MiscInstance<T, P, N> {
406        /**Creates a new wrapper around an on-chain [`Misc`](self) contract instance.
407
408See the [wrapper's documentation](`MiscInstance`) for more details.*/
409        #[inline]
410        pub const fn new(
411            address: alloy_sol_types::private::Address,
412            provider: P,
413        ) -> Self {
414            Self {
415                address,
416                provider,
417                _network_transport: ::core::marker::PhantomData,
418            }
419        }
420        /**Deploys this contract using the given `provider` and constructor arguments, if any.
421
422Returns a new instance of the contract, if the deployment was successful.
423
424For more fine-grained control over the deployment process, use [`deploy_builder`] instead.*/
425        #[inline]
426        pub async fn deploy(
427            provider: P,
428        ) -> alloy_contract::Result<MiscInstance<T, P, N>> {
429            let call_builder = Self::deploy_builder(provider);
430            let contract_address = call_builder.deploy().await?;
431            Ok(Self::new(contract_address, call_builder.provider))
432        }
433        /**Creates a `RawCallBuilder` for deploying this contract using the given `provider`
434and constructor arguments, if any.
435
436This is a simple wrapper around creating a `RawCallBuilder` with the data set to
437the bytecode concatenated with the constructor's ABI-encoded arguments.*/
438        #[inline]
439        pub fn deploy_builder(provider: P) -> alloy_contract::RawCallBuilder<T, P, N> {
440            alloy_contract::RawCallBuilder::new_raw_deploy(
441                provider,
442                ::core::clone::Clone::clone(&BYTECODE),
443            )
444        }
445        /// Returns a reference to the address.
446        #[inline]
447        pub const fn address(&self) -> &alloy_sol_types::private::Address {
448            &self.address
449        }
450        /// Sets the address.
451        #[inline]
452        pub fn set_address(&mut self, address: alloy_sol_types::private::Address) {
453            self.address = address;
454        }
455        /// Sets the address and returns `self`.
456        pub fn at(mut self, address: alloy_sol_types::private::Address) -> Self {
457            self.set_address(address);
458            self
459        }
460        /// Returns a reference to the provider.
461        #[inline]
462        pub const fn provider(&self) -> &P {
463            &self.provider
464        }
465    }
466    impl<T, P: ::core::clone::Clone, N> MiscInstance<T, &P, N> {
467        /// Clones the provider and returns a new instance with the cloned provider.
468        #[inline]
469        pub fn with_cloned_provider(self) -> MiscInstance<T, P, N> {
470            MiscInstance {
471                address: self.address,
472                provider: ::core::clone::Clone::clone(&self.provider),
473                _network_transport: ::core::marker::PhantomData,
474            }
475        }
476    }
477    /// Function calls.
478    #[automatically_derived]
479    impl<
480        T: alloy_contract::private::Transport + ::core::clone::Clone,
481        P: alloy_contract::private::Provider<T, N>,
482        N: alloy_contract::private::Network,
483    > MiscInstance<T, P, N> {
484        /// Creates a new call builder using this contract instance's provider and address.
485        ///
486        /// Note that the call can be any function call, not just those defined in this
487        /// contract. Prefer using the other methods for building type-safe contract calls.
488        pub fn call_builder<C: alloy_sol_types::SolCall>(
489            &self,
490            call: &C,
491        ) -> alloy_contract::SolCallBuilder<T, &P, C, N> {
492            alloy_contract::SolCallBuilder::new_sol(&self.provider, &self.address, call)
493        }
494    }
495    /// Event filters.
496    #[automatically_derived]
497    impl<
498        T: alloy_contract::private::Transport + ::core::clone::Clone,
499        P: alloy_contract::private::Provider<T, N>,
500        N: alloy_contract::private::Network,
501    > MiscInstance<T, P, N> {
502        /// Creates a new event filter using this contract instance's provider and address.
503        ///
504        /// Note that the type can be any event, not just those defined in this contract.
505        /// Prefer using the other methods for building type-safe event filters.
506        pub fn event_filter<E: alloy_sol_types::SolEvent>(
507            &self,
508        ) -> alloy_contract::Event<T, &P, E, N> {
509            alloy_contract::Event::new_sol(&self.provider, &self.address)
510        }
511    }
512}