{"file_path":"src/SPBEAMMom.sol","creation_status":"success","source_code":"// SPDX-FileCopyrightText: 2025 Dai Foundation <www.daifoundation.org>\n// SPDX-License-Identifier: AGPL-3.0-or-later\n//\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU Affero General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU Affero General Public License for more details.\n//\n// You should have received a copy of the GNU Affero General Public License\n// along with this program.  If not, see <https://www.gnu.org/licenses/>.\n\npragma solidity ^0.8.24;\n\ninterface AuthorityLike {\n    function canCall(address src, address dst, bytes4 sig) external view returns (bool);\n}\n\ninterface SPBEAMLike {\n    function file(bytes32 what, uint256 data) external;\n}\n\n/// @title SPBEAM Mom - Shutdown SPBEAM bypassing GSM delay.\n/// @notice Governance contract for halting SPBEAM module operations\n/// @dev Provides:\n///      - Owner/authority-based access control\n///      - Emergency halt without delay\ncontract SPBEAMMom {\n    // --- Auth ---\n    /// @notice Owner with full admin rights\n    address public owner;\n    /// @notice Optional authority contract for additional access control\n    address public authority;\n\n    // --- Events ---\n    /// @notice Owner address changed\n    event SetOwner(address indexed owner);\n    /// @notice Authority contract changed\n    event SetAuthority(address indexed authority);\n    /// @notice SPBEAM module halted\n    event Halt(address indexed spbeam);\n\n    // --- Modifiers ---\n    modifier onlyOwner() {\n        require(msg.sender == owner, \"SPBEAMMom/not-owner\");\n        _;\n    }\n\n    modifier auth() {\n        require(isAuthorized(msg.sender, msg.sig), \"SPBEAMMom/not-authorized\");\n        _;\n    }\n\n    /// @notice Initialize contract with msg.sender as owner\n    constructor() {\n        owner = msg.sender;\n        emit SetOwner(msg.sender);\n    }\n\n    // --- Administration ---\n    /// @notice Transfer ownership to a new address\n    /// @param owner_ New owner address with full admin rights\n    function setOwner(address owner_) external onlyOwner {\n        owner = owner_;\n        emit SetOwner(owner_);\n    }\n\n    /// @notice Set authority contract for additional access control\n    /// @param authority_ New authority contract address (0x0 to disable)\n    function setAuthority(address authority_) external onlyOwner {\n        authority = authority_;\n        emit SetAuthority(authority_);\n    }\n\n    // --- Internal Functions ---\n    /// @notice Check caller authorization\n    /// @param src Caller address\n    /// @param sig Function signature\n    /// @return True if authorized (owner, self, or approved by authority)\n    function isAuthorized(address src, bytes4 sig) internal view returns (bool) {\n        if (src == owner || src == address(this)) {\n            return true;\n        } else if (authority != address(0)) {\n            return AuthorityLike(authority).canCall(src, address(this), sig);\n        } else {\n            return false;\n        }\n    }\n\n    // --- Emergency Actions ---\n    /// @notice Emergency halt of SPBEAM module\n    /// @param spbeam Target SPBEAM contract\n    /// @dev Sets bad=1 to immediately halt operations\n    function halt(address spbeam) external auth {\n        SPBEAMLike(spbeam).file(\"bad\", 1);\n        emit Halt(spbeam);\n    }\n}\n","deployed_bytecode":"0x608060405234801561000f575f80fd5b5060043610610055575f3560e01c806313af403514610059578063364db0fc1461006e5780637a9e5e4b146100815780638da5cb5b14610094578063bf7e214f146100c2575b5f80fd5b61006c6100673660046103d4565b6100d5565b005b61006c61007c3660046103d4565b610170565b61006c61008f3660046103d4565b610268565b5f546100a6906001600160a01b031681565b6040516001600160a01b03909116815260200160405180910390f35b6001546100a6906001600160a01b031681565b5f546001600160a01b031633146101295760405162461bcd60e51b815260206004820152601360248201527229a82122a0a6a6b7b697b737ba16b7bbb732b960691b60448201526064015b60405180910390fd5b5f80546001600160a01b0319166001600160a01b038316908117825560405190917f167d3e9c1016ab80e58802ca9da10ce5c6a0f4debc46a2e7a2cd9e56899a4fb591a250565b610185335f356001600160e01b031916610300565b6101d15760405162461bcd60e51b815260206004820152601860248201527f53504245414d4d6f6d2f6e6f742d617574686f72697a656400000000000000006044820152606401610120565b604051630a6ba04560e21b81526218985960ea1b6004820152600160248201526001600160a01b038216906329ae8114906044015f604051808303815f87803b15801561021c575f80fd5b505af115801561022e573d5f803e3d5ffd5b50506040516001600160a01b03841692507f553ecabd0db41a2351346d8e53c7809e606601ae528edc6e6a10b41565a60c5a91505f90a250565b5f546001600160a01b031633146102b75760405162461bcd60e51b815260206004820152601360248201527229a82122a0a6a6b7b697b737ba16b7bbb732b960691b6044820152606401610120565b600180546001600160a01b0319166001600160a01b0383169081179091556040517f1679749591538f58df6938d50167216de9dda7d8a999dbb21d9f098383a13e02905f90a250565b5f80546001600160a01b038481169116148061032457506001600160a01b03831630145b15610331575060016103ce565b6001546001600160a01b0316156103cb5760015460405163b700961360e01b81526001600160a01b0385811660048301523060248301526001600160e01b0319851660448301529091169063b700961390606401602060405180830381865afa1580156103a0573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906103c49190610401565b90506103ce565b505f5b92915050565b5f602082840312156103e4575f80fd5b81356001600160a01b03811681146103fa575f80fd5b9392505050565b5f60208284031215610411575f80fd5b815180151581146103fa575f80fdfea264697066735822122000bcd3fe929c0692c143922d23134dae3a81685c5f19492b0736552f85738aab64736f6c63430008180033","optimization_enabled":true,"verified_twin_address_hash":null,"is_verified":true,"compiler_settings":{"evmVersion":"cancun","libraries":{},"metadata":{"bytecodeHash":"ipfs"},"optimizer":{"enabled":true,"runs":200},"remappings":[":dss-interfaces/=lib/dss-test/lib/dss-interfaces/src/",":dss-test/=lib/dss-test/src/",":forge-std/=lib/forge-std/src/"]},"optimization_runs":200,"sourcify_repo_url":null,"decoded_constructor_args":null,"compiler_version":"0.8.24+commit.e11b9ed9","is_verified_via_verifier_alliance":true,"verified_at":"2026-02-16T12:30:52.144383Z","implementations":[],"proxy_type":null,"external_libraries":[],"creation_bytecode":"0x608060405234801561000f575f80fd5b505f80546001600160a01b03191633908117825560405190917f167d3e9c1016ab80e58802ca9da10ce5c6a0f4debc46a2e7a2cd9e56899a4fb591a2610456806100585f395ff3fe608060405234801561000f575f80fd5b5060043610610055575f3560e01c806313af403514610059578063364db0fc1461006e5780637a9e5e4b146100815780638da5cb5b14610094578063bf7e214f146100c2575b5f80fd5b61006c6100673660046103d4565b6100d5565b005b61006c61007c3660046103d4565b610170565b61006c61008f3660046103d4565b610268565b5f546100a6906001600160a01b031681565b6040516001600160a01b03909116815260200160405180910390f35b6001546100a6906001600160a01b031681565b5f546001600160a01b031633146101295760405162461bcd60e51b815260206004820152601360248201527229a82122a0a6a6b7b697b737ba16b7bbb732b960691b60448201526064015b60405180910390fd5b5f80546001600160a01b0319166001600160a01b038316908117825560405190917f167d3e9c1016ab80e58802ca9da10ce5c6a0f4debc46a2e7a2cd9e56899a4fb591a250565b610185335f356001600160e01b031916610300565b6101d15760405162461bcd60e51b815260206004820152601860248201527f53504245414d4d6f6d2f6e6f742d617574686f72697a656400000000000000006044820152606401610120565b604051630a6ba04560e21b81526218985960ea1b6004820152600160248201526001600160a01b038216906329ae8114906044015f604051808303815f87803b15801561021c575f80fd5b505af115801561022e573d5f803e3d5ffd5b50506040516001600160a01b03841692507f553ecabd0db41a2351346d8e53c7809e606601ae528edc6e6a10b41565a60c5a91505f90a250565b5f546001600160a01b031633146102b75760405162461bcd60e51b815260206004820152601360248201527229a82122a0a6a6b7b697b737ba16b7bbb732b960691b6044820152606401610120565b600180546001600160a01b0319166001600160a01b0383169081179091556040517f1679749591538f58df6938d50167216de9dda7d8a999dbb21d9f098383a13e02905f90a250565b5f80546001600160a01b038481169116148061032457506001600160a01b03831630145b15610331575060016103ce565b6001546001600160a01b0316156103cb5760015460405163b700961360e01b81526001600160a01b0385811660048301523060248301526001600160e01b0319851660448301529091169063b700961390606401602060405180830381865afa1580156103a0573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906103c49190610401565b90506103ce565b505f5b92915050565b5f602082840312156103e4575f80fd5b81356001600160a01b03811681146103fa575f80fd5b9392505050565b5f60208284031215610411575f80fd5b815180151581146103fa575f80fdfea264697066735822122000bcd3fe929c0692c143922d23134dae3a81685c5f19492b0736552f85738aab64736f6c63430008180033","name":"SPBEAMMom","is_blueprint":false,"license_type":"none","is_fully_verified":true,"is_verified_via_eth_bytecode_db":true,"language":"solidity","evm_version":"cancun","can_be_visualized_via_sol2uml":true,"is_verified_via_sourcify":false,"additional_sources":[],"certified":false,"conflicting_implementations":null,"abi":[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"spbeam","type":"address"}],"name":"Halt","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"authority","type":"address"}],"name":"SetAuthority","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"}],"name":"SetOwner","type":"event"},{"inputs":[],"name":"authority","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spbeam","type":"address"}],"name":"halt","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"authority_","type":"address"}],"name":"setAuthority","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner_","type":"address"}],"name":"setOwner","outputs":[],"stateMutability":"nonpayable","type":"function"}],"is_changed_bytecode":false,"is_partially_verified":false,"constructor_args":null}