AccessManaged
Helper contract for instance contracts to check roles against their IdentityAccessManager diamond
Provides modifiers and helper functions for role-based access control
State Variables
accessManager
IAccessManager public immutable accessManager;
Functions
constructor
Constructor
constructor(address _accessManager);
Parameters
_accessManager
address
The IdentityAccessManager diamond contract address
onlyRole
Modifier to check if caller has a specific role
modifier onlyRole(uint64 role);
Parameters
role
uint64
The role ID to check
onlyEntity
Modifier to check if caller has the ENTITY_ROLE (which is ADMIN_ROLE)
modifier onlyEntity();
onlyEntityOrAgent
Modifier to check if caller has ENTITY_ROLE or PLACEMENT_AGENT_ROLE
modifier onlyEntityOrAgent();
onlyAttestor
Modifier to check if caller has the ATTESTOR_ROLE
modifier onlyAttestor();
onlyTransferAgent
Modifier to check if caller has the TRANSFER_AGENT_ROLE
modifier onlyTransferAgent();
onlyComplianceOfficer
Modifier to check if caller has the COMPLIANCE_OFFICER_ROLE
modifier onlyComplianceOfficer();
_checkRole
Internal function to check if an account has a specific role
function _checkRole(uint64 role, address account) internal view;
Parameters
role
uint64
The role ID to check
account
address
The account to check
_hasRole
Internal function to check if an account has a specific role
function _hasRole(uint64 role, address account) internal view returns (bool accountHasRole);
Parameters
role
uint64
The role ID to check
account
address
The account to check
Returns
accountHasRole
bool
True if the account has the role
hasRole
Check if an account has a specific role (external function)
function hasRole(uint64 role, address account) external view returns (bool rolePresent);
Parameters
role
uint64
The role ID to check
account
address
The account to check
Returns
rolePresent
bool
True if the account has the role
getEntity
Get the entity address from the access manager diamond
function getEntity() external view returns (address entity);
Returns
entity
address
The entity address
_getEntityFromFacet
Internal helper to call facet function (used in try/catch)
function _getEntityFromFacet() external view returns (address entity);
Returns
entity
address
The entity address from the facet
hasAnyEntityRole
Check if an account has any entity-related role
function hasAnyEntityRole(address account) external view returns (bool hasAnyRole);
Parameters
account
address
The account to check
Returns
hasAnyRole
bool
True if the account has any entity role
Events
AccessManagerSet
event AccessManagerSet(address indexed accessManager);
Last updated
Was this helpful?