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

# IB20.setRoleAdmin

> Sets the admin role for a given role on a B20 token, controlling which role can grant and revoke it.

## Signature

```solidity IB20.sol theme={null}
function setRoleAdmin(bytes32 role, bytes32 newAdminRole) external;
```

| Field               | Value                           |
| ------------------- | ------------------------------- |
| Selector            | `0x1e4e0091`                    |
| Canonical signature | `setRoleAdmin(bytes32,bytes32)` |

## Description

Reassigns the admin of `role` to `newAdminRole`. After the call, `grantRole` and `revokeRole` for `role` require the caller to hold `newAdminRole`, not the previous admin. Only the current admin of `role` may call this function.

Emits `RoleAdminChanged(role, previousAdminRole, newAdminRole)`.

## Parameters

| Parameter      | Description                                                                                   |
| -------------- | --------------------------------------------------------------------------------------------- |
| `role`         | Role whose admin is being updated.                                                            |
| `newAdminRole` | New admin role. May be any role, including `role` itself to lock administration of that role. |

## Reverts

* `AccessControlUnauthorizedAccount(account, neededRole)`: caller does not hold the current admin role for `role`, or the token has no admins (transitioned via `renounceLastAdmin`).

## Events

| Event                                                     | Emitted when                |
| --------------------------------------------------------- | --------------------------- |
| `RoleAdminChanged(role, previousAdminRole, newAdminRole)` | Admin reassignment succeeds |

## Access Control

Caller must hold `getRoleAdmin(role)` at the time of the call. On a fresh token, every role's admin is `DEFAULT_ADMIN_ROLE`.

Setting `newAdminRole` equal to `role` makes the role self-administrating. Combined with revoking all current holders, this permanently closes the ability to grant that role to new accounts.

## Example

```solidity Usage Example theme={null}
// Make BURN_ROLE the admin of MINT_ROLE.
// After this call, only BURN_ROLE holders can grant or revoke MINT_ROLE.
IB20(target).setRoleAdmin(MINT_ROLE, BURN_ROLE);

// Lock MINT_ROLE permanently (self-admin, no holders).
IB20(target).revokeRole(MINT_ROLE, holder);
IB20(target).setRoleAdmin(MINT_ROLE, MINT_ROLE);
```
