A contract module which provides set of external functions providing basic role transferring functionality.
The role account is set through role transfer. This module makes it possible to transfer the role of the contract to a new account in one step, as well as to an interim pending role. In the second flow the role does not change until the pending role accepts the role transfer.
function hasAllTheRoles(address account, uint8[] roles) public view returns (bool)
Checks if an account has all the roles.
Name | Type | Description |
---|---|---|
account | address | The address to check |
roles | uint8[] | The roles to check |
Name | Type | Description |
---|---|---|
[0] | bool | True if the account has all the roles, false otherwise |
function hasAnyOfRoles(address account, uint8[] roles) public view returns (bool)
Checks if an account has any of the roles.
Name | Type | Description |
---|---|---|
account | address | The address to check |
roles | uint8[] | The roles to check |
Name | Type | Description |
---|---|---|
[0] | bool | True if the account has any of the roles, false otherwise |
function getAccountRoles(address account) public view returns (uint256 accountRoles)
Returns the roles of an account.
Name | Type | Description |
---|---|---|
account | address | The address to get the roles for |
Name | Type | Description |
---|---|---|
accountRoles | uint256 | The roles of the account in uint256 format |
function getProposedRoles(address fromAccount, address toAccount) public view returns (uint256 proposedRoles_)
Returns the pending role of the contract.
Name | Type | Description |
---|---|---|
fromAccount | address | The address with the current roles |
toAccount | address | The address with the pending roles |
Name | Type | Description |
---|---|---|
proposedRoles_ | uint256 | The pending role of the contract in uint256 format |
function proposeRoles(address toAccount, uint8[] roles) external virtual
Propose to transfer roles of message sender to a new account.
Can only be called by the account with all the proposed roles. emits a RolesProposed event. Roles are not transferred until the new role accepts the role transfer.
Name | Type | Description |
---|---|---|
toAccount | address | The address to transfer role to |
roles | uint8[] | The roles to transfer |
function acceptRoles(address fromAccount, uint8[] roles) external virtual
Accepts roles transferred from another account.
Can only be called by the pending account with all the proposed roles. Emits RolesRemoved and RolesAdded events.
Name | Type | Description |
---|---|---|
fromAccount | address | The address of the current role |
roles | uint8[] | The roles to accept |
function transferRoles(address toAccount, uint8[] roles) external virtual
Transfers roles of the contract to a new account.
Can only be called by the account with all the roles. Emits RolesRemoved and RolesAdded events.
Name | Type | Description |
---|---|---|
toAccount | address | The address to transfer role to |
roles | uint8[] | The roles to transfer |