// SPDX-License-Identifier: BSD-3-Clause pragma solidity 0.5.16; /** * @title IAccessControlManagerV5 * @author Venus * @notice Interface implemented by the `AccessControlManagerV5` contract. */ interface IAccessControlManagerV5 { /** * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole` * * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite * {RoleAdminChanged} not being emitted signaling this. * */ event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole); /** * @dev Emitted when `account` is granted `role`. * * `sender` is the account that originated the contract call, an admin role * bearer except when using {AccessControl-_setupRole}. */ event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Emitted when `account` is revoked `role`. * * `sender` is the account that originated the contract call: * - if using `revokeRole`, it is the admin role bearer * - if using `renounceRole`, it is the role bearer (i.e. `account`) */ event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) external view returns (bool); /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {AccessControl-_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) external view returns (bytes32); /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function grantRole(bytes32 role, address account) external; /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function revokeRole(bytes32 role, address account) external; /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been granted `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. */ function renounceRole(bytes32 role, address account) external; /** * @notice Gives a function call permission to one single account * @dev this function can be called only from Role Admin or DEFAULT_ADMIN_ROLE * May emit a {RoleGranted} event. * @param contractAddress address of contract for which call permissions will be granted * @param functionSig signature e.g. "functionName(uint,bool)" */ function giveCallPermission(address contractAddress, string calldata functionSig, address accountToPermit) external; /** * @notice Revokes an account's permission to a particular function call * @dev this function can be called only from Role Admin or DEFAULT_ADMIN_ROLE * May emit a {RoleRevoked} event. * @param contractAddress address of contract for which call permissions will be revoked * @param functionSig signature e.g. "functionName(uint,bool)" */ function revokeCallPermission( address contractAddress, string calldata functionSig, address accountToRevoke ) external; /** * @notice Verifies if the given account can call a praticular contract's function * @dev Since the contract is calling itself this function, we can get contracts address with msg.sender * @param account address (eoa or contract) for which call permissions will be checked * @param functionSig signature e.g. "functionName(uint,bool)" * @return false if the user account cannot call the particular contract function * */ function isAllowedToCall(address account, string calldata functionSig) external view returns (bool); function hasPermission( address account, address contractAddress, string calldata functionSig ) external view returns (bool); }