Commit d69e922b authored by Michael Amadi's avatar Michael Amadi Committed by GitHub

add interfaces for safe contracts (#12650)

* add interfaces for safe contracts, use named imports for DeputyGuardianModule

* fix failing test
parent da4c33c5
...@@ -196,8 +196,8 @@ ...@@ -196,8 +196,8 @@
"sourceCodeHash": "0x3a0a294932d6deba043f6a2b46b4e8477ee96e7fb054d7e7229a43ce4352c68d" "sourceCodeHash": "0x3a0a294932d6deba043f6a2b46b4e8477ee96e7fb054d7e7229a43ce4352c68d"
}, },
"src/safe/DeputyGuardianModule.sol": { "src/safe/DeputyGuardianModule.sol": {
"initCodeHash": "0x308212d163aad169a5e42ce703a1ce36f5425ad96037850c0747177041f6596e", "initCodeHash": "0xd95e562f395d4eb6e332f4474dffab660ada9e9da7c79f58fb6052278e0904df",
"sourceCodeHash": "0xde1a289c1cb0bf92138daf8f3db7457be2f84bedaa111b536f646dd6e121718c" "sourceCodeHash": "0x45daabe094de0287e244e6fea4f1887b9adc09b07c47dc77361b1678645a1470"
}, },
"src/safe/LivenessGuard.sol": { "src/safe/LivenessGuard.sol": {
"initCodeHash": "0x9ac0b039b1591f7c00cf11cb758d118c9b42e6e08250b619d6b6fd605a43d5ee", "initCodeHash": "0x9ac0b039b1591f7c00cf11cb758d118c9b42e6e08250b619d6b6fd605a43d5ee",
......
...@@ -7,7 +7,7 @@ import { Enum } from "safe-contracts/common/Enum.sol"; ...@@ -7,7 +7,7 @@ import { Enum } from "safe-contracts/common/Enum.sol";
// Libraries // Libraries
import { Unauthorized } from "src/libraries/PortalErrors.sol"; import { Unauthorized } from "src/libraries/PortalErrors.sol";
import "src/dispute/lib/Types.sol"; import { GameType, Timestamp } from "src/dispute/lib/Types.sol";
// Interfaces // Interfaces
import { IAnchorStateRegistry } from "src/dispute/interfaces/IAnchorStateRegistry.sol"; import { IAnchorStateRegistry } from "src/dispute/interfaces/IAnchorStateRegistry.sol";
...@@ -48,8 +48,8 @@ contract DeputyGuardianModule is ISemver { ...@@ -48,8 +48,8 @@ contract DeputyGuardianModule is ISemver {
address internal immutable DEPUTY_GUARDIAN; address internal immutable DEPUTY_GUARDIAN;
/// @notice Semantic version. /// @notice Semantic version.
/// @custom:semver 2.0.1-beta.3 /// @custom:semver 2.0.1-beta.4
string public constant version = "2.0.1-beta.3"; string public constant version = "2.0.1-beta.4";
// Constructor to initialize the Safe and baseModule instances // Constructor to initialize the Safe and baseModule instances
constructor(Safe _safe, ISuperchainConfig _superchainConfig, address _deputyGuardian) { constructor(Safe _safe, ISuperchainConfig _superchainConfig, address _deputyGuardian) {
......
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import { IAnchorStateRegistry } from "src/dispute/interfaces/IAnchorStateRegistry.sol";
import { IFaultDisputeGame } from "src/dispute/interfaces/IFaultDisputeGame.sol";
import { ISuperchainConfig } from "src/L1/interfaces/ISuperchainConfig.sol";
import { IOptimismPortal2 } from "src/L1/interfaces/IOptimismPortal2.sol";
import { IDisputeGame } from "src/dispute/interfaces/IDisputeGame.sol";
import { ISemver } from "src/universal/interfaces/ISemver.sol";
import { GameType, Timestamp } from "src/dispute/lib/Types.sol";
import { GnosisSafe as Safe } from "safe-contracts/GnosisSafe.sol";
interface IDeputyGuardianModule is ISemver {
error ExecutionFailed(string);
error Unauthorized();
event Paused(string identifier);
event Unpaused();
event DisputeGameBlacklisted(IDisputeGame indexed game);
event RespectedGameTypeSet(GameType indexed gameType, Timestamp indexed updatedAt);
function version() external view returns (string memory);
function __constructor__(Safe _safe, ISuperchainConfig _superchainConfig, address _deputyGuardian) external;
function safe() external view returns (Safe safe_);
function superchainConfig() external view returns (ISuperchainConfig superchainConfig_);
function deputyGuardian() external view returns (address deputyGuardian_);
function pause() external;
function unpause() external;
function setAnchorState(IAnchorStateRegistry _registry, IFaultDisputeGame _game) external;
function blacklistDisputeGame(IOptimismPortal2 _portal, IDisputeGame _game) external;
function setRespectedGameType(IOptimismPortal2 _portal, GameType _gameType) external;
}
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import { GnosisSafe as Safe } from "safe-contracts/GnosisSafe.sol";
import { Enum } from "safe-contracts/common/Enum.sol";
import { ISemver } from "src/universal/interfaces/ISemver.sol";
interface ILivenessGuard is ISemver {
event OwnerRecorded(address owner);
function lastLive(address) external view returns (uint256);
function version() external view returns (string memory);
function __constructor__(Safe _safe) external;
function safe() external view returns (Safe safe_);
function checkTransaction(
address _to,
uint256 _value,
bytes memory _data,
Enum.Operation _operation,
uint256 _safeTxGas,
uint256 _baseGas,
uint256 _gasPrice,
address _gasToken,
address payable _refundReceiver,
bytes memory _signatures,
address _msgSender
)
external;
function checkAfterExecution(bytes32, bool) external;
function showLiveness() external;
}
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import { GnosisSafe as Safe } from "safe-contracts/GnosisSafe.sol";
import { LivenessGuard } from "src/safe/LivenessGuard.sol";
import { ISemver } from "src/universal/interfaces/ISemver.sol";
interface ILivenessModule is ISemver {
error OwnerRemovalFailed(string);
event RemovedOwner(address indexed owner);
event OwnershipTransferredToFallback();
function ownershipTransferredToFallback() external view returns (bool);
function version() external view returns (string memory);
function __constructor__(
Safe _safe,
LivenessGuard _livenessGuard,
uint256 _livenessInterval,
uint256 _minOwners,
uint256 _thresholdPercentage,
address _fallbackOwner
)
external;
function getRequiredThreshold(uint256 _numOwners) external view returns (uint256 threshold_);
function safe() external view returns (Safe safe_);
function livenessGuard() external view returns (LivenessGuard livenessGuard_);
function livenessInterval() external view returns (uint256 livenessInterval_);
function minOwners() external view returns (uint256 minOwners_);
function thresholdPercentage() external view returns (uint256 thresholdPercentage_);
function fallbackOwner() external view returns (address fallbackOwner_);
function canRemove(address _owner) external view returns (bool canRemove_);
function removeOwners(address[] memory _previousOwners, address[] memory _ownersToRemove) external;
}
...@@ -953,12 +953,13 @@ contract Specification_Test is CommonTest { ...@@ -953,12 +953,13 @@ contract Specification_Test is CommonTest {
/// @notice Ensures that there's an auth spec for every L1 contract function. /// @notice Ensures that there's an auth spec for every L1 contract function.
function testContractAuth() public { function testContractAuth() public {
string[] memory pathExcludes = new string[](5); string[] memory pathExcludes = new string[](6);
pathExcludes[0] = "src/dispute/interfaces/*"; pathExcludes[0] = "src/dispute/interfaces/*";
pathExcludes[1] = "src/dispute/lib/*"; pathExcludes[1] = "src/dispute/lib/*";
pathExcludes[2] = "src/safe/SafeSigners.sol"; pathExcludes[2] = "src/safe/SafeSigners.sol";
pathExcludes[3] = "src/L1/interfaces/*"; pathExcludes[3] = "src/L1/interfaces/*";
pathExcludes[4] = "src/governance/interfaces/*"; pathExcludes[4] = "src/governance/interfaces/*";
pathExcludes[5] = "src/safe/interfaces/*";
Abi[] memory abis = ForgeArtifacts.getContractFunctionAbis( Abi[] memory abis = ForgeArtifacts.getContractFunctionAbis(
"src/{L1,dispute,governance,safe,universal/ProxyAdmin.sol,universal/WETH98.sol}", pathExcludes "src/{L1,dispute,governance,safe,universal/ProxyAdmin.sol,universal/WETH98.sol}", pathExcludes
); );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment