Skip to content

Commit

Permalink
Merge pull request #82 from lidofinance/feature/interface-cleanup
Browse files Browse the repository at this point in the history
Interfaces over all contracts cleanup
  • Loading branch information
Psirex authored Aug 8, 2024
2 parents 8046f68 + bc81745 commit 33ca8e3
Show file tree
Hide file tree
Showing 11 changed files with 43 additions and 30 deletions.
5 changes: 1 addition & 4 deletions contracts/DualGovernanceConfigProvider.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion contracts/Executor.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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) {}
Expand Down
6 changes: 2 additions & 4 deletions contracts/committees/ResealCommittee.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 4 additions & 6 deletions contracts/committees/TiebreakerCore.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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;
Expand Down
8 changes: 2 additions & 6 deletions contracts/committees/TiebreakerSubCommittee.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions contracts/interfaces/IDualGovernance.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
8 changes: 8 additions & 0 deletions contracts/interfaces/IDualGovernanceConfigProvider.sol
Original file line number Diff line number Diff line change
@@ -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);
}
10 changes: 10 additions & 0 deletions contracts/interfaces/IExternalExecutor.sol
Original file line number Diff line number Diff line change
@@ -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);
}
8 changes: 8 additions & 0 deletions contracts/interfaces/ITiebreaker.sol
Original file line number Diff line number Diff line change
@@ -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;
}
10 changes: 2 additions & 8 deletions contracts/libraries/ExternalCalls.sol
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
1 change: 0 additions & 1 deletion contracts/libraries/Proposers.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit 33ca8e3

Please sign in to comment.