From 7095c228749d6d7a056db7f19a30c96ff255e844 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8r=E2=88=82=C2=A1?= Date: Fri, 19 Apr 2024 17:58:48 +0200 Subject: [PATCH] Addidional cleanup touches --- src/conditions/StandardProposalCondition.sol | 9 ++++++--- src/setup/OptimisticTokenVotingPluginSetup.sol | 1 - test/OptimisticTokenVotingPlugin.t.sol | 17 ++++++++++++++--- 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/src/conditions/StandardProposalCondition.sol b/src/conditions/StandardProposalCondition.sol index 7749839..188665b 100644 --- a/src/conditions/StandardProposalCondition.sol +++ b/src/conditions/StandardProposalCondition.sol @@ -14,12 +14,15 @@ import {OptimisticTokenVotingPlugin} from "../OptimisticTokenVotingPlugin.sol"; /// @notice An abstract contract for non-upgradeable contracts instantiated via the `new` keyword to inherit from to support customary permissions depending on arbitrary on-chain state. contract StandardProposalCondition is ERC165, IPermissionCondition { address dao; - address targetPlugin; uint256 minDelay; - constructor(address _dao, address _targetPlugin, uint256 _minDelay) { + /** + * + * @param _dao The address of the DAO on which permissions are defined + * @param _minDelay The minimum amount of seconds to enforce for proposals created + */ + constructor(address _dao, uint256 _minDelay) { dao = _dao; - targetPlugin = _targetPlugin; minDelay = _minDelay; } diff --git a/src/setup/OptimisticTokenVotingPluginSetup.sol b/src/setup/OptimisticTokenVotingPluginSetup.sol index 2c16925..1585c8f 100644 --- a/src/setup/OptimisticTokenVotingPluginSetup.sol +++ b/src/setup/OptimisticTokenVotingPluginSetup.sol @@ -191,7 +191,6 @@ contract OptimisticTokenVotingPluginSetup is PluginSetup { // Deploy the Std proposal condition StandardProposalCondition stdProposalCondition = new StandardProposalCondition( address(_dao), - address(plugin), MIN_DELAY ); diff --git a/test/OptimisticTokenVotingPlugin.t.sol b/test/OptimisticTokenVotingPlugin.t.sol index 891c8d0..c9bf7f7 100644 --- a/test/OptimisticTokenVotingPlugin.t.sol +++ b/test/OptimisticTokenVotingPlugin.t.sol @@ -6,6 +6,7 @@ import {OptimisticTokenVotingPlugin} from "../src/OptimisticTokenVotingPlugin.so import {IOptimisticTokenVoting} from "../src/IOptimisticTokenVoting.sol"; import {DAO} from "@aragon/osx/core/dao/DAO.sol"; import {IDAO} from "@aragon/osx/core/dao/IDAO.sol"; +import {IPlugin} from "@aragon/osx/core/plugin/IPlugin.sol"; import {IProposal} from "@aragon/osx/core/plugin/proposal/IProposal.sol"; import {IMembership} from "@aragon/osx/core/plugin/membership/IMembership.sol"; import {RATIO_BASE, RatioOutOfBounds} from "@aragon/osx/plugins/utils/Ratio.sol"; @@ -13,6 +14,7 @@ import {DaoUnauthorized} from "@aragon/osx/core/utils/auth.sol"; import {ERC20VotesMock} from "./mocks/ERC20VotesMock.sol"; import {ERC1967Proxy} from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol"; import {IERC165Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/introspection/IERC165Upgradeable.sol"; +import {IERC1822ProxiableUpgradeable} from "@openzeppelin/contracts-upgradeable/interfaces/draft-IERC1822Upgradeable.sol"; contract OptimisticTokenVotingPluginTest is Test { address immutable daoBase = address(new DAO()); @@ -315,10 +317,19 @@ contract OptimisticTokenVotingPluginTest is Test { supported = plugin.supportsInterface(bytes4(0xffffffff)); assertEq(supported, false, "Should not support any other interface"); - // Some fuzzing values are expected to be true - if (_randomInterfaceId == bytes4(0x52d1902d)) { + // Certain fuzzing values are expected to be true + if ( + _randomInterfaceId == plugin.OPTIMISTIC_GOVERNANCE_INTERFACE_ID() || + _randomInterfaceId == type(IERC165Upgradeable).interfaceId || + _randomInterfaceId == type(IPlugin).interfaceId || + _randomInterfaceId == type(IProposal).interfaceId || + _randomInterfaceId == + type(IERC1822ProxiableUpgradeable).interfaceId || + _randomInterfaceId == type(IOptimisticTokenVoting).interfaceId || + _randomInterfaceId == type(IMembership).interfaceId + ) { supported = plugin.supportsInterface(_randomInterfaceId); - assertEq(supported, true, "proxiableUUID should be supported"); + assertEq(supported, true, "Interface should be supported"); return; }