Skip to content

Commit

Permalink
refactor: made clone factory generic
Browse files Browse the repository at this point in the history
  • Loading branch information
heueristik committed Oct 9, 2023
1 parent 4e44274 commit 33dd7b4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
8 changes: 3 additions & 5 deletions packages/contracts/src/test/plugin/CloneFactory.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
12 changes: 7 additions & 5 deletions packages/contracts/test/plugins/governance/admin/admin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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;
Expand All @@ -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 () => {
Expand Down

0 comments on commit 33dd7b4

Please sign in to comment.