> ## Documentation Index
> Fetch the complete documentation index at: https://docs.infinifi.xyz/llms.txt
> Use this file to discover all available pages before exploring further.

# InfiniFiCore.sol

> Central role registry for the infiniFi protocol

**Purpose:** Establishes the central authority for role-based access control across the InfiniFi protocol.

## Description

`InfiniFiCore` is the foundational contract responsible for maintaining and enforcing hierarchical role-based permissions throughout the InfiniFi system. Every contract requiring access control should delegate role checks to this core registry.

## Constructor

Initializes the core roles structure. The deployer is granted the `GOVERNOR` role and all critical admin roles are explicitly set under the `GOVERNOR`'s authority.

<Warning>
  This is a one-time setup mechanism. After deployment, the deployer is expected to renounce their elevated privileges.
</Warning>

## Errors

| Error                              | Description                                         |
| ---------------------------------- | --------------------------------------------------- |
| `RoleAlreadyExists(bytes32 role)`  | Thrown when re-registering an existing role         |
| `RoleDoesNotExist(bytes32 role)`   | Thrown when accessing undefined role                |
| `LengthMismatch(uint256, uint256)` | Thrown on array length mismatch in batch operations |

## Functions

### `createRole`

```solidity theme={null}
function createRole(bytes32 role, bytes32 adminRole) external onlyRole(CoreRoles.GOVERNOR)
```

Creates a new access control role dynamically.

**Parameters:**

* `role`: The new role identifier
* `adminRole`: The admin role that governs the new role

### `setRoleAdmin`

```solidity theme={null}
function setRoleAdmin(bytes32 role, bytes32 adminRole) external onlyRole(CoreRoles.GOVERNOR)
```

Reassigns the admin controller for an existing role.

### `grantRoles`

```solidity theme={null}
function grantRoles(bytes32[] calldata roles, address[] calldata accounts) external
```

Batch operation to grant multiple roles to multiple accounts.

<Note>
  Caller must have administrative rights over each role being granted.
</Note>
