Role Manager

Throughout the Mero protocol there are a number of functions that have restrictions on who/what can call them. For example, the removePool function on the AddressProvider can only be called by the Controller and the setStalePriceDelay on the ChainlinkOracleProvider can only be called by governance.

These roles and restrictions are managed in the RoleManager contract. The role manager stores a list of active roles such as the governance, controller, and maintenance roles. And for each role, stores a list of accounts that have been granted that role. Accounts can be granted a new role via the grantRole function (with a delay through the Governance Timelock), and roles can be removed with the revokeRole function.

You can query the list of accounts that have a given role using the below views:

RoleManager.getRoleMemberCount(bytes32 role) public view returns (uint256)

Returns the number of accounts that currently have the given role.

  • role: The role to query the number of accounts for.

RoleManager.getRoleMember(bytes32 role, uint256 index) external view returns (address)

Returns the account at the given index for a role.

  • role: The role to get the account for.

  • index: the index to get the account for.

The Role Manager contract is imported into many of the Mero contracts and is used to manage the roles and permissions of the various contracts.