31 lines
1.4 KiB
Solidity
31 lines
1.4 KiB
Solidity
|
|
// SPDX-License-Identifier: MIT
|
||
|
|
pragma solidity ^0.8.20;
|
||
|
|
|
||
|
|
import "@openzeppelin/contracts/access/AccessControl.sol";
|
||
|
|
import "./interfaces/IM00MainnetBridgeFacet.sol";
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @title M00DiamondInit
|
||
|
|
* @notice diamondCut _init delegatecall: bootstrap bridge ACL on diamond storage, then wire config.
|
||
|
|
*/
|
||
|
|
contract M00DiamondInit is AccessControl {
|
||
|
|
bytes32 public constant BRIDGE_OPERATOR_ROLE = keccak256("BRIDGE_OPERATOR_ROLE");
|
||
|
|
bytes32 public constant MIRROR_RELAYER_ROLE = keccak256("MIRROR_RELAYER_ROLE");
|
||
|
|
bytes32 public constant INSTRUMENT_ADMIN_ROLE = keccak256("INSTRUMENT_ADMIN_ROLE");
|
||
|
|
bytes32 public constant DOCUMENT_ADMIN_ROLE = keccak256("DOCUMENT_ADMIN_ROLE");
|
||
|
|
bytes32 public constant STANDARDS_ADMIN_ROLE = keccak256("STANDARDS_ADMIN_ROLE");
|
||
|
|
|
||
|
|
function init(IM00MainnetBridgeFacet.BridgeConfig calldata cfg, address governance) external {
|
||
|
|
address grantee = governance == address(0) ? msg.sender : governance;
|
||
|
|
_grantRole(DEFAULT_ADMIN_ROLE, msg.sender);
|
||
|
|
_grantRole(DEFAULT_ADMIN_ROLE, grantee);
|
||
|
|
_grantRole(DEFAULT_ADMIN_ROLE, address(this));
|
||
|
|
_grantRole(BRIDGE_OPERATOR_ROLE, grantee);
|
||
|
|
_grantRole(MIRROR_RELAYER_ROLE, grantee);
|
||
|
|
_grantRole(INSTRUMENT_ADMIN_ROLE, grantee);
|
||
|
|
_grantRole(DOCUMENT_ADMIN_ROLE, grantee);
|
||
|
|
_grantRole(STANDARDS_ADMIN_ROLE, grantee);
|
||
|
|
IM00MainnetBridgeFacet(address(this)).wireMainnetBridge(cfg);
|
||
|
|
}
|
||
|
|
}
|