1pub use access_control::*;
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 access_control {
13 #[rustfmt::skip]
14 const __ABI: &str = "[{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\",\"components\":[],\"indexed\":true},{\"internalType\":\"bytes32\",\"name\":\"previousAdminRole\",\"type\":\"bytes32\",\"components\":[],\"indexed\":true},{\"internalType\":\"bytes32\",\"name\":\"newAdminRole\",\"type\":\"bytes32\",\"components\":[],\"indexed\":true}],\"type\":\"event\",\"name\":\"RoleAdminChanged\",\"outputs\":[],\"anonymous\":false},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\",\"components\":[],\"indexed\":true},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\",\"components\":[],\"indexed\":true},{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\",\"components\":[],\"indexed\":true}],\"type\":\"event\",\"name\":\"RoleGranted\",\"outputs\":[],\"anonymous\":false},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\",\"components\":[],\"indexed\":true},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\",\"components\":[],\"indexed\":true},{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\",\"components\":[],\"indexed\":true}],\"type\":\"event\",\"name\":\"RoleRevoked\",\"outputs\":[],\"anonymous\":false},{\"inputs\":[],\"stateMutability\":\"view\",\"type\":\"function\",\"name\":\"DEFAULT_ADMIN_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\",\"components\":[]}]},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\",\"components\":[]}],\"stateMutability\":\"view\",\"type\":\"function\",\"name\":\"getRoleAdmin\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\",\"components\":[]}]},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\",\"components\":[]},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\",\"components\":[]}],\"stateMutability\":\"nonpayable\",\"type\":\"function\",\"name\":\"grantRole\",\"outputs\":[]},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\",\"components\":[]},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\",\"components\":[]}],\"stateMutability\":\"view\",\"type\":\"function\",\"name\":\"hasRole\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\",\"components\":[]}]},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\",\"components\":[]},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\",\"components\":[]}],\"stateMutability\":\"nonpayable\",\"type\":\"function\",\"name\":\"renounceRole\",\"outputs\":[]},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\",\"components\":[]},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\",\"components\":[]}],\"stateMutability\":\"nonpayable\",\"type\":\"function\",\"name\":\"revokeRole\",\"outputs\":[]},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\",\"components\":[]}],\"stateMutability\":\"view\",\"type\":\"function\",\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\",\"components\":[]}]}]";
15 pub static ACCESSCONTROL_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 AccessControl<M>(::ethers_contract::Contract<M>);
19 impl<M> ::core::clone::Clone for AccessControl<M> {
20 fn clone(&self) -> Self {
21 Self(::core::clone::Clone::clone(&self.0))
22 }
23 }
24 impl<M> ::core::ops::Deref for AccessControl<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 AccessControl<M> {
31 fn deref_mut(&mut self) -> &mut Self::Target {
32 &mut self.0
33 }
34 }
35 impl<M> ::core::fmt::Debug for AccessControl<M> {
36 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
37 f.debug_tuple(stringify!(AccessControl)).field(&self.address()).finish()
38 }
39 }
40 impl<M: ::ethers_providers::Middleware> AccessControl<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 ACCESSCONTROL_ABI.clone(),
51 client,
52 ),
53 )
54 }
55 pub fn default_admin_role(
57 &self,
58 ) -> ::ethers_contract::builders::ContractCall<M, [u8; 32]> {
59 self.0
60 .method_hash([162, 23, 253, 223], ())
61 .expect("method not found (this should never happen)")
62 }
63 pub fn get_role_admin(
65 &self,
66 role: [u8; 32],
67 ) -> ::ethers_contract::builders::ContractCall<M, [u8; 32]> {
68 self.0
69 .method_hash([36, 138, 156, 163], role)
70 .expect("method not found (this should never happen)")
71 }
72 pub fn grant_role(
74 &self,
75 role: [u8; 32],
76 account: ::ethers_core::types::Address,
77 ) -> ::ethers_contract::builders::ContractCall<M, ()> {
78 self.0
79 .method_hash([47, 47, 241, 93], (role, account))
80 .expect("method not found (this should never happen)")
81 }
82 pub fn has_role(
84 &self,
85 role: [u8; 32],
86 account: ::ethers_core::types::Address,
87 ) -> ::ethers_contract::builders::ContractCall<M, bool> {
88 self.0
89 .method_hash([145, 209, 72, 84], (role, account))
90 .expect("method not found (this should never happen)")
91 }
92 pub fn renounce_role(
94 &self,
95 role: [u8; 32],
96 account: ::ethers_core::types::Address,
97 ) -> ::ethers_contract::builders::ContractCall<M, ()> {
98 self.0
99 .method_hash([54, 86, 138, 190], (role, account))
100 .expect("method not found (this should never happen)")
101 }
102 pub fn revoke_role(
104 &self,
105 role: [u8; 32],
106 account: ::ethers_core::types::Address,
107 ) -> ::ethers_contract::builders::ContractCall<M, ()> {
108 self.0
109 .method_hash([213, 71, 116, 31], (role, account))
110 .expect("method not found (this should never happen)")
111 }
112 pub fn supports_interface(
114 &self,
115 interface_id: [u8; 4],
116 ) -> ::ethers_contract::builders::ContractCall<M, bool> {
117 self.0
118 .method_hash([1, 255, 201, 167], interface_id)
119 .expect("method not found (this should never happen)")
120 }
121 pub fn role_admin_changed_filter(
123 &self,
124 ) -> ::ethers_contract::builders::Event<
125 ::std::sync::Arc<M>,
126 M,
127 RoleAdminChangedFilter,
128 > {
129 self.0.event()
130 }
131 pub fn role_granted_filter(
133 &self,
134 ) -> ::ethers_contract::builders::Event<
135 ::std::sync::Arc<M>,
136 M,
137 RoleGrantedFilter,
138 > {
139 self.0.event()
140 }
141 pub fn role_revoked_filter(
143 &self,
144 ) -> ::ethers_contract::builders::Event<
145 ::std::sync::Arc<M>,
146 M,
147 RoleRevokedFilter,
148 > {
149 self.0.event()
150 }
151 pub fn events(
153 &self,
154 ) -> ::ethers_contract::builders::Event<
155 ::std::sync::Arc<M>,
156 M,
157 AccessControlEvents,
158 > {
159 self.0.event_with_filter(::core::default::Default::default())
160 }
161 }
162 impl<M: ::ethers_providers::Middleware> From<::ethers_contract::Contract<M>>
163 for AccessControl<M> {
164 fn from(contract: ::ethers_contract::Contract<M>) -> Self {
165 Self::new(contract.address(), contract.client())
166 }
167 }
168 #[derive(
169 Clone,
170 ::ethers_contract::EthEvent,
171 ::ethers_contract::EthDisplay,
172 Default,
173 Debug,
174 PartialEq,
175 Eq,
176 Hash
177 )]
178 #[ethevent(
179 name = "RoleAdminChanged",
180 abi = "RoleAdminChanged(bytes32,bytes32,bytes32)"
181 )]
182 pub struct RoleAdminChangedFilter {
183 #[ethevent(indexed)]
184 pub role: [u8; 32],
185 #[ethevent(indexed)]
186 pub previous_admin_role: [u8; 32],
187 #[ethevent(indexed)]
188 pub new_admin_role: [u8; 32],
189 }
190 #[derive(
191 Clone,
192 ::ethers_contract::EthEvent,
193 ::ethers_contract::EthDisplay,
194 Default,
195 Debug,
196 PartialEq,
197 Eq,
198 Hash
199 )]
200 #[ethevent(name = "RoleGranted", abi = "RoleGranted(bytes32,address,address)")]
201 pub struct RoleGrantedFilter {
202 #[ethevent(indexed)]
203 pub role: [u8; 32],
204 #[ethevent(indexed)]
205 pub account: ::ethers_core::types::Address,
206 #[ethevent(indexed)]
207 pub sender: ::ethers_core::types::Address,
208 }
209 #[derive(
210 Clone,
211 ::ethers_contract::EthEvent,
212 ::ethers_contract::EthDisplay,
213 Default,
214 Debug,
215 PartialEq,
216 Eq,
217 Hash
218 )]
219 #[ethevent(name = "RoleRevoked", abi = "RoleRevoked(bytes32,address,address)")]
220 pub struct RoleRevokedFilter {
221 #[ethevent(indexed)]
222 pub role: [u8; 32],
223 #[ethevent(indexed)]
224 pub account: ::ethers_core::types::Address,
225 #[ethevent(indexed)]
226 pub sender: ::ethers_core::types::Address,
227 }
228 #[derive(Clone, ::ethers_contract::EthAbiType, Debug, PartialEq, Eq, Hash)]
230 pub enum AccessControlEvents {
231 RoleAdminChangedFilter(RoleAdminChangedFilter),
232 RoleGrantedFilter(RoleGrantedFilter),
233 RoleRevokedFilter(RoleRevokedFilter),
234 }
235 impl ::ethers_contract::EthLogDecode for AccessControlEvents {
236 fn decode_log(
237 log: &::ethers_core::abi::RawLog,
238 ) -> ::core::result::Result<Self, ::ethers_core::abi::Error> {
239 if let Ok(decoded) = RoleAdminChangedFilter::decode_log(log) {
240 return Ok(AccessControlEvents::RoleAdminChangedFilter(decoded));
241 }
242 if let Ok(decoded) = RoleGrantedFilter::decode_log(log) {
243 return Ok(AccessControlEvents::RoleGrantedFilter(decoded));
244 }
245 if let Ok(decoded) = RoleRevokedFilter::decode_log(log) {
246 return Ok(AccessControlEvents::RoleRevokedFilter(decoded));
247 }
248 Err(::ethers_core::abi::Error::InvalidData)
249 }
250 }
251 impl ::core::fmt::Display for AccessControlEvents {
252 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
253 match self {
254 Self::RoleAdminChangedFilter(element) => {
255 ::core::fmt::Display::fmt(element, f)
256 }
257 Self::RoleGrantedFilter(element) => ::core::fmt::Display::fmt(element, f),
258 Self::RoleRevokedFilter(element) => ::core::fmt::Display::fmt(element, f),
259 }
260 }
261 }
262 impl ::core::convert::From<RoleAdminChangedFilter> for AccessControlEvents {
263 fn from(value: RoleAdminChangedFilter) -> Self {
264 Self::RoleAdminChangedFilter(value)
265 }
266 }
267 impl ::core::convert::From<RoleGrantedFilter> for AccessControlEvents {
268 fn from(value: RoleGrantedFilter) -> Self {
269 Self::RoleGrantedFilter(value)
270 }
271 }
272 impl ::core::convert::From<RoleRevokedFilter> for AccessControlEvents {
273 fn from(value: RoleRevokedFilter) -> Self {
274 Self::RoleRevokedFilter(value)
275 }
276 }
277 #[derive(
279 Clone,
280 ::ethers_contract::EthCall,
281 ::ethers_contract::EthDisplay,
282 Default,
283 Debug,
284 PartialEq,
285 Eq,
286 Hash
287 )]
288 #[ethcall(name = "DEFAULT_ADMIN_ROLE", abi = "DEFAULT_ADMIN_ROLE()")]
289 pub struct DefaultAdminRoleCall;
290 #[derive(
292 Clone,
293 ::ethers_contract::EthCall,
294 ::ethers_contract::EthDisplay,
295 Default,
296 Debug,
297 PartialEq,
298 Eq,
299 Hash
300 )]
301 #[ethcall(name = "getRoleAdmin", abi = "getRoleAdmin(bytes32)")]
302 pub struct GetRoleAdminCall {
303 pub role: [u8; 32],
304 }
305 #[derive(
307 Clone,
308 ::ethers_contract::EthCall,
309 ::ethers_contract::EthDisplay,
310 Default,
311 Debug,
312 PartialEq,
313 Eq,
314 Hash
315 )]
316 #[ethcall(name = "grantRole", abi = "grantRole(bytes32,address)")]
317 pub struct GrantRoleCall {
318 pub role: [u8; 32],
319 pub account: ::ethers_core::types::Address,
320 }
321 #[derive(
323 Clone,
324 ::ethers_contract::EthCall,
325 ::ethers_contract::EthDisplay,
326 Default,
327 Debug,
328 PartialEq,
329 Eq,
330 Hash
331 )]
332 #[ethcall(name = "hasRole", abi = "hasRole(bytes32,address)")]
333 pub struct HasRoleCall {
334 pub role: [u8; 32],
335 pub account: ::ethers_core::types::Address,
336 }
337 #[derive(
339 Clone,
340 ::ethers_contract::EthCall,
341 ::ethers_contract::EthDisplay,
342 Default,
343 Debug,
344 PartialEq,
345 Eq,
346 Hash
347 )]
348 #[ethcall(name = "renounceRole", abi = "renounceRole(bytes32,address)")]
349 pub struct RenounceRoleCall {
350 pub role: [u8; 32],
351 pub account: ::ethers_core::types::Address,
352 }
353 #[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 = "revokeRole", abi = "revokeRole(bytes32,address)")]
365 pub struct RevokeRoleCall {
366 pub role: [u8; 32],
367 pub account: ::ethers_core::types::Address,
368 }
369 #[derive(
371 Clone,
372 ::ethers_contract::EthCall,
373 ::ethers_contract::EthDisplay,
374 Default,
375 Debug,
376 PartialEq,
377 Eq,
378 Hash
379 )]
380 #[ethcall(name = "supportsInterface", abi = "supportsInterface(bytes4)")]
381 pub struct SupportsInterfaceCall {
382 pub interface_id: [u8; 4],
383 }
384 #[derive(Clone, ::ethers_contract::EthAbiType, Debug, PartialEq, Eq, Hash)]
386 pub enum AccessControlCalls {
387 DefaultAdminRole(DefaultAdminRoleCall),
388 GetRoleAdmin(GetRoleAdminCall),
389 GrantRole(GrantRoleCall),
390 HasRole(HasRoleCall),
391 RenounceRole(RenounceRoleCall),
392 RevokeRole(RevokeRoleCall),
393 SupportsInterface(SupportsInterfaceCall),
394 }
395 impl ::ethers_core::abi::AbiDecode for AccessControlCalls {
396 fn decode(
397 data: impl AsRef<[u8]>,
398 ) -> ::core::result::Result<Self, ::ethers_core::abi::AbiError> {
399 let data = data.as_ref();
400 if let Ok(decoded)
401 = <DefaultAdminRoleCall as ::ethers_core::abi::AbiDecode>::decode(data) {
402 return Ok(Self::DefaultAdminRole(decoded));
403 }
404 if let Ok(decoded)
405 = <GetRoleAdminCall as ::ethers_core::abi::AbiDecode>::decode(data) {
406 return Ok(Self::GetRoleAdmin(decoded));
407 }
408 if let Ok(decoded)
409 = <GrantRoleCall as ::ethers_core::abi::AbiDecode>::decode(data) {
410 return Ok(Self::GrantRole(decoded));
411 }
412 if let Ok(decoded)
413 = <HasRoleCall as ::ethers_core::abi::AbiDecode>::decode(data) {
414 return Ok(Self::HasRole(decoded));
415 }
416 if let Ok(decoded)
417 = <RenounceRoleCall as ::ethers_core::abi::AbiDecode>::decode(data) {
418 return Ok(Self::RenounceRole(decoded));
419 }
420 if let Ok(decoded)
421 = <RevokeRoleCall as ::ethers_core::abi::AbiDecode>::decode(data) {
422 return Ok(Self::RevokeRole(decoded));
423 }
424 if let Ok(decoded)
425 = <SupportsInterfaceCall as ::ethers_core::abi::AbiDecode>::decode(
426 data,
427 ) {
428 return Ok(Self::SupportsInterface(decoded));
429 }
430 Err(::ethers_core::abi::Error::InvalidData.into())
431 }
432 }
433 impl ::ethers_core::abi::AbiEncode for AccessControlCalls {
434 fn encode(self) -> Vec<u8> {
435 match self {
436 Self::DefaultAdminRole(element) => {
437 ::ethers_core::abi::AbiEncode::encode(element)
438 }
439 Self::GetRoleAdmin(element) => {
440 ::ethers_core::abi::AbiEncode::encode(element)
441 }
442 Self::GrantRole(element) => {
443 ::ethers_core::abi::AbiEncode::encode(element)
444 }
445 Self::HasRole(element) => ::ethers_core::abi::AbiEncode::encode(element),
446 Self::RenounceRole(element) => {
447 ::ethers_core::abi::AbiEncode::encode(element)
448 }
449 Self::RevokeRole(element) => {
450 ::ethers_core::abi::AbiEncode::encode(element)
451 }
452 Self::SupportsInterface(element) => {
453 ::ethers_core::abi::AbiEncode::encode(element)
454 }
455 }
456 }
457 }
458 impl ::core::fmt::Display for AccessControlCalls {
459 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
460 match self {
461 Self::DefaultAdminRole(element) => ::core::fmt::Display::fmt(element, f),
462 Self::GetRoleAdmin(element) => ::core::fmt::Display::fmt(element, f),
463 Self::GrantRole(element) => ::core::fmt::Display::fmt(element, f),
464 Self::HasRole(element) => ::core::fmt::Display::fmt(element, f),
465 Self::RenounceRole(element) => ::core::fmt::Display::fmt(element, f),
466 Self::RevokeRole(element) => ::core::fmt::Display::fmt(element, f),
467 Self::SupportsInterface(element) => ::core::fmt::Display::fmt(element, f),
468 }
469 }
470 }
471 impl ::core::convert::From<DefaultAdminRoleCall> for AccessControlCalls {
472 fn from(value: DefaultAdminRoleCall) -> Self {
473 Self::DefaultAdminRole(value)
474 }
475 }
476 impl ::core::convert::From<GetRoleAdminCall> for AccessControlCalls {
477 fn from(value: GetRoleAdminCall) -> Self {
478 Self::GetRoleAdmin(value)
479 }
480 }
481 impl ::core::convert::From<GrantRoleCall> for AccessControlCalls {
482 fn from(value: GrantRoleCall) -> Self {
483 Self::GrantRole(value)
484 }
485 }
486 impl ::core::convert::From<HasRoleCall> for AccessControlCalls {
487 fn from(value: HasRoleCall) -> Self {
488 Self::HasRole(value)
489 }
490 }
491 impl ::core::convert::From<RenounceRoleCall> for AccessControlCalls {
492 fn from(value: RenounceRoleCall) -> Self {
493 Self::RenounceRole(value)
494 }
495 }
496 impl ::core::convert::From<RevokeRoleCall> for AccessControlCalls {
497 fn from(value: RevokeRoleCall) -> Self {
498 Self::RevokeRole(value)
499 }
500 }
501 impl ::core::convert::From<SupportsInterfaceCall> for AccessControlCalls {
502 fn from(value: SupportsInterfaceCall) -> Self {
503 Self::SupportsInterface(value)
504 }
505 }
506 #[derive(
508 Clone,
509 ::ethers_contract::EthAbiType,
510 ::ethers_contract::EthAbiCodec,
511 Default,
512 Debug,
513 PartialEq,
514 Eq,
515 Hash
516 )]
517 pub struct DefaultAdminRoleReturn(pub [u8; 32]);
518 #[derive(
520 Clone,
521 ::ethers_contract::EthAbiType,
522 ::ethers_contract::EthAbiCodec,
523 Default,
524 Debug,
525 PartialEq,
526 Eq,
527 Hash
528 )]
529 pub struct GetRoleAdminReturn(pub [u8; 32]);
530 #[derive(
532 Clone,
533 ::ethers_contract::EthAbiType,
534 ::ethers_contract::EthAbiCodec,
535 Default,
536 Debug,
537 PartialEq,
538 Eq,
539 Hash
540 )]
541 pub struct HasRoleReturn(pub bool);
542 #[derive(
544 Clone,
545 ::ethers_contract::EthAbiType,
546 ::ethers_contract::EthAbiCodec,
547 Default,
548 Debug,
549 PartialEq,
550 Eq,
551 Hash
552 )]
553 pub struct SupportsInterfaceReturn(pub bool);
554}