-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDiamondFactory.sol
32 lines (27 loc) · 972 Bytes
/
DiamondFactory.sol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import { Diamond } from '../Diamond.sol';
import { IDiamondWritable } from '@solidstate/contracts/proxy/diamond/writable/IDiamondWritable.sol';
contract DiamondFactory {
event Registered(address diamond, address owner);
// // test if minimalProxyFactory works (possible issue w double-delegatecall)
// address immutable public model;
// constructor(
// IDiamondWritable.FacetCut[] memory cuts,
// address target,
// bytes memory data
// ) {
// Diamond diamond = new Diamond(cuts, target, data);
// model = address(diamond);
// }
//also check out Factory.sol solidstate impl?
function createDiamond(
IDiamondWritable.FacetCut[] calldata cuts,
address target,
bytes calldata data
) external returns (address) {
Diamond diamond = new Diamond(msg.sender, cuts, target, data);
emit Registered(address(diamond), msg.sender);
return address(diamond);
}
}