TokenAccessControl
Inherits: AccessControlDefaultAdminRulesUpgradeable, AccountFreezable, PausableUpgradeable
Author: EVMAuth
Provides comprehensive role-based access control for token management.
Abstract contract implementing six distinct roles for granular permission control: upgrade management, access management, token management, minting, burning, and treasury operations. Includes account freezing via AccountFreezable and contract pausing via PausableUpgradeable.
State Variables
UPGRADE_MANAGER_ROLE
Role identifier for contract upgrade permissions.
Required for UUPS upgrade authorization.
bytes32 public constant UPGRADE_MANAGER_ROLE = keccak256("UPGRADE_MANAGER_ROLE");
ACCESS_MANAGER_ROLE
Role identifier for access control management.
Permits pausing/unpausing contract and freezing/unfreezing accounts.
bytes32 public constant ACCESS_MANAGER_ROLE = keccak256("ACCESS_MANAGER_ROLE");
TOKEN_MANAGER_ROLE
Role identifier for token configuration management.
Permits modifying token settings, metadata, and URIs.
bytes32 public constant TOKEN_MANAGER_ROLE = keccak256("TOKEN_MANAGER_ROLE");
MINTER_ROLE
Role identifier for token minting permissions.
Required to create new tokens.
bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE");
BURNER_ROLE
Role identifier for token burning permissions.
Required to destroy existing tokens.
bytes32 public constant BURNER_ROLE = keccak256("BURNER_ROLE");
TREASURER_ROLE
Role identifier for treasury management.
Permits modifying the treasury address for revenue collection.
bytes32 public constant TREASURER_ROLE = keccak256("TREASURER_ROLE");
Functions
__TokenAccessControl_init
Internal initializer for access control setup.
Initializes AccessControlDefaultAdminRules with security delay.
function __TokenAccessControl_init(uint48 initialDelay, address initialDefaultAdmin) internal onlyInitializing;
Parameters
Name | Type | Description |
---|---|---|
initialDelay | uint48 | Seconds before new admin can exercise role (security delay) |
initialDefaultAdmin | address | Address receiving initial admin role |
__TokenAccessControl_init_unchained
Unchained initializer for contract-specific storage.
Currently empty but reserved for future TokenAccessControl-specific initialization.
function __TokenAccessControl_init_unchained() internal onlyInitializing;
freezeAccount
Freezes an account, blocking all token operations.
Restricted to ACCESS_MANAGER_ROLE. Idempotent operation.
Notes:
-
throws: InvalidAddress When account is zero address
-
emits: AccountStatusUpdate With ACCOUNT_FROZEN_STATUS
function freezeAccount(address account) external onlyRole(ACCESS_MANAGER_ROLE);
Parameters
Name | Type | Description |
---|---|---|
account | address | Address to freeze (cannot be zero address) |
unfreezeAccount
Unfreezes an account, restoring all token operations.
Restricted to ACCESS_MANAGER_ROLE. Idempotent operation.
Note: emits: AccountStatusUpdate With ACCOUNT_UNFROZEN_STATUS
function unfreezeAccount(address account) external onlyRole(ACCESS_MANAGER_ROLE);
Parameters
Name | Type | Description |
---|---|---|
account | address | Address to unfreeze |
pause
Pauses all contract operations.
Restricted to ACCESS_MANAGER_ROLE.
Notes:
-
emits: Paused When contract is paused
-
throws: MissingRole When caller lacks ACCESS_MANAGER_ROLE
function pause() external onlyRole(ACCESS_MANAGER_ROLE);
unpause
Resumes contract operations after a pause.
Restricted to ACCESS_MANAGER_ROLE.
Notes:
-
emits: Unpaused When contract is unpaused
-
throws: MissingRole When caller lacks ACCESS_MANAGER_ROLE
function unpause() external onlyRole(ACCESS_MANAGER_ROLE);