openzeppelin_rs/contracts/
Ownable2Step.rs

1pub use ownable_2_step::*;
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 ownable_2_step {
13    #[rustfmt::skip]
14    const __ABI: &str = "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\",\"components\":[],\"indexed\":true},{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\",\"components\":[],\"indexed\":true}],\"type\":\"event\",\"name\":\"OwnershipTransferStarted\",\"outputs\":[],\"anonymous\":false},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\",\"components\":[],\"indexed\":true},{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\",\"components\":[],\"indexed\":true}],\"type\":\"event\",\"name\":\"OwnershipTransferred\",\"outputs\":[],\"anonymous\":false},{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\",\"name\":\"acceptOwnership\",\"outputs\":[]},{\"inputs\":[],\"stateMutability\":\"view\",\"type\":\"function\",\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\",\"components\":[]}]},{\"inputs\":[],\"stateMutability\":\"view\",\"type\":\"function\",\"name\":\"pendingOwner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\",\"components\":[]}]},{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\",\"name\":\"renounceOwnership\",\"outputs\":[]},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\",\"components\":[]}],\"stateMutability\":\"nonpayable\",\"type\":\"function\",\"name\":\"transferOwnership\",\"outputs\":[]}]";
15    ///The parsed JSON ABI of the contract.
16    pub static OWNABLE2STEP_ABI: ::ethers_contract::Lazy<::ethers_core::abi::Abi> = ::ethers_contract::Lazy::new(||
17    ::ethers_core::utils::__serde_json::from_str(__ABI).expect("ABI is always valid"));
18    pub struct Ownable2Step<M>(::ethers_contract::Contract<M>);
19    impl<M> ::core::clone::Clone for Ownable2Step<M> {
20        fn clone(&self) -> Self {
21            Self(::core::clone::Clone::clone(&self.0))
22        }
23    }
24    impl<M> ::core::ops::Deref for Ownable2Step<M> {
25        type Target = ::ethers_contract::Contract<M>;
26        fn deref(&self) -> &Self::Target {
27            &self.0
28        }
29    }
30    impl<M> ::core::ops::DerefMut for Ownable2Step<M> {
31        fn deref_mut(&mut self) -> &mut Self::Target {
32            &mut self.0
33        }
34    }
35    impl<M> ::core::fmt::Debug for Ownable2Step<M> {
36        fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
37            f.debug_tuple(stringify!(Ownable2Step)).field(&self.address()).finish()
38        }
39    }
40    impl<M: ::ethers_providers::Middleware> Ownable2Step<M> {
41        /// Creates a new contract instance with the specified `ethers` client at
42        /// `address`. The contract derefs to a `ethers::Contract` object.
43        pub fn new<T: Into<::ethers_core::types::Address>>(
44            address: T,
45            client: ::std::sync::Arc<M>,
46        ) -> Self {
47            Self(
48                ::ethers_contract::Contract::new(
49                    address.into(),
50                    OWNABLE2STEP_ABI.clone(),
51                    client,
52                ),
53            )
54        }
55        ///Calls the contract's `acceptOwnership` (0x79ba5097) function
56        pub fn accept_ownership(
57            &self,
58        ) -> ::ethers_contract::builders::ContractCall<M, ()> {
59            self.0
60                .method_hash([121, 186, 80, 151], ())
61                .expect("method not found (this should never happen)")
62        }
63        ///Calls the contract's `owner` (0x8da5cb5b) function
64        pub fn owner(
65            &self,
66        ) -> ::ethers_contract::builders::ContractCall<
67            M,
68            ::ethers_core::types::Address,
69        > {
70            self.0
71                .method_hash([141, 165, 203, 91], ())
72                .expect("method not found (this should never happen)")
73        }
74        ///Calls the contract's `pendingOwner` (0xe30c3978) function
75        pub fn pending_owner(
76            &self,
77        ) -> ::ethers_contract::builders::ContractCall<
78            M,
79            ::ethers_core::types::Address,
80        > {
81            self.0
82                .method_hash([227, 12, 57, 120], ())
83                .expect("method not found (this should never happen)")
84        }
85        ///Calls the contract's `renounceOwnership` (0x715018a6) function
86        pub fn renounce_ownership(
87            &self,
88        ) -> ::ethers_contract::builders::ContractCall<M, ()> {
89            self.0
90                .method_hash([113, 80, 24, 166], ())
91                .expect("method not found (this should never happen)")
92        }
93        ///Calls the contract's `transferOwnership` (0xf2fde38b) function
94        pub fn transfer_ownership(
95            &self,
96            new_owner: ::ethers_core::types::Address,
97        ) -> ::ethers_contract::builders::ContractCall<M, ()> {
98            self.0
99                .method_hash([242, 253, 227, 139], new_owner)
100                .expect("method not found (this should never happen)")
101        }
102        ///Gets the contract's `OwnershipTransferStarted` event
103        pub fn ownership_transfer_started_filter(
104            &self,
105        ) -> ::ethers_contract::builders::Event<
106            ::std::sync::Arc<M>,
107            M,
108            OwnershipTransferStartedFilter,
109        > {
110            self.0.event()
111        }
112        ///Gets the contract's `OwnershipTransferred` event
113        pub fn ownership_transferred_filter(
114            &self,
115        ) -> ::ethers_contract::builders::Event<
116            ::std::sync::Arc<M>,
117            M,
118            OwnershipTransferredFilter,
119        > {
120            self.0.event()
121        }
122        /// Returns an `Event` builder for all the events of this contract.
123        pub fn events(
124            &self,
125        ) -> ::ethers_contract::builders::Event<
126            ::std::sync::Arc<M>,
127            M,
128            Ownable2StepEvents,
129        > {
130            self.0.event_with_filter(::core::default::Default::default())
131        }
132    }
133    impl<M: ::ethers_providers::Middleware> From<::ethers_contract::Contract<M>>
134    for Ownable2Step<M> {
135        fn from(contract: ::ethers_contract::Contract<M>) -> Self {
136            Self::new(contract.address(), contract.client())
137        }
138    }
139    #[derive(
140        Clone,
141        ::ethers_contract::EthEvent,
142        ::ethers_contract::EthDisplay,
143        Default,
144        Debug,
145        PartialEq,
146        Eq,
147        Hash
148    )]
149    #[ethevent(
150        name = "OwnershipTransferStarted",
151        abi = "OwnershipTransferStarted(address,address)"
152    )]
153    pub struct OwnershipTransferStartedFilter {
154        #[ethevent(indexed)]
155        pub previous_owner: ::ethers_core::types::Address,
156        #[ethevent(indexed)]
157        pub new_owner: ::ethers_core::types::Address,
158    }
159    #[derive(
160        Clone,
161        ::ethers_contract::EthEvent,
162        ::ethers_contract::EthDisplay,
163        Default,
164        Debug,
165        PartialEq,
166        Eq,
167        Hash
168    )]
169    #[ethevent(
170        name = "OwnershipTransferred",
171        abi = "OwnershipTransferred(address,address)"
172    )]
173    pub struct OwnershipTransferredFilter {
174        #[ethevent(indexed)]
175        pub previous_owner: ::ethers_core::types::Address,
176        #[ethevent(indexed)]
177        pub new_owner: ::ethers_core::types::Address,
178    }
179    ///Container type for all of the contract's events
180    #[derive(Clone, ::ethers_contract::EthAbiType, Debug, PartialEq, Eq, Hash)]
181    pub enum Ownable2StepEvents {
182        OwnershipTransferStartedFilter(OwnershipTransferStartedFilter),
183        OwnershipTransferredFilter(OwnershipTransferredFilter),
184    }
185    impl ::ethers_contract::EthLogDecode for Ownable2StepEvents {
186        fn decode_log(
187            log: &::ethers_core::abi::RawLog,
188        ) -> ::core::result::Result<Self, ::ethers_core::abi::Error> {
189            if let Ok(decoded) = OwnershipTransferStartedFilter::decode_log(log) {
190                return Ok(Ownable2StepEvents::OwnershipTransferStartedFilter(decoded));
191            }
192            if let Ok(decoded) = OwnershipTransferredFilter::decode_log(log) {
193                return Ok(Ownable2StepEvents::OwnershipTransferredFilter(decoded));
194            }
195            Err(::ethers_core::abi::Error::InvalidData)
196        }
197    }
198    impl ::core::fmt::Display for Ownable2StepEvents {
199        fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
200            match self {
201                Self::OwnershipTransferStartedFilter(element) => {
202                    ::core::fmt::Display::fmt(element, f)
203                }
204                Self::OwnershipTransferredFilter(element) => {
205                    ::core::fmt::Display::fmt(element, f)
206                }
207            }
208        }
209    }
210    impl ::core::convert::From<OwnershipTransferStartedFilter> for Ownable2StepEvents {
211        fn from(value: OwnershipTransferStartedFilter) -> Self {
212            Self::OwnershipTransferStartedFilter(value)
213        }
214    }
215    impl ::core::convert::From<OwnershipTransferredFilter> for Ownable2StepEvents {
216        fn from(value: OwnershipTransferredFilter) -> Self {
217            Self::OwnershipTransferredFilter(value)
218        }
219    }
220    ///Container type for all input parameters for the `acceptOwnership` function with signature `acceptOwnership()` and selector `0x79ba5097`
221    #[derive(
222        Clone,
223        ::ethers_contract::EthCall,
224        ::ethers_contract::EthDisplay,
225        Default,
226        Debug,
227        PartialEq,
228        Eq,
229        Hash
230    )]
231    #[ethcall(name = "acceptOwnership", abi = "acceptOwnership()")]
232    pub struct AcceptOwnershipCall;
233    ///Container type for all input parameters for the `owner` function with signature `owner()` and selector `0x8da5cb5b`
234    #[derive(
235        Clone,
236        ::ethers_contract::EthCall,
237        ::ethers_contract::EthDisplay,
238        Default,
239        Debug,
240        PartialEq,
241        Eq,
242        Hash
243    )]
244    #[ethcall(name = "owner", abi = "owner()")]
245    pub struct OwnerCall;
246    ///Container type for all input parameters for the `pendingOwner` function with signature `pendingOwner()` and selector `0xe30c3978`
247    #[derive(
248        Clone,
249        ::ethers_contract::EthCall,
250        ::ethers_contract::EthDisplay,
251        Default,
252        Debug,
253        PartialEq,
254        Eq,
255        Hash
256    )]
257    #[ethcall(name = "pendingOwner", abi = "pendingOwner()")]
258    pub struct PendingOwnerCall;
259    ///Container type for all input parameters for the `renounceOwnership` function with signature `renounceOwnership()` and selector `0x715018a6`
260    #[derive(
261        Clone,
262        ::ethers_contract::EthCall,
263        ::ethers_contract::EthDisplay,
264        Default,
265        Debug,
266        PartialEq,
267        Eq,
268        Hash
269    )]
270    #[ethcall(name = "renounceOwnership", abi = "renounceOwnership()")]
271    pub struct RenounceOwnershipCall;
272    ///Container type for all input parameters for the `transferOwnership` function with signature `transferOwnership(address)` and selector `0xf2fde38b`
273    #[derive(
274        Clone,
275        ::ethers_contract::EthCall,
276        ::ethers_contract::EthDisplay,
277        Default,
278        Debug,
279        PartialEq,
280        Eq,
281        Hash
282    )]
283    #[ethcall(name = "transferOwnership", abi = "transferOwnership(address)")]
284    pub struct TransferOwnershipCall {
285        pub new_owner: ::ethers_core::types::Address,
286    }
287    ///Container type for all of the contract's call
288    #[derive(Clone, ::ethers_contract::EthAbiType, Debug, PartialEq, Eq, Hash)]
289    pub enum Ownable2StepCalls {
290        AcceptOwnership(AcceptOwnershipCall),
291        Owner(OwnerCall),
292        PendingOwner(PendingOwnerCall),
293        RenounceOwnership(RenounceOwnershipCall),
294        TransferOwnership(TransferOwnershipCall),
295    }
296    impl ::ethers_core::abi::AbiDecode for Ownable2StepCalls {
297        fn decode(
298            data: impl AsRef<[u8]>,
299        ) -> ::core::result::Result<Self, ::ethers_core::abi::AbiError> {
300            let data = data.as_ref();
301            if let Ok(decoded)
302                = <AcceptOwnershipCall as ::ethers_core::abi::AbiDecode>::decode(data) {
303                return Ok(Self::AcceptOwnership(decoded));
304            }
305            if let Ok(decoded)
306                = <OwnerCall as ::ethers_core::abi::AbiDecode>::decode(data) {
307                return Ok(Self::Owner(decoded));
308            }
309            if let Ok(decoded)
310                = <PendingOwnerCall as ::ethers_core::abi::AbiDecode>::decode(data) {
311                return Ok(Self::PendingOwner(decoded));
312            }
313            if let Ok(decoded)
314                = <RenounceOwnershipCall as ::ethers_core::abi::AbiDecode>::decode(
315                    data,
316                ) {
317                return Ok(Self::RenounceOwnership(decoded));
318            }
319            if let Ok(decoded)
320                = <TransferOwnershipCall as ::ethers_core::abi::AbiDecode>::decode(
321                    data,
322                ) {
323                return Ok(Self::TransferOwnership(decoded));
324            }
325            Err(::ethers_core::abi::Error::InvalidData.into())
326        }
327    }
328    impl ::ethers_core::abi::AbiEncode for Ownable2StepCalls {
329        fn encode(self) -> Vec<u8> {
330            match self {
331                Self::AcceptOwnership(element) => {
332                    ::ethers_core::abi::AbiEncode::encode(element)
333                }
334                Self::Owner(element) => ::ethers_core::abi::AbiEncode::encode(element),
335                Self::PendingOwner(element) => {
336                    ::ethers_core::abi::AbiEncode::encode(element)
337                }
338                Self::RenounceOwnership(element) => {
339                    ::ethers_core::abi::AbiEncode::encode(element)
340                }
341                Self::TransferOwnership(element) => {
342                    ::ethers_core::abi::AbiEncode::encode(element)
343                }
344            }
345        }
346    }
347    impl ::core::fmt::Display for Ownable2StepCalls {
348        fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
349            match self {
350                Self::AcceptOwnership(element) => ::core::fmt::Display::fmt(element, f),
351                Self::Owner(element) => ::core::fmt::Display::fmt(element, f),
352                Self::PendingOwner(element) => ::core::fmt::Display::fmt(element, f),
353                Self::RenounceOwnership(element) => ::core::fmt::Display::fmt(element, f),
354                Self::TransferOwnership(element) => ::core::fmt::Display::fmt(element, f),
355            }
356        }
357    }
358    impl ::core::convert::From<AcceptOwnershipCall> for Ownable2StepCalls {
359        fn from(value: AcceptOwnershipCall) -> Self {
360            Self::AcceptOwnership(value)
361        }
362    }
363    impl ::core::convert::From<OwnerCall> for Ownable2StepCalls {
364        fn from(value: OwnerCall) -> Self {
365            Self::Owner(value)
366        }
367    }
368    impl ::core::convert::From<PendingOwnerCall> for Ownable2StepCalls {
369        fn from(value: PendingOwnerCall) -> Self {
370            Self::PendingOwner(value)
371        }
372    }
373    impl ::core::convert::From<RenounceOwnershipCall> for Ownable2StepCalls {
374        fn from(value: RenounceOwnershipCall) -> Self {
375            Self::RenounceOwnership(value)
376        }
377    }
378    impl ::core::convert::From<TransferOwnershipCall> for Ownable2StepCalls {
379        fn from(value: TransferOwnershipCall) -> Self {
380            Self::TransferOwnership(value)
381        }
382    }
383    ///Container type for all return fields from the `owner` function with signature `owner()` and selector `0x8da5cb5b`
384    #[derive(
385        Clone,
386        ::ethers_contract::EthAbiType,
387        ::ethers_contract::EthAbiCodec,
388        Default,
389        Debug,
390        PartialEq,
391        Eq,
392        Hash
393    )]
394    pub struct OwnerReturn(pub ::ethers_core::types::Address);
395    ///Container type for all return fields from the `pendingOwner` function with signature `pendingOwner()` and selector `0xe30c3978`
396    #[derive(
397        Clone,
398        ::ethers_contract::EthAbiType,
399        ::ethers_contract::EthAbiCodec,
400        Default,
401        Debug,
402        PartialEq,
403        Eq,
404        Hash
405    )]
406    pub struct PendingOwnerReturn(pub ::ethers_core::types::Address);
407}