hopr_bindings/codegen/
hoprwinningprobabilityoracleevents.rs

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