Skip to main content

ExtensionRegistry

Methods​

DEFAULT_ADMIN_ROLE​

function DEFAULT_ADMIN_ROLE() external view returns (bytes32)

Returns​

NameTypeDescription
_0bytes32undefined

addExtension​

function addExtension(IExtension.Extension _extension) external nonpayable

Parameters​

NameTypeDescription
_extensionIExtension.Extensionundefined

getAllExtensions​

function getAllExtensions() external view returns (struct IExtension.Extension[] allExtensions)

Returns all extensions stored.

Returns​

NameTypeDescription
allExtensionsIExtension.Extension[]undefined

getAllFunctionsOfExtension​

function getAllFunctionsOfExtension(string _extensionName) external view returns (struct IExtension.ExtensionFunction[])

Returns all functions that belong to the given extension contract.

Parameters​

NameTypeDescription
_extensionNamestringundefined

Returns​

NameTypeDescription
_0IExtension.ExtensionFunction[]undefined

getExtension​

function getExtension(string _extensionName) external view returns (struct IExtension.Extension)

Returns the extension metadata and functions for a given extension.

Parameters​

NameTypeDescription
_extensionNamestringundefined

Returns​

NameTypeDescription
_0IExtension.Extensionundefined

getExtensionForFunction​

function getExtensionForFunction(bytes4 _functionSelector) external view returns (struct IExtension.ExtensionMetadata)

Returns the extension metadata for a given function.

Parameters​

NameTypeDescription
_functionSelectorbytes4undefined

Returns​

NameTypeDescription
_0IExtension.ExtensionMetadataundefined

getExtensionImplementation​

function getExtensionImplementation(string _extensionName) external view returns (address)

Returns the extension's implementation smart contract address.

Parameters​

NameTypeDescription
_extensionNamestringundefined

Returns​

NameTypeDescription
_0addressundefined

getRoleAdmin​

function getRoleAdmin(bytes32 role) external view returns (bytes32)

Returns the admin role that controls the specified role.

See {grantRole} and {revokeRole}. To change a role's admin, use {_setRoleAdmin}.

Parameters​

NameTypeDescription
rolebytes32keccak256 hash of the role. e.g. keccak256("TRANSFER_ROLE")

Returns​

NameTypeDescription
_0bytes32undefined

getRoleMember​

function getRoleMember(bytes32 role, uint256 index) external view returns (address member)

Returns the role-member from a list of members for a role, at a given index.

Returns member who has role, at index of role-members list. See struct {RoleMembers}, and mapping {roleMembers}

Parameters​

NameTypeDescription
rolebytes32keccak256 hash of the role. e.g. keccak256("TRANSFER_ROLE")
indexuint256Index in list of current members for the role.

Returns​

NameTypeDescription
memberaddressAddress of account that has role

getRoleMemberCount​

function getRoleMemberCount(bytes32 role) external view returns (uint256 count)

Returns total number of accounts that have a role.

Returns count of accounts that have role. See struct {RoleMembers}, and mapping {roleMembers}

Parameters​

NameTypeDescription
rolebytes32keccak256 hash of the role. e.g. keccak256("TRANSFER_ROLE")

Returns​

NameTypeDescription
countuint256Total number of accounts that have role

grantRole​

function grantRole(bytes32 role, address account) external nonpayable

Grants a role to an account, if not previously granted.

Caller must have admin role for the role. Emits {RoleGranted Event}.

Parameters​

NameTypeDescription
rolebytes32keccak256 hash of the role. e.g. keccak256("TRANSFER_ROLE")
accountaddressAddress of the account to which the role is being granted.

hasRole​

function hasRole(bytes32 role, address account) external view returns (bool)

Checks whether an account has a particular role.

Returns true if account has been granted role.

Parameters​

NameTypeDescription
rolebytes32keccak256 hash of the role. e.g. keccak256("TRANSFER_ROLE")
accountaddressAddress of the account for which the role is being checked.

Returns​

NameTypeDescription
_0boolundefined

hasRoleWithSwitch​

function hasRoleWithSwitch(bytes32 role, address account) external view returns (bool)

Checks whether an account has a particular role; role restrictions can be switched on and off.

Returns true if account has been granted role. Role restrictions can be switched on and off: - If address(0) has ROLE, then the ROLE restrictions don't apply. - If address(0) does not have ROLE, then the ROLE restrictions will apply.

Parameters​

NameTypeDescription
rolebytes32keccak256 hash of the role. e.g. keccak256("TRANSFER_ROLE")
accountaddressAddress of the account for which the role is being checked.

Returns​

NameTypeDescription
_0boolundefined

removeExtension​

function removeExtension(string _extensionName) external nonpayable

Remove an existing extension from the registry.

Parameters​

NameTypeDescription
_extensionNamestringundefined

renounceRole​

function renounceRole(bytes32 role, address account) external nonpayable

Revokes role from the account.

Caller must have the role, with caller being the same as account. Emits {RoleRevoked Event}.

Parameters​

NameTypeDescription
rolebytes32keccak256 hash of the role. e.g. keccak256("TRANSFER_ROLE")
accountaddressAddress of the account from which the role is being revoked.

revokeRole​

function revokeRole(bytes32 role, address account) external nonpayable

Revokes role from an account.

Caller must have admin role for the role. Emits {RoleRevoked Event}.

Parameters​

NameTypeDescription
rolebytes32keccak256 hash of the role. e.g. keccak256("TRANSFER_ROLE")
accountaddressAddress of the account from which the role is being revoked.

updateExtension​

function updateExtension(IExtension.Extension _extension) external nonpayable

Parameters​

NameTypeDescription
_extensionIExtension.Extensionundefined

Events​

ExtensionAdded​

event ExtensionAdded(address indexed extensionAddress, bytes4 indexed functionSelector, string functionSignature)

Parameters​

NameTypeDescription
extensionAddress indexedaddressundefined
functionSelector indexedbytes4undefined
functionSignaturestringundefined

ExtensionRemoved​

event ExtensionRemoved(address indexed extensionAddress, bytes4 indexed functionSelector, string functionSignature)

Parameters​

NameTypeDescription
extensionAddress indexedaddressundefined
functionSelector indexedbytes4undefined
functionSignaturestringundefined

ExtensionUpdated​

event ExtensionUpdated(address indexed oldExtensionAddress, address indexed newExtensionAddress, bytes4 indexed functionSelector, string functionSignature)

Parameters​

NameTypeDescription
oldExtensionAddress indexedaddressundefined
newExtensionAddress indexedaddressundefined
functionSelector indexedbytes4undefined
functionSignaturestringundefined

RoleAdminChanged​

event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole)

Parameters​

NameTypeDescription
role indexedbytes32undefined
previousAdminRole indexedbytes32undefined
newAdminRole indexedbytes32undefined

RoleGranted​

event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender)

Parameters​

NameTypeDescription
role indexedbytes32undefined
account indexedaddressundefined
sender indexedaddressundefined

RoleRevoked​

event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender)

Parameters​

NameTypeDescription
role indexedbytes32undefined
account indexedaddressundefined
sender indexedaddressundefined