Developer Guide
Role Management
Role Management Introduction
The Role Management developer guide will describe the functions associated with Roles, Role Registry, Role Contexts, and Role Context Factory.
This enables developers to perform the following:
- Create a Role
- Update Role's name and description
- Update Role's Controller
- Update Role's Visibility
- Create a Role Context
- Add a Role to a Role Context
- Assign a Role to a wallet/EOA/smart contract
- Remove a Role from a Role Context
- Add a Role Context to a context
- Remove a Role Context from a context
- Override the default role
Role Registry
Create a Role
Use IRoleRegistry interface's createRole function to create a new Role.
To retrieve the role address, list to the transaction receipt and collect the RoleCreatedInRegistry event.
function createRole(string calldata name, string calldata description, address controller) external returns (address role);
Note: Address returned will be the role smart contract address.
Parameters
Name
Role name. e.g., "Transfer Agent"
Description
Role description. eg. "Transfer Agent performs minting, burning and etc."
Controller
Controller address. eg. transfer agent wallet address
Update a Role's Name and Description
Using IRoleRegistry interface's updateRole function, update the name and description of a role.
function updateRole(address role, string calldata name, string calldata description) external;
Parameters
Role
Role address. eg. transfer agent role address
Name
Role name eg. "Transfer Agent"
Description
Role description eg. "Transfer Agent performs minting, burning and etc."
Update Role's Controller
Use IRoleAgency interface's updateRoleController function to update the controller of a role.
function updateRoleController(address role, address newController) external;
Parameters
Role
Role address. eg. transfer agent role address
Controller
Controller address. eg. issuer wallet address
Update Role's Visibility
Using IRoleRegistry interface's updateRoleVisibility function, update the visibility of a role it can be local/global.
function updateRoleVisibility(address _role, Visibility _newVisibility) external;
Parameters
Role
Role address. eg. transfer agent role address
Visibility
Visibility type. local | global
Role Context
Add a Role to a Role Context
Using IRoleAgency interface's addRole function, add a role to a role context.
function addRole(address role) external;
Parameters
Role
Role address. eg. transfer agent role address
Assign a Role to a wallet/EOA/smart contract
Use IRoleAgency interface's assignRole function to assign a role which is present in the role context to a wallet.
function assignRole(address role, address agent) external;
Parameters
Role
Role address. eg. transfer agent role address
Agent
Wallet address (eg. transfer agent wallet address)
Remove a Role from a Role Context
Using IRoleContext interface's removeRole function, remove a role from a role context.
function removeRole(address role) external;
Parameters
Role
Role address. eg. transfer agent role address
Role Agency
Add a Role Context to a context
Using IRoleAgency interface's addRoleContext function, add a role context to a context.
function addRoleContext(address roleContext) external;
Parameters
Role Context
Role context address
Remove a Role Context from a context
Using IRoleAgency interface's removeRoleContext function, remove the attached role context from a context.
function removeRoleContext() external;
Override the default role
Using IRoleAgency interface's overrideDefaultRole function, override the default role which was set early. Populate following parameters in the function:
function overrideDefaultRole(bytes4 functionSig, address role) external;
Parameters
FunctionSig Context
4 bytes function signature Ex: "0x865595e9"
Role
Role address. eg. transfer agent role address
Contact our sales team for more information
View answers to the most common questions about our platforms and services