You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
//SPDX-License-Identifier: GLP-3.0
|
|
|
|
pragma solidity ^0.8.0;
|
|
|
|
|
|
|
|
// import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
|
|
|
|
import "@openzeppelin/contracts/access/Ownable.sol";
|
|
|
|
import "@openzeppelin/contracts/utils/Create2.sol";
|
|
|
|
import "@openzeppelin/contracts/proxy/Clones.sol";
|
|
|
|
import "./Hubv3.sol";
|
|
|
|
|
|
|
|
contract HubFactory is Ownable {
|
|
|
|
event CreateHub(address indexed hub, address indexed creator);
|
|
|
|
|
|
|
|
bool public dbSelector;
|
|
|
|
address[] public hubs;
|
|
|
|
Hubv3 public hubImp;
|
|
|
|
|
|
|
|
constructor(bool _dbSelector) {
|
|
|
|
dbSelector = _dbSelector;
|
|
|
|
}
|
|
|
|
|
|
|
|
function newHubImp() public onlyOwner {
|
|
|
|
hubImp = new Hubv3();
|
|
|
|
}
|
|
|
|
|
|
|
|
function setHubImp(address addr) public onlyOwner {
|
|
|
|
hubImp = Hubv3(addr);
|
|
|
|
}
|
|
|
|
|
|
|
|
function createHub(bool isPermissionless) external{
|
|
|
|
address instance = Clones.clone(address(hubImp));
|
|
|
|
hubs.push(instance);
|
|
|
|
Hubv3(instance).initialize(dbSelector, _msgSender(), isPermissionless);
|
|
|
|
emit CreateHub(instance, _msgSender());
|
|
|
|
}
|
|
|
|
}
|