1+ // The Licensed Work is (c) 2022 Sygma
2+ // SPDX-License-Identifier: LGPL-3.0-only
3+ pragma solidity 0.8.20 ;
4+
5+ import "@openzeppelin/contracts/access/Ownable.sol " ;
6+
7+ /**
8+ @title Facilitates deposits and creation of deposit proposals, and deposit executions.
9+ @author ChainSafe Systems.
10+ */
11+ contract Admin is Ownable {
12+ event StartKeygen ();
13+ event EndKeygen ();
14+ event KeyRefresh (string hash );
15+
16+ error MPCAddressAlreadySet ();
17+ error MPCAddressIsNotUpdatable ();
18+ error MPCAddressZeroAddress ();
19+
20+ constructor () Ownable (msg .sender ) {}
21+
22+ /**
23+ @notice Once MPC address is set, this method can't be invoked anymore.
24+ It's used to trigger the belonging process on the MPC side which also handles keygen function calls order.
25+ @notice Only callable by owner
26+ */
27+ function startKeygen () external onlyOwner {
28+ if (_MPCAddress != address (0 )) revert MPCAddressAlreadySet ();
29+ emit StartKeygen ();
30+ }
31+
32+ /**
33+ @notice This method can be called only once, after the MPC address is set.
34+ @notice Only callable by owner.
35+ @param MPCAddress Address that will be set as MPC address.
36+ */
37+ function endKeygen (address MPCAddress ) external onlyOwner {
38+ if (MPCAddress == address (0 )) revert MPCAddressZeroAddress ();
39+ if (_MPCAddress != address (0 )) revert MPCAddressIsNotUpdatable ();
40+ _MPCAddress = MPCAddress;
41+ emit EndKeygen ();
42+ }
43+
44+ /**
45+ @notice It's used to trigger the refresh process on the MPC side.
46+ @notice Only callable by owner
47+ @param hash Topology hash which prevents changes during refresh process.
48+ */
49+ function refreshKey (string memory hash ) external onlyOwner {
50+ emit KeyRefresh (hash);
51+ }
52+ }
0 commit comments