Commit fb11507d authored by smartcontracts's avatar smartcontracts Committed by GitHub

maint: add interfaces for governance contracts (#11878)

Adds interfaces for the two governance contracts.
parent 7d8ffa2e
...@@ -59,7 +59,7 @@ ...@@ -59,7 +59,7 @@
"name": "governanceToken", "name": "governanceToken",
"outputs": [ "outputs": [
{ {
"internalType": "contract GovernanceToken", "internalType": "contract IGovernanceToken",
"name": "", "name": "",
"type": "address" "type": "address"
} }
......
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
pragma solidity 0.8.15; pragma solidity 0.8.15;
// Contracts
import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/access/Ownable.sol";
import "./GovernanceToken.sol";
// Interfaces
import { IGovernanceToken } from "src/governance/interfaces/IGovernanceToken.sol";
/// @title MintManager /// @title MintManager
/// @notice Set as `owner` of the governance token and responsible for the token inflation /// @notice Set as `owner` of the governance token and responsible for the token inflation
...@@ -11,7 +14,7 @@ import "./GovernanceToken.sol"; ...@@ -11,7 +14,7 @@ import "./GovernanceToken.sol";
/// token supply. Upgradable to allow changes in the inflation schedule. /// token supply. Upgradable to allow changes in the inflation schedule.
contract MintManager is Ownable { contract MintManager is Ownable {
/// @notice The GovernanceToken that the MintManager can mint tokens /// @notice The GovernanceToken that the MintManager can mint tokens
GovernanceToken public immutable governanceToken; IGovernanceToken public immutable governanceToken;
/// @notice The amount of tokens that can be minted per year. /// @notice The amount of tokens that can be minted per year.
/// The value is a fixed point number with 4 decimals. /// The value is a fixed point number with 4 decimals.
...@@ -32,7 +35,7 @@ contract MintManager is Ownable { ...@@ -32,7 +35,7 @@ contract MintManager is Ownable {
/// @param _governanceToken The governance token this contract can mint tokens of. /// @param _governanceToken The governance token this contract can mint tokens of.
constructor(address _upgrader, address _governanceToken) { constructor(address _upgrader, address _governanceToken) {
transferOwnership(_upgrader); transferOwnership(_upgrader);
governanceToken = GovernanceToken(_governanceToken); governanceToken = IGovernanceToken(_governanceToken);
} }
/// @notice Only the token owner is allowed to mint a certain amount of the /// @notice Only the token owner is allowed to mint a certain amount of the
......
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import { ERC20Votes } from "@openzeppelin/contracts/token/ERC20/extensions/ERC20Votes.sol";
interface IGovernanceToken {
event Approval(address indexed owner, address indexed spender, uint256 value);
event DelegateChanged(address indexed delegator, address indexed fromDelegate, address indexed toDelegate);
event DelegateVotesChanged(address indexed delegate, uint256 previousBalance, uint256 newBalance);
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
event Transfer(address indexed from, address indexed to, uint256 value);
function DOMAIN_SEPARATOR() external view returns (bytes32);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function balanceOf(address account) external view returns (uint256);
function burn(uint256 amount) external;
function burnFrom(address account, uint256 amount) external;
function checkpoints(address account, uint32 pos) external view returns (ERC20Votes.Checkpoint memory);
function decimals() external view returns (uint8);
function decreaseAllowance(address spender, uint256 subtractedValue) external returns (bool);
function delegate(address delegatee) external;
function delegateBySig(address delegatee, uint256 nonce, uint256 expiry, uint8 v, bytes32 r, bytes32 s) external;
function delegates(address account) external view returns (address);
function getPastTotalSupply(uint256 blockNumber) external view returns (uint256);
function getPastVotes(address account, uint256 blockNumber) external view returns (uint256);
function getVotes(address account) external view returns (uint256);
function increaseAllowance(address spender, uint256 addedValue) external returns (bool);
function mint(address _account, uint256 _amount) external;
function name() external view returns (string memory);
function nonces(address owner) external view returns (uint256);
function numCheckpoints(address account) external view returns (uint32);
function owner() external view returns (address);
function permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
)
external;
function renounceOwnership() external;
function symbol() external view returns (string memory);
function totalSupply() external view returns (uint256);
function transfer(address to, uint256 amount) external returns (bool);
function transferFrom(address from, address to, uint256 amount) external returns (bool);
function transferOwnership(address newOwner) external;
}
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import { IGovernanceToken } from "src/governance/interfaces/IGovernanceToken.sol";
interface IMintManager {
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
function DENOMINATOR() external view returns (uint256);
function MINT_CAP() external view returns (uint256);
function MINT_PERIOD() external view returns (uint256);
function governanceToken() external view returns (IGovernanceToken);
function mint(address _account, uint256 _amount) external;
function mintPermittedAfter() external view returns (uint256);
function owner() external view returns (address);
function renounceOwnership() external;
function transferOwnership(address newOwner) external;
function upgrade(address _newMintManager) external;
}
...@@ -940,11 +940,12 @@ contract Specification_Test is CommonTest { ...@@ -940,11 +940,12 @@ 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[](4); string[] memory pathExcludes = new string[](5);
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/*";
Abi[] memory abis = ForgeArtifacts.getContractFunctionAbis( Abi[] memory abis = ForgeArtifacts.getContractFunctionAbis(
"src/{L1,dispute,governance,Safe,universal/ProxyAdmin.sol}", pathExcludes "src/{L1,dispute,governance,Safe,universal/ProxyAdmin.sol}", pathExcludes
); );
......
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
pragma solidity 0.8.15; pragma solidity 0.8.15;
// Testing utilities // Testing
import { CommonTest } from "test/setup/CommonTest.sol"; import { CommonTest } from "test/setup/CommonTest.sol";
// Target contract dependencies // Contracts
import { GovernanceToken } from "src/governance/GovernanceToken.sol"; import { GovernanceToken } from "src/governance/GovernanceToken.sol";
// Target contract
import { MintManager } from "src/governance/MintManager.sol"; import { MintManager } from "src/governance/MintManager.sol";
// Interfaces
import { IGovernanceToken } from "src/governance/interfaces/IGovernanceToken.sol";
import { IMintManager } from "src/governance/interfaces/IMintManager.sol";
contract MintManager_Initializer is CommonTest { contract MintManager_Initializer is CommonTest {
address constant owner = address(0x1234); address constant owner = address(0x1234);
address constant rando = address(0x5678); address constant rando = address(0x5678);
GovernanceToken internal gov; IGovernanceToken internal gov;
MintManager internal manager; IMintManager internal manager;
/// @dev Sets up the test suite. /// @dev Sets up the test suite.
function setUp() public virtual override { function setUp() public virtual override {
super.setUp(); super.setUp();
vm.prank(owner); vm.prank(owner);
gov = new GovernanceToken(); gov = IGovernanceToken(address(new GovernanceToken()));
vm.prank(owner); vm.prank(owner);
manager = new MintManager(owner, address(gov)); manager = IMintManager(address(new MintManager(owner, address(gov))));
vm.prank(owner); vm.prank(owner);
gov.transferOwnership(address(manager)); gov.transferOwnership(address(manager));
......
...@@ -24,7 +24,6 @@ import { L1FeeVault } from "src/L2/L1FeeVault.sol"; ...@@ -24,7 +24,6 @@ import { L1FeeVault } from "src/L2/L1FeeVault.sol";
import { GasPriceOracle } from "src/L2/GasPriceOracle.sol"; import { GasPriceOracle } from "src/L2/GasPriceOracle.sol";
import { L1Block } from "src/L2/L1Block.sol"; import { L1Block } from "src/L2/L1Block.sol";
import { LegacyMessagePasser } from "src/legacy/LegacyMessagePasser.sol"; import { LegacyMessagePasser } from "src/legacy/LegacyMessagePasser.sol";
import { GovernanceToken } from "src/governance/GovernanceToken.sol";
import { FeeVault } from "src/universal/FeeVault.sol"; import { FeeVault } from "src/universal/FeeVault.sol";
import { WETH } from "src/L2/WETH.sol"; import { WETH } from "src/L2/WETH.sol";
import { SuperchainWETH } from "src/L2/SuperchainWETH.sol"; import { SuperchainWETH } from "src/L2/SuperchainWETH.sol";
...@@ -52,6 +51,7 @@ import { IL1ERC721Bridge } from "src/L1/interfaces/IL1ERC721Bridge.sol"; ...@@ -52,6 +51,7 @@ import { IL1ERC721Bridge } from "src/L1/interfaces/IL1ERC721Bridge.sol";
import { IOptimismMintableERC20Factory } from "src/universal/interfaces/IOptimismMintableERC20Factory.sol"; import { IOptimismMintableERC20Factory } from "src/universal/interfaces/IOptimismMintableERC20Factory.sol";
import { IAddressManager } from "src/legacy/interfaces/IAddressManager.sol"; import { IAddressManager } from "src/legacy/interfaces/IAddressManager.sol";
import { IOptimismERC20Factory } from "src/L2/interfaces/IOptimismERC20Factory.sol"; import { IOptimismERC20Factory } from "src/L2/interfaces/IOptimismERC20Factory.sol";
import { IGovernanceToken } from "src/governance/interfaces/IGovernanceToken.sol";
/// @title Setup /// @title Setup
/// @dev This contact is responsible for setting up the contracts in state. It currently /// @dev This contact is responsible for setting up the contracts in state. It currently
...@@ -105,7 +105,7 @@ contract Setup { ...@@ -105,7 +105,7 @@ contract Setup {
GasPriceOracle gasPriceOracle = GasPriceOracle(Predeploys.GAS_PRICE_ORACLE); GasPriceOracle gasPriceOracle = GasPriceOracle(Predeploys.GAS_PRICE_ORACLE);
L1Block l1Block = L1Block(Predeploys.L1_BLOCK_ATTRIBUTES); L1Block l1Block = L1Block(Predeploys.L1_BLOCK_ATTRIBUTES);
LegacyMessagePasser legacyMessagePasser = LegacyMessagePasser(Predeploys.LEGACY_MESSAGE_PASSER); LegacyMessagePasser legacyMessagePasser = LegacyMessagePasser(Predeploys.LEGACY_MESSAGE_PASSER);
GovernanceToken governanceToken = GovernanceToken(Predeploys.GOVERNANCE_TOKEN); IGovernanceToken governanceToken = IGovernanceToken(Predeploys.GOVERNANCE_TOKEN);
WETH weth = WETH(payable(Predeploys.WETH)); WETH weth = WETH(payable(Predeploys.WETH));
SuperchainWETH superchainWeth = SuperchainWETH(payable(Predeploys.SUPERCHAIN_WETH)); SuperchainWETH superchainWeth = SuperchainWETH(payable(Predeploys.SUPERCHAIN_WETH));
ETHLiquidity ethLiquidity = ETHLiquidity(Predeploys.ETH_LIQUIDITY); ETHLiquidity ethLiquidity = ETHLiquidity(Predeploys.ETH_LIQUIDITY);
......
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