pod_contracts/
iconstant.rs

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