openzeppelin_rs/contracts/
IAccessControl.rs

1pub use i_access_control::*;
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 i_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\":[{\"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\":[]}]";
15    ///The parsed JSON ABI of the contract.
16    pub static IACCESSCONTROL_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 IAccessControl<M>(::ethers_contract::Contract<M>);
19    impl<M> ::core::clone::Clone for IAccessControl<M> {
20        fn clone(&self) -> Self {
21            Self(::core::clone::Clone::clone(&self.0))
22        }
23    }
24    impl<M> ::core::ops::Deref for IAccessControl<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 IAccessControl<M> {
31        fn deref_mut(&mut self) -> &mut Self::Target {
32            &mut self.0
33        }
34    }
35    impl<M> ::core::fmt::Debug for IAccessControl<M> {
36        fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
37            f.debug_tuple(stringify!(IAccessControl)).field(&self.address()).finish()
38        }
39    }
40    impl<M: ::ethers_providers::Middleware> IAccessControl<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                    IACCESSCONTROL_ABI.clone(),
51                    client,
52                ),
53            )
54        }
55        ///Calls the contract's `getRoleAdmin` (0x248a9ca3) function
56        pub fn get_role_admin(
57            &self,
58            role: [u8; 32],
59        ) -> ::ethers_contract::builders::ContractCall<M, [u8; 32]> {
60            self.0
61                .method_hash([36, 138, 156, 163], role)
62                .expect("method not found (this should never happen)")
63        }
64        ///Calls the contract's `grantRole` (0x2f2ff15d) function
65        pub fn grant_role(
66            &self,
67            role: [u8; 32],
68            account: ::ethers_core::types::Address,
69        ) -> ::ethers_contract::builders::ContractCall<M, ()> {
70            self.0
71                .method_hash([47, 47, 241, 93], (role, account))
72                .expect("method not found (this should never happen)")
73        }
74        ///Calls the contract's `hasRole` (0x91d14854) function
75        pub fn has_role(
76            &self,
77            role: [u8; 32],
78            account: ::ethers_core::types::Address,
79        ) -> ::ethers_contract::builders::ContractCall<M, bool> {
80            self.0
81                .method_hash([145, 209, 72, 84], (role, account))
82                .expect("method not found (this should never happen)")
83        }
84        ///Calls the contract's `renounceRole` (0x36568abe) function
85        pub fn renounce_role(
86            &self,
87            role: [u8; 32],
88            account: ::ethers_core::types::Address,
89        ) -> ::ethers_contract::builders::ContractCall<M, ()> {
90            self.0
91                .method_hash([54, 86, 138, 190], (role, account))
92                .expect("method not found (this should never happen)")
93        }
94        ///Calls the contract's `revokeRole` (0xd547741f) function
95        pub fn revoke_role(
96            &self,
97            role: [u8; 32],
98            account: ::ethers_core::types::Address,
99        ) -> ::ethers_contract::builders::ContractCall<M, ()> {
100            self.0
101                .method_hash([213, 71, 116, 31], (role, account))
102                .expect("method not found (this should never happen)")
103        }
104        ///Gets the contract's `RoleAdminChanged` event
105        pub fn role_admin_changed_filter(
106            &self,
107        ) -> ::ethers_contract::builders::Event<
108            ::std::sync::Arc<M>,
109            M,
110            RoleAdminChangedFilter,
111        > {
112            self.0.event()
113        }
114        ///Gets the contract's `RoleGranted` event
115        pub fn role_granted_filter(
116            &self,
117        ) -> ::ethers_contract::builders::Event<
118            ::std::sync::Arc<M>,
119            M,
120            RoleGrantedFilter,
121        > {
122            self.0.event()
123        }
124        ///Gets the contract's `RoleRevoked` event
125        pub fn role_revoked_filter(
126            &self,
127        ) -> ::ethers_contract::builders::Event<
128            ::std::sync::Arc<M>,
129            M,
130            RoleRevokedFilter,
131        > {
132            self.0.event()
133        }
134        /// Returns an `Event` builder for all the events of this contract.
135        pub fn events(
136            &self,
137        ) -> ::ethers_contract::builders::Event<
138            ::std::sync::Arc<M>,
139            M,
140            IAccessControlEvents,
141        > {
142            self.0.event_with_filter(::core::default::Default::default())
143        }
144    }
145    impl<M: ::ethers_providers::Middleware> From<::ethers_contract::Contract<M>>
146    for IAccessControl<M> {
147        fn from(contract: ::ethers_contract::Contract<M>) -> Self {
148            Self::new(contract.address(), contract.client())
149        }
150    }
151    #[derive(
152        Clone,
153        ::ethers_contract::EthEvent,
154        ::ethers_contract::EthDisplay,
155        Default,
156        Debug,
157        PartialEq,
158        Eq,
159        Hash
160    )]
161    #[ethevent(
162        name = "RoleAdminChanged",
163        abi = "RoleAdminChanged(bytes32,bytes32,bytes32)"
164    )]
165    pub struct RoleAdminChangedFilter {
166        #[ethevent(indexed)]
167        pub role: [u8; 32],
168        #[ethevent(indexed)]
169        pub previous_admin_role: [u8; 32],
170        #[ethevent(indexed)]
171        pub new_admin_role: [u8; 32],
172    }
173    #[derive(
174        Clone,
175        ::ethers_contract::EthEvent,
176        ::ethers_contract::EthDisplay,
177        Default,
178        Debug,
179        PartialEq,
180        Eq,
181        Hash
182    )]
183    #[ethevent(name = "RoleGranted", abi = "RoleGranted(bytes32,address,address)")]
184    pub struct RoleGrantedFilter {
185        #[ethevent(indexed)]
186        pub role: [u8; 32],
187        #[ethevent(indexed)]
188        pub account: ::ethers_core::types::Address,
189        #[ethevent(indexed)]
190        pub sender: ::ethers_core::types::Address,
191    }
192    #[derive(
193        Clone,
194        ::ethers_contract::EthEvent,
195        ::ethers_contract::EthDisplay,
196        Default,
197        Debug,
198        PartialEq,
199        Eq,
200        Hash
201    )]
202    #[ethevent(name = "RoleRevoked", abi = "RoleRevoked(bytes32,address,address)")]
203    pub struct RoleRevokedFilter {
204        #[ethevent(indexed)]
205        pub role: [u8; 32],
206        #[ethevent(indexed)]
207        pub account: ::ethers_core::types::Address,
208        #[ethevent(indexed)]
209        pub sender: ::ethers_core::types::Address,
210    }
211    ///Container type for all of the contract's events
212    #[derive(Clone, ::ethers_contract::EthAbiType, Debug, PartialEq, Eq, Hash)]
213    pub enum IAccessControlEvents {
214        RoleAdminChangedFilter(RoleAdminChangedFilter),
215        RoleGrantedFilter(RoleGrantedFilter),
216        RoleRevokedFilter(RoleRevokedFilter),
217    }
218    impl ::ethers_contract::EthLogDecode for IAccessControlEvents {
219        fn decode_log(
220            log: &::ethers_core::abi::RawLog,
221        ) -> ::core::result::Result<Self, ::ethers_core::abi::Error> {
222            if let Ok(decoded) = RoleAdminChangedFilter::decode_log(log) {
223                return Ok(IAccessControlEvents::RoleAdminChangedFilter(decoded));
224            }
225            if let Ok(decoded) = RoleGrantedFilter::decode_log(log) {
226                return Ok(IAccessControlEvents::RoleGrantedFilter(decoded));
227            }
228            if let Ok(decoded) = RoleRevokedFilter::decode_log(log) {
229                return Ok(IAccessControlEvents::RoleRevokedFilter(decoded));
230            }
231            Err(::ethers_core::abi::Error::InvalidData)
232        }
233    }
234    impl ::core::fmt::Display for IAccessControlEvents {
235        fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
236            match self {
237                Self::RoleAdminChangedFilter(element) => {
238                    ::core::fmt::Display::fmt(element, f)
239                }
240                Self::RoleGrantedFilter(element) => ::core::fmt::Display::fmt(element, f),
241                Self::RoleRevokedFilter(element) => ::core::fmt::Display::fmt(element, f),
242            }
243        }
244    }
245    impl ::core::convert::From<RoleAdminChangedFilter> for IAccessControlEvents {
246        fn from(value: RoleAdminChangedFilter) -> Self {
247            Self::RoleAdminChangedFilter(value)
248        }
249    }
250    impl ::core::convert::From<RoleGrantedFilter> for IAccessControlEvents {
251        fn from(value: RoleGrantedFilter) -> Self {
252            Self::RoleGrantedFilter(value)
253        }
254    }
255    impl ::core::convert::From<RoleRevokedFilter> for IAccessControlEvents {
256        fn from(value: RoleRevokedFilter) -> Self {
257            Self::RoleRevokedFilter(value)
258        }
259    }
260    ///Container type for all input parameters for the `getRoleAdmin` function with signature `getRoleAdmin(bytes32)` and selector `0x248a9ca3`
261    #[derive(
262        Clone,
263        ::ethers_contract::EthCall,
264        ::ethers_contract::EthDisplay,
265        Default,
266        Debug,
267        PartialEq,
268        Eq,
269        Hash
270    )]
271    #[ethcall(name = "getRoleAdmin", abi = "getRoleAdmin(bytes32)")]
272    pub struct GetRoleAdminCall {
273        pub role: [u8; 32],
274    }
275    ///Container type for all input parameters for the `grantRole` function with signature `grantRole(bytes32,address)` and selector `0x2f2ff15d`
276    #[derive(
277        Clone,
278        ::ethers_contract::EthCall,
279        ::ethers_contract::EthDisplay,
280        Default,
281        Debug,
282        PartialEq,
283        Eq,
284        Hash
285    )]
286    #[ethcall(name = "grantRole", abi = "grantRole(bytes32,address)")]
287    pub struct GrantRoleCall {
288        pub role: [u8; 32],
289        pub account: ::ethers_core::types::Address,
290    }
291    ///Container type for all input parameters for the `hasRole` function with signature `hasRole(bytes32,address)` and selector `0x91d14854`
292    #[derive(
293        Clone,
294        ::ethers_contract::EthCall,
295        ::ethers_contract::EthDisplay,
296        Default,
297        Debug,
298        PartialEq,
299        Eq,
300        Hash
301    )]
302    #[ethcall(name = "hasRole", abi = "hasRole(bytes32,address)")]
303    pub struct HasRoleCall {
304        pub role: [u8; 32],
305        pub account: ::ethers_core::types::Address,
306    }
307    ///Container type for all input parameters for the `renounceRole` function with signature `renounceRole(bytes32,address)` and selector `0x36568abe`
308    #[derive(
309        Clone,
310        ::ethers_contract::EthCall,
311        ::ethers_contract::EthDisplay,
312        Default,
313        Debug,
314        PartialEq,
315        Eq,
316        Hash
317    )]
318    #[ethcall(name = "renounceRole", abi = "renounceRole(bytes32,address)")]
319    pub struct RenounceRoleCall {
320        pub role: [u8; 32],
321        pub account: ::ethers_core::types::Address,
322    }
323    ///Container type for all input parameters for the `revokeRole` function with signature `revokeRole(bytes32,address)` and selector `0xd547741f`
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 = "revokeRole", abi = "revokeRole(bytes32,address)")]
335    pub struct RevokeRoleCall {
336        pub role: [u8; 32],
337        pub account: ::ethers_core::types::Address,
338    }
339    ///Container type for all of the contract's call
340    #[derive(Clone, ::ethers_contract::EthAbiType, Debug, PartialEq, Eq, Hash)]
341    pub enum IAccessControlCalls {
342        GetRoleAdmin(GetRoleAdminCall),
343        GrantRole(GrantRoleCall),
344        HasRole(HasRoleCall),
345        RenounceRole(RenounceRoleCall),
346        RevokeRole(RevokeRoleCall),
347    }
348    impl ::ethers_core::abi::AbiDecode for IAccessControlCalls {
349        fn decode(
350            data: impl AsRef<[u8]>,
351        ) -> ::core::result::Result<Self, ::ethers_core::abi::AbiError> {
352            let data = data.as_ref();
353            if let Ok(decoded)
354                = <GetRoleAdminCall as ::ethers_core::abi::AbiDecode>::decode(data) {
355                return Ok(Self::GetRoleAdmin(decoded));
356            }
357            if let Ok(decoded)
358                = <GrantRoleCall as ::ethers_core::abi::AbiDecode>::decode(data) {
359                return Ok(Self::GrantRole(decoded));
360            }
361            if let Ok(decoded)
362                = <HasRoleCall as ::ethers_core::abi::AbiDecode>::decode(data) {
363                return Ok(Self::HasRole(decoded));
364            }
365            if let Ok(decoded)
366                = <RenounceRoleCall as ::ethers_core::abi::AbiDecode>::decode(data) {
367                return Ok(Self::RenounceRole(decoded));
368            }
369            if let Ok(decoded)
370                = <RevokeRoleCall as ::ethers_core::abi::AbiDecode>::decode(data) {
371                return Ok(Self::RevokeRole(decoded));
372            }
373            Err(::ethers_core::abi::Error::InvalidData.into())
374        }
375    }
376    impl ::ethers_core::abi::AbiEncode for IAccessControlCalls {
377        fn encode(self) -> Vec<u8> {
378            match self {
379                Self::GetRoleAdmin(element) => {
380                    ::ethers_core::abi::AbiEncode::encode(element)
381                }
382                Self::GrantRole(element) => {
383                    ::ethers_core::abi::AbiEncode::encode(element)
384                }
385                Self::HasRole(element) => ::ethers_core::abi::AbiEncode::encode(element),
386                Self::RenounceRole(element) => {
387                    ::ethers_core::abi::AbiEncode::encode(element)
388                }
389                Self::RevokeRole(element) => {
390                    ::ethers_core::abi::AbiEncode::encode(element)
391                }
392            }
393        }
394    }
395    impl ::core::fmt::Display for IAccessControlCalls {
396        fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
397            match self {
398                Self::GetRoleAdmin(element) => ::core::fmt::Display::fmt(element, f),
399                Self::GrantRole(element) => ::core::fmt::Display::fmt(element, f),
400                Self::HasRole(element) => ::core::fmt::Display::fmt(element, f),
401                Self::RenounceRole(element) => ::core::fmt::Display::fmt(element, f),
402                Self::RevokeRole(element) => ::core::fmt::Display::fmt(element, f),
403            }
404        }
405    }
406    impl ::core::convert::From<GetRoleAdminCall> for IAccessControlCalls {
407        fn from(value: GetRoleAdminCall) -> Self {
408            Self::GetRoleAdmin(value)
409        }
410    }
411    impl ::core::convert::From<GrantRoleCall> for IAccessControlCalls {
412        fn from(value: GrantRoleCall) -> Self {
413            Self::GrantRole(value)
414        }
415    }
416    impl ::core::convert::From<HasRoleCall> for IAccessControlCalls {
417        fn from(value: HasRoleCall) -> Self {
418            Self::HasRole(value)
419        }
420    }
421    impl ::core::convert::From<RenounceRoleCall> for IAccessControlCalls {
422        fn from(value: RenounceRoleCall) -> Self {
423            Self::RenounceRole(value)
424        }
425    }
426    impl ::core::convert::From<RevokeRoleCall> for IAccessControlCalls {
427        fn from(value: RevokeRoleCall) -> Self {
428            Self::RevokeRole(value)
429        }
430    }
431    ///Container type for all return fields from the `getRoleAdmin` function with signature `getRoleAdmin(bytes32)` and selector `0x248a9ca3`
432    #[derive(
433        Clone,
434        ::ethers_contract::EthAbiType,
435        ::ethers_contract::EthAbiCodec,
436        Default,
437        Debug,
438        PartialEq,
439        Eq,
440        Hash
441    )]
442    pub struct GetRoleAdminReturn(pub [u8; 32]);
443    ///Container type for all return fields from the `hasRole` function with signature `hasRole(bytes32,address)` and selector `0x91d14854`
444    #[derive(
445        Clone,
446        ::ethers_contract::EthAbiType,
447        ::ethers_contract::EthAbiCodec,
448        Default,
449        Debug,
450        PartialEq,
451        Eq,
452        Hash
453    )]
454    pub struct HasRoleReturn(pub bool);
455}