File tree Expand file tree Collapse file tree 2 files changed +50
-3
lines changed
Expand file tree Collapse file tree 2 files changed +50
-3
lines changed Original file line number Diff line number Diff line change @@ -7,9 +7,7 @@ import {Ownable} from "../lib/openzeppelin-contracts/contracts/access/Ownable.so
77contract IPCM is Ownable {
88 string private cidMapping;
99
10- constructor (address owner , string memory initialCID ) Ownable (owner) {
11- cidMapping = initialCID;
12- }
10+ constructor () Ownable (msg .sender ) {}
1311
1412 event MappingUpdated (string value );
1513
Original file line number Diff line number Diff line change 1+ // SPDX-License-Identifier: MIT
2+ pragma solidity ^ 0.8.22 ;
3+
4+ import "../lib/openzeppelin-contracts/contracts/proxy/Clones.sol " ;
5+ import "./IPCM.sol " ;
6+
7+ contract IPCMFactory {
8+ // Address of the implementation contract
9+ address public immutable implementation;
10+
11+ // Event to emit when a new clone is created
12+ event IPCMCreated (address cloneAddress );
13+
14+ constructor () {
15+ // Deploy the implementation contract
16+ implementation = address (new IPCM ());
17+ }
18+
19+ function createIPCM () external returns (address ) {
20+ address clone = Clones.clone (implementation);
21+
22+ emit IPCMCreated (clone);
23+
24+ return clone;
25+ }
26+
27+ // Optional: deterministic clone using create2
28+ // function createDeterministicHelloBase(
29+ // bytes32 salt
30+ // ) external returns (address) {
31+ // address clone = Clones.cloneDeterministic(implementation, salt);
32+
33+ // emit HelloBaseCreated(clone);
34+
35+ // return clone;
36+ // }
37+
38+ // Function to predict the address of a deterministic clone
39+ // function predictDeterministicAddress(
40+ // bytes32 salt
41+ // ) external view returns (address) {
42+ // return
43+ // Clones.predictDeterministicAddress(
44+ // implementation,
45+ // salt,
46+ // address(this)
47+ // );
48+ // }
49+ }
You can’t perform that action at this time.
0 commit comments