hopr_bindings/codegen/
hoprcrypto.rs

1/**
2
3Generated by the following Solidity interface...
4```solidity
5interface HoprCrypto {
6    error InvalidCurvePoint();
7    error InvalidFieldElement();
8    error InvalidPointWitness();
9}
10```
11
12...which was generated by the following JSON ABI:
13```json
14[
15  {
16    "type": "error",
17    "name": "InvalidCurvePoint",
18    "inputs": []
19  },
20  {
21    "type": "error",
22    "name": "InvalidFieldElement",
23    "inputs": []
24  },
25  {
26    "type": "error",
27    "name": "InvalidPointWitness",
28    "inputs": []
29  }
30]
31```*/
32#[allow(
33    non_camel_case_types,
34    non_snake_case,
35    clippy::pub_underscore_fields,
36    clippy::style,
37    clippy::empty_structs_with_brackets
38)]
39pub mod HoprCrypto {
40    use super::*;
41    use alloy::sol_types as alloy_sol_types;
42    /// The creation / init bytecode of the contract.
43    ///
44    /// ```text
45    ///0x
46    /// ```
47    #[rustfmt::skip]
48    #[allow(clippy::all)]
49    pub static BYTECODE: alloy_sol_types::private::Bytes = alloy_sol_types::private::Bytes::from_static(
50        b"",
51    );
52    /// The runtime bytecode of the contract, as deployed on the network.
53    ///
54    /// ```text
55    ///0x
56    /// ```
57    #[rustfmt::skip]
58    #[allow(clippy::all)]
59    pub static DEPLOYED_BYTECODE: alloy_sol_types::private::Bytes = alloy_sol_types::private::Bytes::from_static(
60        b"",
61    );
62    #[derive(serde::Serialize, serde::Deserialize)]
63    #[derive(Default, Debug, PartialEq, Eq, Hash)]
64    /**Custom error with signature `InvalidCurvePoint()` and selector `0x72454a82`.
65```solidity
66error InvalidCurvePoint();
67```*/
68    #[allow(non_camel_case_types, non_snake_case, clippy::pub_underscore_fields)]
69    #[derive(Clone)]
70    pub struct InvalidCurvePoint;
71    #[allow(
72        non_camel_case_types,
73        non_snake_case,
74        clippy::pub_underscore_fields,
75        clippy::style
76    )]
77    const _: () = {
78        use alloy::sol_types as alloy_sol_types;
79        #[doc(hidden)]
80        type UnderlyingSolTuple<'a> = ();
81        #[doc(hidden)]
82        type UnderlyingRustTuple<'a> = ();
83        #[cfg(test)]
84        #[allow(dead_code, unreachable_patterns)]
85        fn _type_assertion(
86            _t: alloy_sol_types::private::AssertTypeEq<UnderlyingRustTuple>,
87        ) {
88            match _t {
89                alloy_sol_types::private::AssertTypeEq::<
90                    <UnderlyingSolTuple as alloy_sol_types::SolType>::RustType,
91                >(_) => {}
92            }
93        }
94        #[automatically_derived]
95        #[doc(hidden)]
96        impl ::core::convert::From<InvalidCurvePoint> for UnderlyingRustTuple<'_> {
97            fn from(value: InvalidCurvePoint) -> Self {
98                ()
99            }
100        }
101        #[automatically_derived]
102        #[doc(hidden)]
103        impl ::core::convert::From<UnderlyingRustTuple<'_>> for InvalidCurvePoint {
104            fn from(tuple: UnderlyingRustTuple<'_>) -> Self {
105                Self
106            }
107        }
108        #[automatically_derived]
109        impl alloy_sol_types::SolError for InvalidCurvePoint {
110            type Parameters<'a> = UnderlyingSolTuple<'a>;
111            type Token<'a> = <Self::Parameters<
112                'a,
113            > as alloy_sol_types::SolType>::Token<'a>;
114            const SIGNATURE: &'static str = "InvalidCurvePoint()";
115            const SELECTOR: [u8; 4] = [114u8, 69u8, 74u8, 130u8];
116            #[inline]
117            fn new<'a>(
118                tuple: <Self::Parameters<'a> as alloy_sol_types::SolType>::RustType,
119            ) -> Self {
120                tuple.into()
121            }
122            #[inline]
123            fn tokenize(&self) -> Self::Token<'_> {
124                ()
125            }
126            #[inline]
127            fn abi_decode_raw_validate(data: &[u8]) -> alloy_sol_types::Result<Self> {
128                <Self::Parameters<
129                    '_,
130                > as alloy_sol_types::SolType>::abi_decode_sequence_validate(data)
131                    .map(Self::new)
132            }
133        }
134    };
135    #[derive(serde::Serialize, serde::Deserialize)]
136    #[derive(Default, Debug, PartialEq, Eq, Hash)]
137    /**Custom error with signature `InvalidFieldElement()` and selector `0x3ae4ed6b`.
138```solidity
139error InvalidFieldElement();
140```*/
141    #[allow(non_camel_case_types, non_snake_case, clippy::pub_underscore_fields)]
142    #[derive(Clone)]
143    pub struct InvalidFieldElement;
144    #[allow(
145        non_camel_case_types,
146        non_snake_case,
147        clippy::pub_underscore_fields,
148        clippy::style
149    )]
150    const _: () = {
151        use alloy::sol_types as alloy_sol_types;
152        #[doc(hidden)]
153        type UnderlyingSolTuple<'a> = ();
154        #[doc(hidden)]
155        type UnderlyingRustTuple<'a> = ();
156        #[cfg(test)]
157        #[allow(dead_code, unreachable_patterns)]
158        fn _type_assertion(
159            _t: alloy_sol_types::private::AssertTypeEq<UnderlyingRustTuple>,
160        ) {
161            match _t {
162                alloy_sol_types::private::AssertTypeEq::<
163                    <UnderlyingSolTuple as alloy_sol_types::SolType>::RustType,
164                >(_) => {}
165            }
166        }
167        #[automatically_derived]
168        #[doc(hidden)]
169        impl ::core::convert::From<InvalidFieldElement> for UnderlyingRustTuple<'_> {
170            fn from(value: InvalidFieldElement) -> Self {
171                ()
172            }
173        }
174        #[automatically_derived]
175        #[doc(hidden)]
176        impl ::core::convert::From<UnderlyingRustTuple<'_>> for InvalidFieldElement {
177            fn from(tuple: UnderlyingRustTuple<'_>) -> Self {
178                Self
179            }
180        }
181        #[automatically_derived]
182        impl alloy_sol_types::SolError for InvalidFieldElement {
183            type Parameters<'a> = UnderlyingSolTuple<'a>;
184            type Token<'a> = <Self::Parameters<
185                'a,
186            > as alloy_sol_types::SolType>::Token<'a>;
187            const SIGNATURE: &'static str = "InvalidFieldElement()";
188            const SELECTOR: [u8; 4] = [58u8, 228u8, 237u8, 107u8];
189            #[inline]
190            fn new<'a>(
191                tuple: <Self::Parameters<'a> as alloy_sol_types::SolType>::RustType,
192            ) -> Self {
193                tuple.into()
194            }
195            #[inline]
196            fn tokenize(&self) -> Self::Token<'_> {
197                ()
198            }
199            #[inline]
200            fn abi_decode_raw_validate(data: &[u8]) -> alloy_sol_types::Result<Self> {
201                <Self::Parameters<
202                    '_,
203                > as alloy_sol_types::SolType>::abi_decode_sequence_validate(data)
204                    .map(Self::new)
205            }
206        }
207    };
208    #[derive(serde::Serialize, serde::Deserialize)]
209    #[derive(Default, Debug, PartialEq, Eq, Hash)]
210    /**Custom error with signature `InvalidPointWitness()` and selector `0xedfdcd98`.
211```solidity
212error InvalidPointWitness();
213```*/
214    #[allow(non_camel_case_types, non_snake_case, clippy::pub_underscore_fields)]
215    #[derive(Clone)]
216    pub struct InvalidPointWitness;
217    #[allow(
218        non_camel_case_types,
219        non_snake_case,
220        clippy::pub_underscore_fields,
221        clippy::style
222    )]
223    const _: () = {
224        use alloy::sol_types as alloy_sol_types;
225        #[doc(hidden)]
226        type UnderlyingSolTuple<'a> = ();
227        #[doc(hidden)]
228        type UnderlyingRustTuple<'a> = ();
229        #[cfg(test)]
230        #[allow(dead_code, unreachable_patterns)]
231        fn _type_assertion(
232            _t: alloy_sol_types::private::AssertTypeEq<UnderlyingRustTuple>,
233        ) {
234            match _t {
235                alloy_sol_types::private::AssertTypeEq::<
236                    <UnderlyingSolTuple as alloy_sol_types::SolType>::RustType,
237                >(_) => {}
238            }
239        }
240        #[automatically_derived]
241        #[doc(hidden)]
242        impl ::core::convert::From<InvalidPointWitness> for UnderlyingRustTuple<'_> {
243            fn from(value: InvalidPointWitness) -> Self {
244                ()
245            }
246        }
247        #[automatically_derived]
248        #[doc(hidden)]
249        impl ::core::convert::From<UnderlyingRustTuple<'_>> for InvalidPointWitness {
250            fn from(tuple: UnderlyingRustTuple<'_>) -> Self {
251                Self
252            }
253        }
254        #[automatically_derived]
255        impl alloy_sol_types::SolError for InvalidPointWitness {
256            type Parameters<'a> = UnderlyingSolTuple<'a>;
257            type Token<'a> = <Self::Parameters<
258                'a,
259            > as alloy_sol_types::SolType>::Token<'a>;
260            const SIGNATURE: &'static str = "InvalidPointWitness()";
261            const SELECTOR: [u8; 4] = [237u8, 253u8, 205u8, 152u8];
262            #[inline]
263            fn new<'a>(
264                tuple: <Self::Parameters<'a> as alloy_sol_types::SolType>::RustType,
265            ) -> Self {
266                tuple.into()
267            }
268            #[inline]
269            fn tokenize(&self) -> Self::Token<'_> {
270                ()
271            }
272            #[inline]
273            fn abi_decode_raw_validate(data: &[u8]) -> alloy_sol_types::Result<Self> {
274                <Self::Parameters<
275                    '_,
276                > as alloy_sol_types::SolType>::abi_decode_sequence_validate(data)
277                    .map(Self::new)
278            }
279        }
280    };
281    ///Container for all the [`HoprCrypto`](self) custom errors.
282    #[derive(serde::Serialize, serde::Deserialize)]
283    #[derive(Debug, PartialEq, Eq, Hash)]
284    pub enum HoprCryptoErrors {
285        #[allow(missing_docs)]
286        InvalidCurvePoint(InvalidCurvePoint),
287        #[allow(missing_docs)]
288        InvalidFieldElement(InvalidFieldElement),
289        #[allow(missing_docs)]
290        InvalidPointWitness(InvalidPointWitness),
291    }
292    #[automatically_derived]
293    impl HoprCryptoErrors {
294        /// All the selectors of this enum.
295        ///
296        /// Note that the selectors might not be in the same order as the variants.
297        /// No guarantees are made about the order of the selectors.
298        ///
299        /// Prefer using `SolInterface` methods instead.
300        pub const SELECTORS: &'static [[u8; 4usize]] = &[
301            [58u8, 228u8, 237u8, 107u8],
302            [114u8, 69u8, 74u8, 130u8],
303            [237u8, 253u8, 205u8, 152u8],
304        ];
305    }
306    #[automatically_derived]
307    impl alloy_sol_types::SolInterface for HoprCryptoErrors {
308        const NAME: &'static str = "HoprCryptoErrors";
309        const MIN_DATA_LENGTH: usize = 0usize;
310        const COUNT: usize = 3usize;
311        #[inline]
312        fn selector(&self) -> [u8; 4] {
313            match self {
314                Self::InvalidCurvePoint(_) => {
315                    <InvalidCurvePoint as alloy_sol_types::SolError>::SELECTOR
316                }
317                Self::InvalidFieldElement(_) => {
318                    <InvalidFieldElement as alloy_sol_types::SolError>::SELECTOR
319                }
320                Self::InvalidPointWitness(_) => {
321                    <InvalidPointWitness as alloy_sol_types::SolError>::SELECTOR
322                }
323            }
324        }
325        #[inline]
326        fn selector_at(i: usize) -> ::core::option::Option<[u8; 4]> {
327            Self::SELECTORS.get(i).copied()
328        }
329        #[inline]
330        fn valid_selector(selector: [u8; 4]) -> bool {
331            Self::SELECTORS.binary_search(&selector).is_ok()
332        }
333        #[inline]
334        #[allow(non_snake_case)]
335        fn abi_decode_raw(
336            selector: [u8; 4],
337            data: &[u8],
338        ) -> alloy_sol_types::Result<Self> {
339            static DECODE_SHIMS: &[fn(
340                &[u8],
341            ) -> alloy_sol_types::Result<HoprCryptoErrors>] = &[
342                {
343                    fn InvalidFieldElement(
344                        data: &[u8],
345                    ) -> alloy_sol_types::Result<HoprCryptoErrors> {
346                        <InvalidFieldElement as alloy_sol_types::SolError>::abi_decode_raw(
347                                data,
348                            )
349                            .map(HoprCryptoErrors::InvalidFieldElement)
350                    }
351                    InvalidFieldElement
352                },
353                {
354                    fn InvalidCurvePoint(
355                        data: &[u8],
356                    ) -> alloy_sol_types::Result<HoprCryptoErrors> {
357                        <InvalidCurvePoint as alloy_sol_types::SolError>::abi_decode_raw(
358                                data,
359                            )
360                            .map(HoprCryptoErrors::InvalidCurvePoint)
361                    }
362                    InvalidCurvePoint
363                },
364                {
365                    fn InvalidPointWitness(
366                        data: &[u8],
367                    ) -> alloy_sol_types::Result<HoprCryptoErrors> {
368                        <InvalidPointWitness as alloy_sol_types::SolError>::abi_decode_raw(
369                                data,
370                            )
371                            .map(HoprCryptoErrors::InvalidPointWitness)
372                    }
373                    InvalidPointWitness
374                },
375            ];
376            let Ok(idx) = Self::SELECTORS.binary_search(&selector) else {
377                return Err(
378                    alloy_sol_types::Error::unknown_selector(
379                        <Self as alloy_sol_types::SolInterface>::NAME,
380                        selector,
381                    ),
382                );
383            };
384            DECODE_SHIMS[idx](data)
385        }
386        #[inline]
387        #[allow(non_snake_case)]
388        fn abi_decode_raw_validate(
389            selector: [u8; 4],
390            data: &[u8],
391        ) -> alloy_sol_types::Result<Self> {
392            static DECODE_VALIDATE_SHIMS: &[fn(
393                &[u8],
394            ) -> alloy_sol_types::Result<HoprCryptoErrors>] = &[
395                {
396                    fn InvalidFieldElement(
397                        data: &[u8],
398                    ) -> alloy_sol_types::Result<HoprCryptoErrors> {
399                        <InvalidFieldElement as alloy_sol_types::SolError>::abi_decode_raw_validate(
400                                data,
401                            )
402                            .map(HoprCryptoErrors::InvalidFieldElement)
403                    }
404                    InvalidFieldElement
405                },
406                {
407                    fn InvalidCurvePoint(
408                        data: &[u8],
409                    ) -> alloy_sol_types::Result<HoprCryptoErrors> {
410                        <InvalidCurvePoint as alloy_sol_types::SolError>::abi_decode_raw_validate(
411                                data,
412                            )
413                            .map(HoprCryptoErrors::InvalidCurvePoint)
414                    }
415                    InvalidCurvePoint
416                },
417                {
418                    fn InvalidPointWitness(
419                        data: &[u8],
420                    ) -> alloy_sol_types::Result<HoprCryptoErrors> {
421                        <InvalidPointWitness as alloy_sol_types::SolError>::abi_decode_raw_validate(
422                                data,
423                            )
424                            .map(HoprCryptoErrors::InvalidPointWitness)
425                    }
426                    InvalidPointWitness
427                },
428            ];
429            let Ok(idx) = Self::SELECTORS.binary_search(&selector) else {
430                return Err(
431                    alloy_sol_types::Error::unknown_selector(
432                        <Self as alloy_sol_types::SolInterface>::NAME,
433                        selector,
434                    ),
435                );
436            };
437            DECODE_VALIDATE_SHIMS[idx](data)
438        }
439        #[inline]
440        fn abi_encoded_size(&self) -> usize {
441            match self {
442                Self::InvalidCurvePoint(inner) => {
443                    <InvalidCurvePoint as alloy_sol_types::SolError>::abi_encoded_size(
444                        inner,
445                    )
446                }
447                Self::InvalidFieldElement(inner) => {
448                    <InvalidFieldElement as alloy_sol_types::SolError>::abi_encoded_size(
449                        inner,
450                    )
451                }
452                Self::InvalidPointWitness(inner) => {
453                    <InvalidPointWitness as alloy_sol_types::SolError>::abi_encoded_size(
454                        inner,
455                    )
456                }
457            }
458        }
459        #[inline]
460        fn abi_encode_raw(&self, out: &mut alloy_sol_types::private::Vec<u8>) {
461            match self {
462                Self::InvalidCurvePoint(inner) => {
463                    <InvalidCurvePoint as alloy_sol_types::SolError>::abi_encode_raw(
464                        inner,
465                        out,
466                    )
467                }
468                Self::InvalidFieldElement(inner) => {
469                    <InvalidFieldElement as alloy_sol_types::SolError>::abi_encode_raw(
470                        inner,
471                        out,
472                    )
473                }
474                Self::InvalidPointWitness(inner) => {
475                    <InvalidPointWitness as alloy_sol_types::SolError>::abi_encode_raw(
476                        inner,
477                        out,
478                    )
479                }
480            }
481        }
482    }
483    use alloy::contract as alloy_contract;
484    /**Creates a new wrapper around an on-chain [`HoprCrypto`](self) contract instance.
485
486See the [wrapper's documentation](`HoprCryptoInstance`) for more details.*/
487    #[inline]
488    pub const fn new<
489        P: alloy_contract::private::Provider<N>,
490        N: alloy_contract::private::Network,
491    >(
492        address: alloy_sol_types::private::Address,
493        provider: P,
494    ) -> HoprCryptoInstance<P, N> {
495        HoprCryptoInstance::<P, N>::new(address, provider)
496    }
497    /**Deploys this contract using the given `provider` and constructor arguments, if any.
498
499Returns a new instance of the contract, if the deployment was successful.
500
501For more fine-grained control over the deployment process, use [`deploy_builder`] instead.*/
502    #[inline]
503    pub fn deploy<
504        P: alloy_contract::private::Provider<N>,
505        N: alloy_contract::private::Network,
506    >(
507        provider: P,
508    ) -> impl ::core::future::Future<
509        Output = alloy_contract::Result<HoprCryptoInstance<P, N>>,
510    > {
511        HoprCryptoInstance::<P, N>::deploy(provider)
512    }
513    /**Creates a `RawCallBuilder` for deploying this contract using the given `provider`
514and constructor arguments, if any.
515
516This is a simple wrapper around creating a `RawCallBuilder` with the data set to
517the bytecode concatenated with the constructor's ABI-encoded arguments.*/
518    #[inline]
519    pub fn deploy_builder<
520        P: alloy_contract::private::Provider<N>,
521        N: alloy_contract::private::Network,
522    >(provider: P) -> alloy_contract::RawCallBuilder<P, N> {
523        HoprCryptoInstance::<P, N>::deploy_builder(provider)
524    }
525    /**A [`HoprCrypto`](self) instance.
526
527Contains type-safe methods for interacting with an on-chain instance of the
528[`HoprCrypto`](self) contract located at a given `address`, using a given
529provider `P`.
530
531If the contract bytecode is available (see the [`sol!`](alloy_sol_types::sol!)
532documentation on how to provide it), the `deploy` and `deploy_builder` methods can
533be used to deploy a new instance of the contract.
534
535See the [module-level documentation](self) for all the available methods.*/
536    #[derive(Clone)]
537    pub struct HoprCryptoInstance<P, N = alloy_contract::private::Ethereum> {
538        address: alloy_sol_types::private::Address,
539        provider: P,
540        _network: ::core::marker::PhantomData<N>,
541    }
542    #[automatically_derived]
543    impl<P, N> ::core::fmt::Debug for HoprCryptoInstance<P, N> {
544        #[inline]
545        fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
546            f.debug_tuple("HoprCryptoInstance").field(&self.address).finish()
547        }
548    }
549    /// Instantiation and getters/setters.
550    #[automatically_derived]
551    impl<
552        P: alloy_contract::private::Provider<N>,
553        N: alloy_contract::private::Network,
554    > HoprCryptoInstance<P, N> {
555        /**Creates a new wrapper around an on-chain [`HoprCrypto`](self) contract instance.
556
557See the [wrapper's documentation](`HoprCryptoInstance`) for more details.*/
558        #[inline]
559        pub const fn new(
560            address: alloy_sol_types::private::Address,
561            provider: P,
562        ) -> Self {
563            Self {
564                address,
565                provider,
566                _network: ::core::marker::PhantomData,
567            }
568        }
569        /**Deploys this contract using the given `provider` and constructor arguments, if any.
570
571Returns a new instance of the contract, if the deployment was successful.
572
573For more fine-grained control over the deployment process, use [`deploy_builder`] instead.*/
574        #[inline]
575        pub async fn deploy(
576            provider: P,
577        ) -> alloy_contract::Result<HoprCryptoInstance<P, N>> {
578            let call_builder = Self::deploy_builder(provider);
579            let contract_address = call_builder.deploy().await?;
580            Ok(Self::new(contract_address, call_builder.provider))
581        }
582        /**Creates a `RawCallBuilder` for deploying this contract using the given `provider`
583and constructor arguments, if any.
584
585This is a simple wrapper around creating a `RawCallBuilder` with the data set to
586the bytecode concatenated with the constructor's ABI-encoded arguments.*/
587        #[inline]
588        pub fn deploy_builder(provider: P) -> alloy_contract::RawCallBuilder<P, N> {
589            alloy_contract::RawCallBuilder::new_raw_deploy(
590                provider,
591                ::core::clone::Clone::clone(&BYTECODE),
592            )
593        }
594        /// Returns a reference to the address.
595        #[inline]
596        pub const fn address(&self) -> &alloy_sol_types::private::Address {
597            &self.address
598        }
599        /// Sets the address.
600        #[inline]
601        pub fn set_address(&mut self, address: alloy_sol_types::private::Address) {
602            self.address = address;
603        }
604        /// Sets the address and returns `self`.
605        pub fn at(mut self, address: alloy_sol_types::private::Address) -> Self {
606            self.set_address(address);
607            self
608        }
609        /// Returns a reference to the provider.
610        #[inline]
611        pub const fn provider(&self) -> &P {
612            &self.provider
613        }
614    }
615    impl<P: ::core::clone::Clone, N> HoprCryptoInstance<&P, N> {
616        /// Clones the provider and returns a new instance with the cloned provider.
617        #[inline]
618        pub fn with_cloned_provider(self) -> HoprCryptoInstance<P, N> {
619            HoprCryptoInstance {
620                address: self.address,
621                provider: ::core::clone::Clone::clone(&self.provider),
622                _network: ::core::marker::PhantomData,
623            }
624        }
625    }
626    /// Function calls.
627    #[automatically_derived]
628    impl<
629        P: alloy_contract::private::Provider<N>,
630        N: alloy_contract::private::Network,
631    > HoprCryptoInstance<P, N> {
632        /// Creates a new call builder using this contract instance's provider and address.
633        ///
634        /// Note that the call can be any function call, not just those defined in this
635        /// contract. Prefer using the other methods for building type-safe contract calls.
636        pub fn call_builder<C: alloy_sol_types::SolCall>(
637            &self,
638            call: &C,
639        ) -> alloy_contract::SolCallBuilder<&P, C, N> {
640            alloy_contract::SolCallBuilder::new_sol(&self.provider, &self.address, call)
641        }
642    }
643    /// Event filters.
644    #[automatically_derived]
645    impl<
646        P: alloy_contract::private::Provider<N>,
647        N: alloy_contract::private::Network,
648    > HoprCryptoInstance<P, N> {
649        /// Creates a new event filter using this contract instance's provider and address.
650        ///
651        /// Note that the type can be any event, not just those defined in this contract.
652        /// Prefer using the other methods for building type-safe event filters.
653        pub fn event_filter<E: alloy_sol_types::SolEvent>(
654            &self,
655        ) -> alloy_contract::Event<&P, E, N> {
656            alloy_contract::Event::new_sol(&self.provider, &self.address)
657        }
658    }
659}