pub use access_control::*;
#[allow(
clippy::enum_variant_names,
clippy::too_many_arguments,
clippy::upper_case_acronyms,
clippy::type_complexity,
dead_code,
non_camel_case_types,
)]
pub mod access_control {
#[rustfmt::skip]
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\":[]}]}]";
pub static ACCESSCONTROL_ABI: ::ethers::contract::Lazy<::ethers::core::abi::Abi> = ::ethers::contract::Lazy::new(||
::ethers::core::utils::__serde_json::from_str(__ABI).expect("ABI is always valid"));
pub struct AccessControl<M>(::ethers::contract::Contract<M>);
impl<M> ::core::clone::Clone for AccessControl<M> {
fn clone(&self) -> Self {
Self(::core::clone::Clone::clone(&self.0))
}
}
impl<M> ::core::ops::Deref for AccessControl<M> {
type Target = ::ethers::contract::Contract<M>;
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl<M> ::core::ops::DerefMut for AccessControl<M> {
fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.0
}
}
impl<M> ::core::fmt::Debug for AccessControl<M> {
fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
f.debug_tuple(stringify!(AccessControl)).field(&self.address()).finish()
}
}
impl<M: ::ethers::providers::Middleware> AccessControl<M> {
pub fn new<T: Into<::ethers::core::types::Address>>(
address: T,
client: ::std::sync::Arc<M>,
) -> Self {
Self(
::ethers::contract::Contract::new(
address.into(),
ACCESSCONTROL_ABI.clone(),
client,
),
)
}
pub fn default_admin_role(
&self,
) -> ::ethers::contract::builders::ContractCall<M, [u8; 32]> {
self.0
.method_hash([162, 23, 253, 223], ())
.expect("method not found (this should never happen)")
}
pub fn get_role_admin(
&self,
role: [u8; 32],
) -> ::ethers::contract::builders::ContractCall<M, [u8; 32]> {
self.0
.method_hash([36, 138, 156, 163], role)
.expect("method not found (this should never happen)")
}
pub fn grant_role(
&self,
role: [u8; 32],
account: ::ethers::core::types::Address,
) -> ::ethers::contract::builders::ContractCall<M, ()> {
self.0
.method_hash([47, 47, 241, 93], (role, account))
.expect("method not found (this should never happen)")
}
pub fn has_role(
&self,
role: [u8; 32],
account: ::ethers::core::types::Address,
) -> ::ethers::contract::builders::ContractCall<M, bool> {
self.0
.method_hash([145, 209, 72, 84], (role, account))
.expect("method not found (this should never happen)")
}
pub fn renounce_role(
&self,
role: [u8; 32],
account: ::ethers::core::types::Address,
) -> ::ethers::contract::builders::ContractCall<M, ()> {
self.0
.method_hash([54, 86, 138, 190], (role, account))
.expect("method not found (this should never happen)")
}
pub fn revoke_role(
&self,
role: [u8; 32],
account: ::ethers::core::types::Address,
) -> ::ethers::contract::builders::ContractCall<M, ()> {
self.0
.method_hash([213, 71, 116, 31], (role, account))
.expect("method not found (this should never happen)")
}
pub fn supports_interface(
&self,
interface_id: [u8; 4],
) -> ::ethers::contract::builders::ContractCall<M, bool> {
self.0
.method_hash([1, 255, 201, 167], interface_id)
.expect("method not found (this should never happen)")
}
pub fn role_admin_changed_filter(
&self,
) -> ::ethers::contract::builders::Event<
::std::sync::Arc<M>,
M,
RoleAdminChangedFilter,
> {
self.0.event()
}
pub fn role_granted_filter(
&self,
) -> ::ethers::contract::builders::Event<
::std::sync::Arc<M>,
M,
RoleGrantedFilter,
> {
self.0.event()
}
pub fn role_revoked_filter(
&self,
) -> ::ethers::contract::builders::Event<
::std::sync::Arc<M>,
M,
RoleRevokedFilter,
> {
self.0.event()
}
pub fn events(
&self,
) -> ::ethers::contract::builders::Event<
::std::sync::Arc<M>,
M,
AccessControlEvents,
> {
self.0.event_with_filter(::core::default::Default::default())
}
}
impl<M: ::ethers::providers::Middleware> From<::ethers::contract::Contract<M>>
for AccessControl<M> {
fn from(contract: ::ethers::contract::Contract<M>) -> Self {
Self::new(contract.address(), contract.client())
}
}
#[derive(
Clone,
::ethers::contract::EthEvent,
::ethers::contract::EthDisplay,
Default,
Debug,
PartialEq,
Eq,
Hash
)]
#[ethevent(
name = "RoleAdminChanged",
abi = "RoleAdminChanged(bytes32,bytes32,bytes32)"
)]
pub struct RoleAdminChangedFilter {
#[ethevent(indexed)]
pub role: [u8; 32],
#[ethevent(indexed)]
pub previous_admin_role: [u8; 32],
#[ethevent(indexed)]
pub new_admin_role: [u8; 32],
}
#[derive(
Clone,
::ethers::contract::EthEvent,
::ethers::contract::EthDisplay,
Default,
Debug,
PartialEq,
Eq,
Hash
)]
#[ethevent(name = "RoleGranted", abi = "RoleGranted(bytes32,address,address)")]
pub struct RoleGrantedFilter {
#[ethevent(indexed)]
pub role: [u8; 32],
#[ethevent(indexed)]
pub account: ::ethers::core::types::Address,
#[ethevent(indexed)]
pub sender: ::ethers::core::types::Address,
}
#[derive(
Clone,
::ethers::contract::EthEvent,
::ethers::contract::EthDisplay,
Default,
Debug,
PartialEq,
Eq,
Hash
)]
#[ethevent(name = "RoleRevoked", abi = "RoleRevoked(bytes32,address,address)")]
pub struct RoleRevokedFilter {
#[ethevent(indexed)]
pub role: [u8; 32],
#[ethevent(indexed)]
pub account: ::ethers::core::types::Address,
#[ethevent(indexed)]
pub sender: ::ethers::core::types::Address,
}
#[derive(Clone, ::ethers::contract::EthAbiType, Debug, PartialEq, Eq, Hash)]
pub enum AccessControlEvents {
RoleAdminChangedFilter(RoleAdminChangedFilter),
RoleGrantedFilter(RoleGrantedFilter),
RoleRevokedFilter(RoleRevokedFilter),
}
impl ::ethers::contract::EthLogDecode for AccessControlEvents {
fn decode_log(
log: &::ethers::core::abi::RawLog,
) -> ::core::result::Result<Self, ::ethers::core::abi::Error> {
if let Ok(decoded) = RoleAdminChangedFilter::decode_log(log) {
return Ok(AccessControlEvents::RoleAdminChangedFilter(decoded));
}
if let Ok(decoded) = RoleGrantedFilter::decode_log(log) {
return Ok(AccessControlEvents::RoleGrantedFilter(decoded));
}
if let Ok(decoded) = RoleRevokedFilter::decode_log(log) {
return Ok(AccessControlEvents::RoleRevokedFilter(decoded));
}
Err(::ethers::core::abi::Error::InvalidData)
}
}
impl ::core::fmt::Display for AccessControlEvents {
fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
match self {
Self::RoleAdminChangedFilter(element) => {
::core::fmt::Display::fmt(element, f)
}
Self::RoleGrantedFilter(element) => ::core::fmt::Display::fmt(element, f),
Self::RoleRevokedFilter(element) => ::core::fmt::Display::fmt(element, f),
}
}
}
impl ::core::convert::From<RoleAdminChangedFilter> for AccessControlEvents {
fn from(value: RoleAdminChangedFilter) -> Self {
Self::RoleAdminChangedFilter(value)
}
}
impl ::core::convert::From<RoleGrantedFilter> for AccessControlEvents {
fn from(value: RoleGrantedFilter) -> Self {
Self::RoleGrantedFilter(value)
}
}
impl ::core::convert::From<RoleRevokedFilter> for AccessControlEvents {
fn from(value: RoleRevokedFilter) -> Self {
Self::RoleRevokedFilter(value)
}
}
#[derive(
Clone,
::ethers::contract::EthCall,
::ethers::contract::EthDisplay,
Default,
Debug,
PartialEq,
Eq,
Hash
)]
#[ethcall(name = "DEFAULT_ADMIN_ROLE", abi = "DEFAULT_ADMIN_ROLE()")]
pub struct DefaultAdminRoleCall;
#[derive(
Clone,
::ethers::contract::EthCall,
::ethers::contract::EthDisplay,
Default,
Debug,
PartialEq,
Eq,
Hash
)]
#[ethcall(name = "getRoleAdmin", abi = "getRoleAdmin(bytes32)")]
pub struct GetRoleAdminCall {
pub role: [u8; 32],
}
#[derive(
Clone,
::ethers::contract::EthCall,
::ethers::contract::EthDisplay,
Default,
Debug,
PartialEq,
Eq,
Hash
)]
#[ethcall(name = "grantRole", abi = "grantRole(bytes32,address)")]
pub struct GrantRoleCall {
pub role: [u8; 32],
pub account: ::ethers::core::types::Address,
}
#[derive(
Clone,
::ethers::contract::EthCall,
::ethers::contract::EthDisplay,
Default,
Debug,
PartialEq,
Eq,
Hash
)]
#[ethcall(name = "hasRole", abi = "hasRole(bytes32,address)")]
pub struct HasRoleCall {
pub role: [u8; 32],
pub account: ::ethers::core::types::Address,
}
#[derive(
Clone,
::ethers::contract::EthCall,
::ethers::contract::EthDisplay,
Default,
Debug,
PartialEq,
Eq,
Hash
)]
#[ethcall(name = "renounceRole", abi = "renounceRole(bytes32,address)")]
pub struct RenounceRoleCall {
pub role: [u8; 32],
pub account: ::ethers::core::types::Address,
}
#[derive(
Clone,
::ethers::contract::EthCall,
::ethers::contract::EthDisplay,
Default,
Debug,
PartialEq,
Eq,
Hash
)]
#[ethcall(name = "revokeRole", abi = "revokeRole(bytes32,address)")]
pub struct RevokeRoleCall {
pub role: [u8; 32],
pub account: ::ethers::core::types::Address,
}
#[derive(
Clone,
::ethers::contract::EthCall,
::ethers::contract::EthDisplay,
Default,
Debug,
PartialEq,
Eq,
Hash
)]
#[ethcall(name = "supportsInterface", abi = "supportsInterface(bytes4)")]
pub struct SupportsInterfaceCall {
pub interface_id: [u8; 4],
}
#[derive(Clone, ::ethers::contract::EthAbiType, Debug, PartialEq, Eq, Hash)]
pub enum AccessControlCalls {
DefaultAdminRole(DefaultAdminRoleCall),
GetRoleAdmin(GetRoleAdminCall),
GrantRole(GrantRoleCall),
HasRole(HasRoleCall),
RenounceRole(RenounceRoleCall),
RevokeRole(RevokeRoleCall),
SupportsInterface(SupportsInterfaceCall),
}
impl ::ethers::core::abi::AbiDecode for AccessControlCalls {
fn decode(
data: impl AsRef<[u8]>,
) -> ::core::result::Result<Self, ::ethers::core::abi::AbiError> {
let data = data.as_ref();
if let Ok(decoded)
= <DefaultAdminRoleCall as ::ethers::core::abi::AbiDecode>::decode(
data,
) {
return Ok(Self::DefaultAdminRole(decoded));
}
if let Ok(decoded)
= <GetRoleAdminCall as ::ethers::core::abi::AbiDecode>::decode(data) {
return Ok(Self::GetRoleAdmin(decoded));
}
if let Ok(decoded)
= <GrantRoleCall as ::ethers::core::abi::AbiDecode>::decode(data) {
return Ok(Self::GrantRole(decoded));
}
if let Ok(decoded)
= <HasRoleCall as ::ethers::core::abi::AbiDecode>::decode(data) {
return Ok(Self::HasRole(decoded));
}
if let Ok(decoded)
= <RenounceRoleCall as ::ethers::core::abi::AbiDecode>::decode(data) {
return Ok(Self::RenounceRole(decoded));
}
if let Ok(decoded)
= <RevokeRoleCall as ::ethers::core::abi::AbiDecode>::decode(data) {
return Ok(Self::RevokeRole(decoded));
}
if let Ok(decoded)
= <SupportsInterfaceCall as ::ethers::core::abi::AbiDecode>::decode(
data,
) {
return Ok(Self::SupportsInterface(decoded));
}
Err(::ethers::core::abi::Error::InvalidData.into())
}
}
impl ::ethers::core::abi::AbiEncode for AccessControlCalls {
fn encode(self) -> Vec<u8> {
match self {
Self::DefaultAdminRole(element) => {
::ethers::core::abi::AbiEncode::encode(element)
}
Self::GetRoleAdmin(element) => {
::ethers::core::abi::AbiEncode::encode(element)
}
Self::GrantRole(element) => {
::ethers::core::abi::AbiEncode::encode(element)
}
Self::HasRole(element) => ::ethers::core::abi::AbiEncode::encode(element),
Self::RenounceRole(element) => {
::ethers::core::abi::AbiEncode::encode(element)
}
Self::RevokeRole(element) => {
::ethers::core::abi::AbiEncode::encode(element)
}
Self::SupportsInterface(element) => {
::ethers::core::abi::AbiEncode::encode(element)
}
}
}
}
impl ::core::fmt::Display for AccessControlCalls {
fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
match self {
Self::DefaultAdminRole(element) => ::core::fmt::Display::fmt(element, f),
Self::GetRoleAdmin(element) => ::core::fmt::Display::fmt(element, f),
Self::GrantRole(element) => ::core::fmt::Display::fmt(element, f),
Self::HasRole(element) => ::core::fmt::Display::fmt(element, f),
Self::RenounceRole(element) => ::core::fmt::Display::fmt(element, f),
Self::RevokeRole(element) => ::core::fmt::Display::fmt(element, f),
Self::SupportsInterface(element) => ::core::fmt::Display::fmt(element, f),
}
}
}
impl ::core::convert::From<DefaultAdminRoleCall> for AccessControlCalls {
fn from(value: DefaultAdminRoleCall) -> Self {
Self::DefaultAdminRole(value)
}
}
impl ::core::convert::From<GetRoleAdminCall> for AccessControlCalls {
fn from(value: GetRoleAdminCall) -> Self {
Self::GetRoleAdmin(value)
}
}
impl ::core::convert::From<GrantRoleCall> for AccessControlCalls {
fn from(value: GrantRoleCall) -> Self {
Self::GrantRole(value)
}
}
impl ::core::convert::From<HasRoleCall> for AccessControlCalls {
fn from(value: HasRoleCall) -> Self {
Self::HasRole(value)
}
}
impl ::core::convert::From<RenounceRoleCall> for AccessControlCalls {
fn from(value: RenounceRoleCall) -> Self {
Self::RenounceRole(value)
}
}
impl ::core::convert::From<RevokeRoleCall> for AccessControlCalls {
fn from(value: RevokeRoleCall) -> Self {
Self::RevokeRole(value)
}
}
impl ::core::convert::From<SupportsInterfaceCall> for AccessControlCalls {
fn from(value: SupportsInterfaceCall) -> Self {
Self::SupportsInterface(value)
}
}
#[derive(
Clone,
::ethers::contract::EthAbiType,
::ethers::contract::EthAbiCodec,
Default,
Debug,
PartialEq,
Eq,
Hash
)]
pub struct DefaultAdminRoleReturn(pub [u8; 32]);
#[derive(
Clone,
::ethers::contract::EthAbiType,
::ethers::contract::EthAbiCodec,
Default,
Debug,
PartialEq,
Eq,
Hash
)]
pub struct GetRoleAdminReturn(pub [u8; 32]);
#[derive(
Clone,
::ethers::contract::EthAbiType,
::ethers::contract::EthAbiCodec,
Default,
Debug,
PartialEq,
Eq,
Hash
)]
pub struct HasRoleReturn(pub bool);
#[derive(
Clone,
::ethers::contract::EthAbiType,
::ethers::contract::EthAbiCodec,
Default,
Debug,
PartialEq,
Eq,
Hash
)]
pub struct SupportsInterfaceReturn(pub bool);
}