// SPDX-License-Identifier: LGPL-3.0-only pragma solidity >=0.7.0 <0.9.0; import {Enum} from "../libraries/Enum.sol"; /** * @title IModuleManager - An interface of contract managing Safe modules * @notice Modules are extensions with unlimited access to a Safe that can be added to a Safe by its owners. ⚠️ WARNING: Modules are a security risk since they can execute arbitrary transactions, so only trusted and audited modules should be added to a Safe. A malicious module can completely takeover a Safe. * @author @safe-global/safe-protocol */ interface IModuleManager { event EnabledModule(address indexed module); event DisabledModule(address indexed module); event ExecutionFromModuleSuccess(address indexed module); event ExecutionFromModuleFailure(address indexed module); event ChangedModuleGuard(address indexed moduleGuard); /** * @notice Enables the module `module` for the Safe. * @dev This can only be done via a Safe transaction. * @param module Module to be whitelisted. */ function enableModule(address module) external; /** * @notice Disables the module `module` for the Safe. * @dev This can only be done via a Safe transaction. * @param prevModule Previous module in the modules linked list. * @param module Module to be removed. */ function disableModule(address prevModule, address module) external; /** * @notice Execute `operation` (0: Call, 1: DelegateCall) to `to` with `value` (Native Token) * @param to Destination address of module transaction. * @param value Ether value of module transaction. * @param data Data payload of module transaction. * @param operation Operation type of module transaction. * @return success Boolean flag indicating if the call succeeded. */ function execTransactionFromModule( address to, uint256 value, bytes memory data, Enum.Operation operation ) external returns (bool success); /** * @notice Execute `operation` (0: Call, 1: DelegateCall) to `to` with `value` (Native Token) and return data * @param to Destination address of module transaction. * @param value Ether value of module transaction. * @param data Data payload of module transaction. * @param operation Operation type of module transaction. * @return success Boolean flag indicating if the call succeeded. * @return returnData Data returned by the call. */ function execTransactionFromModuleReturnData( address to, uint256 value, bytes memory data, Enum.Operation operation ) external returns (bool success, bytes memory returnData); /** * @notice Returns if a module is enabled * @return True if the module is enabled */ function isModuleEnabled(address module) external view returns (bool); /** * @notice Returns an array of modules. * If all entries fit into a single page, the next pointer will be 0x1. * If another page is present, next will be the last element of the returned array. * @param start Start of the page. Has to be a module or start pointer (0x1 address) * @param pageSize Maximum number of modules that should be returned. Has to be > 0 * @return array Array of modules. * @return next Start of the next page. */ function getModulesPaginated(address start, uint256 pageSize) external view returns (address[] memory array, address next); /** * @dev Set a module guard that checks transactions initiated by the module before execution * This can only be done via a Safe transaction. * ⚠️ IMPORTANT: Since a module guard has full power to block Safe transaction execution initiated via a module, * a broken module guard can cause a denial of service for the Safe modules. Make sure to carefully * audit the module guard code and design recovery mechanisms. * @notice Set Module Guard `moduleGuard` for the Safe. Make sure you trust the module guard. * @param moduleGuard The address of the module guard to be used or the zero address to disable the module guard. */ function setModuleGuard(address moduleGuard) external; }