Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: generic clone factory #482

Merged
merged 2 commits into from
Oct 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading