Repository navigation
Expand file tree
/
Copy pathDisputeTemplateRegistry.sol
More file actions
86 lines (69 loc) · 2.92 KB
/
Copy pathDisputeTemplateRegistry.sol
File metadata and controls
86 lines (69 loc) · 2.92 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
74
75
76
77
78
79
80
81
82
83
84
85
86
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.28;
import {UUPSProxiable} from "../proxy/UUPSProxiable.sol";
import {Initializable} from "../proxy/Initializable.sol";
import {IDisputeTemplateRegistry} from "./interfaces/IDisputeTemplateRegistry.sol";
/// @title Dispute Template Registry
/// @notice A contract to maintain a registry of dispute templates.
contract DisputeTemplateRegistry is IDisputeTemplateRegistry, UUPSProxiable, Initializable {
string public constant override version = "2.0.0";
// ************************************* //
// * Storage * //
// ************************************* //
/// @notice The owner of the contract.
address public owner;
/// @notice The number of templates.
uint256 public templates;
// ************************************* //
// * Function Modifiers * //
// ************************************* //
modifier onlyByOwner() {
require(owner == msg.sender, OwnerOnly());
_;
}
// ************************************* //
// * Constructor * //
// ************************************* //
/// @custom:oz-upgrades-unsafe-allow constructor
constructor() {
_disableInitializers();
}
/// @notice Initializer
/// @param _owner Owner of the contract.
function initialize(address _owner) external initializer {
owner = _owner;
}
// ************************ //
// * Governance * //
// ************************ //
/// @dev Access Control to perform implementation upgrades (UUPS Proxiable)
/// Only the owner can perform upgrades (`onlyByOwner`)
function _authorizeUpgrade(address) internal view override onlyByOwner {
// NOP
}
/// @notice Changes the owner of the contract.
/// @param _owner The new owner.
function changeOwner(address _owner) external onlyByOwner {
owner = _owner;
}
// ************************************* //
// * State Modifiers * //
// ************************************* //
/// @notice Registers a new dispute template.
/// @param _templateTag An optional tag for the dispute template, such as "registration" or "removal".
/// @param _templateData The template data.
/// @param _templateDataMappings The data mappings for the template.
/// @return templateId The identifier of the dispute template.
function setDisputeTemplate(
string memory _templateTag,
string memory _templateData,
string memory _templateDataMappings
) external returns (uint256 templateId) {
templateId = templates++;
emit DisputeTemplate(templateId, _templateTag, _templateData, _templateDataMappings);
}
// ************************************* //
// * Errors * //
// ************************************* //
error OwnerOnly();
}