hopr_bindings/codegen/
hopr_crypto.rs

1pub use hopr_crypto::*;
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 hopr_crypto {
13    #[allow(deprecated)]
14    fn __abi() -> ::ethers::core::abi::Abi {
15        ::ethers::core::abi::ethabi::Contract {
16            constructor: ::core::option::Option::None,
17            functions: ::std::collections::BTreeMap::new(),
18            events: ::std::collections::BTreeMap::new(),
19            errors: ::core::convert::From::from([
20                (
21                    ::std::borrow::ToOwned::to_owned("InvalidCurvePoint"),
22                    ::std::vec![
23                        ::ethers::core::abi::ethabi::AbiError {
24                            name: ::std::borrow::ToOwned::to_owned("InvalidCurvePoint"),
25                            inputs: ::std::vec![],
26                        },
27                    ],
28                ),
29                (
30                    ::std::borrow::ToOwned::to_owned("InvalidFieldElement"),
31                    ::std::vec![
32                        ::ethers::core::abi::ethabi::AbiError {
33                            name: ::std::borrow::ToOwned::to_owned(
34                                "InvalidFieldElement",
35                            ),
36                            inputs: ::std::vec![],
37                        },
38                    ],
39                ),
40                (
41                    ::std::borrow::ToOwned::to_owned("InvalidPointWitness"),
42                    ::std::vec![
43                        ::ethers::core::abi::ethabi::AbiError {
44                            name: ::std::borrow::ToOwned::to_owned(
45                                "InvalidPointWitness",
46                            ),
47                            inputs: ::std::vec![],
48                        },
49                    ],
50                ),
51            ]),
52            receive: false,
53            fallback: false,
54        }
55    }
56    ///The parsed JSON ABI of the contract.
57    pub static HOPRCRYPTO_ABI: ::ethers::contract::Lazy<::ethers::core::abi::Abi> = ::ethers::contract::Lazy::new(
58        __abi,
59    );
60    pub struct HoprCrypto<M>(::ethers::contract::Contract<M>);
61    impl<M> ::core::clone::Clone for HoprCrypto<M> {
62        fn clone(&self) -> Self {
63            Self(::core::clone::Clone::clone(&self.0))
64        }
65    }
66    impl<M> ::core::ops::Deref for HoprCrypto<M> {
67        type Target = ::ethers::contract::Contract<M>;
68        fn deref(&self) -> &Self::Target {
69            &self.0
70        }
71    }
72    impl<M> ::core::ops::DerefMut for HoprCrypto<M> {
73        fn deref_mut(&mut self) -> &mut Self::Target {
74            &mut self.0
75        }
76    }
77    impl<M> ::core::fmt::Debug for HoprCrypto<M> {
78        fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
79            f.debug_tuple(::core::stringify!(HoprCrypto)).field(&self.address()).finish()
80        }
81    }
82    impl<M: ::ethers::providers::Middleware> HoprCrypto<M> {
83        /// Creates a new contract instance with the specified `ethers` client at
84        /// `address`. The contract derefs to a `ethers::Contract` object.
85        pub fn new<T: Into<::ethers::core::types::Address>>(
86            address: T,
87            client: ::std::sync::Arc<M>,
88        ) -> Self {
89            Self(
90                ::ethers::contract::Contract::new(
91                    address.into(),
92                    HOPRCRYPTO_ABI.clone(),
93                    client,
94                ),
95            )
96        }
97    }
98    impl<M: ::ethers::providers::Middleware> From<::ethers::contract::Contract<M>>
99    for HoprCrypto<M> {
100        fn from(contract: ::ethers::contract::Contract<M>) -> Self {
101            Self::new(contract.address(), contract.client())
102        }
103    }
104    ///Custom Error type `InvalidCurvePoint` with signature `InvalidCurvePoint()` and selector `0x72454a82`
105    #[derive(
106        Clone,
107        ::ethers::contract::EthError,
108        ::ethers::contract::EthDisplay,
109        serde::Serialize,
110        serde::Deserialize,
111        Default,
112        Debug,
113        PartialEq,
114        Eq,
115        Hash
116    )]
117    #[etherror(name = "InvalidCurvePoint", abi = "InvalidCurvePoint()")]
118    pub struct InvalidCurvePoint;
119    ///Custom Error type `InvalidFieldElement` with signature `InvalidFieldElement()` and selector `0x3ae4ed6b`
120    #[derive(
121        Clone,
122        ::ethers::contract::EthError,
123        ::ethers::contract::EthDisplay,
124        serde::Serialize,
125        serde::Deserialize,
126        Default,
127        Debug,
128        PartialEq,
129        Eq,
130        Hash
131    )]
132    #[etherror(name = "InvalidFieldElement", abi = "InvalidFieldElement()")]
133    pub struct InvalidFieldElement;
134    ///Custom Error type `InvalidPointWitness` with signature `InvalidPointWitness()` and selector `0xedfdcd98`
135    #[derive(
136        Clone,
137        ::ethers::contract::EthError,
138        ::ethers::contract::EthDisplay,
139        serde::Serialize,
140        serde::Deserialize,
141        Default,
142        Debug,
143        PartialEq,
144        Eq,
145        Hash
146    )]
147    #[etherror(name = "InvalidPointWitness", abi = "InvalidPointWitness()")]
148    pub struct InvalidPointWitness;
149    ///Container type for all of the contract's custom errors
150    #[derive(
151        Clone,
152        ::ethers::contract::EthAbiType,
153        serde::Serialize,
154        serde::Deserialize,
155        Debug,
156        PartialEq,
157        Eq,
158        Hash
159    )]
160    pub enum HoprCryptoErrors {
161        InvalidCurvePoint(InvalidCurvePoint),
162        InvalidFieldElement(InvalidFieldElement),
163        InvalidPointWitness(InvalidPointWitness),
164        /// The standard solidity revert string, with selector
165        /// Error(string) -- 0x08c379a0
166        RevertString(::std::string::String),
167    }
168    impl ::ethers::core::abi::AbiDecode for HoprCryptoErrors {
169        fn decode(
170            data: impl AsRef<[u8]>,
171        ) -> ::core::result::Result<Self, ::ethers::core::abi::AbiError> {
172            let data = data.as_ref();
173            if let Ok(decoded) = <::std::string::String as ::ethers::core::abi::AbiDecode>::decode(
174                data,
175            ) {
176                return Ok(Self::RevertString(decoded));
177            }
178            if let Ok(decoded) = <InvalidCurvePoint as ::ethers::core::abi::AbiDecode>::decode(
179                data,
180            ) {
181                return Ok(Self::InvalidCurvePoint(decoded));
182            }
183            if let Ok(decoded) = <InvalidFieldElement as ::ethers::core::abi::AbiDecode>::decode(
184                data,
185            ) {
186                return Ok(Self::InvalidFieldElement(decoded));
187            }
188            if let Ok(decoded) = <InvalidPointWitness as ::ethers::core::abi::AbiDecode>::decode(
189                data,
190            ) {
191                return Ok(Self::InvalidPointWitness(decoded));
192            }
193            Err(::ethers::core::abi::Error::InvalidData.into())
194        }
195    }
196    impl ::ethers::core::abi::AbiEncode for HoprCryptoErrors {
197        fn encode(self) -> ::std::vec::Vec<u8> {
198            match self {
199                Self::InvalidCurvePoint(element) => {
200                    ::ethers::core::abi::AbiEncode::encode(element)
201                }
202                Self::InvalidFieldElement(element) => {
203                    ::ethers::core::abi::AbiEncode::encode(element)
204                }
205                Self::InvalidPointWitness(element) => {
206                    ::ethers::core::abi::AbiEncode::encode(element)
207                }
208                Self::RevertString(s) => ::ethers::core::abi::AbiEncode::encode(s),
209            }
210        }
211    }
212    impl ::ethers::contract::ContractRevert for HoprCryptoErrors {
213        fn valid_selector(selector: [u8; 4]) -> bool {
214            match selector {
215                [0x08, 0xc3, 0x79, 0xa0] => true,
216                _ if selector
217                    == <InvalidCurvePoint as ::ethers::contract::EthError>::selector() => {
218                    true
219                }
220                _ if selector
221                    == <InvalidFieldElement as ::ethers::contract::EthError>::selector() => {
222                    true
223                }
224                _ if selector
225                    == <InvalidPointWitness as ::ethers::contract::EthError>::selector() => {
226                    true
227                }
228                _ => false,
229            }
230        }
231    }
232    impl ::core::fmt::Display for HoprCryptoErrors {
233        fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
234            match self {
235                Self::InvalidCurvePoint(element) => ::core::fmt::Display::fmt(element, f),
236                Self::InvalidFieldElement(element) => {
237                    ::core::fmt::Display::fmt(element, f)
238                }
239                Self::InvalidPointWitness(element) => {
240                    ::core::fmt::Display::fmt(element, f)
241                }
242                Self::RevertString(s) => ::core::fmt::Display::fmt(s, f),
243            }
244        }
245    }
246    impl ::core::convert::From<::std::string::String> for HoprCryptoErrors {
247        fn from(value: String) -> Self {
248            Self::RevertString(value)
249        }
250    }
251    impl ::core::convert::From<InvalidCurvePoint> for HoprCryptoErrors {
252        fn from(value: InvalidCurvePoint) -> Self {
253            Self::InvalidCurvePoint(value)
254        }
255    }
256    impl ::core::convert::From<InvalidFieldElement> for HoprCryptoErrors {
257        fn from(value: InvalidFieldElement) -> Self {
258            Self::InvalidFieldElement(value)
259        }
260    }
261    impl ::core::convert::From<InvalidPointWitness> for HoprCryptoErrors {
262        fn from(value: InvalidPointWitness) -> Self {
263            Self::InvalidPointWitness(value)
264        }
265    }
266}