openzeppelin_rs/contracts/
Ownable.rs1pub use ownable::*;
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 ownable {
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\":\"OwnershipTransferred\",\"outputs\":[],\"anonymous\":false},{\"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\":[]}]";
15 pub static OWNABLE_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 Ownable<M>(::ethers_contract::Contract<M>);
19 impl<M> ::core::clone::Clone for Ownable<M> {
20 fn clone(&self) -> Self {
21 Self(::core::clone::Clone::clone(&self.0))
22 }
23 }
24 impl<M> ::core::ops::Deref for Ownable<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 Ownable<M> {
31 fn deref_mut(&mut self) -> &mut Self::Target {
32 &mut self.0
33 }
34 }
35 impl<M> ::core::fmt::Debug for Ownable<M> {
36 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
37 f.debug_tuple(stringify!(Ownable)).field(&self.address()).finish()
38 }
39 }
40 impl<M: ::ethers_providers::Middleware> Ownable<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 OWNABLE_ABI.clone(),
51 client,
52 ),
53 )
54 }
55 pub fn owner(
57 &self,
58 ) -> ::ethers_contract::builders::ContractCall<
59 M,
60 ::ethers_core::types::Address,
61 > {
62 self.0
63 .method_hash([141, 165, 203, 91], ())
64 .expect("method not found (this should never happen)")
65 }
66 pub fn renounce_ownership(
68 &self,
69 ) -> ::ethers_contract::builders::ContractCall<M, ()> {
70 self.0
71 .method_hash([113, 80, 24, 166], ())
72 .expect("method not found (this should never happen)")
73 }
74 pub fn transfer_ownership(
76 &self,
77 new_owner: ::ethers_core::types::Address,
78 ) -> ::ethers_contract::builders::ContractCall<M, ()> {
79 self.0
80 .method_hash([242, 253, 227, 139], new_owner)
81 .expect("method not found (this should never happen)")
82 }
83 pub fn ownership_transferred_filter(
85 &self,
86 ) -> ::ethers_contract::builders::Event<
87 ::std::sync::Arc<M>,
88 M,
89 OwnershipTransferredFilter,
90 > {
91 self.0.event()
92 }
93 pub fn events(
95 &self,
96 ) -> ::ethers_contract::builders::Event<
97 ::std::sync::Arc<M>,
98 M,
99 OwnershipTransferredFilter,
100 > {
101 self.0.event_with_filter(::core::default::Default::default())
102 }
103 }
104 impl<M: ::ethers_providers::Middleware> From<::ethers_contract::Contract<M>>
105 for Ownable<M> {
106 fn from(contract: ::ethers_contract::Contract<M>) -> Self {
107 Self::new(contract.address(), contract.client())
108 }
109 }
110 #[derive(
111 Clone,
112 ::ethers_contract::EthEvent,
113 ::ethers_contract::EthDisplay,
114 Default,
115 Debug,
116 PartialEq,
117 Eq,
118 Hash
119 )]
120 #[ethevent(
121 name = "OwnershipTransferred",
122 abi = "OwnershipTransferred(address,address)"
123 )]
124 pub struct OwnershipTransferredFilter {
125 #[ethevent(indexed)]
126 pub previous_owner: ::ethers_core::types::Address,
127 #[ethevent(indexed)]
128 pub new_owner: ::ethers_core::types::Address,
129 }
130 #[derive(
132 Clone,
133 ::ethers_contract::EthCall,
134 ::ethers_contract::EthDisplay,
135 Default,
136 Debug,
137 PartialEq,
138 Eq,
139 Hash
140 )]
141 #[ethcall(name = "owner", abi = "owner()")]
142 pub struct OwnerCall;
143 #[derive(
145 Clone,
146 ::ethers_contract::EthCall,
147 ::ethers_contract::EthDisplay,
148 Default,
149 Debug,
150 PartialEq,
151 Eq,
152 Hash
153 )]
154 #[ethcall(name = "renounceOwnership", abi = "renounceOwnership()")]
155 pub struct RenounceOwnershipCall;
156 #[derive(
158 Clone,
159 ::ethers_contract::EthCall,
160 ::ethers_contract::EthDisplay,
161 Default,
162 Debug,
163 PartialEq,
164 Eq,
165 Hash
166 )]
167 #[ethcall(name = "transferOwnership", abi = "transferOwnership(address)")]
168 pub struct TransferOwnershipCall {
169 pub new_owner: ::ethers_core::types::Address,
170 }
171 #[derive(Clone, ::ethers_contract::EthAbiType, Debug, PartialEq, Eq, Hash)]
173 pub enum OwnableCalls {
174 Owner(OwnerCall),
175 RenounceOwnership(RenounceOwnershipCall),
176 TransferOwnership(TransferOwnershipCall),
177 }
178 impl ::ethers_core::abi::AbiDecode for OwnableCalls {
179 fn decode(
180 data: impl AsRef<[u8]>,
181 ) -> ::core::result::Result<Self, ::ethers_core::abi::AbiError> {
182 let data = data.as_ref();
183 if let Ok(decoded)
184 = <OwnerCall as ::ethers_core::abi::AbiDecode>::decode(data) {
185 return Ok(Self::Owner(decoded));
186 }
187 if let Ok(decoded)
188 = <RenounceOwnershipCall as ::ethers_core::abi::AbiDecode>::decode(
189 data,
190 ) {
191 return Ok(Self::RenounceOwnership(decoded));
192 }
193 if let Ok(decoded)
194 = <TransferOwnershipCall as ::ethers_core::abi::AbiDecode>::decode(
195 data,
196 ) {
197 return Ok(Self::TransferOwnership(decoded));
198 }
199 Err(::ethers_core::abi::Error::InvalidData.into())
200 }
201 }
202 impl ::ethers_core::abi::AbiEncode for OwnableCalls {
203 fn encode(self) -> Vec<u8> {
204 match self {
205 Self::Owner(element) => ::ethers_core::abi::AbiEncode::encode(element),
206 Self::RenounceOwnership(element) => {
207 ::ethers_core::abi::AbiEncode::encode(element)
208 }
209 Self::TransferOwnership(element) => {
210 ::ethers_core::abi::AbiEncode::encode(element)
211 }
212 }
213 }
214 }
215 impl ::core::fmt::Display for OwnableCalls {
216 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
217 match self {
218 Self::Owner(element) => ::core::fmt::Display::fmt(element, f),
219 Self::RenounceOwnership(element) => ::core::fmt::Display::fmt(element, f),
220 Self::TransferOwnership(element) => ::core::fmt::Display::fmt(element, f),
221 }
222 }
223 }
224 impl ::core::convert::From<OwnerCall> for OwnableCalls {
225 fn from(value: OwnerCall) -> Self {
226 Self::Owner(value)
227 }
228 }
229 impl ::core::convert::From<RenounceOwnershipCall> for OwnableCalls {
230 fn from(value: RenounceOwnershipCall) -> Self {
231 Self::RenounceOwnership(value)
232 }
233 }
234 impl ::core::convert::From<TransferOwnershipCall> for OwnableCalls {
235 fn from(value: TransferOwnershipCall) -> Self {
236 Self::TransferOwnership(value)
237 }
238 }
239 #[derive(
241 Clone,
242 ::ethers_contract::EthAbiType,
243 ::ethers_contract::EthAbiCodec,
244 Default,
245 Debug,
246 PartialEq,
247 Eq,
248 Hash
249 )]
250 pub struct OwnerReturn(pub ::ethers_core::types::Address);
251}