Skip to main content

Signature

IB20.sol

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

Reverts

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 initCalls 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

Usage Example