-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathL2RegistryFactory.sol
More file actions
73 lines (60 loc) · 3.3 KB
/
Copy pathL2RegistryFactory.sol
File metadata and controls
73 lines (60 loc) · 3.3 KB
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
// ***********************************************
// ▗▖ ▗▖ ▗▄▖ ▗▖ ▗▖▗▄▄▄▖ ▗▄▄▖▗▄▄▄▖▗▄▖ ▗▖ ▗▖▗▄▄▄▖
// ▐▛▚▖▐▌▐▌ ▐▌▐▛▚▞▜▌▐▌ ▐▌ █ ▐▌ ▐▌▐▛▚▖▐▌▐▌
// ▐▌ ▝▜▌▐▛▀▜▌▐▌ ▐▌▐▛▀▀▘ ▝▀▚▖ █ ▐▌ ▐▌▐▌ ▝▜▌▐▛▀▀▘
// ▐▌ ▐▌▐▌ ▐▌▐▌ ▐▌▐▙▄▄▖▗▄▄▞▘ █ ▝▚▄▞▘▐▌ ▐▌▐▙▄▄▖
// ***********************************************
import {Clones} from "@openzeppelin/contracts/proxy/Clones.sol";
import {IL2Registry} from "./interfaces/IL2Registry.sol";
/// @title Durin Registry Factory
/// @author NameStone
/// @notice Facilitates the deployment of new ENS subname registries
contract L2RegistryFactory {
/*//////////////////////////////////////////////////////////////
STATE VARIABLES
//////////////////////////////////////////////////////////////*/
/// @notice The implementation contract to clone
address public immutable registryImplementation;
/*//////////////////////////////////////////////////////////////
EVENTS
//////////////////////////////////////////////////////////////*/
/// @notice Emitted when a new registry is deployed
/// @param name The parent ENS name for the registry
/// @param admin The address granted admin roles for the new registry
/// @param registry The address of the newly deployed registry
event RegistryDeployed(string name, address admin, address registry);
/*//////////////////////////////////////////////////////////////
CONSTRUCTOR
//////////////////////////////////////////////////////////////*/
constructor(address _registryImplementation) {
registryImplementation = _registryImplementation;
}
/*//////////////////////////////////////////////////////////////
PUBLIC FUNCTIONS
//////////////////////////////////////////////////////////////*/
/// @notice Deploys a new L2Registry contract with default parameters
/// @param name The parent ENS name for the registry, e.g. "example.eth"
/// @return address The address of the newly deployed registry clone
function deployRegistry(string calldata name) external returns (address) {
return deployRegistry(name, "", "", msg.sender);
}
/// @notice Deploys a new L2Registry contract with specified parameters
/// @param name The parent ENS name for the registry, e.g. "example.eth"
/// @param symbol The symbol for the registry's ERC721 token
/// @param baseURI The URI for the NFT's metadata
/// @param admin The address to grant admin roles to
/// @return address The address of the newly deployed registry clone
function deployRegistry(
string calldata name,
string memory symbol,
string memory baseURI,
address admin
) public returns (address) {
address registry = Clones.clone(registryImplementation);
IL2Registry(registry).initialize(name, symbol, baseURI, admin);
emit RegistryDeployed(name, admin, registry);
return registry;
}
}