diff --git a/contracts/DualGovernanceConfigProvider.sol b/contracts/DualGovernanceConfigProvider.sol index 9b5900a2..806e3dd5 100644 --- a/contracts/DualGovernanceConfigProvider.sol +++ b/contracts/DualGovernanceConfigProvider.sol @@ -4,10 +4,7 @@ pragma solidity 0.8.26; import {Duration} from "./types/Duration.sol"; import {PercentD16} from "./types/PercentD16.sol"; import {DualGovernanceConfig} from "./libraries/DualGovernanceConfig.sol"; - -interface IDualGovernanceConfigProvider { - function getDualGovernanceConfig() external view returns (DualGovernanceConfig.Context memory config); -} +import {IDualGovernanceConfigProvider} from "./interfaces/IDualGovernanceConfigProvider.sol"; contract ImmutableDualGovernanceConfigProvider is IDualGovernanceConfigProvider { PercentD16 public immutable FIRST_SEAL_RAGE_QUIT_SUPPORT; diff --git a/contracts/Executor.sol b/contracts/Executor.sol index 9715e8c4..1497a326 100644 --- a/contracts/Executor.sol +++ b/contracts/Executor.sol @@ -4,7 +4,7 @@ pragma solidity 0.8.26; import {Address} from "@openzeppelin/contracts/utils/Address.sol"; import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol"; -import {IExternalExecutor} from "./libraries/ExternalCalls.sol"; +import {IExternalExecutor} from "./interfaces/IExternalExecutor.sol"; contract Executor is IExternalExecutor, Ownable { constructor(address owner) Ownable(owner) {} diff --git a/contracts/committees/ResealCommittee.sol b/contracts/committees/ResealCommittee.sol index 8cc8490e..ac1f1c14 100644 --- a/contracts/committees/ResealCommittee.sol +++ b/contracts/committees/ResealCommittee.sol @@ -2,13 +2,11 @@ pragma solidity 0.8.26; import {Address} from "@openzeppelin/contracts/utils/Address.sol"; + +import {IDualGovernance} from "../interfaces/IDualGovernance.sol"; import {HashConsensus} from "./HashConsensus.sol"; import {ProposalsList} from "./ProposalsList.sol"; -interface IDualGovernance { - function resealSealable(address sealables) external; -} - /// @title Reseal Committee Contract /// @notice This contract allows a committee to vote on and execute resealing proposals /// @dev Inherits from HashConsensus for voting mechanisms and ProposalsList for proposal management diff --git a/contracts/committees/TiebreakerCore.sol b/contracts/committees/TiebreakerCore.sol index aea111fb..8c7a10ab 100644 --- a/contracts/committees/TiebreakerCore.sol +++ b/contracts/committees/TiebreakerCore.sol @@ -2,14 +2,12 @@ pragma solidity 0.8.26; import {Address} from "@openzeppelin/contracts/utils/Address.sol"; + +import {ITiebreakerCore} from "../interfaces/ITiebreaker.sol"; +import {IDualGovernance} from "../interfaces/IDualGovernance.sol"; import {HashConsensus} from "./HashConsensus.sol"; import {ProposalsList} from "./ProposalsList.sol"; -interface IDualGovernance { - function tiebreakerScheduleProposal(uint256 proposalId) external; - function tiebreakerResumeSealable(address sealable) external; -} - enum ProposalType { ScheduleProposal, ResumeSelable @@ -18,7 +16,7 @@ enum ProposalType { /// @title Tiebreaker Core Contract /// @notice This contract allows a committee to vote on and execute proposals for scheduling and resuming sealable addresses /// @dev Inherits from HashConsensus for voting mechanisms and ProposalsList for proposal management -contract TiebreakerCore is HashConsensus, ProposalsList { +contract TiebreakerCore is ITiebreakerCore, HashConsensus, ProposalsList { error ResumeSealableNonceMismatch(); address immutable DUAL_GOVERNANCE; diff --git a/contracts/committees/TiebreakerSubCommittee.sol b/contracts/committees/TiebreakerSubCommittee.sol index 09f9fa4b..d608ac9c 100644 --- a/contracts/committees/TiebreakerSubCommittee.sol +++ b/contracts/committees/TiebreakerSubCommittee.sol @@ -2,15 +2,11 @@ pragma solidity 0.8.26; import {Address} from "@openzeppelin/contracts/utils/Address.sol"; + +import {ITiebreakerCore} from "../interfaces/ITiebreaker.sol"; import {HashConsensus} from "./HashConsensus.sol"; import {ProposalsList} from "./ProposalsList.sol"; -interface ITiebreakerCore { - function getSealableResumeNonce(address sealable) external view returns (uint256 nonce); - function scheduleProposal(uint256 _proposalId) external; - function sealableResume(address sealable, uint256 nonce) external; -} - enum ProposalType { ScheduleProposal, ResumeSelable diff --git a/contracts/interfaces/IDualGovernance.sol b/contracts/interfaces/IDualGovernance.sol index 80bf5b27..1ee4e000 100644 --- a/contracts/interfaces/IDualGovernance.sol +++ b/contracts/interfaces/IDualGovernance.sol @@ -5,4 +5,9 @@ import {IGovernance} from "./IGovernance.sol"; interface IDualGovernance is IGovernance { function activateNextState() external; + + function resealSealable(address sealables) external; + + function tiebreakerScheduleProposal(uint256 proposalId) external; + function tiebreakerResumeSealable(address sealable) external; } diff --git a/contracts/interfaces/IDualGovernanceConfigProvider.sol b/contracts/interfaces/IDualGovernanceConfigProvider.sol new file mode 100644 index 00000000..e9c6988c --- /dev/null +++ b/contracts/interfaces/IDualGovernanceConfigProvider.sol @@ -0,0 +1,8 @@ +// SPDX-License-Identifier: MIT +pragma solidity 0.8.26; + +import {DualGovernanceConfig} from "../libraries/DualGovernanceConfig.sol"; + +interface IDualGovernanceConfigProvider { + function getDualGovernanceConfig() external view returns (DualGovernanceConfig.Context memory config); +} diff --git a/contracts/interfaces/IExternalExecutor.sol b/contracts/interfaces/IExternalExecutor.sol new file mode 100644 index 00000000..6999aa53 --- /dev/null +++ b/contracts/interfaces/IExternalExecutor.sol @@ -0,0 +1,10 @@ +// SPDX-License-Identifier: MIT +pragma solidity 0.8.26; + +interface IExternalExecutor { + function execute( + address target, + uint256 value, + bytes calldata payload + ) external payable returns (bytes memory result); +} diff --git a/contracts/interfaces/ITiebreaker.sol b/contracts/interfaces/ITiebreaker.sol new file mode 100644 index 00000000..0993fc31 --- /dev/null +++ b/contracts/interfaces/ITiebreaker.sol @@ -0,0 +1,8 @@ +// SPDX-License-Identifier: MIT +pragma solidity 0.8.26; + +interface ITiebreakerCore { + function getSealableResumeNonce(address sealable) external view returns (uint256 nonce); + function scheduleProposal(uint256 _proposalId) external; + function sealableResume(address sealable, uint256 nonce) external; +} diff --git a/contracts/libraries/ExternalCalls.sol b/contracts/libraries/ExternalCalls.sol index 9896e027..dfa9838f 100644 --- a/contracts/libraries/ExternalCalls.sol +++ b/contracts/libraries/ExternalCalls.sol @@ -1,20 +1,14 @@ // SPDX-License-Identifier: MIT pragma solidity 0.8.26; +import {IExternalExecutor} from "../interfaces/IExternalExecutor.sol"; + struct ExternalCall { address target; uint96 value; // ~ 7.9 billion ETH bytes payload; } -interface IExternalExecutor { - function execute( - address target, - uint256 value, - bytes calldata payload - ) external payable returns (bytes memory result); -} - library ExternalCalls { function execute( ExternalCall[] memory calls, diff --git a/contracts/libraries/Proposers.sol b/contracts/libraries/Proposers.sol index 0d93f9f8..5978aafb 100644 --- a/contracts/libraries/Proposers.sol +++ b/contracts/libraries/Proposers.sol @@ -12,7 +12,6 @@ struct Proposer { /// @title Proposers Library /// @dev This library manages proposers and their assigned executors in a governance system, providing functions to register, /// unregister, and verify proposers and their roles. It ensures proper assignment and validation of proposers and executors. - library Proposers { using SafeCast for uint256;