// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.0; import "@openzeppelin/contracts/utils/introspection/IERC165.sol"; /** * @title SOMA Guard Contract. * @author SOMA.finance * @dev Required interface of an ERC1155 compliant contract, as defined in the * https://eips.ethereum.org/EIPS/eip-1155[EIP]. * * _Available since v3.1._ * @notice A contract to batch update account privileges. */ interface ISomaGuard { /** * @notice Emitted when privileges for a 2D array of accounts are updated. * @param accounts The 2D array of addresses. * @param privileges The array of privileges. * @param sender The address of the message sender. */ event BatchUpdate(address[][] accounts, bytes32[] privileges, address indexed sender); /** * @notice Emitted when privileges for an array of accounts are updated. * @param accounts The array of addresses. * @param access The array of privileges. * @param sender The address of the message sender. */ event BatchUpdateSingle(address[] accounts, bytes32[] access, address indexed sender); /** * @notice Returns the default privileges of the SomaGuard contract. * @dev Returns bytes32(uint256(2 ** 64 - 1)). */ function DEFAULT_PRIVILEGES() external view returns (bytes32); /** * @notice Returns the operator role of the SomaGuard contract. * @dev Returns keccak256('SomaGuard.OPERATOR_ROLE'). */ function OPERATOR_ROLE() external view returns (bytes32); /** * @notice Returns the privilege of an account. * @param account The account to return the privilege of. */ function privileges(address account) external view returns (bytes32); /** * @notice Returns True if an account passes a query, where query is the desired privileges. * @param account The account to check the privileges of. * @param query The desired privileges to check for. */ function check(address account, bytes32 query) external view returns (bool); /** * @notice Returns the privileges for each account. * @param accounts_ The array of accounts return the privileges of. * @return privileges_ The array of privileges. */ function batchFetch(address[] calldata accounts_) external view returns (bytes32[] memory privileges_); /** * @notice Updates the privileges of an array of accounts. * @param accounts_ The array of addresses to accumulate privileges of. * @param privileges_ The array of privileges to update the array of accounts with. * @custom:emits BatchUpdateSingle * @custom:requirement The length of `accounts_` must be equal to the length of `privileges_`. * @custom:requirement The length of `accounts_` must be greater than zero. * @custom:requirement The function caller must have the OPERATOR_ROLE. * @return True if the batch update was successful. */ function batchUpdate(address[] calldata accounts_, bytes32[] calldata privileges_) external returns (bool); /** * @notice Updates the privileges of a 2D array of accounts, where the child array of accounts are all assigned to the * same privileges. * @param accounts_ The array of addresses to accumulate privileges of. * @param privileges_ The array of privileges to update the 2D array of accounts with. * @custom:emits BatchUpdate * @custom:requirement The length of `accounts_` must be equal to the length of `privileges_`. * @custom:requirement The length of `accounts_` must be greater than zero. * @custom:requirement The function caller must have the OPERATOR_ROLE. * @return True if the batch update was successful. */ function batchUpdate(address[][] calldata accounts_, bytes32[] calldata privileges_) external returns (bool); }