forked from unstoppabledomains/dot-crypto
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMintingController.sol
50 lines (38 loc) · 1.74 KB
/
MintingController.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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
pragma solidity 0.5.12;
import "@openzeppelin/contracts-2.3/access/roles/MinterRole.sol";
import "./IMintingController.sol";
import "../CNSRegistry.sol";
/**
* @title MintingController
* @dev Defines the functions for distribution of Second Level Domains (SLD)s.
*/
contract MintingController is IMintingController, MinterRole {
CNSRegistry internal _registry;
constructor (CNSRegistry registry) public {
_registry = registry;
}
function registry() external view returns (address) {
return address(_registry);
}
function mintSLD(address to, string memory label) public onlyMinter {
_registry.controlledMintChild(to, _registry.root(), label);
}
function safeMintSLD(address to, string calldata label) external {
safeMintSLD(to, label, "");
}
function safeMintSLD(address to, string memory label, bytes memory _data) public onlyMinter {
_registry.controlledSafeMintChild(to, _registry.root(), label, _data);
}
function mintSLDWithResolver(address to, string memory label, address resolver) public onlyMinter {
_registry.controlledMintChild(to, _registry.root(), label);
_registry.controlledResolveTo(resolver, _registry.childIdOf(_registry.root(), label));
}
function safeMintSLDWithResolver(address to, string calldata label, address resolver) external {
safeMintSLD(to, label, "");
_registry.controlledResolveTo(resolver, _registry.childIdOf(_registry.root(), label));
}
function safeMintSLDWithResolver(address to, string calldata label, address resolver, bytes calldata _data) external {
safeMintSLD(to, label, _data);
_registry.controlledResolveTo(resolver, _registry.childIdOf(_registry.root(), label));
}
}