PausableModule

Description:

Multi-signature wallet contract requiring multiple confirmations for transaction execution.

Blockchain: Ethereum

Source Code: View Code On The Blockchain

Solidity Source Code:

{{
  "language": "Solidity",
  "sources": {
    "@openzeppelin/contracts/access/Ownable.sol": {
      "content": "// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol)

pragma solidity ^0.8.20;

import {Context} from "../utils/Context.sol";

/**
 * @dev Contract module which provides a basic access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * The initial owner is set to the address provided by the deployer. This can
 * later be changed with {transferOwnership}.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be applied to your functions to restrict their use to
 * the owner.
 */
abstract contract Ownable is Context {
    address private _owner;

    /**
     * @dev The caller account is not authorized to perform an operation.
     */
    error OwnableUnauthorizedAccount(address account);

    /**
     * @dev The owner is not a valid owner account. (eg. `address(0)`)
     */
    error OwnableInvalidOwner(address owner);

    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

    /**
     * @dev Initializes the contract setting the address provided by the deployer as the initial owner.
     */
    constructor(address initialOwner) {
        if (initialOwner == address(0)) {
            revert OwnableInvalidOwner(address(0));
        }
        _transferOwnership(initialOwner);
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        _checkOwner();
        _;
    }

    /**
     * @dev Returns the address of the current owner.
     */
    function owner() public view virtual returns (address) {
        return _owner;
    }

    /**
     * @dev Throws if the sender is not the owner.
     */
    function _checkOwner() internal view virtual {
        if (owner() != _msgSender()) {
            revert OwnableUnauthorizedAccount(_msgSender());
        }
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby disabling any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        _transferOwnership(address(0));
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        if (newOwner == address(0)) {
            revert OwnableInvalidOwner(address(0));
        }
        _transferOwnership(newOwner);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal virtual {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}
"
    },
    "@openzeppelin/contracts/utils/Context.sol": {
      "content": "// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)

pragma solidity ^0.8.20;

/**
 * @dev Provides information about the current execution context, including the
 * sender of the transaction and its data. While these are generally available
 * via msg.sender and msg.data, they should not be accessed in such a direct
 * manner, since when dealing with meta-transactions the account sending and
 * paying for execution may not be the actual sender (as far as an application
 * is concerned).
 *
 * This contract is only required for intermediate, library-like contracts.
 */
abstract contract Context {
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }

    function _contextSuffixLength() internal view virtual returns (uint256) {
        return 0;
    }
}
"
    },
    "@safe-global/safe-contracts/contracts/common/Enum.sol": {
      "content": "// SPDX-License-Identifier: LGPL-3.0-only
pragma solidity >=0.7.0 <0.9.0;

/**
 * @title Enum - Collection of enums used in Safe contracts.
 * @author Richard Meissner - @rmeissner
 */
abstract contract Enum {
    enum Operation {
        Call,
        DelegateCall
    }
}
"
    },
    "contracts/interfaces/external/ISafe.sol": {
      "content": "// SPDX-License-Identifier: MIT
pragma solidity 0.8.28;

import { Enum } from "@safe-global/safe-contracts/contracts/common/Enum.sol";

interface ISafe {
    /// @dev Allows a Module to execute a Safe transaction without any further confirmations.
    /// @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.
    function execTransactionFromModule(
        address to,
        uint256 value,
        bytes calldata data,
        Enum.Operation operation
    ) external returns (bool success);
}
"
    },
    "contracts/interfaces/external/ITruStakePOL.sol": {
      "content": "// SPDX-License-Identifier: MIT
pragma solidity 0.8.28;

interface ITruStakePOL {
    function pause() external;
}
"
    },
    "contracts/interfaces/IPausableModule.sol": {
      "content": "// SPDX-License-Identifier: MIT
pragma solidity 0.8.28;

/// @title Pausable Module Interface
/// @notice Interface for a Safe module that allows pausing a protected contract.
interface IPausableModule {
    // --- Events ---

    /// @notice Emitted when the protected contract is paused.
    /// @param contractAddress The address of the contract being paused.
    event Paused(address indexed contractAddress);

    /// @notice Emitted when the module is disabled.
    event Disabled();

    // --- Errors ---

    /// @notice Thrown if a zero address is provided where it is not allowed.
    error ZeroAddress();

    /// @notice Thrown if the caller is not the keeper.
    error OnlyKeeper(address caller);

    /// @notice Thrown if the caller is not the owner or the keeper.
    error OnlyOwnerOrKeeper(address caller);

    /// @notice Thrown if pausing the protected contract fails.
    error PauseFailed();

    // --- Functions ---

    /// @notice Pause the protected contract.
    /// @dev Can be called by the owner or the keeper.
    function pause() external;

    /// @notice Disable the module.
    /// @dev Can be called by the keeper.
    function disable() external;
}
"
    },
    "contracts/PausableModule.sol": {
      "content": "// SPDX-License-Identifier: MIT
pragma solidity 0.8.28;

import { Enum } from "@safe-global/safe-contracts/contracts/common/Enum.sol";
import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol";
import { IPausableModule } from "./interfaces/IPausableModule.sol";
import { ITruStakePOL } from "./interfaces/external/ITruStakePOL.sol";
import { ISafe } from "./interfaces/external/ISafe.sol";

/// @title Pausable Safe Module
/// @author TruFin Labs
/// @notice A Safe Module to pause a contract.
contract PausableModule is IPausableModule, Ownable {
    /// @notice The Safe that this module is added to.
    ISafe public safe;

    /// @notice The address of the keeper.
    address public keeper;

    /// @notice The address of the contract to be paused.
    address public stakerAddress;

    /// @notice Ensures the caller is the keeper.
    modifier onlyKeeper() {
        address sender = _msgSender();
        if (sender != keeper) revert OnlyKeeper(sender);
        _;
    }

    /// @notice Ensures the caller is the owner or the keeper.
    modifier onlyOwnerOrKeeper() {
        address sender = _msgSender();
        if (sender != owner() && sender != keeper) revert OnlyOwnerOrKeeper(sender);
        _;
    }

    /// @notice Sets the staker address, the Safe address, and the keeper address.
    /// @param _safeAddress The address of the Safe that this module is added to.
    /// @param _keeper The address of the keeper.
    /// @param _stakerAddress The address of the contract to be paused.
    /// @dev The deployer is set as the owner.
    constructor(address _safeAddress, address _keeper, address _stakerAddress) Ownable(msg.sender) {
        if (_safeAddress == address(0) || _keeper == address(0) || _stakerAddress == address(0)) {
            revert ZeroAddress();
        }

        safe = ISafe(_safeAddress);
        keeper = _keeper;
        stakerAddress = _stakerAddress;
    }

    /// @inheritdoc IPausableModule
    function pause() external onlyOwnerOrKeeper {
        bool success = safe.execTransactionFromModule({
            to: stakerAddress,
            value: 0,
            data: abi.encodeWithSelector(ITruStakePOL.pause.selector),
            operation: Enum.Operation.Call
        });

        if (!success) revert PauseFailed();

        emit Paused(stakerAddress);
    }

    /// @inheritdoc IPausableModule
    function disable() external onlyKeeper {
        delete stakerAddress;
        delete safe;
        delete keeper;

        emit Disabled();
    }
}
"
    }
  },
  "settings": {
    "optimizer": {
      "enabled": true,
      "runs": 200
    },
    "evmVersion": "cancun",
    "outputSelection": {
      "*": {
        "*": [
          "evm.bytecode",
          "evm.deployedBytecode",
          "devdoc",
          "userdoc",
          "metadata",
          "abi"
        ]
      }
    }
  }
}}

Tags:
Multisig, Upgradeable, Multi-Signature, Factory|addr:0xe6dcd72cc14e1b1a6c4d8a3c4b7d9f3bcf84c246|verified:true|block:23547252|tx:0x246e4fdcec672772f730686f1f804bc582d80bee3d989b98a0c88e0ec0e6e0b6|first_check:1760101945

Submitted on: 2025-10-10 15:12:26

Comments

Log in to comment.

No comments yet.