From 33dd7b4441cfd334f43d2c4d33f4fd81630c5803 Mon Sep 17 00:00:00 2001 From: Michael Heuer Date: Mon, 9 Oct 2023 09:39:09 +0200 Subject: [PATCH] refactor: made clone factory generic --- packages/contracts/src/test/plugin/CloneFactory.sol | 8 +++----- .../contracts/test/plugins/governance/admin/admin.ts | 12 +++++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/packages/contracts/src/test/plugin/CloneFactory.sol b/packages/contracts/src/test/plugin/CloneFactory.sol index b6bd6c506..f903a2dc9 100644 --- a/packages/contracts/src/test/plugin/CloneFactory.sol +++ b/packages/contracts/src/test/plugin/CloneFactory.sol @@ -4,15 +4,13 @@ pragma solidity ^0.8.8; import {Clones} from "@openzeppelin/contracts/proxy/Clones.sol"; -import {Admin} from "../../plugins/governance/admin/Admin.sol"; - -contract AdminCloneFactory { +contract CloneFactory { using Clones for address; address private immutable implementation; - constructor() { - implementation = address(new Admin()); + constructor(address _implementation) { + implementation = _implementation; } function deployClone() external returns (address clone) { diff --git a/packages/contracts/test/plugins/governance/admin/admin.ts b/packages/contracts/test/plugins/governance/admin/admin.ts index df3f0a6fc..44096a9d9 100644 --- a/packages/contracts/test/plugins/governance/admin/admin.ts +++ b/packages/contracts/test/plugins/governance/admin/admin.ts @@ -16,8 +16,8 @@ import {ADMIN_INTERFACE_ID} from '../../../../../subgraph/src/utils/constants'; import {OZ_ERRORS} from '../../../test-utils/error'; import {toBytes32} from '../../../test-utils/voting'; import { - AdminCloneFactory, - AdminCloneFactory__factory, + CloneFactory, + CloneFactory__factory, Admin__factory, IERC165Upgradeable__factory, IMembership__factory, @@ -38,7 +38,7 @@ const EXECUTE_PERMISSION_ID = ethers.utils.id('EXECUTE_PERMISSION'); describe('Admin', function () { let signers: SignerWithAddress[]; let plugin: any; - let adminCloneFactory: AdminCloneFactory; + let adminCloneFactory: CloneFactory; let dao: any; let ownerAddress: string; let dummyActions: any; @@ -61,8 +61,10 @@ describe('Admin', function () { dao = await deployNewDAO(signers[0]); - const AdminCloneFactory = new AdminCloneFactory__factory(signers[0]); - adminCloneFactory = await AdminCloneFactory.deploy(); + const admin = await new Admin__factory(signers[0]).deploy(); + adminCloneFactory = await new CloneFactory__factory(signers[0]).deploy( + admin.address + ); }); beforeEach(async () => {