> ## 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.grantRole

> Grants a role to an account on a B20 token, subject to the caller holding the role's admin role.

## Signature

```solidity IB20.sol theme={null}
function grantRole(bytes32 role, address account) external;
```

| Field               | Value                        |
| ------------------- | ---------------------------- |
| Selector            | `0x2f2ff15d`                 |
| Canonical signature | `grantRole(bytes32,address)` |

## Description

Grants `role` to `account` and emits `RoleGranted(role, account, sender)`. B20 follows OpenZeppelin AccessControl semantics, under which granting a role the account already holds changes nothing and emits no event.

The caller must hold the admin role of `role`. On a fresh token every role's admin is `DEFAULT_ADMIN_ROLE`. That mapping can be changed with `setRoleAdmin`. After `renounceLastAdmin` is called, no address holds `DEFAULT_ADMIN_ROLE` and `grantRole` becomes permanently unreachable for any role whose admin chain includes `DEFAULT_ADMIN_ROLE`.

Any number of addresses can hold the same role. There is no single-holder slot.

## Parameters

| Parameter | Description                             |
| --------- | --------------------------------------- |
| `role`    | The `bytes32` role identifier to grant. |
| `account` | The address that will receive the role. |

## Reverts

| Error                                                   | Condition                                                                                                         |
| ------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------- |
| `AccessControlUnauthorizedAccount(account, neededRole)` | Caller does not hold the admin role for `role`, including when the token has no admins after `renounceLastAdmin`. |

## Access Control

The caller must hold `getRoleAdmin(role)`. By default that is `DEFAULT_ADMIN_ROLE` for every role. After `setRoleAdmin(role, newAdminRole)` is called, the caller must hold `newAdminRole` instead.

Factory `initCall`s bypass role gates during token creation. `createB20` uses this path to grant `DEFAULT_ADMIN_ROLE` to `initialAdmin` without a role check.

## Policy Interaction

No direct policy interaction.

## Example

```solidity Usage Example theme={null}
IB20(target).grantRole(MINT_ROLE, minterAddress);
```
