openzeppelin_rs/contracts/
PullPayment.rs1pub use pull_payment::*;
2#[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 pull_payment {
13 #[rustfmt::skip]
14 const __ABI: &str = "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"dest\",\"type\":\"address\",\"components\":[]}],\"stateMutability\":\"view\",\"type\":\"function\",\"name\":\"payments\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\",\"components\":[]}]},{\"inputs\":[{\"internalType\":\"address payable\",\"name\":\"payee\",\"type\":\"address\",\"components\":[]}],\"stateMutability\":\"nonpayable\",\"type\":\"function\",\"name\":\"withdrawPayments\",\"outputs\":[]}]";
15 pub static PULLPAYMENT_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 PullPayment<M>(::ethers_contract::Contract<M>);
19 impl<M> ::core::clone::Clone for PullPayment<M> {
20 fn clone(&self) -> Self {
21 Self(::core::clone::Clone::clone(&self.0))
22 }
23 }
24 impl<M> ::core::ops::Deref for PullPayment<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 PullPayment<M> {
31 fn deref_mut(&mut self) -> &mut Self::Target {
32 &mut self.0
33 }
34 }
35 impl<M> ::core::fmt::Debug for PullPayment<M> {
36 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
37 f.debug_tuple(stringify!(PullPayment)).field(&self.address()).finish()
38 }
39 }
40 impl<M: ::ethers_providers::Middleware> PullPayment<M> {
41 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 PULLPAYMENT_ABI.clone(),
51 client,
52 ),
53 )
54 }
55 pub fn payments(
57 &self,
58 dest: ::ethers_core::types::Address,
59 ) -> ::ethers_contract::builders::ContractCall<M, ::ethers_core::types::U256> {
60 self.0
61 .method_hash([226, 152, 44, 33], dest)
62 .expect("method not found (this should never happen)")
63 }
64 pub fn withdraw_payments(
66 &self,
67 payee: ::ethers_core::types::Address,
68 ) -> ::ethers_contract::builders::ContractCall<M, ()> {
69 self.0
70 .method_hash([49, 179, 235, 148], payee)
71 .expect("method not found (this should never happen)")
72 }
73 }
74 impl<M: ::ethers_providers::Middleware> From<::ethers_contract::Contract<M>>
75 for PullPayment<M> {
76 fn from(contract: ::ethers_contract::Contract<M>) -> Self {
77 Self::new(contract.address(), contract.client())
78 }
79 }
80 #[derive(
82 Clone,
83 ::ethers_contract::EthCall,
84 ::ethers_contract::EthDisplay,
85 Default,
86 Debug,
87 PartialEq,
88 Eq,
89 Hash
90 )]
91 #[ethcall(name = "payments", abi = "payments(address)")]
92 pub struct PaymentsCall {
93 pub dest: ::ethers_core::types::Address,
94 }
95 #[derive(
97 Clone,
98 ::ethers_contract::EthCall,
99 ::ethers_contract::EthDisplay,
100 Default,
101 Debug,
102 PartialEq,
103 Eq,
104 Hash
105 )]
106 #[ethcall(name = "withdrawPayments", abi = "withdrawPayments(address)")]
107 pub struct WithdrawPaymentsCall {
108 pub payee: ::ethers_core::types::Address,
109 }
110 #[derive(Clone, ::ethers_contract::EthAbiType, Debug, PartialEq, Eq, Hash)]
112 pub enum PullPaymentCalls {
113 Payments(PaymentsCall),
114 WithdrawPayments(WithdrawPaymentsCall),
115 }
116 impl ::ethers_core::abi::AbiDecode for PullPaymentCalls {
117 fn decode(
118 data: impl AsRef<[u8]>,
119 ) -> ::core::result::Result<Self, ::ethers_core::abi::AbiError> {
120 let data = data.as_ref();
121 if let Ok(decoded)
122 = <PaymentsCall as ::ethers_core::abi::AbiDecode>::decode(data) {
123 return Ok(Self::Payments(decoded));
124 }
125 if let Ok(decoded)
126 = <WithdrawPaymentsCall as ::ethers_core::abi::AbiDecode>::decode(data) {
127 return Ok(Self::WithdrawPayments(decoded));
128 }
129 Err(::ethers_core::abi::Error::InvalidData.into())
130 }
131 }
132 impl ::ethers_core::abi::AbiEncode for PullPaymentCalls {
133 fn encode(self) -> Vec<u8> {
134 match self {
135 Self::Payments(element) => ::ethers_core::abi::AbiEncode::encode(element),
136 Self::WithdrawPayments(element) => {
137 ::ethers_core::abi::AbiEncode::encode(element)
138 }
139 }
140 }
141 }
142 impl ::core::fmt::Display for PullPaymentCalls {
143 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
144 match self {
145 Self::Payments(element) => ::core::fmt::Display::fmt(element, f),
146 Self::WithdrawPayments(element) => ::core::fmt::Display::fmt(element, f),
147 }
148 }
149 }
150 impl ::core::convert::From<PaymentsCall> for PullPaymentCalls {
151 fn from(value: PaymentsCall) -> Self {
152 Self::Payments(value)
153 }
154 }
155 impl ::core::convert::From<WithdrawPaymentsCall> for PullPaymentCalls {
156 fn from(value: WithdrawPaymentsCall) -> Self {
157 Self::WithdrawPayments(value)
158 }
159 }
160 #[derive(
162 Clone,
163 ::ethers_contract::EthAbiType,
164 ::ethers_contract::EthAbiCodec,
165 Default,
166 Debug,
167 PartialEq,
168 Eq,
169 Hash
170 )]
171 pub struct PaymentsReturn(pub ::ethers_core::types::U256);
172}