openzeppelin_rs/contracts/
ConditionalEscrow.rs

1pub use conditional_escrow::*;
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 conditional_escrow {
13    #[rustfmt::skip]
14    const __ABI: &str = "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"payee\",\"type\":\"address\",\"components\":[],\"indexed\":true},{\"internalType\":\"uint256\",\"name\":\"weiAmount\",\"type\":\"uint256\",\"components\":[],\"indexed\":false}],\"type\":\"event\",\"name\":\"Deposited\",\"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\":[{\"internalType\":\"address\",\"name\":\"payee\",\"type\":\"address\",\"components\":[],\"indexed\":true},{\"internalType\":\"uint256\",\"name\":\"weiAmount\",\"type\":\"uint256\",\"components\":[],\"indexed\":false}],\"type\":\"event\",\"name\":\"Withdrawn\",\"outputs\":[],\"anonymous\":false},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"payee\",\"type\":\"address\",\"components\":[]}],\"stateMutability\":\"payable\",\"type\":\"function\",\"name\":\"deposit\",\"outputs\":[]},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"payee\",\"type\":\"address\",\"components\":[]}],\"stateMutability\":\"view\",\"type\":\"function\",\"name\":\"depositsOf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\",\"components\":[]}]},{\"inputs\":[],\"stateMutability\":\"view\",\"type\":\"function\",\"name\":\"owner\",\"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\":[]},{\"inputs\":[{\"internalType\":\"address payable\",\"name\":\"payee\",\"type\":\"address\",\"components\":[]}],\"stateMutability\":\"nonpayable\",\"type\":\"function\",\"name\":\"withdraw\",\"outputs\":[]},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"payee\",\"type\":\"address\",\"components\":[]}],\"stateMutability\":\"view\",\"type\":\"function\",\"name\":\"withdrawalAllowed\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\",\"components\":[]}]}]";
15    ///The parsed JSON ABI of the contract.
16    pub static CONDITIONALESCROW_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 ConditionalEscrow<M>(::ethers_contract::Contract<M>);
19    impl<M> ::core::clone::Clone for ConditionalEscrow<M> {
20        fn clone(&self) -> Self {
21            Self(::core::clone::Clone::clone(&self.0))
22        }
23    }
24    impl<M> ::core::ops::Deref for ConditionalEscrow<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 ConditionalEscrow<M> {
31        fn deref_mut(&mut self) -> &mut Self::Target {
32            &mut self.0
33        }
34    }
35    impl<M> ::core::fmt::Debug for ConditionalEscrow<M> {
36        fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
37            f.debug_tuple(stringify!(ConditionalEscrow)).field(&self.address()).finish()
38        }
39    }
40    impl<M: ::ethers_providers::Middleware> ConditionalEscrow<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                    CONDITIONALESCROW_ABI.clone(),
51                    client,
52                ),
53            )
54        }
55        ///Calls the contract's `deposit` (0xf340fa01) function
56        pub fn deposit(
57            &self,
58            payee: ::ethers_core::types::Address,
59        ) -> ::ethers_contract::builders::ContractCall<M, ()> {
60            self.0
61                .method_hash([243, 64, 250, 1], payee)
62                .expect("method not found (this should never happen)")
63        }
64        ///Calls the contract's `depositsOf` (0xe3a9db1a) function
65        pub fn deposits_of(
66            &self,
67            payee: ::ethers_core::types::Address,
68        ) -> ::ethers_contract::builders::ContractCall<M, ::ethers_core::types::U256> {
69            self.0
70                .method_hash([227, 169, 219, 26], payee)
71                .expect("method not found (this should never happen)")
72        }
73        ///Calls the contract's `owner` (0x8da5cb5b) function
74        pub fn owner(
75            &self,
76        ) -> ::ethers_contract::builders::ContractCall<
77            M,
78            ::ethers_core::types::Address,
79        > {
80            self.0
81                .method_hash([141, 165, 203, 91], ())
82                .expect("method not found (this should never happen)")
83        }
84        ///Calls the contract's `renounceOwnership` (0x715018a6) function
85        pub fn renounce_ownership(
86            &self,
87        ) -> ::ethers_contract::builders::ContractCall<M, ()> {
88            self.0
89                .method_hash([113, 80, 24, 166], ())
90                .expect("method not found (this should never happen)")
91        }
92        ///Calls the contract's `transferOwnership` (0xf2fde38b) function
93        pub fn transfer_ownership(
94            &self,
95            new_owner: ::ethers_core::types::Address,
96        ) -> ::ethers_contract::builders::ContractCall<M, ()> {
97            self.0
98                .method_hash([242, 253, 227, 139], new_owner)
99                .expect("method not found (this should never happen)")
100        }
101        ///Calls the contract's `withdraw` (0x51cff8d9) function
102        pub fn withdraw(
103            &self,
104            payee: ::ethers_core::types::Address,
105        ) -> ::ethers_contract::builders::ContractCall<M, ()> {
106            self.0
107                .method_hash([81, 207, 248, 217], payee)
108                .expect("method not found (this should never happen)")
109        }
110        ///Calls the contract's `withdrawalAllowed` (0x685ca194) function
111        pub fn withdrawal_allowed(
112            &self,
113            payee: ::ethers_core::types::Address,
114        ) -> ::ethers_contract::builders::ContractCall<M, bool> {
115            self.0
116                .method_hash([104, 92, 161, 148], payee)
117                .expect("method not found (this should never happen)")
118        }
119        ///Gets the contract's `Deposited` event
120        pub fn deposited_filter(
121            &self,
122        ) -> ::ethers_contract::builders::Event<
123            ::std::sync::Arc<M>,
124            M,
125            DepositedFilter,
126        > {
127            self.0.event()
128        }
129        ///Gets the contract's `OwnershipTransferred` event
130        pub fn ownership_transferred_filter(
131            &self,
132        ) -> ::ethers_contract::builders::Event<
133            ::std::sync::Arc<M>,
134            M,
135            OwnershipTransferredFilter,
136        > {
137            self.0.event()
138        }
139        ///Gets the contract's `Withdrawn` event
140        pub fn withdrawn_filter(
141            &self,
142        ) -> ::ethers_contract::builders::Event<
143            ::std::sync::Arc<M>,
144            M,
145            WithdrawnFilter,
146        > {
147            self.0.event()
148        }
149        /// Returns an `Event` builder for all the events of this contract.
150        pub fn events(
151            &self,
152        ) -> ::ethers_contract::builders::Event<
153            ::std::sync::Arc<M>,
154            M,
155            ConditionalEscrowEvents,
156        > {
157            self.0.event_with_filter(::core::default::Default::default())
158        }
159    }
160    impl<M: ::ethers_providers::Middleware> From<::ethers_contract::Contract<M>>
161    for ConditionalEscrow<M> {
162        fn from(contract: ::ethers_contract::Contract<M>) -> Self {
163            Self::new(contract.address(), contract.client())
164        }
165    }
166    #[derive(
167        Clone,
168        ::ethers_contract::EthEvent,
169        ::ethers_contract::EthDisplay,
170        Default,
171        Debug,
172        PartialEq,
173        Eq,
174        Hash
175    )]
176    #[ethevent(name = "Deposited", abi = "Deposited(address,uint256)")]
177    pub struct DepositedFilter {
178        #[ethevent(indexed)]
179        pub payee: ::ethers_core::types::Address,
180        pub wei_amount: ::ethers_core::types::U256,
181    }
182    #[derive(
183        Clone,
184        ::ethers_contract::EthEvent,
185        ::ethers_contract::EthDisplay,
186        Default,
187        Debug,
188        PartialEq,
189        Eq,
190        Hash
191    )]
192    #[ethevent(
193        name = "OwnershipTransferred",
194        abi = "OwnershipTransferred(address,address)"
195    )]
196    pub struct OwnershipTransferredFilter {
197        #[ethevent(indexed)]
198        pub previous_owner: ::ethers_core::types::Address,
199        #[ethevent(indexed)]
200        pub new_owner: ::ethers_core::types::Address,
201    }
202    #[derive(
203        Clone,
204        ::ethers_contract::EthEvent,
205        ::ethers_contract::EthDisplay,
206        Default,
207        Debug,
208        PartialEq,
209        Eq,
210        Hash
211    )]
212    #[ethevent(name = "Withdrawn", abi = "Withdrawn(address,uint256)")]
213    pub struct WithdrawnFilter {
214        #[ethevent(indexed)]
215        pub payee: ::ethers_core::types::Address,
216        pub wei_amount: ::ethers_core::types::U256,
217    }
218    ///Container type for all of the contract's events
219    #[derive(Clone, ::ethers_contract::EthAbiType, Debug, PartialEq, Eq, Hash)]
220    pub enum ConditionalEscrowEvents {
221        DepositedFilter(DepositedFilter),
222        OwnershipTransferredFilter(OwnershipTransferredFilter),
223        WithdrawnFilter(WithdrawnFilter),
224    }
225    impl ::ethers_contract::EthLogDecode for ConditionalEscrowEvents {
226        fn decode_log(
227            log: &::ethers_core::abi::RawLog,
228        ) -> ::core::result::Result<Self, ::ethers_core::abi::Error> {
229            if let Ok(decoded) = DepositedFilter::decode_log(log) {
230                return Ok(ConditionalEscrowEvents::DepositedFilter(decoded));
231            }
232            if let Ok(decoded) = OwnershipTransferredFilter::decode_log(log) {
233                return Ok(ConditionalEscrowEvents::OwnershipTransferredFilter(decoded));
234            }
235            if let Ok(decoded) = WithdrawnFilter::decode_log(log) {
236                return Ok(ConditionalEscrowEvents::WithdrawnFilter(decoded));
237            }
238            Err(::ethers_core::abi::Error::InvalidData)
239        }
240    }
241    impl ::core::fmt::Display for ConditionalEscrowEvents {
242        fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
243            match self {
244                Self::DepositedFilter(element) => ::core::fmt::Display::fmt(element, f),
245                Self::OwnershipTransferredFilter(element) => {
246                    ::core::fmt::Display::fmt(element, f)
247                }
248                Self::WithdrawnFilter(element) => ::core::fmt::Display::fmt(element, f),
249            }
250        }
251    }
252    impl ::core::convert::From<DepositedFilter> for ConditionalEscrowEvents {
253        fn from(value: DepositedFilter) -> Self {
254            Self::DepositedFilter(value)
255        }
256    }
257    impl ::core::convert::From<OwnershipTransferredFilter> for ConditionalEscrowEvents {
258        fn from(value: OwnershipTransferredFilter) -> Self {
259            Self::OwnershipTransferredFilter(value)
260        }
261    }
262    impl ::core::convert::From<WithdrawnFilter> for ConditionalEscrowEvents {
263        fn from(value: WithdrawnFilter) -> Self {
264            Self::WithdrawnFilter(value)
265        }
266    }
267    ///Container type for all input parameters for the `deposit` function with signature `deposit(address)` and selector `0xf340fa01`
268    #[derive(
269        Clone,
270        ::ethers_contract::EthCall,
271        ::ethers_contract::EthDisplay,
272        Default,
273        Debug,
274        PartialEq,
275        Eq,
276        Hash
277    )]
278    #[ethcall(name = "deposit", abi = "deposit(address)")]
279    pub struct DepositCall {
280        pub payee: ::ethers_core::types::Address,
281    }
282    ///Container type for all input parameters for the `depositsOf` function with signature `depositsOf(address)` and selector `0xe3a9db1a`
283    #[derive(
284        Clone,
285        ::ethers_contract::EthCall,
286        ::ethers_contract::EthDisplay,
287        Default,
288        Debug,
289        PartialEq,
290        Eq,
291        Hash
292    )]
293    #[ethcall(name = "depositsOf", abi = "depositsOf(address)")]
294    pub struct DepositsOfCall {
295        pub payee: ::ethers_core::types::Address,
296    }
297    ///Container type for all input parameters for the `owner` function with signature `owner()` and selector `0x8da5cb5b`
298    #[derive(
299        Clone,
300        ::ethers_contract::EthCall,
301        ::ethers_contract::EthDisplay,
302        Default,
303        Debug,
304        PartialEq,
305        Eq,
306        Hash
307    )]
308    #[ethcall(name = "owner", abi = "owner()")]
309    pub struct OwnerCall;
310    ///Container type for all input parameters for the `renounceOwnership` function with signature `renounceOwnership()` and selector `0x715018a6`
311    #[derive(
312        Clone,
313        ::ethers_contract::EthCall,
314        ::ethers_contract::EthDisplay,
315        Default,
316        Debug,
317        PartialEq,
318        Eq,
319        Hash
320    )]
321    #[ethcall(name = "renounceOwnership", abi = "renounceOwnership()")]
322    pub struct RenounceOwnershipCall;
323    ///Container type for all input parameters for the `transferOwnership` function with signature `transferOwnership(address)` and selector `0xf2fde38b`
324    #[derive(
325        Clone,
326        ::ethers_contract::EthCall,
327        ::ethers_contract::EthDisplay,
328        Default,
329        Debug,
330        PartialEq,
331        Eq,
332        Hash
333    )]
334    #[ethcall(name = "transferOwnership", abi = "transferOwnership(address)")]
335    pub struct TransferOwnershipCall {
336        pub new_owner: ::ethers_core::types::Address,
337    }
338    ///Container type for all input parameters for the `withdraw` function with signature `withdraw(address)` and selector `0x51cff8d9`
339    #[derive(
340        Clone,
341        ::ethers_contract::EthCall,
342        ::ethers_contract::EthDisplay,
343        Default,
344        Debug,
345        PartialEq,
346        Eq,
347        Hash
348    )]
349    #[ethcall(name = "withdraw", abi = "withdraw(address)")]
350    pub struct WithdrawCall {
351        pub payee: ::ethers_core::types::Address,
352    }
353    ///Container type for all input parameters for the `withdrawalAllowed` function with signature `withdrawalAllowed(address)` and selector `0x685ca194`
354    #[derive(
355        Clone,
356        ::ethers_contract::EthCall,
357        ::ethers_contract::EthDisplay,
358        Default,
359        Debug,
360        PartialEq,
361        Eq,
362        Hash
363    )]
364    #[ethcall(name = "withdrawalAllowed", abi = "withdrawalAllowed(address)")]
365    pub struct WithdrawalAllowedCall {
366        pub payee: ::ethers_core::types::Address,
367    }
368    ///Container type for all of the contract's call
369    #[derive(Clone, ::ethers_contract::EthAbiType, Debug, PartialEq, Eq, Hash)]
370    pub enum ConditionalEscrowCalls {
371        Deposit(DepositCall),
372        DepositsOf(DepositsOfCall),
373        Owner(OwnerCall),
374        RenounceOwnership(RenounceOwnershipCall),
375        TransferOwnership(TransferOwnershipCall),
376        Withdraw(WithdrawCall),
377        WithdrawalAllowed(WithdrawalAllowedCall),
378    }
379    impl ::ethers_core::abi::AbiDecode for ConditionalEscrowCalls {
380        fn decode(
381            data: impl AsRef<[u8]>,
382        ) -> ::core::result::Result<Self, ::ethers_core::abi::AbiError> {
383            let data = data.as_ref();
384            if let Ok(decoded)
385                = <DepositCall as ::ethers_core::abi::AbiDecode>::decode(data) {
386                return Ok(Self::Deposit(decoded));
387            }
388            if let Ok(decoded)
389                = <DepositsOfCall as ::ethers_core::abi::AbiDecode>::decode(data) {
390                return Ok(Self::DepositsOf(decoded));
391            }
392            if let Ok(decoded)
393                = <OwnerCall as ::ethers_core::abi::AbiDecode>::decode(data) {
394                return Ok(Self::Owner(decoded));
395            }
396            if let Ok(decoded)
397                = <RenounceOwnershipCall as ::ethers_core::abi::AbiDecode>::decode(
398                    data,
399                ) {
400                return Ok(Self::RenounceOwnership(decoded));
401            }
402            if let Ok(decoded)
403                = <TransferOwnershipCall as ::ethers_core::abi::AbiDecode>::decode(
404                    data,
405                ) {
406                return Ok(Self::TransferOwnership(decoded));
407            }
408            if let Ok(decoded)
409                = <WithdrawCall as ::ethers_core::abi::AbiDecode>::decode(data) {
410                return Ok(Self::Withdraw(decoded));
411            }
412            if let Ok(decoded)
413                = <WithdrawalAllowedCall as ::ethers_core::abi::AbiDecode>::decode(
414                    data,
415                ) {
416                return Ok(Self::WithdrawalAllowed(decoded));
417            }
418            Err(::ethers_core::abi::Error::InvalidData.into())
419        }
420    }
421    impl ::ethers_core::abi::AbiEncode for ConditionalEscrowCalls {
422        fn encode(self) -> Vec<u8> {
423            match self {
424                Self::Deposit(element) => ::ethers_core::abi::AbiEncode::encode(element),
425                Self::DepositsOf(element) => {
426                    ::ethers_core::abi::AbiEncode::encode(element)
427                }
428                Self::Owner(element) => ::ethers_core::abi::AbiEncode::encode(element),
429                Self::RenounceOwnership(element) => {
430                    ::ethers_core::abi::AbiEncode::encode(element)
431                }
432                Self::TransferOwnership(element) => {
433                    ::ethers_core::abi::AbiEncode::encode(element)
434                }
435                Self::Withdraw(element) => ::ethers_core::abi::AbiEncode::encode(element),
436                Self::WithdrawalAllowed(element) => {
437                    ::ethers_core::abi::AbiEncode::encode(element)
438                }
439            }
440        }
441    }
442    impl ::core::fmt::Display for ConditionalEscrowCalls {
443        fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
444            match self {
445                Self::Deposit(element) => ::core::fmt::Display::fmt(element, f),
446                Self::DepositsOf(element) => ::core::fmt::Display::fmt(element, f),
447                Self::Owner(element) => ::core::fmt::Display::fmt(element, f),
448                Self::RenounceOwnership(element) => ::core::fmt::Display::fmt(element, f),
449                Self::TransferOwnership(element) => ::core::fmt::Display::fmt(element, f),
450                Self::Withdraw(element) => ::core::fmt::Display::fmt(element, f),
451                Self::WithdrawalAllowed(element) => ::core::fmt::Display::fmt(element, f),
452            }
453        }
454    }
455    impl ::core::convert::From<DepositCall> for ConditionalEscrowCalls {
456        fn from(value: DepositCall) -> Self {
457            Self::Deposit(value)
458        }
459    }
460    impl ::core::convert::From<DepositsOfCall> for ConditionalEscrowCalls {
461        fn from(value: DepositsOfCall) -> Self {
462            Self::DepositsOf(value)
463        }
464    }
465    impl ::core::convert::From<OwnerCall> for ConditionalEscrowCalls {
466        fn from(value: OwnerCall) -> Self {
467            Self::Owner(value)
468        }
469    }
470    impl ::core::convert::From<RenounceOwnershipCall> for ConditionalEscrowCalls {
471        fn from(value: RenounceOwnershipCall) -> Self {
472            Self::RenounceOwnership(value)
473        }
474    }
475    impl ::core::convert::From<TransferOwnershipCall> for ConditionalEscrowCalls {
476        fn from(value: TransferOwnershipCall) -> Self {
477            Self::TransferOwnership(value)
478        }
479    }
480    impl ::core::convert::From<WithdrawCall> for ConditionalEscrowCalls {
481        fn from(value: WithdrawCall) -> Self {
482            Self::Withdraw(value)
483        }
484    }
485    impl ::core::convert::From<WithdrawalAllowedCall> for ConditionalEscrowCalls {
486        fn from(value: WithdrawalAllowedCall) -> Self {
487            Self::WithdrawalAllowed(value)
488        }
489    }
490    ///Container type for all return fields from the `depositsOf` function with signature `depositsOf(address)` and selector `0xe3a9db1a`
491    #[derive(
492        Clone,
493        ::ethers_contract::EthAbiType,
494        ::ethers_contract::EthAbiCodec,
495        Default,
496        Debug,
497        PartialEq,
498        Eq,
499        Hash
500    )]
501    pub struct DepositsOfReturn(pub ::ethers_core::types::U256);
502    ///Container type for all return fields from the `owner` function with signature `owner()` and selector `0x8da5cb5b`
503    #[derive(
504        Clone,
505        ::ethers_contract::EthAbiType,
506        ::ethers_contract::EthAbiCodec,
507        Default,
508        Debug,
509        PartialEq,
510        Eq,
511        Hash
512    )]
513    pub struct OwnerReturn(pub ::ethers_core::types::Address);
514    ///Container type for all return fields from the `withdrawalAllowed` function with signature `withdrawalAllowed(address)` and selector `0x685ca194`
515    #[derive(
516        Clone,
517        ::ethers_contract::EthAbiType,
518        ::ethers_contract::EthAbiCodec,
519        Default,
520        Debug,
521        PartialEq,
522        Eq,
523        Hash
524    )]
525    pub struct WithdrawalAllowedReturn(pub bool);
526}