pod_contracts/
iowned.rs

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