# ExtensionRegistry

## Methods

### DEFAULT\_ADMIN\_ROLE

```solidity
function DEFAULT_ADMIN_ROLE() external view returns (bytes32)
```

#### Returns

| Name | Type    | Description |
| ---- | ------- | ----------- |
| \_0  | bytes32 | undefined   |

### addExtension

```solidity
function addExtension(IExtension.Extension _extension) external nonpayable
```

#### Parameters

| Name        | Type                 | Description |
| ----------- | -------------------- | ----------- |
| \_extension | IExtension.Extension | undefined   |

### getAllExtensions

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

Returns all extensions stored.

#### Returns

| Name          | Type                    | Description |
| ------------- | ----------------------- | ----------- |
| allExtensions | IExtension.Extension\[] | undefined   |

### getAllFunctionsOfExtension

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

Returns all functions that belong to the given extension contract.

#### Parameters

| Name            | Type   | Description |
| --------------- | ------ | ----------- |
| \_extensionName | string | undefined   |

#### Returns

| Name | Type                            | Description |
| ---- | ------------------------------- | ----------- |
| \_0  | IExtension.ExtensionFunction\[] | undefined   |

### getExtension

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

Returns the extension metadata and functions for a given extension.

#### Parameters

| Name            | Type   | Description |
| --------------- | ------ | ----------- |
| \_extensionName | string | undefined   |

#### Returns

| Name | Type                 | Description |
| ---- | -------------------- | ----------- |
| \_0  | IExtension.Extension | undefined   |

### getExtensionForFunction

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

Returns the extension metadata for a given function.

#### Parameters

| Name               | Type   | Description |
| ------------------ | ------ | ----------- |
| \_functionSelector | bytes4 | undefined   |

#### Returns

| Name | Type                         | Description |
| ---- | ---------------------------- | ----------- |
| \_0  | IExtension.ExtensionMetadata | undefined   |

### getExtensionImplementation

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

Returns the extension's implementation smart contract address.

#### Parameters

| Name            | Type   | Description |
| --------------- | ------ | ----------- |
| \_extensionName | string | undefined   |

#### Returns

| Name | Type    | Description |
| ---- | ------- | ----------- |
| \_0  | address | undefined   |

### getRoleAdmin

```solidity
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

| Name | Type    | Description                                                  |
| ---- | ------- | ------------------------------------------------------------ |
| role | bytes32 | keccak256 hash of the role. e.g. keccak256("TRANSFER\_ROLE") |

#### Returns

| Name | Type    | Description |
| ---- | ------- | ----------- |
| \_0  | bytes32 | undefined   |

### getRoleMember

```solidity
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

| Name  | Type    | Description                                                  |
| ----- | ------- | ------------------------------------------------------------ |
| role  | bytes32 | keccak256 hash of the role. e.g. keccak256("TRANSFER\_ROLE") |
| index | uint256 | Index in list of current members for the role.               |

#### Returns

| Name   | Type    | Description                        |
| ------ | ------- | ---------------------------------- |
| member | address | Address of account that has `role` |

### getRoleMemberCount

```solidity
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

| Name | Type    | Description                                                  |
| ---- | ------- | ------------------------------------------------------------ |
| role | bytes32 | keccak256 hash of the role. e.g. keccak256("TRANSFER\_ROLE") |

#### Returns

| Name  | Type    | Description                               |
| ----- | ------- | ----------------------------------------- |
| count | uint256 | Total number of accounts that have `role` |

### grantRole

```solidity
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

| Name    | Type    | Description                                                  |
| ------- | ------- | ------------------------------------------------------------ |
| role    | bytes32 | keccak256 hash of the role. e.g. keccak256("TRANSFER\_ROLE") |
| account | address | Address of the account to which the role is being granted.   |

### hasRole

```solidity
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

| Name    | Type    | Description                                                  |
| ------- | ------- | ------------------------------------------------------------ |
| role    | bytes32 | keccak256 hash of the role. e.g. keccak256("TRANSFER\_ROLE") |
| account | address | Address of the account for which the role is being checked.  |

#### Returns

| Name | Type | Description |
| ---- | ---- | ----------- |
| \_0  | bool | undefined   |

### hasRoleWithSwitch

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

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

*Returns `true` if `account` has been granted `role`. Role restrictions can be swtiched 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

| Name    | Type    | Description                                                  |
| ------- | ------- | ------------------------------------------------------------ |
| role    | bytes32 | keccak256 hash of the role. e.g. keccak256("TRANSFER\_ROLE") |
| account | address | Address of the account for which the role is being checked.  |

#### Returns

| Name | Type | Description |
| ---- | ---- | ----------- |
| \_0  | bool | undefined   |

### removeExtension

```solidity
function removeExtension(string _extensionName) external nonpayable
```

Remove an existing extension from the registry.

#### Parameters

| Name            | Type   | Description |
| --------------- | ------ | ----------- |
| \_extensionName | string | undefined   |

### renounceRole

```solidity
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

| Name    | Type    | Description                                                  |
| ------- | ------- | ------------------------------------------------------------ |
| role    | bytes32 | keccak256 hash of the role. e.g. keccak256("TRANSFER\_ROLE") |
| account | address | Address of the account from which the role is being revoked. |

### revokeRole

```solidity
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

| Name    | Type    | Description                                                  |
| ------- | ------- | ------------------------------------------------------------ |
| role    | bytes32 | keccak256 hash of the role. e.g. keccak256("TRANSFER\_ROLE") |
| account | address | Address of the account from which the role is being revoked. |

### updateExtension

```solidity
function updateExtension(IExtension.Extension _extension) external nonpayable
```

#### Parameters

| Name        | Type                 | Description |
| ----------- | -------------------- | ----------- |
| \_extension | IExtension.Extension | undefined   |

## Events

### ExtensionAdded

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

#### Parameters

| Name                       | Type    | Description |
| -------------------------- | ------- | ----------- |
| extensionAddress `indexed` | address | undefined   |
| functionSelector `indexed` | bytes4  | undefined   |
| functionSignature          | string  | undefined   |

### ExtensionRemoved

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

#### Parameters

| Name                       | Type    | Description |
| -------------------------- | ------- | ----------- |
| extensionAddress `indexed` | address | undefined   |
| functionSelector `indexed` | bytes4  | undefined   |
| functionSignature          | string  | undefined   |

### ExtensionUpdated

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

#### Parameters

| Name                          | Type    | Description |
| ----------------------------- | ------- | ----------- |
| oldExtensionAddress `indexed` | address | undefined   |
| newExtensionAddress `indexed` | address | undefined   |
| functionSelector `indexed`    | bytes4  | undefined   |
| functionSignature             | string  | undefined   |

### RoleAdminChanged

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

#### Parameters

| Name                        | Type    | Description |
| --------------------------- | ------- | ----------- |
| role `indexed`              | bytes32 | undefined   |
| previousAdminRole `indexed` | bytes32 | undefined   |
| newAdminRole `indexed`      | bytes32 | undefined   |

### RoleGranted

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

#### Parameters

| Name              | Type    | Description |
| ----------------- | ------- | ----------- |
| role `indexed`    | bytes32 | undefined   |
| account `indexed` | address | undefined   |
| sender `indexed`  | address | undefined   |

### RoleRevoked

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

#### Parameters

| Name              | Type    | Description |
| ----------------- | ------- | ----------- |
| role `indexed`    | bytes32 | undefined   |
| account `indexed` | address | undefined   |
| sender `indexed`  | address | undefined   |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://the-artist-xchange.gitbook.io/the-artist-xchange/docs/extensionregistry.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
