Skip to content
Lattice

AccessControlTimed

Git Source

Inherits: AccessControl, IAccessControlTimed

Title: AccessControlTimed

Author: Modified from OpenZeppelin (https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/access/AccessControl.sol)

Diamond facet exposing AccessControl + per-grant (start, expires) windows.

Notes:

  • lattice-version: 0.1.0
  • lattice-source: OpenZeppelin v5.1.0

Functions

grantRoleTimed

function grantRoleTimed(bytes32 role, address account, uint48 start, uint48 expires) external virtual override;

Parameters

NameTypeDescription
rolebytes32
accountaddress
startuint48
expiresuint48

extendRole

function extendRole(bytes32 role, address account, uint48 newExpires) external virtual override;

Parameters

NameTypeDescription
rolebytes32
accountaddress
newExpiresuint48

roleExpiration

function roleExpiration(bytes32 role, address account)
        external
        view
        virtual
        override
        returns (uint48 start, uint48 expires);

Parameters

NameTypeDescription
rolebytes32
accountaddress

Returns

NameTypeDescription
startuint48
expiresuint48

hasRole

Checks whether an account has been granted a specific role.

function hasRole(bytes32 _role, address _account)
        public
        view
        virtual
        override(AccessControl, IAccessControl)
        returns (bool);

Parameters

NameTypeDescription
_rolebytes32The role identifier to verify.
_accountaddressThe account address to check.

Returns

NameTypeDescription
<none>boolbool True if the account has the role, false otherwise.

getRoleAdmin

Retrieves the admin role that controls access to a specific role.

function getRoleAdmin(bytes32 _role) public view virtual override(AccessControl, IAccessControl) returns (bytes32);

Parameters

NameTypeDescription
_rolebytes32The role identifier to query.

Returns

NameTypeDescription
<none>bytes32bytes32 The admin role that can grant or revoke the specified role.
To change a role's admin, use AccessControl.

grantRole

Grants a role to an account.

Emits a RoleGranted event if the account didn't already hold the role. Requirements:

  • the caller must have the admin role for the target role.
function grantRole(bytes32 _role, address _account) public virtual override(AccessControl, IAccessControl);

Parameters

NameTypeDescription
_rolebytes32The role identifier to grant.
_accountaddressThe account address to grant the role to.

revokeRole

Revokes a role from an account.

Emits a RoleRevoked event if the account currently holds the role. Requirements:

  • the caller must have the admin role for the target role.
function revokeRole(bytes32 _role, address _account) public virtual override(AccessControl, IAccessControl);

Parameters

NameTypeDescription
_rolebytes32The role identifier to revoke.
_accountaddressThe account address to revoke the role from.

renounceRole

Renounces a role from the calling account.

Allows accounts to lose privileges if compromised (e.g., misplaced keys or compromised devices). Emits a RoleRevoked event if the caller currently holds the role. Requirements:

  • the caller's actual address must match the callerConfirmation parameter for security.
function renounceRole(bytes32 _role, address _callerConfirmation)
        public
        virtual
        override(AccessControl, IAccessControl);

Parameters

NameTypeDescription
_rolebytes32The role identifier to renounce.
_callerConfirmationaddressThe caller's address as a confirmation parameter.

exportSelectors

ERC-8153 selector export: this facet's cuttable selectors, tightly packed (4 bytes each).

Excludes exportSelectors() itself (0x0ef22643) - it is never cut into a diamond. Order matches forge inspect AccessControlTimed methodIdentifiers (alphabetical by signature); kept in exact parity by ExportSelectorsParityTest. Chunks: extendRole(bytes32,address,uint48) 0xa6db71fa getRoleAdmin(bytes32) 0x248a9ca3 grantRole(bytes32,address) 0x2f2ff15d grantRoleTimed(bytes32,address,uint48,uint48) 0x701eb66a hasRole(bytes32,address) 0x91d14854 renounceRole(bytes32,address) 0x36568abe revokeRole(bytes32,address) 0xd547741f roleExpiration(bytes32,address) 0x83a045f1

function exportSelectors() external pure virtual override returns (bytes memory selectors);

Returns

NameTypeDescription
selectorsbytes