# IAuthorizer\_v1.sol

[Git Source](https://github.com/InverterNetwork/inverter-contracts/blob/649b450f02fc8b735c128ff0821467e71966c666/src/modules/authorizer/IAuthorizer_v1.sol)

**Inherits:** IAccessControlEnumerable

### Functions

#### checkForRole

Checks whether an address holds the required role to execute the current transaction.

*The calling contract needs to generate the right role ID using its own address and the role identifier. In modules, this function should be used instead of `hasRole`, as there are Authorizer-specific checks that need to be performed.*

```solidity
function checkForRole(bytes32 role, address who) external view returns (bool);
```

**Parameters**

| Name   | Type      | Description                                 |
| ------ | --------- | ------------------------------------------- |
| `role` | `bytes32` | The identifier of the role we want to check |
| `who`  | `address` | The address on which to perform the check.  |

**Returns**

| Name     | Type   | Description                                |
| -------- | ------ | ------------------------------------------ |
| `<none>` | `bool` | bool Returns if the address holds the role |

#### generateRoleId

Helper function to generate a bytes32 role hash for a module role.

```solidity
function generateRoleId(address module, bytes32 role)
    external
    pure
    returns (bytes32);
```

**Parameters**

| Name     | Type      | Description                                         |
| -------- | --------- | --------------------------------------------------- |
| `module` | `address` | The address of the module to generate the hash for. |
| `role`   | `bytes32` | The ID number of the role to generate the hash for. |

**Returns**

| Name     | Type      | Description                              |
| -------- | --------- | ---------------------------------------- |
| `<none>` | `bytes32` | bytes32 Returns the generated role hash. |

#### grantRoleFromModule

Used by a Module to grant a role to a user.

```solidity
function grantRoleFromModule(bytes32 role, address target) external;
```

**Parameters**

| Name     | Type      | Description                             |
| -------- | --------- | --------------------------------------- |
| `role`   | `bytes32` | The identifier of the role to grant.    |
| `target` | `address` | The address to which to grant the role. |

#### grantRoleFromModuleBatched

Used by a Module to grant a role to a set of users.

```solidity
function grantRoleFromModuleBatched(bytes32 role, address[] calldata targets)
    external;
```

**Parameters**

| Name      | Type        | Description                               |
| --------- | ----------- | ----------------------------------------- |
| `role`    | `bytes32`   | The identifier of the role to grant.      |
| `targets` | `address[]` | The addresses to which to grant the role. |

#### revokeRoleFromModule

Used by a Module to revoke a role from a user.

```solidity
function revokeRoleFromModule(bytes32 role, address target) external;
```

**Parameters**

| Name     | Type      | Description                           |
| -------- | --------- | ------------------------------------- |
| `role`   | `bytes32` | The identifier of the role to revoke. |
| `target` | `address` | The address to revoke the role from.  |

#### revokeRoleFromModuleBatched

Used by a Module to revoke a role from a set of users.

```solidity
function revokeRoleFromModuleBatched(bytes32 role, address[] calldata targets)
    external;
```

**Parameters**

| Name      | Type        | Description                           |
| --------- | ----------- | ------------------------------------- |
| `role`    | `bytes32`   | The identifier of the role to revoke. |
| `targets` | `address[]` | The address to revoke the role from.  |

#### transferAdminRole

Transfer the admin rights to a given role.

```solidity
function transferAdminRole(bytes32 roleId, bytes32 newAdmin) external;
```

**Parameters**

| Name       | Type      | Description                                        |
| ---------- | --------- | -------------------------------------------------- |
| `roleId`   | `bytes32` | The role on which to peform the admin transfer.    |
| `newAdmin` | `bytes32` | The new role to which to transfer admin access to. |

#### burnAdminFromModuleRole

Irreversibly burns the admin of a given role.

*The module itself can still grant and revoke it's own roles. This only burns third-party access to the role.*

```solidity
function burnAdminFromModuleRole(bytes32 role) external;
```

**Parameters**

| Name   | Type      | Description                           |
| ------ | --------- | ------------------------------------- |
| `role` | `bytes32` | The role to remove admin access from. |

#### grantGlobalRole

Grants a global role to a target.

*Only the addresses with the Admin role should be able to call this function.*

```solidity
function grantGlobalRole(bytes32 role, address target) external;
```

**Parameters**

| Name     | Type      | Description                       |
| -------- | --------- | --------------------------------- |
| `role`   | `bytes32` | The role to grant.                |
| `target` | `address` | The address to grant the role to. |

#### grantGlobalRoleBatched

Grants a global role to a set of targets.

*Only the addresses with the Admin role should be able to call this function.*

```solidity
function grantGlobalRoleBatched(bytes32 role, address[] calldata targets)
    external;
```

**Parameters**

| Name      | Type        | Description                         |
| --------- | ----------- | ----------------------------------- |
| `role`    | `bytes32`   | The role to grant.                  |
| `targets` | `address[]` | The addresses to grant the role to. |

#### revokeGlobalRole

Revokes a global role from a target.

*Only the addresses with the Admin role should be able to call this function.*

```solidity
function revokeGlobalRole(bytes32 role, address target) external;
```

**Parameters**

| Name     | Type      | Description                       |
| -------- | --------- | --------------------------------- |
| `role`   | `bytes32` | The role to grant.                |
| `target` | `address` | The address to grant the role to. |

#### revokeGlobalRoleBatched

Revokes a global role from a set of targets.

*Only the addresses with the Admin role should be able to call this function.*

```solidity
function revokeGlobalRoleBatched(bytes32 role, address[] calldata targets)
    external;
```

**Parameters**

| Name      | Type        | Description                         |
| --------- | ----------- | ----------------------------------- |
| `role`    | `bytes32`   | The role to grant.                  |
| `targets` | `address[]` | The addresses to grant the role to. |

#### getAdminRole

Returns the role ID of the admin role.

```solidity
function getAdminRole() external view returns (bytes32);
```

**Returns**

| Name     | Type      | Description  |
| -------- | --------- | ------------ |
| `<none>` | `bytes32` | The role ID. |

### Errors

#### Module\_\_Authorizer\_\_NotActiveModule

The function is only callable by an active Module.

```solidity
error Module__Authorizer__NotActiveModule(address module);
```

**Parameters**

| Name     | Type      | Description                |
| -------- | --------- | -------------------------- |
| `module` | `address` | The address of the module. |

#### Module\_\_Authorizer\_\_ModuleNotSelfManaged

The function is only callable if the Module is self-managing its roles.

```solidity
error Module__Authorizer__ModuleNotSelfManaged();
```

#### Module\_\_Authorizer\_\_AdminRoleCannotBeEmpty

There always needs to be at least one admin.

```solidity
error Module__Authorizer__AdminRoleCannotBeEmpty();
```

#### Module\_\_Authorizer\_\_OrchestratorCannotHaveAdminRole

The orchestrator cannot own itself.

```solidity
error Module__Authorizer__OrchestratorCannotHaveAdminRole();
```

#### Module\_\_Authorizer\_\_InvalidInitialAdmin

The provided initial admin address is invalid.

```solidity
error Module__Authorizer__InvalidInitialAdmin();
```


---

# 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://docs.inverter.network/contracts/technical-reference/modules/authorizer/iauthorizer_v1.sol.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.
